$dh = dir($inpath);
$ty1="";
$ty2="";
$filearr = array();
while($file = $dh->read()) {
//-----计算文件大小和创建时间
if($file!="." && $file!=".." && !is_dir("$inpath/$file")){
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
$filearr[] = $file;
$filetimearr[] = $filetime;
}
if($file == ".") continue;
else if($file == "..")
{
if($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "\n<tr>
<td class='linerow' colspan='2'>
<a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode($tmp).$addparm."'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
<td colspan='2' class='linerow'> 当前目录:$activepath</td>
</tr>
";
echo $line;
}
else if(is_dir("$inpath/$file"))
{
if(preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if(preg_match("#^\.(.*)$#i", $file)) continue;
$dirarr[] = $file;
}
}//End Loop
$dh->close();
arsort($dirarr);
foreach($dirarr as $file)
{
$line = "\n<tr>
<td bgcolor='#F9FBF0' class='linerow' colspan='2'>
<a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode("$activepath/$file").$addparm."'><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a></td>
<td class='linerow'> </td>
<td bgcolor='#F9FBF0' c织梦后台模板lass='linerow'> </td>
</tr>";
echo "$line";
}
array_multisort($filetimearr,SORT_DESC,SORT_STRING, $filearr);
array_multisort($filetimearr,SORT_DESC,SORT_STRING, $filetimearr);
$result = array_combine($filearr,$filetimearr);
foreach($result as $file => $filetime)
{
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if($filesize != "")
if($filesize < 0.1){
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 2);
}
else{
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 1);
}
if(preg_match("#\.(gif|png)#i", $file))
{
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
$reurl = $remoteupUrl.$reurl;
}else{
$reurl = $reurl;
}
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td align='center' class='linerow' bgcolor='#F9FBF0'>
<a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif' width='16' height='16' border='0' align=absmiddle></a>
</td>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=# onclick=\"ReturnImg('$reurl');\" $lstyle><img src=img/gif.gif border=0 width=16 height=16 align=absmiddle>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else if(preg_match("#\.(jpg)dede手机模板#i", $file))
{
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
$reurl = $remoteupUrl.$reurl;
}else{
$reurl = $reurl;
}
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td align='center' class='linerow' bgcolor='#F9FBF0'>
<a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif' width='16' height='16' border='0' align=absmiddle></a>
</td>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=# onclick=\"ReturnImg('$reurl');\" $lstyle><img src=img/jpg.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
}
关键词标签: 织梦 站内 文件夹
声明: 本文由我的SEOUC技术文章主页发布于:2023-07-18 ,文章dedecms织梦站内选择文件夹和图片文件排序问题主要讲述站内,文件夹,织梦网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_29037.html
为你推荐与dedecms织梦站内选择文件夹和图片文件排序问题相关的文章
网站建设技术SEOUC.COM
专注网站建设,SEO优化,小程序设计制作搭建开发定制网站等,数千家网站定制开发案例,网站推广技术服务。
5000+合作客服
8年从业经验
150+覆盖行业
|