国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

select_media.php 8.2KB

2年前
2年前
2年前
2年前
1年前
1年前
2年前
2年前
2年前
2年前
2年前
1年前
2年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. /**
  3. * 选择多媒体
  4. *
  5. * @version $id:select_media.php 9:43 2010年7月8日 tianya $
  6. * @package DedeBIZ.Dialog
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (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. <!DOCTYPE html>
  44. <html>
  45. <head>
  46. <meta charset="utf-8">
  47. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  48. <title>选择多媒体</title>
  49. <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
  50. <link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
  51. <link rel="stylesheet" href="/static/web/css/admin.css">
  52. </head>
  53. <body>
  54. <div class="upload-box">
  55. <table class="table shadow-sm icon">
  56. <tr>
  57. <td colspan="3">
  58. <form name="myform" action="select_media_post.php" method="POST" enctype="multipart/form-data">
  59. <input type="hidden" name="activepath" value="<?php echo $activepath ?>">
  60. <?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : ''; echo $noeditor;?>
  61. <input type="hidden" name="f" value="<?php echo $f ?>">
  62. <input type="hidden" name="job" value="upload">
  63. <input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>">
  64. <input type="file" name="uploadfile" class="w-75">
  65. <button type="submit" name="sb1" class="btn btn-success btn-sm">上传</button>
  66. </form>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td width="40%">点击名称选择文件</td>
  71. <td width="26%">文件大小</td>
  72. <td>修改时间</td>
  73. </tr>
  74. <?php
  75. $dh = scandir($inpath);
  76. $ty1 = '';
  77. $ty2 = '';
  78. foreach ($dh as $file) {
  79. //计算文件大小和创建时间
  80. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  81. $filesize = filesize("$inpath/$file");
  82. $filesize = $filesize / 1024;
  83. if ($filesize != "")
  84. if ($filesize < 0.1) {
  85. @list($ty1, $ty2) = split("\.", $filesize);
  86. $filesize = $ty1.".".substr($ty2, 0, 2);
  87. } else {
  88. @list($ty1, $ty2) = split("\.", $filesize);
  89. $filesize = $ty1.".".substr($ty2, 0, 1);
  90. }
  91. $filetime = filemtime("$inpath/$file");
  92. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  93. }
  94. //判断文件类型并作处理
  95. if ($file == ".") continue;
  96. else if ($file == "..") {
  97. if ($activepath == "") continue;
  98. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  99. $line = "<tr>
  100. <td><a href='select_media.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='/static/web/img/icon_dir2.png'> 上级目录</a></td>
  101. <td colspan='2'>当前目录:$activepath</td>
  102. </tr>";
  103. echo $line;
  104. } else if (is_dir("$inpath/$file")) {
  105. if (preg_match("#^_(.*)$#i", $file)) continue;
  106. if (preg_match("#^\.(.*)$#i", $file)) continue;
  107. $line = "<tr>
  108. <td colspan='3'><a href=select_media.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='/static/web/img/icon_dir.png'> $file</a></td>
  109. </tr>";
  110. echo "$line";
  111. } else if (preg_match("#\.(swf|fly|fla|flv)#i", $file)) {
  112. $reurl = "$activeurl/$file";
  113. $reurl = preg_replace("#^\.\.#", "", $reurl);
  114. $reurl = $reurl;
  115. if ($file == $comeback) $lstyle = "class='text-danger'";
  116. else $lstyle = '';
  117. $line = "<tr>
  118. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_flash.png'> $file</a></td>
  119. <td>$filesize KB</td>
  120. <td align='center'>$filetime</td>
  121. </tr>";
  122. echo "$line";
  123. } else if (preg_match("#\.(wmv|avi)#i", $file)) {
  124. $reurl = "$activeurl/$file";
  125. $reurl = preg_replace("#^\.\.#", "", $reurl);
  126. $reurl = $reurl;
  127. if ($file == $comeback) $lstyle = "class='text-danger'";
  128. else $lstyle = '';
  129. $line = "<tr>
  130. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_video.png'> $file</a></td>
  131. <td>$filesize KB</td>
  132. <td align='center'>$filetime</td>
  133. </tr>";
  134. echo "$line";
  135. } else if (preg_match("#\.(rm|rmvb|mp3|mp4)#i", $file)) {
  136. $reurl = "$activeurl/$file";
  137. $reurl = preg_replace("#^\.\.#", "", $reurl);
  138. $reurl = $reurl;
  139. if ($file == $comeback) $lstyle = "class='text-danger'";
  140. else $lstyle = '';
  141. $line = "<tr>
  142. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_rm.png'> $file</a></td>
  143. <td>$filesize KB</td>
  144. <td align='center'>$filetime</td>
  145. </tr>";
  146. echo "$line";
  147. } else if (preg_match("#\.(mp3|wma)#", $file)) {
  148. $reurl = "$activeurl/$file";
  149. $reurl = preg_replace("#^\.\.#", "", $reurl);
  150. $reurl = $reurl;
  151. if ($file == $comeback) $lstyle = "class='text-danger'";
  152. else $lstyle = '';
  153. $line = "<tr>
  154. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_music.png'> $file</a></td>
  155. <td>$filesize KB</td>
  156. <td align='center'>$filetime</td>
  157. </tr>";
  158. echo "$line";
  159. }
  160. }//End Loop
  161. ?>
  162. </table>
  163. </div>
  164. <script>
  165. function nullLink() {
  166. return;
  167. }
  168. function ReturnValue(reimg) {
  169. if (window.opener.document.<?php echo $f ?> != null) {
  170. window.opener.document.<?php echo $f ?>.value = reimg;
  171. }
  172. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
  173. if (window.opener.CKEDITOR != null && funcNum != 1) {
  174. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  175. }
  176. window.close();
  177. }
  178. </script>
  179. </body>
  180. </html>