国内流行的内容管理系统(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 DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__) . "/config.php");
  12. //权限检查
  13. CheckPurview('sys_Feedback');
  14. require_once(DEDEINC . "/datalistcp.class.php");
  15. require_once(DEDEINC . "/typelink.class.php");
  16. setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
  17. function IsCheck($st)
  18. {
  19. return $st == 1 ? "[已审核]" : "<font color='red'>[未审核]</font>";
  20. }
  21. function jsTrimjajx($str, $len)
  22. {
  23. $str = preg_replace("/{quote}(.*){\/quote}/is", '', $str);
  24. $str = str_replace('&lt;br/&gt;', ' ', $str);
  25. $str = cn_substr($str, $len);
  26. $str = preg_replace("/['\"\r\n]/", "", $str);
  27. $str = str_replace('&lt;', '<', $str);
  28. $str = str_replace('&gt;', '>', $str);
  29. return $str;
  30. }
  31. if (!empty($job)) {
  32. $ids = preg_replace("#[^0-9,]#", '', $fid);
  33. if (empty($ids)) {
  34. ShowMsg("你没选中任何选项!", $_COOKIE['ENV_GOBACK_URL'], 0, 500);
  35. exit;
  36. }
  37. } else {
  38. $job = '';
  39. }
  40. // 更新回复统计
  41. function UpdateReplycount($id)
  42. {
  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. }