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

172 lines
6.9KB

  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="<?php echo $cfg_soft_lang;?>">
  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>
  52. html{background:#f8f8f8}
  53. .bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
  54. </style>
  55. </head>
  56. <body class="bg">
  57. <script>
  58. function nullLink() {
  59. return;
  60. }
  61. function ReturnValue(reimg) {
  62. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
  63. if (window.opener.CKEDITOR != null && funcNum != 1) {
  64. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  65. }
  66. if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
  67. let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/web/img/addon.gif'>附件:${reimg}</a>`;
  68. window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
  69. }
  70. if (window.opener.document.<?php echo $f ?> != null) {
  71. window.opener.document.<?php echo $f ?>.value = reimg;
  72. window.close();
  73. return
  74. }
  75. window.close();
  76. }
  77. </script>
  78. <table width="100%" cellpadding="0" cellspacing="1" align="center" class="table table-borderless icon">
  79. <tr>
  80. <td colspan="3">
  81. <form action="select_soft_post.php" method="POST" enctype="multipart/form-data" name="myform">
  82. <input type="hidden" name="activepath" value="<?php echo $activepath ?>">
  83. <input type="hidden" name="f" value="<?php echo $f ?>">
  84. <input type="hidden" name="job" value="upload">
  85. 上传:<input type="file" name="uploadfile" size="24" style="width:50%;border:none">
  86. 改名:<input type="text" name="newname" class="biz-input-sm">
  87. <button type="submit" name="sb1" class="btn btn-success btn-sm">保存</button>
  88. </form>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td colspan="3" class="biz-td">点击选择的文件,红色字样的为刚上传的文件</td>
  93. </tr>
  94. <tr>
  95. <td width="50%" class="biz-td">选择文件</td>
  96. <td width="20%" class="biz-td">文件大小</td>
  97. <td class="biz-td">修改时间</td>
  98. </tr>
  99. <?php
  100. $dh = scandir($inpath);
  101. $ty1 = $ty2 = "";
  102. foreach ($dh as $file) {
  103. //计算文件大小和创建时间
  104. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  105. $filesize = filesize("$inpath/$file");
  106. $filesize = $filesize / 1024;
  107. if ($filesize != "")
  108. if ($filesize < 0.1) {
  109. @list($ty1, $ty2) = split("\.", $filesize);
  110. $filesize = $ty1.".".substr($ty2, 0, 2);
  111. } else {
  112. @list($ty1, $ty2) = split("\.", $filesize);
  113. $filesize = $ty1.".".substr($ty2, 0, 1);
  114. }
  115. $filetime = filemtime("$inpath/$file");
  116. $filetime = MyDate("Y-m-d H:i", $filetime);
  117. }
  118. //判断文件类型并作处理
  119. if ($file == ".") continue;
  120. else if ($file == "..") {
  121. if ($activepath == "") continue;
  122. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  123. $line = "<tr>
  124. <td class='biz-td'><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/dir2.gif'>上级目录</a></td>
  125. <td colspan='2' class='biz-td'>当前目录:$activepath</td>
  126. </tr>\r\n";
  127. echo $line;
  128. } else if (is_dir("$inpath/$file")) {
  129. if (preg_match("#^_(.*)$#i", $file)) continue;
  130. if (preg_match("#^\.(.*)$#i", $file)) continue;
  131. $line = "<tr>
  132. <td class='biz-td'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='../../static/web/img/dir.gif'>$file</a></td>
  133. <td class='biz-td'></td>
  134. <td class='biz-td'></td>
  135. </tr>";
  136. echo "$line";
  137. } else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
  138. if ($file == $comeback) $lstyle = "class='text-danger'";
  139. else $lstyle = "";
  140. $reurl = "$activeurl/$file";
  141. $reurl = preg_replace("#^\.\.#", "", $reurl);
  142. $reurl = $reurl;
  143. $line = "<tr>
  144. <td class='biz-td'>
  145. <img src='../../static/web/img/zip.gif'>
  146. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
  147. </td>
  148. <td class='biz-td'>$filesize KB</td>
  149. <td class='biz-td'>$filetime</td>
  150. </tr>";
  151. echo "$line";
  152. } else {
  153. if ($file == $comeback) $lstyle = "class='text-danger'";
  154. else $lstyle = '';
  155. $reurl = "$activeurl/$file";
  156. $reurl = preg_replace("#^\.\.#", "", $reurl);
  157. $reurl = $reurl;
  158. $line = "<tr>
  159. <td class='biz-td'>
  160. <img src='../../static/web/img/exe.gif'>
  161. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
  162. </td>
  163. <td class='biz-td'>$filesize KB</td>
  164. <td class='biz-td'>$filetime</td>
  165. </tr>";
  166. echo "$line";
  167. }
  168. }//End Loop
  169. ?>
  170. </table>
  171. </body>
  172. </html>