phpBB

Code Changes

File: includes/mcp/mcp_post.php

  Unmodified   Added   Modified   Removed
Line 24Line 24
*/
function mcp_post_details($id, $mode, $action)
{

*/
function mcp_post_details($id, $mode, $action)
{

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


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


$user->add_lang('posting');



$user->add_lang('posting');


	$post_id = request_var('p', 0);
$start = request_var('start', 0);

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


// Get post data
$post_info = phpbb_get_post_data(array($post_id), false, true);


// Get post data
$post_info = phpbb_get_post_data(array($post_id), false, true);

Line 51Line 52

if ($auth->acl_get('m_info', $post_info['forum_id']))
{


if ($auth->acl_get('m_info', $post_info['forum_id']))
{

				$ip = request_var('ip', '');

				$ip = $request->variable('ip', '');

				include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

$template->assign_vars(array(

				include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

$template->assign_vars(array(

Line 72Line 73

if ($action == 'chgposter')
{


if ($action == 'chgposter')
{

				$username = request_var('username', '', true);

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

				$sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
}
else
{

				$sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
}
else
{

				$new_user_id = request_var('u', 0);

				$new_user_id = $request->variable('u', 0);

				$sql_where = 'user_id = ' . $new_user_id;
}


				$sql_where = 'user_id = ' . $new_user_id;
}


Line 104Line 105
					trigger_error('FORM_INVALID');
}
}

					trigger_error('FORM_INVALID');
}
}

 

break;

default:

/**
* This event allows you to handle custom post moderation options
*
* @event core.mcp_post_additional_options
* @var string action Post moderation action name
* @var array post_info Information on the affected post
* @since 3.1.5-RC1
*/
$vars = array('action', 'post_info');
extract($phpbb_dispatcher->trigger_event('core.mcp_post_additional_options', compact($vars)));


break;
}


break;
}

Line 112Line 128
	$users_ary = $usernames_ary = array();
$attachments = $extensions = array();
$post_id = $post_info['post_id'];

	$users_ary = $usernames_ary = array();
$attachments = $extensions = array();
$post_id = $post_info['post_id'];

	$topic_tracking_info = array();

 

// Get topic tracking info
if ($config['load_db_lastread'])


// Get topic tracking info
if ($config['load_db_lastread'])

Line 134Line 149

if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{


if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{

		$extensions = $cache->obtain_attach_extensions($post_info['forum_id']);


 
		$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '

		$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '

Line 197Line 210
		$l_deleted_by = '';
}


		$l_deleted_by = '';
}


	$template->assign_vars(array(

	$mcp_post_template_data = array(

		'U_MCP_ACTION'			=> "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"),

		'U_MCP_ACTION'			=> "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"),

Line 244Line 257
		'POST_SUBJECT'			=> $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],

		'POST_SUBJECT'			=> $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],

		'POST_IPADDR'			=> ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',

		'POST_IPADDR'			=> ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',

		'POST_ID'				=> $post_info['post_id'],

'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '',

		'POST_ID'				=> $post_info['post_id'],

'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '',

	));


























	);

$s_additional_opts = false;

/**
* Event to add/modify MCP post template data
*
* @event core.mcp_post_template_data
* @var array post_info Array with the post information
* @var array mcp_post_template_data Array with the MCP post template data
* @var array attachments Array with the post attachments, if any
* @var bool s_additional_opts Must be set to true in extension if additional options are presented in MCP post panel
* @since 3.1.5-RC1
*/
$vars = array(
'post_info',
'mcp_post_template_data',
'attachments',
's_additional_opts',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_post_template_data', compact($vars)));

$template->assign_vars($mcp_post_template_data);
$template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts);

unset($mcp_post_template_data);


// Get User Notes
$log_data = array();


// Get User Notes
$log_data = array();

Line 314Line 352
	// Get IP
if ($auth->acl_get('m_info', $post_info['forum_id']))
{

	// Get IP
if ($auth->acl_get('m_info', $post_info['forum_id']))
{

		$rdns_ip_num = request_var('rdns', '');

		$rdns_ip_num = $request->variable('rdns', '');


if ($rdns_ip_num != 'all')
{


if ($rdns_ip_num != 'all')
{

Line 420Line 458
*/
function change_poster(&$post_info, $userdata)
{

*/
function change_poster(&$post_info, $userdata)
{

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

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


if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
{


if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
{

Line 497Line 535
	{
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;

	{
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;

		$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user);

		$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);


if (!$error && method_exists($search, 'destroy_cache'))
{


if (!$error && method_exists($search, 'destroy_cache'))
{

Line 507Line 545

$from_username = $post_info['username'];
$to_username = $userdata['username'];


$from_username = $post_info['username'];
$to_username = $userdata['username'];

 

/**
* This event allows you to perform additional tasks after changing a post's poster
*
* @event core.mcp_change_poster_after
* @var array userdata Information on a post's new poster
* @var array post_info Information on the affected post
* @since 3.1.6-RC1
* @changed 3.1.7-RC1 Change location to prevent post_info from being set to the new post information
*/
$vars = array('userdata', 'post_info');
extract($phpbb_dispatcher->trigger_event('core.mcp_change_poster_after', compact($vars)));


// Renew post info
$post_info = phpbb_get_post_data(array($post_id), false, true);


// Renew post info
$post_info = phpbb_get_post_data(array($post_id), false, true);

Line 519Line 569
	$post_info = $post_info[$post_id];

// Now add log entry

	$post_info = $post_info[$post_id];

// Now add log entry

	add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username);








	$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MCP_CHANGE_POSTER', false, array(
'forum_id' => $post_info['forum_id'],
'topic_id' => $post_info['topic_id'],
'post_id' => $post_info['post_id'],
$post_info['topic_title'],
$from_username,
$to_username
));

}


}