国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

265 行
8.1KB

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