function do_report() { global $vbulletin, $postinfo, $threadinfo, $foruminfo; if (!$vbulletin->userinfo['userid']) { json_error(ERR_NO_PERMISSION); } $reportthread = ($rpforumid = $vbulletin->options['rpforumid'] and $rpforuminfo = fetch_foruminfo($rpforumid)); $reportemail = ($vbulletin->options['enableemail'] and $vbulletin->options['rpemail']); if (!$reportthread and !$reportemail) { standard_error(fetch_error('emaildisabled')); } $reportobj = new vB_ReportItem_Post($vbulletin); $reportobj->set_extrainfo('forum', $foruminfo); $reportobj->set_extrainfo('thread', $threadinfo); $perform_floodcheck = $reportobj->need_floodcheck(); if ($perform_floodcheck) { $reportobj->perform_floodcheck_precommit(); } $forumperms = fetch_permissions($threadinfo['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or $threadinfo['postuserid'] != $vbulletin->userinfo['userid'] and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) { json_error(ERR_NO_PERMISSION); } if (!$postinfo['postid']) { standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink'])); } if ((!$postinfo['visible'] or $postinfo['isdeleted']) and !can_moderate($threadinfo['forumid'])) { standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink'])); } if ((!$threadinfo['visible'] or $threadinfo['isdeleted']) and !can_moderate($threadinfo['forumid'])) { standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])); } // check if there is a forum password and if so, ensure the user has it set verify_forum_password($foruminfo['forumid'], $foruminfo['password']); ($hook = vBulletinHook::fetch_hook('report_start')) ? eval($hook) : false; $vbulletin->input->clean_array_gpc('p', array('reason' => TYPE_STR)); if ($vbulletin->GPC['reason'] == '') { standard_error(fetch_error('noreason')); } if ($perform_floodcheck) { $reportobj->perform_floodcheck_commit(); } $reportobj->do_report(prepare_remote_utf8_string($vbulletin->GPC['reason']), $postinfo); return array('success' => true); }
public function report_item($reason) { require_once DIR . '/includes/class_reportitem.php'; $threadinfo = verify_id('thread', $this->item['threadid'], 0, 1); $foruminfo = fetch_foruminfo($threadinfo['forumid']); $reportobj = new vB_ReportItem_Post($this->registry); $reportobj->set_extrainfo('forum', $foruminfo); $reportobj->set_extrainfo('thread', $threadinfo); $reportobj->do_report($reason, $this->item); }
//check usergroup of user to see if they can use this if (!$vbulletin->userinfo['userid']) { print_no_permission(); } $reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid)); $reportemail = ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail']); if (!$reportthread AND !$reportemail) { eval(standard_error(fetch_error('emaildisabled'))); } $reportobj = new vB_ReportItem_Post($vbulletin); $reportobj->set_extrainfo('forum', $foruminfo); $reportobj->set_extrainfo('thread', $threadinfo); $perform_floodcheck = $reportobj->need_floodcheck(); if ($perform_floodcheck) { $reportobj->perform_floodcheck_precommit(); } if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'report'; } $forumperms = fetch_permissions($threadinfo['forumid']);
/** * Sets information regarding the report * * @param array Information regarding the report * */ function set_reportinfo(&$reportinfo) { $content = new vBCms_Item_Content_Article($this->extrainfo['node']); parent::set_reportinfo($reportinfo); $reportinfo = array_merge($reportinfo, array('entrytitle' => unhtmlspecialchars($content->getTitle()), 'node' => $this->extrainfo['node'], 'itemlink' => vBCms_Route_Content::getURL(array('node' => $this->extrainfo['node'] . '-' . $content->getUrl())), 'postid' => $this->iteminfo['postid'])); }