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

102 lines
2.5KB

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