misc_report.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: misc_report.php 25246 2011-11-02 03:34:53Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if(empty($_G['uid'])) {
  12. showmessage('not_loggedin', null, array(), array('login' => 1));
  13. }
  14. $rtype = $_GET['rtype'];
  15. $rid = intval($_GET['rid']);
  16. $tid = intval($_GET['tid']);
  17. $fid = intval($_GET['fid']);
  18. $uid = intval($_GET['uid']);
  19. $default_url = array(
  20. 'user' => 'home.php?mod=space&uid=',
  21. 'post' => 'forum.php?mod=redirect&goto=findpost&ptid='.$tid.'&pid=',
  22. 'thread' => 'forum.php?mod=viewthread&tid=',
  23. 'group' => 'forum.php?mod=group&fid=',
  24. 'album' => 'home.php?mod=space&do=album&uid='.$uid.'&id=',
  25. 'blog' => 'home.php?mod=space&do=blog&uid='.$uid.'&id=',
  26. 'pic' => 'home.php?mod=space&do=album&uid='.$uid.'&picid='
  27. );
  28. $url = '';
  29. if($rid && !empty($default_url[$rtype])) {
  30. $url = $default_url[$rtype].intval($rid);
  31. } else {
  32. $url = addslashes(dhtmlspecialchars(base64_decode($_GET['url'])));
  33. $url = preg_match("/^http[s]?:\/\/[^\[\"']+$/i", trim($url)) ? trim($url) : '';
  34. }
  35. if(empty($url) || empty($_G['inajax'])) {
  36. showmessage('report_parameters_invalid');
  37. }
  38. $urlkey = md5($url);
  39. if(submitcheck('reportsubmit')) {
  40. $message = censor(cutstr(dhtmlspecialchars(trim($_GET['message'])), 200, ''));
  41. $message = $_G['username'].'&nbsp;:&nbsp;'.rtrim($message, "\\");
  42. if($reportid = C::t('common_report')->fetch_by_urlkey($urlkey)) {
  43. C::t('common_report')->update_num($reportid, $message);
  44. } else {
  45. $data = array('url' => $url, 'urlkey' => $urlkey, 'uid' => $_G['uid'], 'username' => $_G['username'], 'message' => $message, 'dateline' => TIMESTAMP);
  46. if($fid) {
  47. $data['fid'] = $fid;
  48. }
  49. C::t('common_report')->insert($data);
  50. $report_receive = unserialize($_G['setting']['report_receive']);
  51. $moderators = array();
  52. if($report_receive['adminuser']) {
  53. foreach($report_receive['adminuser'] as $touid) {
  54. notification_add($touid, 'report', 'new_report', array('from_id' => 1, 'from_idtype' => 'newreport'), 1);
  55. }
  56. }
  57. if($fid && $rtype == 'post') {
  58. foreach(C::t('forum_moderator')->fetch_all_by_fid($fid, false) as $row) {
  59. $moderators[] = $row['uid'];
  60. }
  61. if($report_receive['supmoderator']) {
  62. $moderators = array_unique(array_merge($moderators, $report_receive['supmoderator']));
  63. }
  64. foreach($moderators as $touid) {
  65. $touid != $_G['uid'] && !in_array($touid, $report_receive) && notification_add($touid, 'report', 'new_post_report', array('fid' => $fid, 'from_id' => 1, 'from_idtype' => 'newreport'), 1);
  66. }
  67. }
  68. }
  69. showmessage('report_succeed', '', array(), array('closetime' => true, 'showdialog' => 1, 'alert' => 'right'));
  70. }
  71. require_once libfile('function/misc');
  72. include template('common/report');
  73. ?>