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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. /**
  3. * 软件选择框
  4. *
  5. * @version $Id: select_soft.php 1 9:43 2010年7月8日Z tianya $
  6. * @package DedeBIZ.Dialog
  7. * @copyright Copyright (c) 2021, 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. <html>
  43. <head>
  44. <meta charset="<?php echo $cfg_soft_lang; ?>">
  45. <title>软件管理器</title>
  46. <link rel="stylesheet" href="../../static/css/bootstrap.min.css">
  47. <link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
  48. <link rel="stylesheet" href="../css/base.css">
  49. <style>
  50. html{background:#f2f2f2}
  51. body{margin:0;line-height:22px;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
  52. a{text-decoration:none!important}
  53. table{background:#fff}
  54. .bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
  55. .linerow{border-bottom:1px solid #eee!important}
  56. </style>
  57. </head>
  58. <body class="bg">
  59. <script>
  60. function nullLink() {
  61. return;
  62. }
  63. function ReturnValue(reimg) {
  64. if (window.opener.document.<?php echo $f ?> != null) {
  65. window.opener.document.<?php echo $f ?>.value = reimg;
  66. }
  67. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>;
  68. if (window.opener.CKEDITOR != null && funcNum != 1) {
  69. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  70. }
  71. if (window.opener.CKEDITOR.instances.<?php echo $f ?>) {
  72. let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/img/addon.gif'>附件:${reimg}</a>`;
  73. window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
  74. }
  75. window.close();
  76. }
  77. </script>
  78. <table width="100%" border="0" cellpadding="0" cellspacing="1" align="center" class="table table-borderless">
  79. <tr>
  80. <td colspan="3" height="30">
  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. &nbsp;上传:<input type="file" name="uploadfile" size="24" style="border:none">
  86. &nbsp;
  87. 改名:<input type="text" name="newname" style="width:160px">
  88. &nbsp;
  89. <button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
  90. </form>
  91. </td>
  92. </tr>
  93. <tr>
  94. <td colspan="3">
  95. <table width="100%" border="0" cellspacing="0" cellpadding="2">
  96. <tr height="28">
  97. <td width="50%" class="linerow">选择文件</td>
  98. <td width="20%" class="linerow">文件大小</td>
  99. <td width="30%" class="linerow">修改时间</td>
  100. </tr>
  101. <?php
  102. $dh = dir($inpath);
  103. $ty1 = $ty2 = '';
  104. while ($file = $dh->read()) {
  105. //计算文件大小和创建时间
  106. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  107. $filesize = filesize("$inpath/$file");
  108. $filesize = $filesize / 1024;
  109. if ($filesize != "")
  110. if ($filesize < 0.1) {
  111. @list($ty1, $ty2) = split("\.", $filesize);
  112. $filesize = $ty1 . "." . substr($ty2, 0, 2);
  113. } else {
  114. @list($ty1, $ty2) = split("\.", $filesize);
  115. $filesize = $ty1 . "." . substr($ty2, 0, 1);
  116. }
  117. $filetime = filemtime("$inpath/$file");
  118. $filetime = MyDate("Y-m-d H:i", $filetime);
  119. }
  120. //判断文件类型并作处理
  121. if ($file == ".") continue;
  122. else if ($file == "..") {
  123. if ($activepath == "") continue;
  124. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  125. $line = "\n<tr height='28'>
  126. <td class='linerow'><a href='select_soft.php?f=$f&activepath=" . urlencode($tmp) . $addparm . "'><img src='img/dir2.gif'>上级目录</a></td>
  127. <td colspan='2' class='linerow'>当前目录:$activepath</td>
  128. </tr>\r\n";
  129. echo $line;
  130. } else if (is_dir("$inpath/$file")) {
  131. if (preg_match("#^_(.*)$#i", $file)) continue;
  132. if (preg_match("#^\.(.*)$#i", $file)) continue;
  133. $line = "\n<tr height='28'>
  134. <td class='linerow'><a href=select_soft.php?f=$f&activepath=" . urlencode("$activepath/$file") . $addparm . "><img src='img/dir.gif'>$file</a></td>
  135. <td class='linerow'></td>
  136. <td class='linerow'></td>
  137. </tr>";
  138. echo "$line";
  139. } else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
  140. if ($file == $comeback) $lstyle = " style='color:red' ";
  141. else $lstyle = "";
  142. $reurl = "$activeurl/$file";
  143. $reurl = preg_replace("#^\.\.#", "", $reurl);
  144. $reurl = $reurl;
  145. $line = "\n<tr height='28'>
  146. <td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/zip.gif'>$file</a></td>
  147. <td class='linerow'>$filesize KB</td>
  148. <td class='linerow'>$filetime</td>
  149. </tr>";
  150. echo "$line";
  151. } else {
  152. if ($file == $comeback) $lstyle = " style='color:red' ";
  153. else $lstyle = '';
  154. $reurl = "$activeurl/$file";
  155. $reurl = preg_replace("#^\.\.#", "", $reurl);
  156. $reurl = $reurl;
  157. $line = "\n<tr height='28'>
  158. <td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/exe.gif'>$file</a></td>
  159. <td class='linerow'>$filesize KB</td>
  160. <td class='linerow'>$filetime</td>
  161. </tr>";
  162. echo "$line";
  163. }
  164. }//End Loop
  165. $dh->close();
  166. ?>
  167. </table>
  168. </td>
  169. </tr>
  170. <tr>
  171. <td colspan="3" height="30">点击选择的文件,红色字样的为刚上传的文件</td>
  172. </tr>
  173. </table>
  174. </body>
  175. </html>