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

select_media.php 10KB

2年前
2年前
2年前
2年前
2年前
10ヶ月前
1年前
9ヶ月前
9ヶ月前
10ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
10ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
10ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
10ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
1年前
1年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  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 class="p-3">
  54. <div class="card shadow-sm mb-3">
  55. <div class="card-body">
  56. <form name="myform" action="select_media_post.php" method="POST" enctype="multipart/form-data">
  57. <input type="hidden" name="activepath" value="<?php echo $activepath ?>">
  58. <?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : ''; echo $noeditor;?>
  59. <input type="hidden" name="f" value="<?php echo $f ?>">
  60. <input type="hidden" name="job" value="upload">
  61. <input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>">
  62. <input type="file" name="uploadfile">
  63. <button type="submit" class="btn btn-success btn-sm">上传</button>
  64. </form>
  65. </div>
  66. </div>
  67. <div class="card shadow-sm">
  68. <div class="card-header">选择多媒体</div>
  69. <div class="card-body">
  70. <div class="table-responsive">
  71. <table class="table table-borderless icon">
  72. <thead>
  73. <tr>
  74. <td scope="col">文件名称</td>
  75. <td scope="col">文件大小</td>
  76. <td scope="col">修改时间</td>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. <?php
  81. $dh = scandir($inpath);
  82. $ty1 = "";
  83. $ty2 = "";
  84. foreach ($dh as $file) {
  85. //计算文件大小和创建时间
  86. if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
  87. $filesize = filesize("$inpath/$file");
  88. $filesize = $filesize / 1024;
  89. if ($filesize != "")
  90. if ($filesize < 0.1) {
  91. @list($ty1, $ty2) = split("\.", $filesize);
  92. $filesize = $ty1.".".substr($ty2, 0, 2);
  93. } else {
  94. @list($ty1, $ty2) = split("\.", $filesize);
  95. $filesize = $ty1.".".substr($ty2, 0, 1);
  96. }
  97. $filetime = filemtime("$inpath/$file");
  98. $filetime = MyDate("Y-m-d H:i:s", $filetime);
  99. }
  100. //判断文件类型并作处理
  101. if ($file == ".") continue;
  102. else if ($file == "..") {
  103. if ($activepath == "") continue;
  104. $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
  105. $line = "<tr>
  106. <td colspan='2'>当前目录:$activepath</td>
  107. <td align='right'><a href='select_media.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='/static/web/img/icon_dir2.png'> 返回上级</a></td>
  108. </tr>";
  109. echo $line;
  110. } else if (is_dir("$inpath/$file")) {
  111. if (preg_match("#^_(.*)$#i", $file)) continue;
  112. if (preg_match("#^\.(.*)$#i", $file)) continue;
  113. $line = "<tr>
  114. <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>
  115. </tr>";
  116. echo "$line";
  117. } else if (preg_match("#\.(swf|fly|fla|flv)#i", $file)) {
  118. $reurl = "$activeurl/$file";
  119. $reurl = preg_replace("#^\.\.#", "", $reurl);
  120. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  121. $reurl = $remoteupUrl.$reurl;
  122. }
  123. if ($file == $comeback) $lstyle = "class='text-danger'";
  124. else $lstyle = '';
  125. $line = "<tr>
  126. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_flash.png'> $file</a></td>
  127. <td>$filesize KB</td>
  128. <td align='center'>$filetime</td>
  129. </tr>";
  130. echo "$line";
  131. } else if (preg_match("#\.(wmv|avi)#i", $file)) {
  132. $reurl = "$activeurl/$file";
  133. $reurl = preg_replace("#^\.\.#", "", $reurl);
  134. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  135. $reurl = $remoteupUrl.$reurl;
  136. }
  137. if ($file == $comeback) $lstyle = "class='text-danger'";
  138. else $lstyle = '';
  139. $line = "<tr>
  140. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_video.png'> $file</a></td>
  141. <td>$filesize KB</td>
  142. <td align='center'>$filetime</td>
  143. </tr>";
  144. echo "$line";
  145. } else if (preg_match("#\.(rm|rmvb|mp3|mp4)#i", $file)) {
  146. $reurl = "$activeurl/$file";
  147. $reurl = preg_replace("#^\.\.#", "", $reurl);
  148. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  149. $reurl = $remoteupUrl.$reurl;
  150. }
  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_rm.png'> $file</a></td>
  155. <td>$filesize KB</td>
  156. <td align='center'>$filetime</td>
  157. </tr>";
  158. echo "$line";
  159. } else if (preg_match("#\.(mp3|wma)#", $file)) {
  160. $reurl = "$activeurl/$file";
  161. $reurl = preg_replace("#^\.\.#", "", $reurl);
  162. if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
  163. $reurl = $remoteupUrl.$reurl;
  164. }
  165. if ($file == $comeback) $lstyle = "class='text-danger'";
  166. else $lstyle = '';
  167. $line = "<tr>
  168. <td><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='/static/web/img/icon_music.png'> $file</a></td>
  169. <td>$filesize KB</td>
  170. <td align='center'>$filetime</td>
  171. </tr>";
  172. echo "$line";
  173. }
  174. }
  175. ?>
  176. </tbody>
  177. </table>
  178. </div>
  179. </div>
  180. </div>
  181. <script>
  182. function nullLink() {
  183. return;
  184. }
  185. function ReturnValue(reimg) {
  186. if (window.opener.document.<?php echo $f ?> != null) {
  187. window.opener.document.<?php echo $f ?>.value = reimg;
  188. }
  189. var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
  190. if (window.opener.CKEDITOR != null && funcNum != 1) {
  191. window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
  192. }
  193. window.close();
  194. }
  195. </script>
  196. </body>
  197. </html>