Ejemplo n.º 1
0
function ReportToModerator()
{
    global $txt, $topic, $sourcedir, $modSettings, $user_info, $context, $smcFunc;
    $context['robot_no_index'] = true;
    // You can't use this if it's off or you are not allowed to do it.
    isAllowedTo('report_any');
    // If they're posting, it should be processed by ReportToModerator2.
    if ((isset($_POST[$context['session_var']]) || isset($_POST['submit'])) && empty($context['post_errors'])) {
        ReportToModerator2();
    }
    // We need a message ID to check!
    if (empty($_REQUEST['msg']) && empty($_REQUEST['mid'])) {
        fatal_lang_error('no_access', false);
    }
    // For compatibility, accept mid, but we should be using msg. (not the flavor kind!)
    $_REQUEST['msg'] = empty($_REQUEST['msg']) ? (int) $_REQUEST['mid'] : (int) $_REQUEST['msg'];
    // Check the message's ID - don't want anyone reporting a post they can't even see!
    $result = $smcFunc['db_query']('', '
		SELECT m.id_msg, m.id_member, t.id_member_started
		FROM {db_prefix}messages AS m
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})
		WHERE m.id_msg = {int:id_msg}
			AND m.id_topic = {int:current_topic}
		LIMIT 1', array('current_topic' => $topic, 'id_msg' => $_REQUEST['msg']));
    if ($smcFunc['db_num_rows']($result) == 0) {
        fatal_lang_error('no_board', false);
    }
    list($_REQUEST['msg'], $member, $starter) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    // Do we need to show the visual verification image?
    $context['require_verification'] = $user_info['is_guest'] && !empty($modSettings['guests_report_require_captcha']);
    if ($context['require_verification']) {
        require_once $sourcedir . '/Subs-Editor.php';
        $verificationOptions = array('id' => 'report');
        $context['require_verification'] = create_control_verification($verificationOptions);
        $context['visual_verification_id'] = $verificationOptions['id'];
    }
    // Show the inputs for the comment, etc.
    loadLanguage('Post');
    loadTemplate('SendTopic');
    $context['comment_body'] = !isset($_POST['comment']) ? '' : trim($_POST['comment']);
    $context['email_address'] = !isset($_POST['email']) ? '' : trim($_POST['email']);
    // This is here so that the user could, in theory, be redirected back to the topic.
    $context['start'] = $_REQUEST['start'];
    $context['message_id'] = $_REQUEST['msg'];
    $context['page_title'] = $txt['report_to_mod'];
    $context['sub_template'] = 'report';
}
Ejemplo n.º 2
0
function ReportToModerator()
{
    global $txt, $db_prefix, $topic, $modSettings, $user_info, $ID_MEMBER, $context;
    // You can't use this if it's off or you are not allowed to do it.
    isAllowedTo('report_any');
    // If they're posting, it should be processed by ReportToModerator2.
    if (isset($_POST['sc']) || isset($_POST['submit'])) {
        ReportToModerator2();
    }
    // We need a message ID to check!
    if (empty($_GET['msg']) && empty($_GET['mid'])) {
        fatal_lang_error(1, false);
    }
    // For compatibility, accept mid, but we should be using msg. (not the flavor kind!)
    $_GET['msg'] = empty($_GET['msg']) ? (int) $_GET['mid'] : (int) $_GET['msg'];
    // Check the message's ID - don't want anyone reporting a post they can't even see!
    $result = db_query("\n\t\tSELECT m.ID_MSG, m.ID_MEMBER, t.ID_MEMBER_STARTED\n\t\tFROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t)\n\t\tWHERE m.ID_MSG = {$_GET['msg']}\n\t\t\tAND m.ID_TOPIC = {$topic}\n\t\t\tAND t.ID_TOPIC = {$topic}\n\t\tLIMIT 1", __FILE__, __LINE__);
    if (mysql_num_rows($result) == 0) {
        fatal_lang_error('smf232');
    }
    list($_GET['msg'], $member, $starter) = mysql_fetch_row($result);
    mysql_free_result($result);
    // If they can't modify their post, then they should be able to report it... otherwise it is illogical.
    if ($member == $ID_MEMBER && (allowedTo(array('modify_own', 'modify_any')) || $ID_MEMBER == $starter && allowedTo('modify_replies'))) {
        fatal_lang_error('rtm_not_own', false);
    }
    // Show the inputs for the comment, etc.
    loadLanguage('Post');
    loadTemplate('SendTopic');
    // This is here so that the user could, in theory, be redirected back to the topic.
    $context['start'] = $_REQUEST['start'];
    $context['message_id'] = $_GET['msg'];
    $context['page_title'] = $txt['rtm1'];
    $context['sub_template'] = 'report';
}