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

73 lines
1.8KB

  1. <?php
  2. /**
  3. * 附件选择
  4. *
  5. * @version $Id: uploads_select.php 1 8:38 2010年7月9日Z tianya $
  6. * @package DedeCMS.Member
  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. CheckRank(0,0,FALSE);
  13. require_once(DEDEINC."/datalistcp.class.php");
  14. setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
  15. $menutype = 'content';
  16. if(empty($filename)) $filename = '';
  17. $keyword = empty($keyword) ? '' : FilterSearch($keyword);
  18. $addsql = " WHERE mid='".$cfg_ml->M_ID."' AND title LIKE '%$keyword%' ";
  19. if(empty($mediatype)) $mediatype = 0;
  20. $mediatype = intval($mediatype);
  21. if($mediatype>0) $addsql .= " AND mediatype='$mediatype' ";
  22. $sql = "SELECT * FROM `#@__uploads` $addsql ORDER BY aid DESC";
  23. $dlist = new DataListCP();
  24. $dlist->pageSize = 5;
  25. $dlist->SetParameter("mediatype",$mediatype);
  26. $dlist->SetParameter("keyword",$keyword);
  27. $dlist->SetParameter("f",$f);
  28. $dlist->SetTemplate(DEDEMEMBER."/templets/uploads_select.htm");
  29. $dlist->SetSource($sql);
  30. $dlist->Display();
  31. /**
  32. * 附件类型
  33. *
  34. * @access public
  35. * @param int $tid 类型ID
  36. * @param string $nurl
  37. * @return string
  38. */
  39. function MediaType($tid, $nurl)
  40. {
  41. if($tid==1)
  42. {
  43. return "图片";
  44. }
  45. else if($tid==2)
  46. {
  47. return "FLASH";
  48. }
  49. else if($tid==3)
  50. {
  51. return "视频/音频";
  52. }
  53. else
  54. {
  55. return "附件/其它";
  56. }
  57. }
  58. function GetFileSize($fs)
  59. {
  60. $fs = $fs/1024;
  61. return sprintf("%10.1f",$fs)." K";
  62. }
  63. function GetImageView($furl,$mtype)
  64. {
  65. if($mtype==1)
  66. {
  67. return "<img src='$furl' border='0' /><br />";
  68. }
  69. }