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

121 lines
3.3KB

  1. <?php
  2. /**
  3. * 圈子列表
  4. *
  5. * @version $Id: group_main.php 1 15:34 2011-1-21 tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2019, 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. CheckPurview('group_Main');
  13. require_once(DEDEINC.'/datalistcp.class.php');
  14. setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
  15. $id = isset($id) && is_numeric($id) ? $id : 0;
  16. $action = isset($action) ? trim($action) : '';
  17. $keyword = isset($keyword) ? trim($keyword) : '';
  18. $keyword = stripslashes($keyword);
  19. $keyword = preg_replace("#[\"\r\n\t\*\?\(\)\$%']#"," ",trim($keyword));
  20. $keyword = addslashes($keyword);
  21. if($action=="close")
  22. {
  23. if($id > 0)
  24. {
  25. $db->ExecuteNoneQuery("UPDATE #@__groups SET ishidden=1 WHERE groupid='$id'");
  26. }
  27. }
  28. else if($action=="open")
  29. {
  30. if($id > 0)
  31. {
  32. $db->ExecuteNoneQuery("UPDATE #@__groups SET ishidden=0 WHERE groupid='$id'");
  33. }
  34. }
  35. else if($action=="del")
  36. {
  37. if($id > 0)
  38. {
  39. $db->ExecuteNoneQuery("DELETE FROM #@__groups WHERE groupid='$id'");
  40. $db->ExecuteNoneQuery("DELETE FROM #@__group_threads WHERE gid='$id'");
  41. $db->ExecuteNoneQuery("DELETE FROM #@__group_posts WHERE gid='$id'");
  42. }
  43. }
  44. $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops=0 ORDER BY orders ASC");
  45. $db->Execute(1);
  46. $option = '';
  47. while($rs = $db->GetArray(1))
  48. {
  49. $option .= "<option value='".$rs['storeid']."'>".$rs['storename']."</option>\n";
  50. $v = $rs['storeid'];
  51. $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops='{$v}' ORDER BY orders ASC");
  52. $db->Execute(2);
  53. while($rs = $db->GetArray(2))
  54. {
  55. $option .= "<option value='".$rs['storeid']."'>--".$rs['storename']."</option>\n";
  56. }
  57. }
  58. $wheresql = "WHERE groupid>0";
  59. if(!empty($keyword))
  60. {
  61. $wheresql .= " AND (groupname like '%".$keyword."%' OR des like '%".$keyword."%' OR creater like '%".$keyword."%')";
  62. }
  63. if(!isset($username))
  64. {
  65. $username = '';
  66. }
  67. if(!empty($username))
  68. {
  69. $wheresql .= " AND creater like '%".$username."%'";
  70. }
  71. if(!isset($store))
  72. {
  73. $store = -1;
  74. }
  75. if($store > 0)
  76. {
  77. $wheresql .= " AND (storeid='".$store."' OR rootstoreid='".$store."')";
  78. }
  79. $sql = "SELECT * FROM #@__groups $wheresql ORDER BY stime DESC";
  80. $dl = new DataListCP();
  81. $dl->pageSize = 20;
  82. $dl->SetParameter("username",$username);
  83. $dl->SetParameter("store",$store);
  84. $dl->SetParameter("keyword",$keyword);
  85. //这两句的顺序不能更换
  86. $dl->SetTemplate(DEDEADMIN."/templets/group_main.htm"); //载入模板
  87. $dl->SetSource($sql); //设定查询SQL
  88. $dl->Display(); //显示
  89. function GetGroupstore($id)
  90. {
  91. global $db;
  92. $row = $db->GetOne("SELECT storename,tops FROM #@__store_groups WHERE storeid='{$id}'");
  93. if(is_array($row))
  94. {
  95. $store = $row['storename'];
  96. if(!$row['tops'])
  97. {
  98. return $row['storename'];
  99. }
  100. else
  101. {
  102. $rs = $db->GetOne("SELECT storename FROM #@__store_groups WHERE storeid='".$row['tops']."'");
  103. return $rs['storename'].">".$store;
  104. }
  105. }
  106. else
  107. {
  108. return false;
  109. }
  110. }
  111. ?>