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

select_soft.php 8.7KB

3 年之前
2 年之前
3 年之前
2 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
2 年之前
2 年之前
2 年之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
5 月之前
10 月之前
10 月之前
2 年之前
3 年之前
2 年之前
10 月之前
2 年之前
3 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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 GNU GPL v2 (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. $noeditor = isset($noeditor) ? $noeditor : '';
  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. <!DOCTYPE html>
  44. <html>
  45. <head>
  46. <meta charset="utf-8">
  47. <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  48. <title>选择软件</title>
  49. <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
  50. <link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
  51. <link rel="stylesheet" href="/static/web/css/admin.css">
  52. </head>
  53. <body class="p-3">
  54. <div class="card shadow-sm mb-3">
  55. <div class="card-body">
  56. <form name="myform" action="select_soft_post.php" method="POST" enctype="multipart/form-data">
  57. <input type="hidden" name="activepath" value="<?php echo $activepath ?>">
  58. <?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : ''; echo $noeditor;?>
  59. <input type="hidden" name="f" value="<?php echo $f ?>">
  60. <input type="hidden" name="job" value="upload">
  61. <input type="file" name="uploadfile">
  62. <label>重命名:<input type="text" name="newname" class="admin-input-sm"></label>
  63. <button type="submit" class="btn btn-success btn-sm">保存</button>
  64. </form>
  65. </div>
  66. </div>
  67. <div class="card shadow-sm">
  68. <div class="card-header">选择软件</div>
  69. <div class="card-body">
  70. <div class="table-responsive">
  71. <table class="table table-borderless icon">
  72. <thead>
  73. <tr>
  74. <td scope="col">文件名称</td>
  75. <td scope="col">文件大小</td>
  76. <td scope="col">修改时间</td>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. <?php
  81. $dh = scandir($inpath);
  82. $ty1 = "";
  83. $ty2 = "";
  84. foreach ($dh as $file) {
  85. //计算文件大小和创建时间
  86. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  87. $filesize = filesize("$inpath/$file");
  88. $filesize = $filesize / 1024;
  89. if ($filesize != "")
  90. if ($filesize < 0.1) {
  91. @list($ty1, $ty2) = split("\.", $filesize);
  92. $filesize = $ty1.".".substr($ty2, 0, 2);
  93. } else {
  94. @list($ty1, $ty2) = split("\.", $filesize);
  95. $filesize = $ty1.".".substr($ty2, 0, 1);
  96. }
  97. $filetime = filemtime("$inpath/$file");
  98. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  99. }
  100. //判断文件类型并作处理
  101. if ($file == ".") continue;
  102. else if ($file == "..") {
  103. if ($activepath == "") continue;
  104. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  105. $line = "<tr>
  106. <td><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='/static/web/img/icon_dir2.png'> 返回上级</a></td>
  107. <td colspan='2'>当前目录:$activepath</td>
  108. </tr>\r\n";
  109. echo $line;
  110. } else if (is_dir("$inpath/$file")) {
  111. if (preg_match("#^_(.*)$#i", $file)) continue;
  112. if (preg_match("#^\.(.*)$#i", $file)) continue;
  113. $line = "<tr>
  114. <td colspan='3'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='/static/web/img/icon_dir.png'> $file</a></td>
  115. </tr>";
  116. echo "$line";
  117. } else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
  118. $reurl = "$activeurl/$file";
  119. $reurl = preg_replace("#^\.\.#", "", $reurl);
  120. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  121. $reurl = $remoteupUrl.$reurl;
  122. } else {
  123. $reurl = $reurl;
  124. }
  125. if ($file == $comeback) $lstyle = "class='text-danger'";
  126. else $lstyle = '';
  127. $line = "<tr>
  128. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_zip.png'> $file</a></td>
  129. <td>$filesize KB</td>
  130. <td>$filetime</td>
  131. </tr>";
  132. echo "$line";
  133. } else {
  134. $reurl = "$activeurl/$file";
  135. $reurl = preg_replace("#^\.\.#", "", $reurl);
  136. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  137. $reurl = $remoteupUrl.$reurl;
  138. } else {
  139. $reurl = $reurl;
  140. }
  141. if ($file == $comeback) $lstyle = "class='text-danger'";
  142. else $lstyle = '';
  143. $line = "<tr>
  144. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_exe.png'> $file</a></td>
  145. <td>$filesize KB</td>
  146. <td>$filetime</td>
  147. </tr>";
  148. echo "$line";
  149. }
  150. }
  151. ?>
  152. </tbody>
  153. </table>
  154. </div>
  155. </div>
  156. </div>
  157. <script>
  158. function nullLink() {
  159. return;
  160. }
  161. function ReturnValue(reimg) {
  162. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
  163. if (window.opener.CKEDITOR != null && funcNum != 1) {
  164. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  165. }
  166. if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
  167. let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/web/img/icon_addon.png'>附件:${reimg}</a>`;
  168. window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
  169. }
  170. if (window.opener.document.<?php echo $f ?> != null) {
  171. window.opener.document.<?php echo $f ?>.value = reimg;
  172. window.close();
  173. return
  174. }
  175. window.close();
  176. }
  177. </script>
  178. </body>
  179. </html>