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

124 lines
3.9KB

  1. <?php
  2. /**
  3. * 评论管理
  4. *
  5. * @version $Id: feedback_main.php 1 19:09 2010年7月12日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. //权限检查
  14. CheckPurview('sys_Feedback');
  15. require_once(DEDEINC . "/datalistcp.class.php");
  16. require_once(DEDEINC . "/typelink.class.php");
  17. setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
  18. function IsCheck($st)
  19. {
  20. return $st == 1 ? "[已审核]" : "<font color='red'>[未审核]</font>";
  21. }
  22. function jsTrimjajx($str, $len)
  23. {
  24. $str = preg_replace("/{quote}(.*){\/quote}/is", '', $str);
  25. $str = str_replace('&lt;br/&gt;', ' ', $str);
  26. $str = cn_substr($str, $len);
  27. $str = preg_replace("/['\"\r\n]/", "", $str);
  28. $str = str_replace('&lt;', '<', $str);
  29. $str = str_replace('&gt;', '>', $str);
  30. return $str;
  31. }
  32. if (!empty($job)) {
  33. $ids = preg_replace("#[^0-9,]#", '', $fid);
  34. if (empty($ids)) {
  35. ShowMsg("你没选中任何选项!", $_COOKIE['ENV_GOBACK_URL'], 0, 500);
  36. exit;
  37. }
  38. } else {
  39. $job = '';
  40. }
  41. // 更新回复统计
  42. function UpdateReplycount($id){
  43. global $dsql;
  44. $row = $dsql->GetOne("SELECT COUNT(*) as dd FROM `#@__feedback` WHERE fid = $id AND ischeck=1");
  45. $dsql->ExecNoneQuery("UPDATE `#@__feedback` SET `replycount`='{$row['dd']}' WHERE `id`=$id;");
  46. }
  47. //删除评论
  48. if ($job == 'del') {
  49. $query = "DELETE FROM `#@__feedback` WHERE id IN($ids) ";
  50. $dsql->ExecuteNoneQuery($query);
  51. ShowMsg("成功删除指定的评论!", $_COOKIE['ENV_GOBACK_URL'], 0, 500);
  52. exit();
  53. }
  54. //删除相同IP的所有评论
  55. else if ($job == 'delall') {
  56. $dsql->SetQuery("SELECT ip FROM `#@__feedback` WHERE id IN ($ids) ");
  57. $dsql->Execute();
  58. $ips = '';
  59. while ($row = $dsql->GetArray()) {
  60. $ips .= ($ips == '' ? " ip = '{$row['ip']}' " : " Or ip = '{$row['ip']}' ");
  61. }
  62. if ($ips != '') {
  63. $query = "DELETE FROM `#@__feedback` WHERE $ips ";
  64. $dsql->ExecuteNoneQuery($query);
  65. }
  66. ShowMsg("成功删除指定相同IP的所有评论!", $_COOKIE['ENV_GOBACK_URL'], 0, 500);
  67. exit();
  68. }
  69. //审核评论
  70. else if ($job == 'check') {
  71. $query = "UPDATE `#@__feedback` SET ischeck=1 WHERE id IN($ids) ";
  72. $dsql->ExecuteNoneQuery($query);
  73. $dquery = "SELECT * FROM `#@__feedback` WHERE id IN($ids)";
  74. $dsql->SetQuery($dquery);
  75. $dsql->Execute();
  76. while ($row = $dsql->GetArray()) {
  77. UpdateReplycount($row['fid']);
  78. }
  79. ShowMsg("成功审核指定评论!", $_COOKIE['ENV_GOBACK_URL'], 0, 500);
  80. exit();
  81. }
  82. //浏览评论
  83. else {
  84. $bgcolor = '';
  85. $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0;
  86. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  87. $fid = isset($fid) && is_numeric($fid) ? $fid : 0;
  88. $keyword = !isset($keyword) ? '' : $keyword;
  89. $ip = !isset($ip) ? '' : $ip;
  90. $tl = new TypeLink($typeid);
  91. $openarray = $tl->GetOptionArray($typeid, $admin_catalogs, 0);
  92. $addsql = ($typeid != 0 ? " And typeid IN (" . GetSonIds($typeid) . ")" : '');
  93. $addsql .= ($aid != 0 ? " And aid=$aid " : '');
  94. $addsql .= ($ip != '' ? " And ip LIKE '$ip' " : '');
  95. if ($fid > 0) {
  96. $addsql .= " AND fid={$fid} ";
  97. }
  98. $querystring = "SELECT * FROM `#@__feedback` WHERE msg LIKE '%$keyword%' $addsql ORDER BY dtime DESC";
  99. $dlist = new DataListCP();
  100. $dlist->pageSize = 15;
  101. $dlist->SetParameter('aid', $aid);
  102. $dlist->SetParameter('ip', $ip);
  103. $dlist->SetParameter('typeid', $typeid);
  104. $dlist->SetParameter('keyword', $keyword);
  105. $dlist->SetTemplate(DEDEADMIN . '/templets/feedback_main.htm');
  106. $dlist->SetSource($querystring);
  107. $dlist->Display();
  108. }