TruePathfile.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. $enews=$_POST['enews'];
  7. if(empty($enews))
  8. {$enews=$_GET['enews'];}
  9. if($enews)
  10. {
  11. hCheckEcmsRHash();
  12. include('TruePathfileFun.php');
  13. }
  14. if($enews=='TranTruePathFile')//上传固定目录文件
  15. {
  16. $file=$_FILES['file']['tmp_name'];
  17. $file_name=$_FILES['file']['name'];
  18. $file_type=$_FILES['file']['type'];
  19. $file_size=$_FILES['file']['size'];
  20. TranTruePathFile($filepathr['filelevel'],$filepathr['filepath'],$file,$file_name,$file_type,$file_size,$_POST,$logininid,$loginin);
  21. }
  22. elseif($enews=='DelTruePathFile')//删除固定目录文件
  23. {
  24. DelTruePathFile($filepathr['filelevel'],$filepathr['filepath'],$_POST['filename'],$logininid,$loginin);
  25. }
  26. //基目录
  27. $actionurl=$filepath_r['actionurl'];
  28. $filepath=$filepathr['filepath'];
  29. $openpath=ECMS_PATH.$filepathr['filepath'];
  30. if(!file_exists($openpath))
  31. {
  32. exit();
  33. }
  34. $hand=@opendir($openpath);
  35. ?>
  36. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  37. <html>
  38. <head>
  39. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  40. <title>管理附件</title>
  41. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  42. <script>
  43. function CheckAll(form)
  44. {
  45. for (var i=0;i<form.elements.length;i++)
  46. {
  47. var e = form.elements[i];
  48. if (e.name != 'chkall')
  49. e.checked = form.chkall.checked;
  50. }
  51. }
  52. </script>
  53. </head>
  54. <body>
  55. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  56. <tr>
  57. <td width="34%"><?=$filepathr['url']?></td>
  58. <td width="66%"><div align="right" class="emenubutton"></div></td>
  59. </tr>
  60. </table>
  61. <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  62. <form action="<?=$actionurl?>" method="post" enctype="multipart/form-data" name="form2">
  63. <?=$ecms_hashur['form']?>
  64. <tr>
  65. <td>上传附件:
  66. <input type="file" name="file">
  67. <input type="submit" name="Submit2" value="上传">
  68. <input name="enews" type="hidden" id="enews" value="TranTruePathFile">
  69. <?=$filepathr['addpostvar']?>
  70. </td>
  71. </tr>
  72. </form>
  73. </table>
  74. <br>
  75. <table width="100%" border="0" cellspacing="1" cellpadding="2">
  76. <tr>
  77. <td height="32">当前目录:<strong>/<?=$filepath?></strong></td>
  78. </tr>
  79. </table>
  80. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  81. <form name="form1" method="post" action="<?=$actionurl?>" onsubmit="return confirm('确认删除?');">
  82. <?=$ecms_hashur['form']?>
  83. <tr class="header">
  84. <td height="25"> <div align="center">选择</div></td>
  85. <td height="25"><div align="center">文件名</div></td>
  86. <td><div align="center">大小</div></td>
  87. <td><div align="center">类型</div></td>
  88. <td><div align="center">修改时间</div></td>
  89. </tr>
  90. <?php
  91. $efileurl=$public_r['newsurl'].$filepath.'/';
  92. while($file=@readdir($hand))
  93. {
  94. if($file=="."||$file=="..")
  95. {
  96. continue;
  97. }
  98. $truefile=$file;
  99. $pathfile=$openpath."/".$file;
  100. if(is_dir($pathfile))//目录
  101. {
  102. $filelink="'#empirecms'";
  103. $filename=$file;
  104. $img="../../data/images/dir/folder.gif";
  105. $checkbox="";
  106. $target="";
  107. //发布时间
  108. $ftime=@filemtime($pathfile);
  109. $filetime=date("Y-m-d H:i:s",$ftime);
  110. $filesize='<目录>';
  111. $filetype='文件夹';
  112. }
  113. else//文件
  114. {
  115. $filelink=$efileurl.$truefile;
  116. $filename=$file;
  117. $ftype=GetFiletype($file);
  118. $checkbox="<input name='filename[]' type='checkbox' value='".$truefile."'>";
  119. $target=" target='_blank'";
  120. //发布时间
  121. $ftime=@filemtime($pathfile);
  122. $filetime=date("Y-m-d H:i:s",$ftime);
  123. //文件大小
  124. $fsize=@filesize($pathfile);
  125. $filesize=ChTheFilesize($fsize);
  126. $furl=$efileurl.$truefile;
  127. }
  128. ?>
  129. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  130. <td width="6%" height="25">
  131. <div align="center">
  132. <?=$checkbox?>
  133. </div></td>
  134. <td width="47%" height="25"><a href=<?=$filelink?><?=$target?>>
  135. <?=$filename?>
  136. </a></td>
  137. <td width="14%">
  138. <div align="right">
  139. <?=$filesize?>
  140. </div></td>
  141. <td width="10%">
  142. <div align="center">
  143. <?=$ftype?>
  144. </div></td>
  145. <td width="23%">
  146. <div align="center">
  147. <?=$filetime?>
  148. </div></td>
  149. </tr>
  150. <?
  151. }
  152. @closedir($hand);
  153. ?>
  154. <tr bgcolor="#FFFFFF">
  155. <td height="25">
  156. <div align="center">
  157. <input type="checkbox" name="chkall" value="on" onclick="CheckAll(this.form)">
  158. </div></td>
  159. <td height="25" colspan="4">
  160. <input type="submit" name="Submit" value="删除文件">
  161. <input name="enews" type="hidden" id="enews" value="DelTruePathFile">
  162. <?=$filepathr['addpostvar']?>
  163. </td>
  164. </tr>
  165. </form>
  166. </table>
  167. </body>
  168. </html>