<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
  <title>文件管理器</title>
	<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
	<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
  <link rel="stylesheet" href="../static/web/css/admin.css">
  <style>
    .linerow {
      border-bottom:1px solid #CBD8AC;
      height:26px
    }
  </style>
</head>
<body background='../static/web/img/allbg.gif' leftmargin='8' topmargin='8'>
  <table width='98%' border='0' cellspacing='1' cellpadding='2' align='center' class="table table-bordered maintable mt-3">
    <tr height="26" align="center">
      <td width="36%" background="../static/web/img/wbg.gif">文件名</td>
      <td width="12%" background="../static/web/img/newlinebg3.gif">文件大小</td>
      <td width="20%" background="../static/web/img/wbg.gif">最后修改时间</td>
      <td width="30%" background="../static/web/img/newlinebg3.gif">操作</td>
    </tr>
    <?php
$dh = dir($inpath);
$ty1="";
$ty2="";
$files = $dirs = array();
while(($file = $dh->read()) !== false)
{
	if($file!="." && $file!=".." && !is_dir("$inpath/$file"))
	{
		@$filesize = filesize("$inpath/$file");
		@$filesize=$filesize/1024;
		@$filetime = filemtime("$inpath/$file");
		@$filetime = MyDate("Y-m-d H:i:s",$filetime);
		if($filesize<0.1)
		{
			@list($ty1,$ty2)=explode(".",$filesize);
			$filesize=$ty1.".".substr($ty2,0,2);
		}
		else
		{
			@list($ty1,$ty2)=explode(".",$filesize);
			$filesize=$ty1.".".substr($ty2,0,1);
		}
	}
	if($file == ".")
	{
		continue;
	}
	else if($file == "..")
	{
		if($activepath == "")
		{
			continue;
		}
		$tmp = preg_replace("#[\/][^\/]*$#i","",$activepath);
		$line = "\n<tr>
  <td bgcolor='#ffffff' height='26'>
  <a href=file_manage_main.php?activepath=".urlencode($tmp)."><img src='../static/web/img/dir2.gif'>上级目录</a>
  </td>
  <td colspan='3' bgcolor='#ffffff'>
   当前目录:$activepath &nbsp;

   </td>
  </tr>";
		$dirs[] = $line;
	}
	else if(is_dir("$inpath/$file"))
	{
		if(preg_match("#^_(.*)$#i",$file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
		if(preg_match("#^\.(.*)$#i",$file)) continue;
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
    <a href=file_manage_main.php?activepath=".urlencode("$activepath/$file")."><img src='../static/web/img/dir.gif'>$file</a></td>
   <td>　</td>
   <td>　</td>
   <td>
   <a href=file_manage_view.php?filename=".urlencode($file)."&activepath=".urlencode($activepath)."&fmdo=rename class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href=file_manage_view.php?filename=".urlencode($file)."&activepath=".urlencode($activepath)."&type=dir&fmdo=del class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   </td>
   </td>
   </tr>";
		$dirs[] = $line;
	}
	else if(preg_match("#\.(gif|png)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/gif.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'><i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(jpg)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/jpg.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center' class='linerow'>$filetime</td>
   <td >
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(swf|fla|fly)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/flash.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(zip|rar|tar.gz)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/zip.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(exe)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/exe.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td >
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(mp3|wma)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF'  height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/mp3.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(wmv|api)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/wmv.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(rm|rmvb)#i",$file))
	{
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/rm.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center' class='linerow'>$filetime</td>
   <td>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'>  <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(txt|inc|pl|cgi|asp|xml|xsl|aspx|cfm)#",$file))
	{
		$edurl = "file_manage_view.php?fmdo=edit&filename=".urlencode($file)."&activepath=".urlencode($activepath);
		$line = "\n<tr bgcolor='#FFFFFF' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/txt.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='$edurl' class='btn btn-success btn-sm'> <i class='fa fa-pencil-square-o' aria-hidden='true'></i> 编辑</a>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'>  <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(htm|html)#i",$file))
	{
		$edurl = "file_manage_view.php?fmdo=edit&filename=".urlencode($file)."&activepath=".urlencode($activepath);
		$line = "\n<tr bgcolor='#FFFFFF'  height='26'onMouseMove=\"javascript:this.bgColor='#F9FBF0';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/htm.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='$edurl' class='btn btn-success btn-sm'> <i class='fa fa-pencil-square-o' aria-hidden='true'></i> 编辑</a>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(php)#i",$file))
	{
		$edurl = "file_manage_view.php?fmdo=edit&filename=".urlencode($file)."&activepath=".urlencode($activepath);
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/php.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='$edurl' class='btn btn-success btn-sm'> <i class='fa fa-pencil-square-o' aria-hidden='true'></i> 编辑</a>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(js)#i",$file))
	{
		$edurl = "file_manage_view.php?fmdo=edit&filename=".urlencode($file)."&activepath=".urlencode($activepath);
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/js.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='$edurl' class='btn btn-success btn-sm'> <i class='fa fa-pencil-square-o' aria-hidden='true'></i> 编辑</a>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'><i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'>  <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	}
	else if(preg_match("#\.(css)#i",$file))
	{
		$edurl = "file_manage_view.php?fmdo=edit&filename=".urlencode($file)."&activepath=".urlencode($activepath);
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
   <td>
   <a href=$activeurl/$file target=_blank><img src='../static/web/img/css.gif'>$file</a></td>
   <td>$filesize KB</td>
   <td align='center'>$filetime</td>
   <td>
   <a href='$edurl' class='btn btn-success btn-sm'> <i class='fa fa-pencil-square-o' aria-hidden='true'></i> 编辑</a>
   <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
   <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'>  <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
   <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
   </td>
   </tr>";
		$files[] = $line;
	} else {
		$line = "\n<tr bgcolor='#FFFFFF' height='26' onMouseMove=\"javascript:this.bgColor='#FCFDEE';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">
    <td><a href=$activeurl/$file target=_blank>$file</td>
    <td>$filesize KB</td>
    <td align='center'>$filetime</td>
    <td>
    <a href='file_manage_view.php?fmdo=rename&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-address-card-o' aria-hidden='true'></i> 改名</a>
    <a href='file_manage_view.php?fmdo=del&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'>  <i class='fa fa-trash' aria-hidden='true'></i> 删除</a>
    <a href='file_manage_view.php?fmdo=move&filename=".urlencode($file)."&activepath=".urlencode($activepath)."' class='btn btn-success btn-sm'> <i class='fa fa-share-square' aria-hidden='true'></i> 移动</a>
    </td>
    </tr>";
		$files[] = $line;
	}
}
$dh->close();
foreach ($dirs as $dir)
{
	echo $dir;
}
foreach ($files as $file)
{
	echo $file;
}
?>
    <tr>
      <td colspan="4" height='26' bgcolor='#f8f8f8'>
        <a href='file_manage_main.php' class="btn btn-success btn-sm">根目录</a>
        <a href='file_manage_view.php?fmdo=newfile&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">新建文件</a>
        <a href='file_manage_view.php?fmdo=newdir&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">新建目录</a>
        <a href='file_manage_view.php?fmdo=upload&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">文件上传</a>
        <a href='file_manage_control.php?fmdo=space&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">空间检查</a>
        &nbsp;&nbsp;</td>
    </tr>
  </table>
</body>
</html>