国内流行的内容管理系统(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.

200 lines
8.7KB

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