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

88 lines
2.5KB

  1. <?php
  2. /**圈子留言管理
  3. *
  4. * @version $Id: group_guestbook.php 1 15:34 2011-1-21 tianya $
  5. * @package DedeCMS.Administrator
  6. * @copyright Copyright (c) 2007 - 2019, DesDev, Inc.
  7. * @license http://help.dedecms.com/usersguide/license.html
  8. * @link http://www.dedecms.com
  9. */
  10. require_once(dirname(__FILE__)."/config.php");
  11. require_once(DEDEINC.'/datalistcp.class.php');
  12. CheckPurview('group_Edit');
  13. $gid = isset($gid) && is_numeric($gid) ? $gid : 0;
  14. $id = isset($id) && is_numeric($id) ? $id : 0;
  15. $action = isset($action) ? trim($action) : '';
  16. $keyword = isset($keyword) ? trim($keyword) : '';
  17. $keyword = stripslashes($keyword);
  18. $keyword = preg_replace("#[\"\r\n\t\*\?\(\)\$%']#", " ", trim($keyword));
  19. $keyword = addslashes($keyword);
  20. $username = isset($username) ? trim($username) : '';
  21. $username = stripslashes($username);
  22. $username = preg_replace("#[\"\r\n\t\*\?\(\)\$%']#", " ", trim($username));
  23. $username = addslashes($username);
  24. if($gid < 1)
  25. {
  26. ShowMsg("含有非法操作!.","-1");
  27. exit();
  28. }
  29. if($action=="del")
  30. {
  31. if($id > 0)
  32. {
  33. $db->ExecuteNoneQuery("DELETE FROM #@__group_guestbook WHERE bid='$id'");
  34. }
  35. }
  36. else if($action=="save")
  37. {
  38. if($id > 0)
  39. {
  40. $row = $db->GetOne("SELECT * FROM #@__group_guestbook WHERE bid='$id'");
  41. if(empty($message))
  42. {
  43. $message = $row['message'];
  44. }
  45. if(empty($title))
  46. {
  47. $title = $row['title'];
  48. }
  49. $db->ExecuteNoneQuery("UPDATE #@__group_guestbook SET message='".$message."',title='".$title."' WHERE bid='$id'");
  50. }
  51. }
  52. else if($action=="edit")
  53. {
  54. $row = $db->GetOne("SELECT * FROM #@__group_guestbook WHERE bid='$id'");
  55. $title = $row['title'];
  56. $message = $row['message'];
  57. }
  58. //列表加载模板
  59. $wheresql = "WHERE gid='{$gid}'";
  60. if(!empty($keyword))
  61. {
  62. $wheresql .= " AND (title like '%".$keyword."%' OR message like '%".$keyword."%')";
  63. }
  64. if(!empty($username))
  65. {
  66. $wheresql .= " AND uname like '%".$username."%'";
  67. }
  68. $sql = "SELECT * FROM #@__group_guestbook $wheresql ORDER BY stime DESC";
  69. $dl = new DataListCP();
  70. $dl->pageSize = 20;
  71. $dl->SetParameter("keyword",$keyword);
  72. $dl->SetParameter("username",$username);
  73. $dl->SetParameter("gid",$gid);
  74. //这两句的顺序不能更换
  75. $dl->SetTemplate(DEDEADMIN."/templets/group_guestbook.htm"); //载入模板
  76. $dl->SetSource($sql); //设定查询SQL
  77. $dl->Display(); //显示
  78. ?>