国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
6.6KB

  1. <?php
  2. /**
  3. * 软件选择框
  4. *
  5. * @version $Id: select_soft.php 1 9:43 2010年7月8日Z tianya $
  6. * @package DedeCMS.Dialog
  7. * @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. if(empty($activepath))
  13. {
  14. $activepath = '';
  15. }
  16. $activepath = str_replace('.','',$activepath);
  17. $activepath = preg_replace("#\/{1,}#", '/', $activepath);
  18. if(strlen($activepath) < strlen($cfg_soft_dir))
  19. {
  20. $activepath = $cfg_soft_dir;
  21. }
  22. $inpath = $cfg_basedir.$activepath;
  23. $activeurl = '..'.$activepath;
  24. if(empty($f))
  25. {
  26. $f='form1.enclosure';
  27. }
  28. if (!is_dir($inpath) )
  29. {
  30. die('No Exsits Path');
  31. }
  32. if(empty($comeback))
  33. {
  34. $comeback = '';
  35. }
  36. $addparm = '';
  37. if (!empty($CKEditor))
  38. {
  39. $addparm = '&CKEditor='.$CKEditor;
  40. }
  41. if (!empty($CKEditorFuncNum))
  42. {
  43. $addparm .= '&CKEditorFuncNum='.$CKEditorFuncNum;
  44. }
  45. if (!empty($noeditor))
  46. {
  47. $addparm .= '&noeditor=yes';
  48. }
  49. ?>
  50. <html>
  51. <head>
  52. <meta http-equiv='Content-Type' content='text/html; charset=<?php echo $cfg_soft_lang; ?>'>
  53. <title>软件管理器</title>
  54. <link href='../../images/img/base.css' rel='stylesheet' type='text/css'>
  55. <style>
  56. .linerow {border-bottom: 1px solid #CBD8AC;}
  57. </style>
  58. </head>
  59. <body background='img/allbg.gif' leftmargin='5' topmargin='0'>
  60. <SCRIPT language='JavaScript'>
  61. function nullLink()
  62. {
  63. return;
  64. }
  65. function ReturnValue(reimg)
  66. {
  67. if(window.opener.document.<?php echo $f?> != null)
  68. {
  69. window.opener.document.<?php echo $f?>.value=reimg;
  70. }
  71. var funcNum = <?php echo isset($CKEditorFuncNum)? $CKEditorFuncNum : 1;?>;
  72. if(window.opener.CKEDITOR != null && funcNum != 1)
  73. {
  74. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  75. }
  76. window.close();
  77. }
  78. </SCRIPT>
  79. <table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' align="center">
  80. <tr>
  81. <td colspan='3' bgcolor='#E8F1DE' background="img/tbg.gif" height='28'>
  82. <form action='select_soft_post.php' method='POST' enctype="multipart/form-data" name='myform'>
  83. <input type='hidden' name='activepath' value='<?php echo $activepath?>' />
  84. <input type='hidden' name='f' value='<?php echo $f?>' />
  85. <input type='hidden' name='job' value='upload' />
  86. &nbsp;上 传: <input type='file' name='uploadfile' size='25' />
  87. &nbsp;
  88. 改 名:<input type='test' name='newname' style='width:90px' />
  89. &nbsp;
  90. <input type='submit' name='sb1' value='确定' />
  91. </form>
  92. </td>
  93. </tr>
  94. <tr bgcolor='#FFFFFF'>
  95. <td colspan='3'>
  96. <!-- 开始文件列表 -->
  97. <table width='100%' border='0' cellspacing='0' cellpadding='2'>
  98. <tr bgcolor="#CCCCCC" height="24">
  99. <td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
  100. <td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
  101. <td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
  102. </tr>
  103. <?php
  104. $dh = dir($inpath);
  105. $ty1 = $ty2 = '';
  106. while($file = $dh->read())
  107. {
  108. //-----计算文件大小和创建时间
  109. if($file != "." && $file != ".." && !is_dir("$inpath/$file"))
  110. {
  111. $filesize = filesize("$inpath/$file");
  112. $filesize = $filesize / 1024;
  113. if($filesize != "")
  114. if($filesize < 0.1){
  115. @list($ty1, $ty2) = split("\.", $filesize);
  116. $filesize = $ty1.".".substr($ty2, 0, 2);
  117. }
  118. else{
  119. @list($ty1, $ty2) = split("\.", $filesize);
  120. $filesize = $ty1.".".substr($ty2, 0, 1);
  121. }
  122. $filetime = filemtime("$inpath/$file");
  123. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  124. }
  125. //------判断文件类型并作处理
  126. if($file == ".") continue;
  127. else if($file == "..")
  128. {
  129. if($activepath == "") continue;
  130. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  131. $line = "\n<tr height='24'>
  132. <td class='linerow'> <a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
  133. <td colspan='2' class='linerow'> 当前目录:$activepath</td>
  134. </tr>\r\n";
  135. echo $line;
  136. }
  137. else if(is_dir("$inpath/$file"))
  138. {
  139. if(preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
  140. if(preg_match("#^\.(.*)$#i", $file)) continue;
  141. $line = "\n<tr height='24'>
  142. <td bgcolor='#F9FBF0' class='linerow'>
  143. <a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  144. </td>
  145. <td class='linerow'>-</td>
  146. <td bgcolor='#F9FBF0' class='linerow'>-</td>
  147. </tr>";
  148. echo "$line";
  149. }
  150. else if(preg_match("#\.(zip|rar|tgr.gz)#i", $file))
  151. {
  152. if($file==$comeback) $lstyle = " style='color:red' ";
  153. else $lstyle = "";
  154. $reurl = "$activeurl/$file";
  155. $reurl = preg_replace("#^\.\.#", "", $reurl);
  156. if($cfg_remote_site=='Y' && $remoteuploads == 1)
  157. {
  158. $reurl = $remoteupUrl.$reurl;
  159. } else {
  160. $reurl = $reurl;
  161. }
  162. $line = "\n<tr height='24'>
  163. <td class='linerow' bgcolor='#F9FBF0'>
  164. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/zip.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  165. </td>
  166. <td class='linerow'>$filesize KB</td>
  167. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  168. </tr>";
  169. echo "$line";
  170. }
  171. else
  172. {
  173. if($file==$comeback) $lstyle = " style='color:red' ";
  174. else $lstyle = '';
  175. $reurl = "$activeurl/$file";
  176. $reurl = preg_replace("#^\.\.#", "", $reurl);
  177. if($cfg_remote_site=='Y' && $remoteuploads == 1)
  178. {
  179. $reurl = $remoteupUrl.$reurl;
  180. } else {
  181. $reurl = $reurl;
  182. }
  183. $line = "\n<tr height='24'>
  184. <td class='linerow' bgcolor='#F9FBF0'>
  185. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/exe.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  186. </td>
  187. <td class='linerow'>$filesize KB</td>
  188. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  189. </tr>";
  190. echo "$line";
  191. }
  192. }//End Loop
  193. $dh->close();
  194. ?>
  195. <!-- 文件列表完 -->
  196. </table></td></tr>
  197. <tr><td colspan='3' bgcolor='#E8F1DE' height='26'>&nbsp;请点击要选择的文件,红色字样的为刚上传的文件。</td></tr>
  198. </table>
  199. </body>
  200. </html>