phpBB

Code Changes

File: report.php

  Unmodified   Added   Modified   Removed
Line 24Line 24

$forum_id = request_var('f', 0);
$post_id = request_var('p', 0);


$forum_id = request_var('f', 0);
$post_id = request_var('p', 0);

 
$pm_id			= request_var('pm', 0);

$reason_id		= request_var('reason_id', 0);
$report_text = utf8_normalize_nfc(request_var('report_text', '', true));
$user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false;

$submit = (isset($_POST['submit'])) ? true : false;


$reason_id		= request_var('reason_id', 0);
$report_text = utf8_normalize_nfc(request_var('report_text', '', true));
$user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false;

$submit = (isset($_POST['submit'])) ? true : false;


if (!$post_id)

if (!$post_id && (!$pm_id || !$config['allow_pm_report']))

{
trigger_error('NO_POST_SELECTED');
}


{
trigger_error('NO_POST_SELECTED');
}


 
if ($post_id)
{

$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";

$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";

 
	$return_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
$pm_id = 0;
}
else
{
$redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&p=$pm_id");
$return_forum_url = '';
$post_id = 0;
$forum_id = 0;
}


// Has the report been cancelled?
if (isset($_POST['cancel']))


// Has the report been cancelled?
if (isset($_POST['cancel']))

Line 43Line 56
	redirect($redirect_url);
}


	redirect($redirect_url);
}


 
if ($post_id)
{

// Grab all relevant data
$sql = 'SELECT t.*, p.*
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t

// Grab all relevant data
$sql = 'SELECT t.*, p.*
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t

Line 88Line 103
{
$message = $user->lang['ALREADY_REPORTED'];
$message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');

{
$message = $user->lang['ALREADY_REPORTED'];
$message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');

 
		$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');

	trigger_error($message);
}

	trigger_error($message);
}

 
}
else
{
// Grab all relevant data
$sql = 'SELECT p.*, pt.*
FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . " pt
WHERE p.msg_id = $pm_id
AND p.msg_id = pt.msg_id
AND (p.author_id = " . $user->data['user_id'] . " OR pt.user_id = " . $user->data['user_id'] . ")";
$result = $db->sql_query($sql);
$report_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

if (!$report_data)
{
$user->add_lang('ucp');
trigger_error('NO_MESSAGE');
}

if ($report_data['message_reported'])
{
$message = $user->lang['ALREADY_REPORTED_PM'];
$message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}
}

if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REPORT);
}

$error = array();
$s_hidden_fields = '';


// Submit report?
if ($submit && $reason_id)
{


// Submit report?
if ($submit && $reason_id)
{

 
	if (isset($captcha))
{
$visual_confirmation_response = $captcha->validate();
if ($visual_confirmation_response)
{
$error[] = $visual_confirmation_response;
}
}


	$sql = 'SELECT *
FROM ' . REPORTS_REASONS_TABLE . "
WHERE reason_id = $reason_id";

	$sql = 'SELECT *
FROM ' . REPORTS_REASONS_TABLE . "
WHERE reason_id = $reason_id";

Line 103Line 164

if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other'))
{


if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other'))
{

		trigger_error('EMPTY_REPORT');








		$error[] = $user->lang('EMPTY_REPORT');
}

if (!sizeof($error))
{
if (isset($captcha))
{
$captcha->reset();

	}

$sql_ary = array(
'reason_id' => (int) $reason_id,
'post_id' => $post_id,

	}

$sql_ary = array(
'reason_id' => (int) $reason_id,
'post_id' => $post_id,

 
			'pm_id'			=> $pm_id,

		'user_id'		=> (int) $user->data['user_id'],
'user_notify' => (int) $user_notify,
'report_closed' => 0,

		'user_id'		=> (int) $user->data['user_id'],
'user_notify' => (int) $user_notify,
'report_closed' => 0,

Line 120Line 189
	$db->sql_query($sql);
$report_id = $db->sql_nextid();


	$db->sql_query($sql);
$report_id = $db->sql_nextid();


	if (!$report_data['post_reported'])

		if ($post_id)

	{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_reported = 1
WHERE post_id = ' . $post_id;
$db->sql_query($sql);

	{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_reported = 1
WHERE post_id = ' . $post_id;
$db->sql_query($sql);

	}

 

if (!$report_data['topic_reported'])
{


if (!$report_data['topic_reported'])
{

Line 135Line 203
			WHERE topic_id = ' . $report_data['topic_id'] . '
OR topic_moved_id = ' . $report_data['topic_id'];
$db->sql_query($sql);

			WHERE topic_id = ' . $report_data['topic_id'] . '
OR topic_moved_id = ' . $report_data['topic_id'];
$db->sql_query($sql);

 
			}

$lang_return = $user->lang['RETURN_TOPIC'];
$lang_success = $user->lang['POST_REPORTED_SUCCESS'];
}
else
{
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
SET message_reported = 1
WHERE msg_id = ' . $pm_id;
$db->sql_query($sql);

$sql_ary = array(
'msg_id' => $pm_id,
'user_id' => ANONYMOUS,
'author_id' => (int) $report_data['author_id'],
'pm_deleted' => 0,
'pm_new' => 0,
'pm_unread' => 0,
'pm_replied' => 0,
'pm_marked' => 0,
'pm_forwarded' => 0,
'folder_id' => PRIVMSGS_INBOX,
);

$sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);

$lang_return = $user->lang['RETURN_PM'];
$lang_success = $user->lang['PM_REPORTED_SUCCESS'];

	}

meta_refresh(3, $redirect_url);


	}

meta_refresh(3, $redirect_url);


	$message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');





		$message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>');
if ($return_forum_url)
{
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
}

	trigger_error($message);

	trigger_error($message);

 
	}
else if (isset($captcha) && $captcha->is_solved() !== false)
{
$s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
}

}

// Generate the reasons
display_reasons($reason_id);

}

// Generate the reasons
display_reasons($reason_id);

 

$page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST'];

if (isset($captcha) && $captcha->is_solved() === false)
{
$template->assign_vars(array(
'S_CONFIRM_CODE' => true,
'CAPTCHA_TEMPLATE' => $captcha->get_template(),
));
}


$template->assign_vars(array(


$template->assign_vars(array(

 
	'ERROR'				=> (sizeof($error)) ? implode('<br />', $error) : '',
'S_REPORT_POST' => ($pm_id) ? false : true,

	'REPORT_TEXT'		=> $report_text,

	'REPORT_TEXT'		=> $report_text,

	'S_REPORT_ACTION'	=> append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&amp;p=' . $post_id),


	'S_REPORT_ACTION'	=> append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&amp;p=' . $post_id . '&amp;pm=' . $pm_id),
'S_HIDDEN_FIELDS' => (sizeof($s_hidden_fields)) ? $s_hidden_fields : null,


'S_NOTIFY' => $user_notify,
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)


'S_NOTIFY' => $user_notify,
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)

Line 157Line 277
generate_forum_nav($forum_data);

// Start output of page

generate_forum_nav($forum_data);

// Start output of page

page_header($user->lang['REPORT_POST']);

page_header($page_title);


$template->set_filenames(array(
'body' => 'report_body.html')


$template->set_filenames(array(
'body' => 'report_body.html')