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

223 lines
8.8KB

  1. <?php
  2. /**
  3. * 多媒体选择框
  4. *
  5. * @version $Id: select_media.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. $noeditor = isset($noeditor) ? $noeditor : '';
  16. $activepath = str_replace('.', '', $activepath);
  17. $activepath = preg_replace("#\/{1,}#", '/', $activepath);
  18. if (strlen($activepath) < strlen($cfg_other_medias)) {
  19. $activepath = $cfg_other_medias;
  20. }
  21. $inpath = $cfg_basedir . $activepath;
  22. $activeurl = '..' . $activepath;
  23. if (!is_dir($inpath)) {
  24. die('No Exsits Path');
  25. }
  26. if (empty($f)) {
  27. $f = 'form1.enclosure';
  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. <html>
  44. <head>
  45. <meta http-equiv='Content-Type' content='text/html; charset=<?php echo $cfg_soft_lang; ?>'>
  46. <title>媒体文件管理器</title>
  47. <link rel="stylesheet" href="../../static/css/bootstrap.min.css">
  48. <link href="../../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  49. <link href='../css/base.css' rel='stylesheet' type='text/css'>
  50. <style>
  51. .linerow {
  52. border-bottom: 1px solid #CBD8AC;
  53. }
  54. </style>
  55. </head>
  56. <body background='img/allbg.gif' leftmargin='0' topmargin='0'>
  57. <SCRIPT language='JavaScript'>
  58. function nullLink() {
  59. return;
  60. }
  61. function ReturnValue(reimg) {
  62. if (window.opener.document.<?php echo $f ?> != null) {
  63. window.opener.document.<?php echo $f ?>.value = reimg;
  64. }
  65. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>;
  66. if (window.opener.CKEDITOR != null && funcNum != 1) {
  67. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  68. }
  69. window.close();
  70. }
  71. </SCRIPT>
  72. <table width='100%' border='0' align="center" cellspacing='0' cellpadding='2' class="table maintable table-borderless" style="margin:0 auto">
  73. <tr bgcolor="#CCCCCC">
  74. <td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
  75. <td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
  76. <td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
  77. </tr>
  78. <?php
  79. $dh = dir($inpath);
  80. $ty1 = "";
  81. $ty2 = "";
  82. while ($file = $dh->read()) {
  83. //-----计算文件大小和创建时间
  84. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  85. $filesize = filesize("$inpath/$file");
  86. $filesize = $filesize / 1024;
  87. if ($filesize != "")
  88. if ($filesize < 0.1) {
  89. @list($ty1, $ty2) = split("\.", $filesize);
  90. $filesize = $ty1 . "." . substr($ty2, 0, 2);
  91. } else {
  92. @list($ty1, $ty2) = split("\.", $filesize);
  93. $filesize = $ty1 . "." . substr($ty2, 0, 1);
  94. }
  95. $filetime = filemtime("$inpath/$file");
  96. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  97. }
  98. //------判断文件类型并作处理
  99. if ($file == ".") continue;
  100. else if ($file == "..") {
  101. if ($activepath == "") continue;
  102. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  103. $line = "\n<tr>
  104. <td class='linerow'> <a href=select_media.php?f=$f&activepath=" . urlencode($tmp) . $addparm . "><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
  105. <td colspan='2' class='linerow'> 当前目录:$activepath</td>
  106. </tr>\r\n";
  107. echo $line;
  108. } else if (is_dir("$inpath/$file")) {
  109. if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
  110. if (preg_match("#^\.(.*)$#i", $file)) continue;
  111. $line = "\n<tr>
  112. <td bgcolor='#F9FBF0' class='linerow'>
  113. <a href=select_media.php?f=$f&activepath=" . urlencode("$activepath/$file") . $addparm . "><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  114. </td>
  115. <td class='linerow'>-</td>
  116. <td bgcolor='#F9FBF0' class='linerow'>-</td>
  117. </tr>";
  118. echo "$line";
  119. } else if (preg_match("#\.(swf|fly|fla|flv)#i", $file)) {
  120. $reurl = "$activeurl/$file";
  121. $reurl = preg_replace("#^\.\.#", "", $reurl);
  122. $reurl = $reurl;
  123. if ($file == $comeback) $lstyle = " style='color:red' ";
  124. else $lstyle = "";
  125. $line = "\n<tr>
  126. <td class='linerow' bgcolor='#F9FBF0'>
  127. <a href=\"javascript:ReturnValue('$reurl');\"><img src=img/flash.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  128. </td>
  129. <td class='linerow'>$filesize KB</td>
  130. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  131. </tr>";
  132. echo "$line";
  133. } else if (preg_match("#\.(wmv|avi)#i", $file)) {
  134. $reurl = "$activeurl/$file";
  135. $reurl = preg_replace("#^\.\.#", "", $reurl);
  136. $reurl = $reurl;
  137. if ($file == $comeback) $lstyle = " style='color:red' ";
  138. else $lstyle = "";
  139. $line = "\n<tr>
  140. <td class='linerow' bgcolor='#F9FBF0'>
  141. <a href=\"javascript:ReturnValue('$reurl');\"><img src=img/wmv.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  142. </td>
  143. <td class='linerow'>$filesize KB</td>
  144. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  145. </tr>";
  146. echo "$line";
  147. } else if (preg_match("#\.(rm|rmvb)#i", $file)) {
  148. $reurl = "$activeurl/$file";
  149. $reurl = preg_replace("#^\.\.#", "", $reurl);
  150. $reurl = $reurl;
  151. if ($file == $comeback) $lstyle = " style='color:red' ";
  152. else $lstyle = "";
  153. $line = "\n<tr>
  154. <td class='linerow' bgcolor='#F9FBF0'>
  155. <a href=\"javascript:ReturnValue('$reurl');\"><img src=img/rm.gif border=0 width=16 height=16 align=absmiddle>$file</a>
  156. </td>
  157. <td class='linerow'>$filesize KB</td>
  158. <td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
  159. </tr>";
  160. echo "$line";
  161. } else if (preg_match("#\.(mp3|wma)#", $file)) {
  162. $reurl = "$activeurl/$file";
  163. $reurl = preg_replace("#^\.\.#", "", $reurl);
  164. $reurl = $reurl;
  165. if ($file == $comeback) $lstyle = " style='color:red' ";
  166. else $lstyle = "";
  167. $line = "\n<tr>
  168. <td class='linerow' bgcolor='#F9FBF0'>
  169. <a href=\"javascript:ReturnValue('$reurl');\"><img src=img/mp3.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. <tr>
  181. <td colspan='3' bgcolor='#E8F1DE'>
  182. <table width='100%'>
  183. <form action='select_media_post.php' method='POST' enctype="multipart/form-data" name='myform'>
  184. <input type='hidden' name='activepath' value='<?php echo $activepath ?>'>
  185. <input type='hidden' name='f' value='<?php echo $f ?>'>
  186. <input type='hidden' name='job' value='upload'>
  187. <input type='hidden' name='CKEditorFuncNum' value='<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>'>
  188. <tr>
  189. <td background="img/tbg.gif" bgcolor="#99CC00">
  190. &nbsp;上 传: <input type='file' name='uploadfile' style='width:320px'>&nbsp;<button class="btn btn-success btn-sm" type='submit' name='sb1'>确定</button>
  191. </td>
  192. </tr>
  193. </form>
  194. </table>
  195. </td>
  196. </tr>
  197. </table>
  198. </body>
  199. </html>