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

203 lines
9.0KB

  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 http-equiv='Content-Type' content='text/html; charset=<?php echo $cfg_soft_lang; ?>'>
  45. <title>软件管理器</title>
  46. <link rel="stylesheet" href="../../static/css/bootstrap.min.css">
  47. <link href="../../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  48. <link href='../css/base.css' rel='stylesheet' type='text/css'>
  49. <style>
  50. .linerow {
  51. border-bottom: 1px solid #CBD8AC;
  52. }
  53. </style>
  54. </head>
  55. <body background='img/allbg.gif' leftmargin='5' topmargin='0'>
  56. <SCRIPT language='JavaScript'>
  57. function nullLink() {
  58. return;
  59. }
  60. function ReturnValue(reimg) {
  61. if (window.opener.document.<?php echo $f ?> != null) {
  62. window.opener.document.<?php echo $f ?>.value = reimg;
  63. }
  64. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>;
  65. if (window.opener.CKEDITOR != null && funcNum != 1) {
  66. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  67. }
  68. if (window.opener.CKEDITOR.instances.<?php echo $f ?>) {
  69. let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/img/addon.gif' border='0' />附件:${reimg}</a>`;
  70. window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
  71. }
  72. window.close();
  73. }
  74. </SCRIPT>
  75. <table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' align="center" class="table maintable table-borderless">
  76. <tr>
  77. <td colspan='3' bgcolor='#E8F1DE' background="img/tbg.gif" height='28'>
  78. <form action='select_soft_post.php' method='POST' enctype="multipart/form-data" name='myform'>
  79. <input type='hidden' name='activepath' value='<?php echo $activepath ?>' />
  80. <input type='hidden' name='f' value='<?php echo $f ?>' />
  81. <input type='hidden' name='job' value='upload' />
  82. &nbsp;上 传: <input type='file' name='uploadfile' size='25' />
  83. &nbsp;
  84. 改 名:<input type='test' name='newname' style='width:90px' />
  85. &nbsp;
  86. <button type='submit' name='sb1' class="btn btn-secondary btn-sm">确定</button>
  87. </form>
  88. </td>
  89. </tr>
  90. <tr bgcolor='#FFFFFF'>
  91. <td colspan='3'>
  92. <!-- 开始文件列表 -->
  93. <table width='100%' border='0' cellspacing='0' cellpadding='2'>
  94. <tr bgcolor="#CCCCCC" height="24">
  95. <td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
  96. <td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
  97. <td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
  98. </tr>
  99. <?php
  100. $dh = dir($inpath);
  101. $ty1 = $ty2 = '';
  102. while ($file = $dh->read()) {
  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:s", $filetime);
  117. }
  118. //------判断文件类型并作处理
  119. if ($file == ".") continue;
  120. else if ($file == "..") {
  121. if ($activepath == "") continue;
  122. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  123. $line = "\n<tr height='24'>
  124. <td class='linerow'> <a href='select_soft.php?f=$f&activepath=" . urlencode($tmp) . $addparm . "'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
  125. <td colspan='2' class='linerow'> 当前目录:$activepath</td>
  126. </tr>\r\n";
  127. echo $line;
  128. } else if (is_dir("$inpath/$file")) {
  129. if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
  130. if (preg_match("#^\.(.*)$#i", $file)) continue;
  131. $line = "\n<tr height='24'>
  132. <td bgcolor='#F9FBF0' class='linerow'>
  133. <a href=select_soft.php?f=$f&activepath=" . urlencode("$activepath/$file") . $addparm . "><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  134. </td>
  135. <td class='linerow'>-</td>
  136. <td bgcolor='#F9FBF0' 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. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  145. $reurl = $remoteupUrl . $reurl;
  146. } else {
  147. $reurl = $reurl;
  148. }
  149. $line = "\n<tr height='24'>
  150. <td class='linerow' bgcolor='#F9FBF0'>
  151. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/zip.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  152. </td>
  153. <td class='linerow'>$filesize KB</td>
  154. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  155. </tr>";
  156. echo "$line";
  157. } else {
  158. if ($file == $comeback) $lstyle = " style='color:red' ";
  159. else $lstyle = '';
  160. $reurl = "$activeurl/$file";
  161. $reurl = preg_replace("#^\.\.#", "", $reurl);
  162. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  163. $reurl = $remoteupUrl . $reurl;
  164. } else {
  165. $reurl = $reurl;
  166. }
  167. $line = "\n<tr height='24'>
  168. <td class='linerow' bgcolor='#F9FBF0'>
  169. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/exe.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  170. </td>
  171. <td class='linerow'>$filesize KB</td>
  172. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  173. </tr>";
  174. echo "$line";
  175. }
  176. } //End Loop
  177. $dh->close();
  178. ?>
  179. <!-- 文件列表完 -->
  180. </table>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td colspan='3' bgcolor='#E8F1DE' height='26'>&nbsp;请点击要选择的文件,红色字样的为刚上传的文件。</td>
  185. </tr>
  186. </table>
  187. </body>
  188. </html>