phpBB

Code Changes

File: includes/mcp/mcp_topic.php

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

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

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

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


$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());



$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());


	$user->add_lang('viewtopic');

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

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

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

 
	$user->add_lang('viewtopic');





	$topic_id = request_var('t', 0);

	$topic_id = $request->variable('t', 0);

	$topic_info = phpbb_get_topic_data(array($topic_id), false, true);

if (!sizeof($topic_info))

	$topic_info = phpbb_get_topic_data(array($topic_id), false, true);

if (!sizeof($topic_info))

Line 43Line 44
	$topic_info = $topic_info[$topic_id];

// Set up some vars

	$topic_info = $topic_info[$topic_id];

// Set up some vars

	$icon_id		= request_var('icon', 0);
$subject = utf8_normalize_nfc(request_var('subject', '', true));
$start = request_var('start', 0);
$sort_days_old = request_var('st_old', 0);
$forum_id = request_var('f', 0);
$to_topic_id = request_var('to_topic_id', 0);
$to_forum_id = request_var('to_forum_id', 0);

	$icon_id		= $request->variable('icon', 0);
$subject = $request->variable('subject', '', true);
$start = $request->variable('start', 0);
$sort_days_old = $request->variable('st_old', 0);
$forum_id = $request->variable('f', 0);
$to_topic_id = $request->variable('to_topic_id', 0);
$to_forum_id = $request->variable('to_forum_id', 0);

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

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

	$submitted_id_list	= request_var('post_ids', array(0));
$checked_ids = $post_id_list = request_var('post_id_list', array(0));

	$submitted_id_list	= $request->variable('post_ids', array(0));
$checked_ids = $post_id_list = $request->variable('post_id_list', array(0));


// Resync Topic?
if ($action == 'resync')


// Resync Topic?
if ($action == 'resync')

Line 116Line 117
	$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);


	$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);


	$limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';

	/* @var $phpbb_content_visibility \phpbb\content_visibility */

	$phpbb_content_visibility = $phpbb_container->get('content.visibility');

	$phpbb_content_visibility = $phpbb_container->get('content.visibility');

 
	$limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';


if ($total == -1)
{
$total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']);
}



if ($total == -1)
{
$total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']);
}


	$posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));

	$posts_per_page = max(0, $request->variable('posts_per_page', intval($config['posts_per_page'])));

	if ($posts_per_page == 0)
{
$posts_per_page = $total;

	if ($posts_per_page == 0)
{
$posts_per_page = $total;

Line 147Line 149
	$result = $db->sql_query_limit($sql, $posts_per_page, $start);

$rowset = $post_id_list = array();

	$result = $db->sql_query_limit($sql, $posts_per_page, $start);

$rowset = $post_id_list = array();

	$bbcode_bitfield = '';

 
	while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];

	while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];

		$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);

 
	}
$db->sql_freeresult($result);

	}
$db->sql_freeresult($result);


if ($bbcode_bitfield !== '')
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}

$topic_tracking_info = array();

 

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


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

Line 179Line 171
	$has_unapproved_posts = $has_deleted_posts = false;

// Grab extensions

	$has_unapproved_posts = $has_deleted_posts = false;

// Grab extensions

	$extensions = $attachments = array();

	$attachments = array();

	if ($topic_info['topic_attachment'] && sizeof($post_id_list))
{

	if ($topic_info['topic_attachment'] && sizeof($post_id_list))
{

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


 
		// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
{

		// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
{

Line 201Line 191
			$db->sql_freeresult($result);
}
}

			$db->sql_freeresult($result);
}
}

 

/**
* Event to modify the post data for the MCP topic review before assigning the posts
*
* @event core.mcp_topic_modify_post_data
* @var array attachments List of attachments post_id => array of attachments
* @var int forum_id The forum ID we are currently in
* @var int id ID of the tab we are displaying
* @var string mode Mode of the MCP page we are displaying
* @var array post_id_list Array with post ids we are going to display
* @var array rowset Array with the posts data
* @var int topic_id The topic ID we are currently reviewing
* @since 3.1.7-RC1
*/
$vars = array(
'attachments',
'forum_id',
'id',
'mode',
'post_id_list',
'rowset',
'topic_id',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars)));


