本文整理汇总了PHP中GetFiletype函数的典型用法代码示例。如果您正苦于以下问题:PHP GetFiletype函数的具体用法?PHP GetFiletype怎么用?PHP GetFiletype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFiletype函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TranTruePathFile
function TranTruePathFile($level, $path, $file, $file_name, $file_type, $file_size, $add, $userid, $username)
{
global $empire, $dbtbpre, $public_r;
if (!$file_name) {
printerror("EmptyTranFile", "history.go(-1)");
}
$r['filetype'] = GetFiletype($file_name);
//取得文件类型
//如果是.php文件
if (CheckSaveTranFiletype($r['filetype'])) {
printerror("TranPHP", "history.go(-1)");
}
$type_r = explode("|" . $r['filetype'] . "|", $public_r['filetype']);
if (count($type_r) < 2) {
printerror("TranFiletypeFail", "history.go(-1)");
}
if ($file_size > $public_r['filesize'] * 1024) {
printerror("TranFilesizeFail", "history.go(-1)");
}
//文件名
$r['insertfile'] = ReturnDoTranFilename($file_name, $classid);
$r['filename'] = $r['insertfile'] . $r['filetype'];
$r['name'] = ECMS_PATH . $path . '/' . $r['filename'];
$r['tran'] = 1;
//上传文件
$cp = @move_uploaded_file($file, $r['name']);
if (empty($cp)) {
$r['tran'] = 0;
printerror('TranFail', '');
}
DoChmodFile($r['name']);
//操作日志
insert_dolog("path={$path}<br>filename=" . $r['filename']);
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['HTTP_REFERER'] . '">';
db_close();
$empire = null;
}
示例2: GetAdJs
function GetAdJs($adid)
{
global $empire, $public_r, $dbtbpre;
$r = $empire->fetch1("select * from {$dbtbpre}enewsad where adid='{$adid}'");
$file = "../../../d/js/acmsd/" . $public_r[adfile] . $adid . ".js";
//到期
if ($r['endtime'] != '0000-00-00' && time() > to_time($r['endtime'])) {
$r[reptext] = ClearHtmlZs($r[reptext]);
$h = addslashes(str_replace("\r\n", "", $r[reptext]));
$html = "document.write(\"" . $h . "\")";
WriteFiletext_n($file, $html);
return '';
}
if ($r['ylink']) {
$ad_url = $r['url'];
} else {
$ad_url = $public_r[newsurl] . "e/public/ClickAd?adid=" . $adid;
//广告链接
}
//----------------------文字广告
if ($r[t] == 1) {
$r[titlefont] = $r[titlecolor] . ',' . $r[titlefont];
$picurl = DoTitleFont($r[titlefont], $r[picurl]);
//文字属性
$h = "<a href='" . $ad_url . "' target=" . $r[target] . " title='" . $r[alt] . "'>" . addslashes($picurl) . "</a>";
//普通显示
if ($r[adtype] == 1) {
$html = "document.write(\"" . $h . "\")";
} else {
$html = "document.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_dialog.js></script>\"); \ndocument.write(\"<div style='position:absolute;left:300px;top:150px;width:" . $r[pic_width] . "; height:" . $r[pic_height] . ";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=" . $r[pic_width] . " height=" . $r[pic_height] . " bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='" . $public_r[newsurl] . "d/js/acmsd/close_o.gif'></a> </td></tr><tr><td bgcolor=f4f4f4 > " . $h . "</td></tr></table></div>\");";
}
} elseif ($r[t] == 2) {
$r[htmlcode] = ClearHtmlZs($r[htmlcode]);
$h = addslashes(str_replace("\r\n", "", $r[htmlcode]));
//普通显示
if ($r[adtype] == 1) {
$html = "document.write(\"" . $h . "\")";
} else {
$html = "document.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_dialog.js></script>\"); \ndocument.write(\"<div style='position:absolute;left:300px;top:150px;width:" . $r[pic_width] . "; height:" . $r[pic_height] . ";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=" . $r[pic_width] . " height=" . $r[pic_height] . " bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='" . $public_r[newsurl] . "d/js/acmsd/close_o.gif'></a> </td></tr><tr><td bgcolor=f4f4f4 > " . $h . "</td></tr></table></div>\");";
}
} elseif ($r[t] == 3) {
//打开新窗口
if ($r[adtype] == 8) {
$html = "window.open('" . $r[url] . "');";
} elseif ($r[adtype] == 9) {
$html = "window.open('" . $r[url] . "','','width=" . $r[pic_width] . ",height=" . $r[pic_height] . ",scrollbars=yes');";
} else {
$html = "window.showModalDialog('" . $r[url] . "','','dialogWidth:" . $r[pic_width] . "px;dialogHeight:" . $r[pic_height] . "px;scroll:no;status:no;help:no');";
}
} else {
$filetype = GetFiletype($r[picurl]);
//flash
if ($filetype == ".swf") {
$h = "<object classid=\\\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\\\" name=\\\"movie\\\" width=\\\"" . $r[pic_width] . "\\\" height=\\\"" . $r[pic_height] . "\\\" id=\\\"movie\\\"><param name=\\\"movie\\\" value=\\\"" . $r[picurl] . "\\\"><param name=\\\"quality\\\" value=\\\"high\\\"><param name=\\\"menu\\\" value=\\\"false\\\"><embed src=\\\"" . $r[picurl] . "\\\" width=\\\"" . $r[pic_width] . "\\\" height=\\\"" . $r[pic_height] . "\\\" quality=\\\"high\\\" pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\" type=\\\"application/x-shockwave-flash\\\" id=\\\"movie\\\" name=\\\"movie\\\" menu=\\\"false\\\"></embed><PARAM NAME='wmode' VALUE='Opaque'></object>";
} else {
$h = "<a href='" . $ad_url . "' target=" . $r[target] . "><img src='" . $r[picurl] . "' border=0 width='" . $r[pic_width] . "' height='" . $r[pic_height] . "' alt='" . $r[alt] . "'></a>";
}
//普通显示
if ($r[adtype] == 1) {
$html = "document.write(\"" . $h . "\");";
} elseif ($r[adtype] == 4) {
$html = "ns4=(document.layers)?true:false;\nie4=(document.all)?true:false;\nif(ns4){document.write(\"<layer id=DGbanner2 width=" . $r[pic_width] . " height=" . $r[pic_height] . " onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>" . $h . "</layer>\");}\nelse{document.write(\"<div id=DGbanner2 style='position:absolute; width:" . $r[pic_width] . "px; height:" . $r[pic_height] . "px; z-index:9; filter: Alpha(Opacity=90)' onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>" . $h . "</div>\");}\ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_float_fullscreen.js></script>\");";
} elseif ($r[adtype] == 5) {
$html = "if (navigator.appName == 'Netscape')\n{document.write(\"<layer id=DGbanner3 top=150 width=" . $r[pic_width] . " height=" . $r[pic_height] . ">" . $h . "</layer>\");}\nelse{document.write(\"<div id=DGbanner3 style='position: absolute;width:" . $r[pic_height] . ";top:150;visibility: visible;z-index: 1'>" . $h . "</div>\");}\ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_float_upanddown.js></script>\");";
} elseif ($r[adtype] == 6) {
$html = "if(navigator.appName == 'Netscape')\n{document.write(\"<layer id=DGbanner10 top=150 width=" . $r[pic_width] . " height=" . $r[pic_height] . ">" . $h . "</layer>\");}\nelse{document.write(\"<div id=DGbanner10 style='position: absolute;width:" . $r[pic_width] . ";top:150;visibility: visible;z-index: 1'>" . $h . "</div>\");}\ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_float_upanddown_L.js></script>\");";
} elseif ($r[adtype] == 7) {
$html = "ns4=(document.layers)?true:false;\nif(ns4){document.write(\"<layer id=DGbanner4Cont onLoad='moveToAbsolute(layer1.pageX-160,layer1.pageY);clip.height=" . $r[pic_height] . ";clip.width=" . $r[pic_width] . "; visibility=show;'><layer id=DGbanner4News position:absolute; top:0; left:0>" . $h . "</layer></layer>\");}\nelse{document.write(\"<div id=DGbanner4 style='position:absolute;top:0; left:0;'><div id=DGbanner4Cont style='position:absolute;width:" . $r[pic_width] . ";height:" . $r[pic_height] . ";clip:rect(0," . $r[pic_width] . "," . $r[pic_height] . ",0)'><div id=DGbanner4News style='position:absolute;top:0;left:0;right:820'>" . $h . "</div></div></div>\");} \ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_fullscreen.js></script>\");";
} elseif ($r[adtype] == 3) {
$html = "document.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_dialog.js></script>\"); \ndocument.write(\"<div style='position:absolute;left:300px;top:150px;width:" . $r[pic_width] . "; height:" . $r[pic_height] . ";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=" . $r[pic_width] . " height=" . $r[pic_height] . " bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='" . $public_r[newsurl] . "d/js/acmsd/close_o.gif'></a> </td></tr><tr><td bgcolor=f4f4f4 > " . $h . "</td></tr></table></div>\");";
} else {
$html = "function closeAd(){huashuolayer2.style.visibility='hidden';huashuolayer3.style.visibility='hidden';}function winload(){huashuolayer2.style.top=109;huashuolayer2.style.left=5;huashuolayer3.style.top=109;huashuolayer3.style.right=5;}//if(document.body.offsetWidth>800){\n\t\t\t\t{document.write(\"<div id=huashuolayer2 style='position: absolute;visibility:visible;z-index:1'><table width=0 border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=" . $public_r[newsurl] . "d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>" . $h . "</td></tr></table></div>\"+\"<div id=huashuolayer3 style='position: absolute;visibility:visible;z-index:1'><table width=0 border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=" . $public_r[newsurl] . "d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>" . $h . "</td></tr></table></div>\");}winload()//}";
}
}
WriteFiletext_n($file, $html);
}
示例3: SaveMorepicFile
function SaveMorepicFile($varname, $msavepic, $i, $picurl, $picname, $classid, $id, $add)
{
global $public_r, $empire, $loginin, $dbtbpre, $tranpicturetype;
if ($varname == "mbigpfile") {
$addname = "[b]";
}
$type = 1;
$r[url] = $picurl;
//上传
if ($_FILES[$varname]['name'][$i]) {
//取得文件类型
$filetype = GetFiletype($_FILES[$varname]['name'][$i]);
//允许上传类型
if (CheckSaveTranFiletype($filetype)) {
return $r;
}
if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
return $r;
}
//图片文件
if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
return $r;
}
//文件大小
if ($_FILES[$varname]['size'][$i] > $public_r['filesize'] * 1024) {
return $r;
}
//上传
$r = DoTranFile($_FILES[$varname]['tmp_name'][$i], $_FILES[$varname]['name'][$i], $_FILES[$varname]['type'][$i], $_FILES[$varname]['size'][$i], $classid);
//------------------------写入数据库
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
$filetime = date("Y-m-d H:i:s");
if (empty($picname)) {
$picname = $r[filename];
} else {
$picname = $addname . $picname;
}
$picname = RepPostStr($picname);
$id = (int) $id;
$cjid = 0;
if (!$id) {
$cjid = (int) $add['filepass'];
}
$sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,onclick,id,cjid,fpath) values('{$r['filename']}',{$r['filesize']},'{$loginin}','{$r['filepath']}','{$filetime}',{$classid},'{$picname}',{$type},0,{$id},{$cjid},'{$public_r['fpath']}');");
return $r;
} else {
if (empty($msavepic)) {
return $r;
}
if (empty($picurl)) {
return $r;
}
//----------------取得文件类型
$filetype = GetFiletype($picurl);
//允许上传类型
if (CheckSaveTranFiletype($filetype)) {
return $r;
}
if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
return $r;
}
//图片文件
if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
return $r;
}
//保存
$r = DoTranUrl($picurl, $classid);
if ($r['tran']) {
//记录数据库
$filetime = date("Y-m-d H:i:s");
//变量处理
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
$r[type] = (int) $r[type];
if (empty($picname)) {
$picname = $r[filename];
} else {
$picname = $addname . $picname;
}
$picname = RepPostStr($picname);
$id = (int) $id;
$cjid = 0;
if (!$id) {
$cjid = (int) $add['filepass'];
}
$sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,onclick,fpath) values('{$r['filename']}',{$r['filesize']},'{$loginin}','{$r['filepath']}','{$filetime}',{$classid},'{$picname}',{$type},{$id},{$cjid},0,'{$public_r['fpath']}');");
return $r;
}
return $r;
}
}
示例4: TranMoreFile
function TranMoreFile($file, $file_name, $file_type, $file_size, $no, $type, $userid, $username)
{
global $empire, $public_r, $dbtbpre;
$count = count($file_name);
if (empty($count)) {
printerror("MustChangeTranOneFile", "history.go(-1)");
}
//操作权限
CheckLevel($userid, $username, $classid, "file");
$type = (int) $type;
for ($i = 0; $i < $count; $i++) {
if (empty($file_name[$i])) {
continue;
}
//取得文件类型
$filetype = GetFiletype($file_name[$i]);
//如果是.php文件
if (CheckSaveTranFiletype($filetype)) {
continue;
}
$type_r = explode("|" . $filetype . "|", $public_r['filetype']);
if (count($type_r) < 2) {
continue;
}
if ($file_size[$i] > $public_r['filesize'] * 1024) {
continue;
}
//上传
$r = DoTranFile($file[$i], $file_name[$i], $file_type[$i], $file_size[$i], $classid);
//写入数据库
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
$filetime = date("Y-m-d H:i:s");
if (empty($no[$i])) {
$no[$i] = $r[filename];
}
$sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,onclick,id,cjid,fpath) values('{$r['filename']}',{$r['filesize']},'{$username}','{$r['filepath']}','{$filetime}',{$classid},'{$no[$i]}',{$type},0,0,0,'{$public_r['fpath']}');");
}
insert_dolog("");
//操作日志
printerror("TranMoreFileSuccess", "file/TranMoreFile.php");
}
示例5: Ebak_DoTranExecSql
function Ebak_DoTranExecSql($file, $file_name, $file_type, $file_size, $add)
{
global $empire, $phome_db_dbname, $phome_db_ver, $phome_db_char;
if (!$file_name || !$file_size) {
printerror("NotChangeSQLFile", "history.go(-1)");
}
$filetype = GetFiletype($file_name);
//取得扩展名
if ($filetype != ".sql") {
printerror("NotTranSQLFile", "history.go(-1)");
}
//上传文件
$newfile = 'tmp/uploadsql' . time() . '.sql';
$cp = Ebak_DoTranFile($file, $newfile);
if (empty($cp)) {
printerror("TranSQLFileFail", "history.go(-1)");
}
$query = ReadFiletext($newfile);
DelFiletext($newfile);
if (!$query) {
printerror("EmptyRunSql", "history.go(-1)");
}
//数据库
if ($add['mydbname']) {
$empire->query("use `" . $add['mydbname'] . "`");
}
//编码
if ($add['mydbchar']) {
DoSetDbChar($add['mydbchar']);
}
Ebak_DoRunQuery($query, $add['mydbchar'], $phome_db_ver);
printerror("RunSqlSuccess", "DoSql.php");
}
示例6: DoCropImage
function DoCropImage($add, $userid, $username)
{
global $empire, $dbtbpre, $public_r, $class_r, $ecms_config, $efileftp_fr, $efileftp_dr;
//参数处理
$pic_x = (int) $add['pic_x'];
$pic_y = (int) $add['pic_y'];
$pic_w = (int) $add['pic_w'];
$pic_h = (int) $add['pic_h'];
$doing = (int) $add['doing'];
$fileid = (int) $add['fileid'];
$filepass = (int) $add['filepass'];
$classid = (int) $add['classid'];
$infoid = (int) $add['infoid'];
$modtype = (int) $add['modtype'];
$fstb = 0;
if (empty($modtype)) {
$fstb = GetInfoTranFstb($classid, $infoid, 0);
}
//取得文件地址
if (empty($fileid)) {
printerror('NotCropImage', 'history.go(-1)');
}
$filer = $empire->fetch1("select fileid,path,filename,classid,fpath,no from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid}'");
if (empty($filer['fileid'])) {
printerror('NotCropImage', 'history.go(-1)');
}
$path = $filer['path'] ? $filer['path'] . '/' : $filer['path'];
$fspath = ReturnFileSavePath($filer['classid'], $filer['fpath']);
$big_image_name = eReturnEcmsMainPortPath() . $fspath['filepath'] . $path . $filer['filename'];
//moreport
if (!file_exists($big_image_name)) {
printerror('NotCropImage', 'history.go(-1)');
}
$filetype = GetFiletype($filer['filename']);
//取得文件类型
if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
printerror('CropImageFiletypeFail', 'history.go(-1)');
}
//目标图片
$new_datepath = FormatFilePath($filer['classid'], '', 0);
$new_path = $new_datepath ? $new_datepath . '/' : $new_datepath;
$new_insertfile = ReturnDoTranFilename($filer['filename'], 0);
$new_fspath = ReturnFileSavePath($filer['classid']);
$new_savepath = eReturnEcmsMainPortPath() . $new_fspath['filepath'] . $new_path;
//moreport
$new_name = $new_savepath . $new_insertfile;
//处理图片
$returnr['file'] = '';
$returnr['filetype'] = '';
if ($temp_img_type = @getimagesize($big_image_name)) {
preg_match('/\\/([a-z]+)$/i', $temp_img_type[mime], $tpn);
$img_type = $tpn[1];
} else {
preg_match('/\\.([a-z]+)$/i', $big_image_name, $tpn);
$img_type = $tpn[1];
}
$all_type = array("jpg" => array("create" => "ImageCreateFromjpeg", "output" => "imagejpeg", "exn" => ".jpg"), "gif" => array("create" => "ImageCreateFromGIF", "output" => "imagegif", "exn" => ".gif"), "jpeg" => array("create" => "ImageCreateFromjpeg", "output" => "imagejpeg", "exn" => ".jpg"), "png" => array("create" => "imagecreatefrompng", "output" => "imagepng", "exn" => ".png"), "wbmp" => array("create" => "imagecreatefromwbmp", "output" => "image2wbmp", "exn" => ".wbmp"));
$func_create = $all_type[$img_type]['create'];
if (empty($func_create) or !function_exists($func_create)) {
printerror('CropImageFiletypeFail', 'history.go(-1)');
}
//输出
$func_output = $all_type[$img_type]['output'];
$func_exname = $all_type[$img_type]['exn'];
if (($func_exname == '.gif' || $func_exname == '.png' || $func_exname == '.wbmp') && !function_exists($func_output)) {
$func_output = 'imagejpeg';
$func_exname = '.jpg';
}
$big_image = $func_create($big_image_name);
$big_width = imagesx($big_image);
$big_height = imagesy($big_image);
if (!$big_width || !$big_height || $big_width < 10 || $big_height < 10) {
printerror('CropImageFilesizeFail', 'history.go(-1)');
}
if (function_exists("imagecopyresampled")) {
$temp_image = imagecreatetruecolor($pic_w, $pic_h);
imagecopyresampled($temp_image, $big_image, 0, 0, $pic_x, $pic_y, $pic_w, $pic_h, $pic_w, $pic_h);
} else {
$temp_image = imagecreate($pic_w, $pic_h);
imagecopyresized($temp_image, $big_image, 0, 0, $pic_x, $pic_y, $pic_w, $pic_h, $pic_w, $pic_h);
}
$func_output($temp_image, $new_name . $func_exname);
ImageDestroy($big_image);
ImageDestroy($temp_image);
$insert_file = $new_name . $func_exname;
$insert_filename = $new_insertfile . $func_exname;
if (file_exists($insert_file)) {
if (!$doing) {
$empire->query("delete from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid}'");
DelFiletext($big_image_name);
//FileServer
if ($public_r['openfileserver']) {
$efileftp_dr[] = $big_image_name;
}
}
//写入数据库
$no = '[CropImg]' . $filer['no'];
$filesize = filesize($insert_file);
$filesize = (int) $filesize;
$classid = (int) $classid;
//.........这里部分代码省略.........
示例7: while
<td width="4%"><div align="center"></div></td>
<td width="8%"><div align="center">ID</div></td>
<td width="42%">
<div align="center">文件名</div></td>
<td width="15%">
<div align="center">大小</div></td>
<td width="21%">
<div align="center">上传时间</div></td>
<td width="10%">
<div align="center">选择</div></td>
</tr>
<?
while($r=$empire->fetch($sql))
{
$filesize=ChTheFilesize($r[filesize]);
$filetype=GetFiletype($r[filename]);//取得文件扩展名
//文件
$fspath=ReturnFileSavePath($r[classid],$r[fpath]);
$filepath=$r[path]?$r[path].'/':$r[path];
$file=$fspath['fileurl'].$filepath.$r[filename];
//播放器
if(strstr($ecms_config['sets']['mediaplayertype'],",".$filetype.","))//mediaplayer
{
$fileimg="<img src='../../data/type/mywmv.gif' border=0>";
}
else//realplayer
{
$fileimg="<img src='../../data/type/myrm.gif' border=0>";
}
$buttonr=ToReturnDoFileButton($doing,$tranfrom,$field,$file,$r[filename],$r[fileid],$filesize,$filetype,$r[no],$type);
$button=$buttonr['button'];
示例8: while
<td width="4%"> </td>
<td width="8%">
<div align="center">ID</div></td>
<td width="42%">
<div align="center">文件名</div></td>
<td width="15%">
<div align="center">大小</div></td>
<td width="21%">
<div align="center">上传时间</div></td>
<td width="10%"><div align="center">选择</div></td>
</tr>
<?php
while ($r = $empire->fetch($sql)) {
$filesize = ChTheFilesize($r[filesize]);
//取得文件类型
$truefiletype = GetFiletype($r[filename]);
$filetype = substr($truefiletype, 1);
//文件
$fspath = ReturnFileSavePath($r[classid], $r[fpath]);
$filepath = $r[path] ? $r[path] . '/' : $r[path];
$file = $fspath['fileurl'] . $filepath . $r[filename];
$buttonr = ToReturnDoFileButton($doing, $tranfrom, $field, $file, $r[filename], $r[fileid], $filesize, $truefiletype, $r[no], $type);
$button = $buttonr['button'];
$buttonurl = $buttonr['bturl'];
?>
<tr>
<td bgcolor="#FFFFFF"><div align="center">
<input type=checkbox name=fileid[] value="<?php
echo $r[fileid];
?>
">
示例9: LoadInMod
function LoadInMod($add, $file, $file_name, $file_type, $file_size, $userid, $username)
{
global $empire, $dbtbpre, $phome_db_dbchar;
//验证权限
CheckLevel($userid, $username, $classid, "table");
$tbname = RepPostVar(trim($add['tbname']));
if (!$file_name || !$file_size || !$tbname) {
printerror("EmptyLoadInMod", "");
}
//扩展名
$filetype = GetFiletype($file_name);
if ($filetype != ".mod") {
printerror("LoadInModMustmod", "");
}
//表名是否已存在
$num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewstable where tbname='{$tbname}' limit 1");
if ($num) {
printerror("HaveLoadInTb", "");
}
//上传文件
$path = ECMS_PATH . "e/data/tmp/mod/uploadm" . time() . make_password(10) . ".php";
$cp = @move_uploaded_file($file, $path);
if (!$cp) {
printerror("EmptyLoadInMod", "");
}
DoChmodFile($path);
@(include $path);
UpdateTbDefMod($tid, $tbname, $mid);
//公共变量
TogSaveTxtF(1);
GetConfig(1);
//更新缓存
//生成模型表单文件
$modr = $empire->fetch1("select mtemp,qmtemp,cj from {$dbtbpre}enewsmod where mid='{$mid}'");
ChangeMForm($mid, $tid, $modr[mtemp]);
//更新表单
ChangeQmForm($mid, $tid, $modr[qmtemp]);
//更新前台表单
ChangeMCj($mid, $tid, $modr[cj]);
//采集表单
//删除文件
DelFiletext($path);
//操作日志
insert_dolog("tid={$tid}&tb={$tbname}<br>mid={$mid}");
printerror("LoadInModSuccess", "db/ListTable.php");
}
示例10: LoadInTempGroup
function LoadInTempGroup($add, $file, $file_name, $file_type, $file_size, $userid, $username)
{
global $empire, $dbtbpre;
//验证权限
CheckLevel($userid, $username, $classid, "tempgroup");
if (!$file_name || !$file_size) {
printerror("EmptyLoadInTempGroup", "");
}
$gid = (int) $add['gid'];
//扩展名
$filetype = GetFiletype($file_name);
if ($filetype != ".temp") {
printerror("LoadInTempGroupMusttemp", "");
}
//上传文件
$path = ECMS_PATH . DASHBOARD . '/data/tmp/temp/uploadtg' . time() . make_password(10) . '.temp';
$cp = @move_uploaded_file($file, $path);
DoChmodFile($path);
$data = ReadFiletext($path);
DelFiletext($path);
//转码
if ($add['ChangeChar']) {
$data = LoadInTempChangeChar($add['tempchar'], $data);
}
if (empty($data)) {
printerror("EmptyLoadInTempGroup", "");
}
//返回版本
$pageexp = "<!---ecms.temp--->";
$checkpr = explode($pageexp, $data);
$tempverr = LoadInTGReturnVer($checkpr[0]);
$gname = $tempverr['gname'];
$thistempver = $tempverr['ver'];
$thistempchar = $tempverr['tempchar'];
//替换旧地址
$GLOBALS['loadtempver'] = $thistempver;
if (empty($thistempver)) {
$data = LoadInTGReptext_pubvar($data);
}
//入库
$pageexp = "<!---ecms.temp--->";
$record = "<!---ecms.record--->";
$field = "<!---ecms.field--->";
$pr = explode($pageexp, $data);
if (empty($gid)) {
$sql = $empire->query("insert into {$dbtbpre}enewstempgroup(gname,isdefault) values('" . addslashes($gname) . "',0);");
$gid = $empire->lastid();
$gname = $pr[0];
$en = "_" . $gid;
CreateTempTb($gid, $en);
//复制表
} else {
$r = $empire->fetch1("select gid,gname from {$dbtbpre}enewstempgroup where gid={$gid}");
if (!$r['gid']) {
printerror("LoadInTempGroupMusttemp", "");
}
if ($gid == 1) {
$en = "";
} else {
$en = "_" . $gid;
}
$gname = $r['gname'];
ClearTempTb($gid, $en);
//清空表
}
//版本
$isold = 0;
$ckcount = count($pr);
if ($ckcount <= 10) {
$isold = 1;
} elseif ($ckcount <= 11) {
$isold = 2;
}
LoadInTGBqtemp($gid, $en, $record, $field, $pr[1]);
//标签模板
LoadInTGJstemp($gid, $en, $record, $field, $pr[2]);
//JS模板
LoadInTGListtemp($gid, $en, $record, $field, $pr[3]);
//列表模板
LoadInTGNewstemp($gid, $en, $record, $field, $pr[4]);
//内容模板
LoadInTGPubtemp($gid, $en, $record, $field, $pr[5], $isold);
//公共模板
LoadInTGSearchtemp($gid, $en, $record, $field, $pr[6]);
//搜索模板
LoadInTGTempvar($gid, $en, $record, $field, $pr[7]);
//模板变量
LoadInTGVotetemp($gid, $en, $record, $field, $pr[8]);
//投票模板
LoadInTGClasstemp($gid, $en, $record, $field, $pr[9]);
//栏目模板
if ($isold != 1) {
LoadInTGPltemp($gid, $en, $record, $field, $pr[10]);
//评论模板
}
if ($isold == 0) {
LoadInTGPrinttemp($gid, $en, $record, $field, $pr[11]);
//打印模板
}
LoadInTGPagetemp($gid, $en, $record, $field, $pr[12]);
//.........这里部分代码省略.........
示例11: DoQTranFile
function DoQTranFile($add, $file, $file_name, $file_type, $file_size, $userid, $username, $rnd, $ecms = 0)
{
global $empire, $dbtbpre, $class_r, $public_r, $ecms_config;
if ($public_r['addnews_ok']) {
$ecms != 1 ? printerror("NotOpenCQInfo", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotOpenCQInfo', '', '');
}
$filepass = (int) $add['filepass'];
$classid = (int) $add['classid'];
$infoid = (int) $add['infoid'];
if (!$file_name || !$filepass || !$classid || !$class_r[$classid][tbname]) {
$ecms != 1 ? printerror("EmptyQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'EmptyQTranFile', '', '');
}
//信息
if ($infoid) {
$index_r = $empire->fetch1("select classid,checked from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_index where id='{$infoid}'");
if (!$index_r['classid'] || $classid != $index_r['classid']) {
$ecms != 1 ? printerror("EmptyQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'EmptyQTranFile', '', '');
}
$infotb = ReturnInfoMainTbname($class_r[$classid][tbname], $index_r['checked']);
$infor = $empire->fetch1("select classid,fstb from " . $infotb . " where id='{$infoid}'");
if (!$infor['fstb'] || $classid != $infor['classid']) {
$ecms != 1 ? printerror("EmptyQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'EmptyQTranFile', '', '');
}
$fstb = $infor['fstb'];
} else {
$fstb = $public_r['filedeftb'];
}
//验证权限
$userid = (int) $userid;
$username = RepPostVar($username);
$rnd = RepPostVar($rnd);
DoQCheckAddLevel($classid, $userid, $username, $rnd, 0, 0);
$filetype = GetFiletype($file_name);
//取得文件类型
if (CheckSaveTranFiletype($filetype)) {
$ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
}
$type = (int) $add['type'];
$pr = $empire->fetch1("select qaddtran,qaddtransize,qaddtranimgtype,qaddtranfile,qaddtranfilesize,qaddtranfiletype from {$dbtbpre}enewspublic limit 1");
if ($type == 1) {
if (!$pr['qaddtran']) {
$ecms != 1 ? printerror("CloseQTranPic", "", 9) : ECMS_QEditorPrintError(1, '', '', 'CloseQTranPic', '', '');
}
if (!strstr($pr['qaddtranimgtype'], "|" . $filetype . "|")) {
$ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
}
if ($file_size > $pr['qaddtransize'] * 1024) {
$ecms != 1 ? printerror("TooBigQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TooBigQTranFile', '', '');
}
if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
$ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
}
} elseif ($type == 2) {
if (!$pr['qaddtranfile']) {
$ecms != 1 ? printerror("CloseQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'CloseQTranFile', '', '');
}
if (!strstr($pr['qaddtranfiletype'], "|" . $filetype . "|")) {
$ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
}
if ($file_size > $pr['qaddtranfilesize'] * 1024) {
$ecms != 1 ? printerror("TooBigQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TooBigQTranFile', '', '');
}
if (!strstr($ecms_config['sets']['tranflashtype'], ',' . $filetype . ',')) {
$ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
}
} else {
if (!$pr['qaddtranfile']) {
$ecms != 1 ? printerror("CloseQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'CloseQTranFile', '', '');
}
if (!strstr($pr['qaddtranfiletype'], "|" . $filetype . "|")) {
$ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
}
if ($file_size > $pr['qaddtranfilesize'] * 1024) {
$ecms != 1 ? printerror("TooBigQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TooBigQTranFile', '', '');
}
}
$r = DoTranFile($file, $file_name, $file_type, $file_size, $classid);
if (empty($r[tran])) {
$ecms != 1 ? printerror("TranFail", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TranFail', '', '');
}
//写入数据库
$filetime = time();
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
eInsertFileTable($r[filename], $r[filesize], $r[filepath], '[Member]' . $username, $classid, $r[filename], $type, $filepass, $filepass, $public_r[fpath], 0, 0, $fstb);
//编辑器
if ($ecms == 1) {
ECMS_QEditorPrintError(0, $r[url], $r[filename], '', $r[filename], $r[filesize]);
} else {
echo "<script>opener.document.add." . $add['field'] . ".value='" . $r['url'] . "';window.close();</script>";
}
db_close();
$empire = null;
exit;
}
示例12: egetip
$have_fen = 1;
}
}
}
}
//验证码
$ip = egetip();
$pass = md5(ReturnDownSysCheckIp() . "wm_chief" . $public_r[downpass] . $user[userid]);
$op = GetOnlinePass();
$url = "../../enews/?enews=GetSofturl&classid={$classid}&id={$id}&pathid={$pathid}&pass=" . $pass . "&p=" . $user[userid] . ":::" . $user[rnd] . "&onlinetime=" . $op[0] . "&onlinepass=" . $op[1];
$trueurl = ReturnDSofturl($showdown_r[1], $showdown_r[4], '../../', 0);
//实际地址
$playerpass = "wm_chief";
//自动识别播放器
if (empty($r[playerid])) {
$ftype = GetFiletype($showdown_r[1]);
if ($ftype == '.swf') {
@(include "flasher.php");
} elseif ($ftype == '.flv') {
@(include "flver.php");
} elseif (strstr($realplayertype, ',' . $ftype . ',')) {
@(include "realplayer.php");
} else {
@(include "mediaplayer.php");
}
} else {
$playerr = $empire->fetch1("select filename from {$dbtbpre}enewsplayer where id='{$r['playerid']}'");
if ($playerr['filename']) {
@(include $playerr[filename]);
}
}
示例13: SaveMorepicFile
function SaveMorepicFile($varname, $msavepic, $i, $picurl, $picname, $classid, $id, $add, $modtype = 0, $fstb = 1)
{
global $public_r, $empire, $loginin, $dbtbpre, $ecms_config;
if ($varname == "mbigpfile") {
$addname = "[b]";
}
$type = 1;
$r[url] = $picurl;
//上传
if ($_FILES[$varname]['name'][$i]) {
//取得文件类型
$filetype = GetFiletype($_FILES[$varname]['name'][$i]);
//允许上传类型
if (CheckSaveTranFiletype($filetype)) {
return $r;
}
if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
return $r;
}
//图片文件
if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
return $r;
}
//文件大小
if ($_FILES[$varname]['size'][$i] > $public_r['filesize'] * 1024) {
return $r;
}
//上传
$r = DoTranFile($_FILES[$varname]['tmp_name'][$i], $_FILES[$varname]['name'][$i], $_FILES[$varname]['type'][$i], $_FILES[$varname]['size'][$i], $classid);
//------------------------写入数据库
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
if (empty($picname)) {
$picname = $r[filename];
} else {
$picname = $addname . $picname;
}
$picname = RepPostStr($picname);
$id = (int) $id;
$cjid = 0;
if (!$id) {
$cjid = (int) $add['filepass'];
}
eInsertFileTable($r[filename], $r[filesize], $r[filepath], $loginin, $classid, $picname, $type, $id, $cjid, $public_r[fpath], 0, 0, $fstb);
return $r;
} else {
if (empty($msavepic)) {
return $r;
}
if (empty($picurl)) {
return $r;
}
//----------------取得文件类型
$filetype = GetFiletype($picurl);
//允许上传类型
if (CheckSaveTranFiletype($filetype)) {
return $r;
}
if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
return $r;
}
//图片文件
if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
return $r;
}
//保存
$r = DoTranUrl($picurl, $classid);
if ($r['tran']) {
//记录数据库
//变量处理
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
$r[type] = (int) $r[type];
if (empty($picname)) {
$picname = $r[filename];
} else {
$picname = $addname . $picname;
}
$picname = RepPostStr($picname);
$id = (int) $id;
$cjid = 0;
if (!$id) {
$cjid = (int) $add['filepass'];
}
eInsertFileTable($r[filename], $r[filesize], $r[filepath], $loginin, $classid, $picname, $type, $id, $cjid, $public_r[fpath], 0, 0, $fstb);
return $r;
}
return $r;
}
}
示例14: TranMoreFile
function TranMoreFile($file, $file_name, $file_type, $file_size, $no, $type, $userid, $username)
{
global $empire, $public_r, $dbtbpre;
$count = count($file_name);
if (empty($count)) {
printerror("MustChangeTranOneFile", "history.go(-1)");
}
//操作权限
CheckLevel($userid, $username, $classid, "file");
$type = (int) $type;
for ($i = 0; $i < $count; $i++) {
if (empty($file_name[$i])) {
continue;
}
//取得文件类型
$filetype = GetFiletype($file_name[$i]);
//如果是.php文件
if (CheckSaveTranFiletype($filetype)) {
continue;
}
$type_r = explode("|" . $filetype . "|", $public_r['filetype']);
if (count($type_r) < 2) {
continue;
}
if ($file_size[$i] > $public_r['filesize'] * 1024) {
continue;
}
//上传
$r = DoTranFile($file[$i], $file_name[$i], $file_type[$i], $file_size[$i], $classid);
//写入数据库
$r[filesize] = (int) $r[filesize];
$classid = (int) $classid;
if (empty($no[$i])) {
$no[$i] = $file_name[$i];
}
eInsertFileTable($r[filename], $r[filesize], $r[filepath], $username, $classid, $no[$i], $type, 0, 0, $public_r[fpath], 0, 5, 0);
}
insert_dolog("");
//操作日志
printerror("TranMoreFileSuccess", "file/TranMoreFile.php" . hReturnEcmsHashStrHref2(1));
}
示例15: DoTranUrl
function DoTranUrl($url, $classid)
{
global $public_r, $class_r, $ecms_config, $efileftp_fr;
$classid = (int) $classid;
//处理地址
$url = trim($url);
$url = str_replace(" ", "%20", $url);
$r[tran] = 1;
//附件地址
$r[url] = $url;
//文件类型
$r[filetype] = GetFiletype($url);
if (CheckSaveTranFiletype($r[filetype])) {
$r[tran] = 0;
return $r;
}
//是否已上传的文件
$havetr = CheckNotSaveUrl($url);
if ($havetr) {
$r[tran] = 0;
return $r;
}
//是否地址
if (!strstr($url, '://')) {
$r[tran] = 0;
return $r;
}
$string = ReadFiletext($url);
if (empty($string)) {
$r[tran] = 0;
return $r;
}
//文件名
$r[insertfile] = ReturnDoTranFilename($file_name, $classid);
$r[filename] = $r[insertfile] . $r[filetype];
//日期目录
$r[filepath] = FormatFilePath($classid, $mynewspath, 0);
$filepath = $r[filepath] ? $r[filepath] . '/' : $r[filepath];
//存放目录
$fspath = ReturnFileSavePath($classid);
$r[savepath] = eReturnEcmsMainPortPath() . $fspath['filepath'] . $filepath;
//moreport
//附件地址
$r[url] = $fspath['fileurl'] . $filepath . $r[filename];
//缩图文件
$r[name] = $r[savepath] . "small" . $r[insertfile];
//附件文件
$r[yname] = $r[savepath] . $r[filename];
WriteFiletext_n($r[yname], $string);
$r[filesize] = @filesize($r[yname]);
//返回类型
if (strstr($ecms_config['sets']['tranflashtype'], ',' . $r[filetype] . ',')) {
$r[type] = 2;
} elseif (strstr($ecms_config['sets']['tranpicturetype'], ',' . $r[filetype] . ',')) {
$r[type] = 1;
} elseif (strstr($ecms_config['sets']['mediaplayertype'], ',' . $r[filetype] . ',') || strstr($ecms_config['sets']['realplayertype'], ',' . $r[filetype] . ',')) {
$r[type] = 3;
} else {
$r[type] = 0;
}
//FileServer
if ($public_r['openfileserver']) {
$efileftp_fr[] = $r['yname'];
}
return $r;
}