function sys_ResizeImg($file, $width, $height, $docut = 0, $target_filename = '') { global $public_r, $tranpicturetype; if (!$file || !$width || !$height) { return $file; } //扩展名 $filetype = GetFiletype($file); if (!strstr($tranpicturetype, ',' . $filetype . ',')) { return $file; } $efileurl = eReturnFileUrl(); if (strstr($file, $efileurl)) { $file = str_replace($efileurl, '/d/file/', $file); } if (strstr($file, '://')) { return $file; } $filename = ECMS_PATH . substr($file, 1); if (!file_exists($filename)) { return $file; } if ($target_filename) { $newfilename = $target_filename; } else { $newfilename = md5($file . '-' . $width . '-' . $height . '-' . $docut); } $newname = ECMS_PATH . 'e/data/tmp/titlepic/' . $newfilename; if (empty($target_filename) && file_exists($newname . $filetype)) { return $public_r['newsurl'] . 'e/data/tmp/titlepic/' . $newfilename . $filetype; } if (!defined('InEmpireCMSGd')) { include_once ECMS_PATH . 'e/class/gd.php'; } $filer = ResizeImage($filename, $newname, $width, $height, $docut); $fileurl = $public_r['newsurl'] . 'e/data/tmp/titlepic/' . $newfilename . $filer['filetype']; return $fileurl; }
echo $filepath; ?> </strong> [<a href="#ecms" onclick="javascript:history.go(-1);">返回上一页</a>]</td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder"> <form name="form1" method="post" action="../ecmsfile.php" onsubmit="return confirm('确认删除?');"> <tr class="header"> <td height="25"> <div align="center">选择</div></td> <td height="25"><div align="center">文件名</div></td> <td><div align="center">大小</div></td> <td><div align="center">类型</div></td> <td><div align="center">修改时间</div></td> </tr> <?php $efileurl = eReturnFileUrl(1); while ($file = @readdir($hand)) { if (empty($filepath)) { $truefile = $file; } else { $truefile = $filepath . "/" . $file; } if ($file == "." || $file == "..") { continue; } //目录 $pathfile = $openpath . "/" . $file; if (is_dir($pathfile)) { $filelink = "'FilePath.php?filepath=" . $truefile . "'"; $filename = $file; $img = "../../data/images/dir/folder.gif";
function QDownLoadFile($file) { global $public_r; if (strstr($file, "\\")) { $exp = "\\"; } elseif (strstr($file, "/")) { $exp = "/"; } else { Header("Location:{$file}"); exit; } if (strstr($file, $exp . "e" . $exp) || strstr($file, "..") || strstr($file, "?") || strstr($file, "#")) { Header("Location:{$file}"); exit; } $efileurl = eReturnFileUrl(); if (strstr($file, $efileurl)) { $file = str_replace($efileurl, '/data/', $file); } if (!strstr($file, "://")) { if (!file_exists($file)) { $file = eReturnEcmsMainPortPath() . substr($file, 1); } } $filename = GetDownurlFilename($file, $exp); if (empty($filename)) { Header("Location:{$file}"); exit; } //下载 Header("Content-type: application/octet-stream"); //Header("Accept-Ranges: bytes"); //Header("Accept-Length: ".$filesize); Header("Content-Disposition: attachment; filename=" . $filename); echo ReadFiletext($file); }
function sys_ResizeImg($file,$width,$height,$docut=0,$target_filename='',$target_path='e/data/tmp/titlepic/'){ global $public_r,$ecms_config; if(!$file||!$width||!$height) { return $file; } //扩展名 $filetype=GetFiletype($file); if(!strstr($ecms_config['sets']['tranpicturetype'],','.$filetype.',')) { return $file; } $efileurl=eReturnFileUrl(); if(strstr($file,$efileurl)) { $file=str_replace($efileurl,'/data/',$file); } if(strstr($file,'://')) { return $file; } $filename=eReturnEcmsMainPortPath().substr($file,1);//moreport if(!file_exists($filename)) { return $file; } if($target_filename) { $newfilename=$target_filename; } else { $newfilename=md5($file.'-'.$width.'-'.$height.'-'.$docut); } $newpath=ECMS_PATH.$target_path; $newurl=$public_r['newsurl'].$target_path; $newname=$newpath.$newfilename; if(empty($target_filename)&&file_exists($newname.$filetype)) { return $newurl.$newfilename.$filetype; } if(!defined('InEmpireCMSGd')) { include_once ECMS_PATH.DASHBOARD.'/class/gd.php'; } $filer=ResizeImage($filename,$newname,$width,$height,$docut); $fileurl=$newurl.$newfilename.$filer['filetype']; return $fileurl; }
{ $filelink="'filep.php?filepath=".$truefile.$search."'"; $filename=$file; $img="../../data/images/dir/folder.gif"; $target=""; //发布时间 $ftime=@filemtime($pathfile); $filetime=date("Y-m-d H:i:s",$ftime); $filesize='<目录>'; $filetype='文件夹'; $button=""; } //文件 else { $filelink="'".eReturnFileUrl().$truefile."'"; $filename=$file; $ftype=GetFiletype($file); $img='../../data/images/dir/'.substr($ftype,1,strlen($ftype))."_icon.gif"; if(!file_exists($img)) { $img='../../data/images/dir/unknown_icon.gif'; } $target=" target='_blank'"; //发布时间 $ftime=@filemtime($pathfile); $filetime=date("Y-m-d H:i:s",$ftime); //文件大小 $fsize=@filesize($pathfile); $filesize=ChTheFilesize($fsize); //文件类型
function ReturnFileSavePath($classid, $fpath = '') { global $public_r, $class_r; $fpath = $fpath || strstr(',' . $fpath . ',', ',0,') ? $fpath : $public_r['fpath']; $efileurl = eReturnFileUrl(); if ($fpath == 1) { $r['filepath'] = '/data/p/'; $r['fileurl'] = $efileurl . 'p/'; } elseif ($fpath == 2) { $r['filepath'] = '/data/'; $r['fileurl'] = $efileurl; } else { if (empty($classid)) { $r['filepath'] = '/data/p/'; $r['fileurl'] = $efileurl . 'p/'; } else { $r['filepath'] = '/data/' . $class_r[$classid][classpath] . '/'; $r['fileurl'] = $efileurl . $class_r[$classid][classpath] . '/'; } } return $r; }