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

  1. <?php
  2. /**
  3. * 圈子公告管理
  4. *
  5. * @version $Id: group_notice.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. require_once(DEDEINC.'/datalistcp.class.php');
  13. CheckPurview('group_Edit');
  14. $id = isset($id) && is_numeric($id) ? $id : 0;
  15. $gid = isset($gid) && is_numeric($gid) ? $gid : 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. $username = isset($username) ? trim($username) : '';
  22. $username = stripslashes($username);
  23. $username = preg_replace("#[\"\r\n\t\*\?\(\)\$%']#", " ", trim($username));
  24. $username = addslashes($username);
  25. if($gid < 1)
  26. {
  27. ShowMsg("含有非法操作!.","-1");
  28. exit();
  29. }
  30. if($action=="del")
  31. {
  32. if($id > 0)
  33. {
  34. $db->ExecuteNoneQuery("DELETE FROM #@__group_notice WHERE id='$id'");
  35. }
  36. }
  37. else if($action=="edit")
  38. {
  39. $row = $db->GetOne("SELECT * FROM #@__group_notice WHERE id='$id'");
  40. $title = $row['title'];
  41. $notice = $row['notice'];
  42. }
  43. else if($action=="save")
  44. {
  45. $row = $db->GetOne("SELECT * FROM #@__group_notice WHERE id='$id'");
  46. if(empty($title))
  47. {
  48. $title = $row['title'];
  49. }
  50. if(empty($notice))
  51. {
  52. $notice = $row['notice'];
  53. }
  54. $db->ExecuteNoneQuery("UPDATE #@__group_notice SET notice='".$notice."',title='".$title."' WHERE id='$id'");
  55. }
  56. unset($row);
  57. //列表加载模板
  58. $wheresql = "WHERE gid='{$gid}'";
  59. if(!empty($keyword))
  60. {
  61. $wheresql .= " AND (title like '%".$keyword."%' OR notice like '%".$keyword."%')";
  62. }
  63. if(!empty($username))
  64. {
  65. $wheresql .= " AND uname like '%".$username."%'";
  66. }
  67. $sql = "SELECT * FROM #@__group_notice $wheresql ORDER BY stime DESC";
  68. $dl = new DataListCP();
  69. $dl->pageSize = 20;
  70. $dl->SetParameter("keyword",$keyword);
  71. $dl->SetParameter("username",$username);
  72. $dl->SetParameter("gid",$gid);
  73. //这两句的顺序不能更换
  74. $dl->SetTemplate(DEDEADMIN."/templets/group_notice.htm"); //载入模板
  75. $dl->SetSource($sql); //设定查询SQL
  76. $dl->Display(); //显示
  77. ?>