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

199 lines
8.7KB

  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) 2020, 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. window.close();
  69. }
  70. </SCRIPT>
  71. <table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' align="center" class="table maintable table-borderless">
  72. <tr>
  73. <td colspan='3' bgcolor='#E8F1DE' background="img/tbg.gif" height='28'>
  74. <form action='select_soft_post.php' method='POST' enctype="multipart/form-data" name='myform'>
  75. <input type='hidden' name='activepath' value='<?php echo $activepath ?>' />
  76. <input type='hidden' name='f' value='<?php echo $f ?>' />
  77. <input type='hidden' name='job' value='upload' />
  78. &nbsp;上 传: <input type='file' name='uploadfile' size='25' />
  79. &nbsp;
  80. 改 名:<input type='test' name='newname' style='width:90px' />
  81. &nbsp;
  82. <button type='submit' name='sb1' class="btn btn-secondary btn-sm">确定</button>
  83. </form>
  84. </td>
  85. </tr>
  86. <tr bgcolor='#FFFFFF'>
  87. <td colspan='3'>
  88. <!-- 开始文件列表 -->
  89. <table width='100%' border='0' cellspacing='0' cellpadding='2'>
  90. <tr bgcolor="#CCCCCC" height="24">
  91. <td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
  92. <td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
  93. <td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
  94. </tr>
  95. <?php
  96. $dh = dir($inpath);
  97. $ty1 = $ty2 = '';
  98. while ($file = $dh->read()) {
  99. //-----计算文件大小和创建时间
  100. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  101. $filesize = filesize("$inpath/$file");
  102. $filesize = $filesize / 1024;
  103. if ($filesize != "")
  104. if ($filesize < 0.1) {
  105. @list($ty1, $ty2) = split("\.", $filesize);
  106. $filesize = $ty1 . "." . substr($ty2, 0, 2);
  107. } else {
  108. @list($ty1, $ty2) = split("\.", $filesize);
  109. $filesize = $ty1 . "." . substr($ty2, 0, 1);
  110. }
  111. $filetime = filemtime("$inpath/$file");
  112. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  113. }
  114. //------判断文件类型并作处理
  115. if ($file == ".") continue;
  116. else if ($file == "..") {
  117. if ($activepath == "") continue;
  118. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  119. $line = "\n<tr height='24'>
  120. <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>
  121. <td colspan='2' class='linerow'> 当前目录:$activepath</td>
  122. </tr>\r\n";
  123. echo $line;
  124. } else if (is_dir("$inpath/$file")) {
  125. if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
  126. if (preg_match("#^\.(.*)$#i", $file)) continue;
  127. $line = "\n<tr height='24'>
  128. <td bgcolor='#F9FBF0' class='linerow'>
  129. <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>
  130. </td>
  131. <td class='linerow'>-</td>
  132. <td bgcolor='#F9FBF0' class='linerow'>-</td>
  133. </tr>";
  134. echo "$line";
  135. } else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
  136. if ($file == $comeback) $lstyle = " style='color:red' ";
  137. else $lstyle = "";
  138. $reurl = "$activeurl/$file";
  139. $reurl = preg_replace("#^\.\.#", "", $reurl);
  140. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  141. $reurl = $remoteupUrl . $reurl;
  142. } else {
  143. $reurl = $reurl;
  144. }
  145. $line = "\n<tr height='24'>
  146. <td class='linerow' bgcolor='#F9FBF0'>
  147. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/zip.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  148. </td>
  149. <td class='linerow'>$filesize KB</td>
  150. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  151. </tr>";
  152. echo "$line";
  153. } else {
  154. if ($file == $comeback) $lstyle = " style='color:red' ";
  155. else $lstyle = '';
  156. $reurl = "$activeurl/$file";
  157. $reurl = preg_replace("#^\.\.#", "", $reurl);
  158. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  159. $reurl = $remoteupUrl . $reurl;
  160. } else {
  161. $reurl = $reurl;
  162. }
  163. $line = "\n<tr height='24'>
  164. <td class='linerow' bgcolor='#F9FBF0'>
  165. <a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/exe.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  166. </td>
  167. <td class='linerow'>$filesize KB</td>
  168. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  169. </tr>";
  170. echo "$line";
  171. }
  172. } //End Loop
  173. $dh->close();
  174. ?>
  175. <!-- 文件列表完 -->
  176. </table>
  177. </td>
  178. </tr>
  179. <tr>
  180. <td colspan='3' bgcolor='#E8F1DE' height='26'>&nbsp;请点击要选择的文件,红色字样的为刚上传的文件。</td>
  181. </tr>
  182. </table>
  183. </body>
  184. </html>