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

171 lines
7.3KB

  1. <?php
  2. /**
  3. * 软件选择
  4. *
  5. * @version $id:select_soft.php 9:43 2010年7月8日 tianya $
  6. * @package DedeBIZ.Dialog
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. if (empty($activepath)) {
  13. $activepath = '';
  14. }
  15. $activepath = str_replace('.', '', $activepath);
  16. $activepath = preg_replace("#\/{1,}#", '/', $activepath);
  17. if (strlen($activepath) < strlen($cfg_soft_dir)) {
  18. $activepath = $cfg_soft_dir;
  19. }
  20. $inpath = $cfg_basedir.$activepath;
  21. $activeurl = '..'.$activepath;
  22. if (empty($f)) {
  23. $f = 'form1.enclosure';
  24. }
  25. if (!is_dir($inpath)) {
  26. die('No Exsits Path');
  27. }
  28. if (empty($comeback)) {
  29. $comeback = '';
  30. }
  31. $addparm = '';
  32. if (!empty($CKEditor)) {
  33. $addparm = '&CKEditor='.$CKEditor;
  34. }
  35. if (!empty($CKEditorFuncNum)) {
  36. $addparm .= '&CKEditorFuncNum='.$CKEditorFuncNum;
  37. }
  38. if (!empty($noeditor)) {
  39. $addparm .= '&noeditor=yes';
  40. }
  41. ?>
  42. <!DOCTYPE html>
  43. <html>
  44. <head>
  45. <meta charset="utf-8">
  46. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  47. <title>选择软件</title>
  48. <link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
  49. <link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
  50. <link rel="stylesheet" href="../../static/web/css/admin.css">
  51. <style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
  52. <script>
  53. function nullLink() {
  54. return;
  55. }
  56. function ReturnValue(reimg) {
  57. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
  58. if (window.opener.CKEDITOR != null && funcNum != 1) {
  59. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  60. }
  61. if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
  62. let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/web/img/icon_addon.png'>附件:${reimg}</a>`;
  63. window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
  64. }
  65. if (window.opener.document.<?php echo $f ?> != null) {
  66. window.opener.document.<?php echo $f ?>.value = reimg;
  67. window.close();
  68. return
  69. }
  70. window.close();
  71. }
  72. </script>
  73. </head>
  74. <body>
  75. <div class="upload-bg">
  76. <table width="100%" cellpadding="0" cellspacing="1" align="center" class="table table-borderless icon">
  77. <tr>
  78. <td colspan="3">
  79. <form action="select_soft_post.php" method="POST" enctype="multipart/form-data" name="myform">
  80. <input type="hidden" name="activepath" value="<?php echo $activepath ?>">
  81. <input type="hidden" name="f" value="<?php echo $f ?>">
  82. <input type="hidden" name="job" value="upload">
  83. <span>选择:<input type="file" name="uploadfile" class="w-50"></span>
  84. <span>改名:<input type="text" name="newname" class="admin-input-sm"></span>
  85. <button type="submit" name="sb1" class="btn btn-success btn-sm">保存</button>
  86. </form>
  87. </td>
  88. </tr>
  89. <tr>
  90. <td colspan="3" class="admin-td">点击选择的文件,红色字样的为刚上传的文件</td>
  91. </tr>
  92. <tr>
  93. <td width="50%" class="admin-td">选择文件</td>
  94. <td width="20%" class="admin-td">文件大小</td>
  95. <td class="admin-td">修改时间</td>
  96. </tr>
  97. <?php
  98. $dh = scandir($inpath);
  99. $ty1 = $ty2 = "";
  100. foreach ($dh as $file) {
  101. //计算文件大小和创建时间
  102. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  103. $filesize = filesize("$inpath/$file");
  104. $filesize = $filesize / 1024;
  105. if ($filesize != "")
  106. if ($filesize < 0.1) {
  107. @list($ty1, $ty2) = split("\.", $filesize);
  108. $filesize = $ty1.".".substr($ty2, 0, 2);
  109. } else {
  110. @list($ty1, $ty2) = split("\.", $filesize);
  111. $filesize = $ty1.".".substr($ty2, 0, 1);
  112. }
  113. $filetime = filemtime("$inpath/$file");
  114. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  115. }
  116. //判断文件类型并作处理
  117. if ($file == ".") continue;
  118. else if ($file == "..") {
  119. if ($activepath == "") continue;
  120. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  121. $line = "<tr>
  122. <td class='admin-td'><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
  123. <td colspan='2' class='admin-td'>当前目录:$activepath</td>
  124. </tr>\r\n";
  125. echo $line;
  126. } else if (is_dir("$inpath/$file")) {
  127. if (preg_match("#^_(.*)$#i", $file)) continue;
  128. if (preg_match("#^\.(.*)$#i", $file)) continue;
  129. $line = "<tr>
  130. <td class='admin-td'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='../../static/web/img/icon_dir.png'>$file</a></td>
  131. <td class='admin-td'></td>
  132. <td class='admin-td'></td>
  133. </tr>";
  134. echo "$line";
  135. } else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
  136. if ($file == $comeback) $lstyle = "class='text-danger'";
  137. else $lstyle = "";
  138. $reurl = "$activeurl/$file";
  139. $reurl = preg_replace("#^\.\.#", "", $reurl);
  140. $reurl = $reurl;
  141. $line = "<tr>
  142. <td class='admin-td'>
  143. <img src='../../static/web/img/icon_zip.png'>
  144. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
  145. </td>
  146. <td class='admin-td'>$filesize KB</td>
  147. <td class='admin-td'>$filetime</td>
  148. </tr>";
  149. echo "$line";
  150. } else {
  151. if ($file == $comeback) $lstyle = "class='text-danger'";
  152. else $lstyle = '';
  153. $reurl = "$activeurl/$file";
  154. $reurl = preg_replace("#^\.\.#", "", $reurl);
  155. $reurl = $reurl;
  156. $line = "<tr>
  157. <td class='admin-td'>
  158. <img src='../../static/web/img/icon_exe.png'>
  159. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
  160. </td>
  161. <td class='admin-td'>$filesize KB</td>
  162. <td class='admin-td'>$filetime</td>
  163. </tr>";
  164. echo "$line";
  165. }
  166. }//End Loop
  167. ?>
  168. </table>
  169. </div>
  170. </body>
  171. </html>