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

86 lines
2.5KB

  1. <?php
  2. /**
  3. * 附件管理
  4. *
  5. * @version $Id: media_main.php 1 11:17 2010年7月19日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__) . "/config.php");
  12. require_once(DEDEINC . "/datalistcp.class.php");
  13. require_once(DEDEINC . "/common.func.php");
  14. setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
  15. if (empty($dopost)) $dopost = '';
  16. //文件式管理器
  17. if ($dopost == 'filemanager') {
  18. if (file_exists('./file_manage_main.php')) {
  19. header("location:file_manage_main.php?activepath=$cfg_medias_dir");
  20. } else {
  21. ShowMsg("找不到文件管理器,可能已经卸载!", "-1");
  22. }
  23. exit();
  24. }
  25. //数据库管理
  26. // ------------------------------------------------------------------------
  27. if (empty($keyword)) $keyword = "";
  28. $addsql = " WHERE (u.title LIKE '%$keyword%' OR u.url LIKE '%$keyword%') ";
  29. if (empty($membertype)) {
  30. $membertype = 0;
  31. }
  32. if ($membertype == 1) {
  33. $addsql .= " AND u.mid>0 ";
  34. } else if ($membertype == 2) {
  35. $addsql .= " AND u.mid>0 ";
  36. }
  37. if (empty($mediatype)) {
  38. $mediatype = 0;
  39. }
  40. if ($mediatype > 1) {
  41. $addsql .= " AND u.mediatype='$membertype' ";
  42. }
  43. $sql = "SELECT u.aid,u.title,u.url,u.mediatype,u.filesize,u.mid,u.uptime
  44. ,a.userid AS adminname,m.userid AS membername
  45. FROM #@__uploads u
  46. LEFT JOIN #@__admin a ON a.id = u.mid
  47. LEFT JOIN #@__member m ON m.mid = u.mid
  48. $addsql ORDER BY u.aid DESC";
  49. $dlist = new DataListCP();
  50. $dlist->pageSize = 20;
  51. $dlist->SetParameter("mediatype", $mediatype);
  52. $dlist->SetParameter("keyword", $keyword);
  53. $dlist->SetParameter("membertype", $membertype);
  54. $dlist->SetTemplate(DEDEADMIN . "/templets/media_main.htm");
  55. $dlist->SetSource($sql);
  56. $dlist->Display();
  57. function MediaType($tid, $nurl)
  58. {
  59. if ($tid == 1) {
  60. return "图片<a href=\"javascript:;\" onClick=\"ChangeImage('$nurl');\"><img src='./dialog/img/picviewnone.gif' name='picview' border='0' alt='预览'></a>";
  61. } else if ($tid == 2) {
  62. return "FLASH";
  63. } else if ($tid == 3) {
  64. return "视频/音频";
  65. } else {
  66. return "附件/其它";
  67. }
  68. }
  69. function GetFileSize($fs)
  70. {
  71. $fs = $fs / 1024;
  72. return trim(sprintf("%10.1f", $fs) . " K");
  73. }
  74. function UploadAdmin($adminid, $mid)
  75. {
  76. if ($adminid != '') return $adminid;
  77. else return $mid;
  78. }