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

240 lines
9.5KB

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