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

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. /**
  3. * 软件选择
  4. *
  5. * @version $Id: select_soft.php 2022-07-01 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><?php echo Lang('dialog_soft_select');?></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.min.css">
  51. <style>
  52. html{background:#f8f8f8}
  53. .bg{margin:10px;border-radius:.2rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}
  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'>附件:${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%" align="center" cellpadding="0" cellspacing="1" class="table table-borderless">
  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. <?php echo Lang('upload');?>:<input type="file" name="uploadfile" size="24" style="width:50%;border:0">
  86. <?php echo Lang('rename');?>:<input type="text" name="newname" style="width:160px">
  87. <button type="submit" name="sb1" class="btn btn-success btn-sm"><?php echo Lang('save');?></button>
  88. </form>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td colspan="3">
  93. <table width="100%" cellspacing="0" cellpadding="2">
  94. <tr>
  95. <td width="50%" class="linerow"><?php echo Lang('dialog_soft_select');?></td>
  96. <td width="25%" class="linerow"><?php echo Lang('filesize');?></td>
  97. <td width="25%" class="linerow"><?php echo Lang('edit_time');?></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) = explode("\.", $filesize);
  110. $filesize = $ty1.".".substr($ty2, 0, 2);
  111. } else {
  112. @list($ty1, $ty2) = explode("\.", $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='linerow'><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' class='bi bi-folder-symlink' viewBox='0 0 18 18'><path d='m11.798 8.271-3.182 1.97c-.27.166-.616-.036-.616-.372V9.1s-2.571-.3-4 2.4c.571-4.8 3.143-4.8 4-4.8v-.769c0-.336.346-.538.616-.371l3.182 1.969c.27.166.27.576 0 .742z'/><path d='m.5 3 .04.87a1.99 1.99 0 0 0-.342 1.311l.637 7A2 2 0 0 0 2.826 14h10.348a2 2 0 0 0 1.991-1.819l.637-7A2 2 0 0 0 13.81 3H9.828a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 6.172 1H2.5a2 2 0 0 0-2 2zm.694 2.09A1 1 0 0 1 2.19 4h11.62a1 1 0 0 1 .996 1.09l-.636 7a1 1 0 0 1-.996.91H2.826a1 1 0 0 1-.995-.91l-.637-7zM6.172 2a1 1 0 0 1 .707.293L7.586 3H2.19c-.24 0-.47.042-.683.12L1.5 2.98a1 1 0 0 1 1-.98h3.672z'/></svg>".Lang('parent_directory')."</a></td>
  125. <td colspan='2' class='linerow'>".Lang('current_directory').":$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='linerow'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' class='bi bi-folder' viewBox='0 0 18 18'><path d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4H2.19zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z'/></svg>$file</a></td>
  133. <td class='linerow'></td>
  134. <td class='linerow'></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='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' class='bi bi-file-zip' viewBox='0 0 18 18'><path d='M6.5 7.5a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v.938l.4 1.599a1 1 0 0 1-.416 1.074l-.93.62a1 1 0 0 1-1.109 0l-.93-.62a1 1 0 0 1-.415-1.074l.4-1.599V7.5zm2 0h-1v.938a1 1 0 0 1-.03.243l-.4 1.598.93.62.93-.62-.4-1.598a1 1 0 0 1-.03-.243V7.5z'/><path d='M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm5.5-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H9v1H8v1h1v1H8v1h1v1H7.5V5h-1V4h1V3h-1V2h1V1z'/></svg>$file</a></td>
  145. <td class='linerow'>$filesize KB</td>
  146. <td class='linerow'>$filetime</td>
  147. </tr>";
  148. echo "$line";
  149. } else {
  150. if ($file == $comeback) $lstyle = " class='text-danger' ";
  151. else $lstyle = '';
  152. $reurl = "$activeurl/$file";
  153. $reurl = preg_replace("#^\.\.#", "", $reurl);
  154. $reurl = $reurl;
  155. $line = "<tr>
  156. <td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' class='bi bi-filetype-exe' viewBox='0 0 18 18'><path fill-rule='evenodd' d='M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM2.575 15.202H.785v-1.073H2.47v-.606H.785v-1.025h1.79v-.648H0v3.999h2.575v-.647ZM6.31 11.85h-.893l-.823 1.439h-.036l-.832-1.439h-.931l1.227 1.983-1.239 2.016h.861l.853-1.415h.035l.85 1.415h.908l-1.254-1.992L6.31 11.85Zm1.025 3.352h1.79v.647H6.548V11.85h2.576v.648h-1.79v1.025h1.684v.606H7.334v1.073Z'/></svg>$file</a></td>
  157. <td class='linerow'>$filesize KB</td>
  158. <td class='linerow'>$filetime</td>
  159. </tr>";
  160. echo "$line";
  161. }
  162. }//End Loop
  163. ?>
  164. </table>
  165. </td>
  166. </tr>
  167. <tr>
  168. <td colspan="3"><?php echo Lang('dialog_soft_select_tip');?></td>
  169. </tr>
  170. </table>
  171. </body>
  172. </html>