phpBB

Code Changes

File: includes/mcp/mcp_warn.php

  Unmodified   Added   Modified   Removed
Line 35Line 35

function main($id, $mode)
{


function main($id, $mode)
{

		global $auth, $db, $user, $template;
global $config, $phpbb_root_path, $phpEx;

		global $request;






		$action = request_var('action', array('' => ''));

		$action = $request->variable('action', array('' => ''));


if (is_array($action))
{


if (is_array($action))
{

Line 78Line 77
	*/
function mcp_warn_front_view()
{

	*/
function mcp_warn_front_view()
{

		global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth;

		global $phpEx, $phpbb_root_path;
global $template, $db, $user;


$template->assign_vars(array(
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'),


$template->assign_vars(array(
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'),

Line 132Line 131
	function mcp_warn_list_view($action)
{
global $phpEx, $phpbb_root_path, $config, $phpbb_container;

	function mcp_warn_list_view($action)
{
global $phpEx, $phpbb_root_path, $config, $phpbb_container;

		global $template, $db, $user, $auth;

		global $template, $user, $auth, $request;





		$user->add_lang('memberlist');

		/* @var $pagination \phpbb\pagination */

		$pagination = $phpbb_container->get('pagination');

		$pagination = $phpbb_container->get('pagination');

 
		$user->add_lang('memberlist');





		$start	= request_var('start', 0);
$st = request_var('st', 0);
$sk = request_var('sk', 'b');
$sd = request_var('sd', 'd');

		$start	= $request->variable('start', 0);
$st = $request->variable('st', 0);
$sk = $request->variable('sk', 'b');
$sd = $request->variable('sd', 'd');


$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']);


$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']);

Line 189Line 189
	*/
function mcp_warn_post_view($action)
{

	*/
function mcp_warn_post_view($action)
{

		global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth, $phpbb_dispatcher;

		global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $phpbb_dispatcher;





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

		$post_id = $request->variable('p', 0);
$forum_id = $request->variable('f', 0);

		$notify = (isset($_REQUEST['notify_user'])) ? true : false;

		$notify = (isset($_REQUEST['notify_user'])) ? true : false;

		$warning = utf8_normalize_nfc(request_var('warning', '', true));

		$warning = $request->variable('warning', '', true);


$sql = 'SELECT u.*, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u


$sql = 'SELECT u.*, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u

Line 369Line 369
	*/
function mcp_warn_user_view($action)
{

	*/
function mcp_warn_user_view($action)
{

		global $phpEx, $phpbb_root_path, $config, $module;
global $template, $db, $user, $auth, $phpbb_dispatcher;

		global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $phpbb_dispatcher;





		$user_id = request_var('u', 0);
$username = request_var('username', '', true);

		$user_id = $request->variable('u', 0);
$username = $request->variable('username', '', true);

		$notify = (isset($_REQUEST['notify_user'])) ? true : false;

		$notify = (isset($_REQUEST['notify_user'])) ? true : false;

		$warning = utf8_normalize_nfc(request_var('warning', '', true));

		$warning = $request->variable('warning', '', true);


$sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";



$sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";


Line 522Line 522
*/
function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
{

*/
function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
{

	global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth;

	global $phpEx, $phpbb_root_path, $config, $phpbb_log;
global $db, $user;


if ($send_pm)
{
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);



if ($send_pm)
{
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);


		$user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.$phpEx")) ? $user_row['user_lang'] : $config['default_lang'];
include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.$phpEx");

















		// Attempt to translate warning to language of user being warned if user's language differs from issuer's language
if ($user_row['user_lang'] != $user->lang_name)
{
$lang = array();

$user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx)) ? $user_row['user_lang'] : $config['default_lang'];
include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx);

$warn_pm_subject = $lang['WARNING_PM_SUBJECT'];
$warn_pm_body = sprintf($lang['WARNING_PM_BODY'], $warning);

unset($lang);
}
else
{
$warn_pm_subject = $user->lang('WARNING_PM_SUBJECT');
$warn_pm_body = $user->lang('WARNING_PM_BODY', $warning);
}


$message_parser = new parse_message();



$message_parser = new parse_message();


		$message_parser->message = $user->lang('WARNING_PM_BODY', $warning);

		$message_parser->message = $warn_pm_body;

		$message_parser->parse(true, true, true, false, false, true, true);

$pm_data = array(

		$message_parser->parse(true, true, true, false, false, true, true);

$pm_data = array(

Line 553Line 569
			'address_list'			=> array('u' => array($user_row['user_id'] => 'to')),
);


			'address_list'			=> array('u' => array($user_row['user_id'] => 'to')),
);


		submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false);

		submit_pm('post', $warn_pm_subject, $pm_data, false);

	}


	}


	add_log('admin', 'LOG_USER_WARNING', $user_row['username']);
$log_id = add_log('user', $user_row['user_id'], 'LOG_USER_WARNING_BODY', $warning);




	$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array($user_row['username']));
$log_id = $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING_BODY', false, array(
'reportee_id' => $user_row['user_id'],
$warning
));


$sql_ary = array(
'user_id' => $user_row['user_id'],


$sql_ary = array(
'user_id' => $user_row['user_id'],

Line 582Line 601
	$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);


	$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);


	add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']);






	$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $row['topic_id'],
'post_id' => $post_id,
$user_row['username']
));

}


}