foreach ($rowset as $i => $row)
{


foreach ($rowset as $i => $row)
{

Line 228Line 242

$post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;



$post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;


		$template->assign_block_vars('postrow', array(

		$post_row = array(

			'POST_AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),

			'POST_AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),

Line 250Line 264

'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''),
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '',


'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''),
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '',

			'U_MCP_REPORT'		=> ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '')

			'U_MCP_REPORT'		=> ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '',

		);

		);

 

/**
* Event to modify the template data block for topic reviews in the MCP
*
* @event core.mcp_topic_review_modify_row
* @var int id ID of the tab we are displaying
* @var string mode Mode of the MCP page we are displaying
* @var int topic_id The topic ID we are currently reviewing
* @var int forum_id The forum ID we are currently in
* @var int start Start item of this page
* @var int current_row_number Number of the post on this page
* @var array post_row Template block array of the current post
* @var array row Array with original post and user data
* @var array topic_info Array with topic data
* @var int total Total posts count
* @since 3.1.4-RC1
*/
$vars = array(
'id',
'mode',
'topic_id',
'forum_id',
'start',
'current_row_number',
'post_row',
'row',
'topic_info',
'total',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_row', compact($vars)));

$template->assign_block_vars('postrow', $post_row);


// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments[$row['post_id']]))


// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments[$row['post_id']]))

Line 356Line 402
*/
function split_topic($action, $topic_id, $to_forum_id, $subject)
{

*/
function split_topic($action, $topic_id, $to_forum_id, $subject)
{

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

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





	$post_id_list	= request_var('post_id_list', array(0));
$forum_id = request_var('forum_id', 0);
$start = request_var('start', 0);

	$post_id_list	= $request->variable('post_id_list', array(0));
$forum_id = $request->variable('forum_id', 0);
$start = $request->variable('start', 0);


if (!sizeof($post_id_list))
{


if (!sizeof($post_id_list))
{

Line 414Line 460
		return;
}


		return;
}


	$redirect = request_var('redirect', build_url(array('quickmod')));

	$redirect = $request->variable('redirect', build_url(array('quickmod')));


$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',


$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',

Line 427Line 473
		'redirect'		=> $redirect,
'subject' => $subject,
'to_forum_id' => $to_forum_id,

		'redirect'		=> $redirect,
'subject' => $subject,
'to_forum_id' => $to_forum_id,

		'icon'			=> request_var('icon', 0))

		'icon'			=> $request->variable('icon', 0))

	);

	);

	$success_msg = $return_link = '';

 

if (confirm_box(true))
{


if (confirm_box(true))
{

Line 490Line 535
			trigger_error('NO_POST_SELECTED');
}


			trigger_error('NO_POST_SELECTED');
}


		$icon_id = request_var('icon', 0);

		$icon_id = $request->variable('icon', 0);


$sql_ary = array(
'forum_id' => $to_forum_id,


$sql_ary = array(
'forum_id' => $to_forum_id,

Line 508Line 553
		$topic_info = phpbb_get_topic_data(array($topic_id));
$topic_info = $topic_info[$topic_id];


		$topic_info = phpbb_get_topic_data(array($topic_id));
$topic_info = $topic_info[$topic_id];


		add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject);
add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']);









		$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_DESTINATION', false, array(
'forum_id' => $to_forum_id,
'topic_id' => $to_topic_id,
$subject
));
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_SOURCE', false, array(
'forum_id' => $forum_id,
'topic_id' => $topic_id,
$topic_info['topic_title']
));


// Change topic title of first post
$sql = 'UPDATE ' . POSTS_TABLE . "


// Change topic title of first post
$sql = 'UPDATE ' . POSTS_TABLE . "

Line 563Line 616
		$success_msg = 'TOPIC_SPLIT_SUCCESS';

// Update forum statistics

		$success_msg = 'TOPIC_SPLIT_SUCCESS';

// Update forum statistics

		set_config_count('num_topics', 1, true);

		$config->increment('num_topics', 1, false);


// Link back to both topics
$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');


// Link back to both topics
$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');

		$redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");

		$redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");

		$redirect = reapply_sid($redirect);

meta_refresh(3, $redirect);

		$redirect = reapply_sid($redirect);

meta_refresh(3, $redirect);

Line 584Line 637
*/
function merge_posts($topic_id, $to_topic_id)
{

*/
function merge_posts($topic_id, $to_topic_id)
{

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

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


if (!$to_topic_id)
{


if (!$to_topic_id)
{

Line 610Line 663

$topic_data = $topic_data[$to_topic_id];



$topic_data = $topic_data[$to_topic_id];


	$post_id_list	= request_var('post_id_list', array(0));
$start = request_var('start', 0);

	$post_id_list	= $request->variable('post_id_list', array(0));
$start = $request->variable('start', 0);


if (!sizeof($post_id_list))
{


if (!sizeof($post_id_list))
{

Line 624Line 677
		return;
}


		return;
}


	$redirect = request_var('redirect', build_url(array('quickmod')));

	$redirect = $request->variable('redirect', build_url(array('quickmod')));


$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',


$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',

Line 636Line 689
		'redirect'		=> $redirect,
't' => $topic_id)
);

		'redirect'		=> $redirect,
't' => $topic_id)
);

	$success_msg = $return_link = '';

	$return_link = '';


if (confirm_box(true))
{
$to_forum_id = $topic_data['forum_id'];

move_posts($post_id_list, $to_topic_id, false);


if (confirm_box(true))
{
$to_forum_id = $topic_data['forum_id'];

move_posts($post_id_list, $to_topic_id, false);

		add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);







$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array(
'forum_id' => $to_forum_id,
'topic_id' => $to_topic_id,
$topic_data['topic_title']
));


// Message and return links
$success_msg = 'POSTS_MERGED_SUCCESS';


// Message and return links
$success_msg = 'POSTS_MERGED_SUCCESS';

Line 682Line 740

// Link to the new topic
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');


// Link to the new topic
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');

		$redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");

		$redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");

		$redirect = reapply_sid($redirect);

meta_refresh(3, $redirect);

		$redirect = reapply_sid($redirect);

meta_refresh(3, $redirect);