phpBB

Code Changes

File: includes/mcp/mcp_topic.php

  Unmodified   Added   Modified   Removed
Line 49Line 49
	$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));

	$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));

 

// Resync Topic?
if ($action == 'resync')
{
if (!function_exists('mcp_resync_topics'))
{
include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx);
}
mcp_resync_topics(array($topic_id));
}


// Split Topic?
if ($action == 'split_all' || $action == 'split_beyond')


// Split Topic?
if ($action == 'split_all' || $action == 'split_beyond')

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

if ($total == -1)

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

if ($total == -1)

 
	{
if ($auth->acl_get('m_approve', $topic_info['forum_id']))
{
$total = $topic_info['topic_replies_real'] + 1;
}
else

	{
$total = $topic_info['topic_replies'] + 1;

	{
$total = $topic_info['topic_replies'] + 1;

 
		}

	}

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

	}

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

Line 230Line 247
			'POST_ID'		=> $row['post_id'],
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) . '">', '</a>'),


			'POST_ID'		=> $row['post_id'],
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) . '">', '</a>'),


			'MINI_POST_IMG'			=> ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),

			'MINI_POST_IMG'			=> ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),





			'S_POST_REPORTED'	=> ($row['post_reported']) ? true : false,
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,

			'S_POST_REPORTED'	=> ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])),
'S_POST_UNAPPROVED' => (!$row['post_approved'] && $auth->acl_get('m_approve', $topic_info['forum_id'])),

			'S_CHECKED'			=> (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,


			'S_CHECKED'			=> (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,


Line 259Line 276
	// Display topic icons for split topic
$s_topic_icons = false;


	// Display topic icons for split topic
$s_topic_icons = false;


	if ($auth->acl_get('m_split', $topic_info['forum_id']))

	if ($auth->acl_gets('m_split', 'm_merge', (int) $topic_info['forum_id']))

	{
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
$s_topic_icons = posting_gen_topic_icons('', $icon_id);

	{
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
$s_topic_icons = posting_gen_topic_icons('', $icon_id);

Line 301Line 318
		'POSTS_PER_PAGE'	=> $posts_per_page,
'ACTION' => $action,


		'POSTS_PER_PAGE'	=> $posts_per_page,
'ACTION' => $action,


		'REPORTED_IMG'		=> $user->img('icon_topic_reported', 'POST_REPORTED', false, true),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED', false, true),


		'REPORTED_IMG'		=> $user->img('icon_topic_reported', 'POST_REPORTED'),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'),


'S_MCP_ACTION' => "$url&amp;i=$id&amp;mode=$mode&amp;action=$action&amp;start=$start",
'S_FORUM_SELECT' => ($to_forum_id) ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true),


'S_MCP_ACTION' => "$url&amp;i=$id&amp;mode=$mode&amp;action=$action&amp;start=$start",
'S_FORUM_SELECT' => ($to_forum_id) ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true),

Line 312Line 330
		'S_CAN_APPROVE'		=> ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false,

		'S_CAN_APPROVE'		=> ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false,

 
		'S_CAN_SYNC'		=> $auth->acl_get('m_', $topic_info['forum_id']),

		'S_REPORT_VIEW'		=> ($action == 'reports') ? true : false,
'S_MERGE_VIEW' => ($action == 'merge') ? true : false,
'S_SPLIT_VIEW' => ($action == 'split') ? true : false,

		'S_REPORT_VIEW'		=> ($action == 'reports') ? true : false,
'S_MERGE_VIEW' => ($action == 'merge') ? true : false,
'S_SPLIT_VIEW' => ($action == 'split') ? true : false,

Line 497Line 516
			SET post_subject = '" . $db->sql_escape($subject) . "'
WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);

			SET post_subject = '" . $db->sql_escape($subject) . "'
WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);

 

// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);

$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $to_topic_id,
'user_id' => (int) $row['user_id'],
'notify_status' => (int) $row['notify_status'],
);
}
$db->sql_freeresult($result);

if (sizeof($sql_ary))
{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}

// Copy bookmarks to new topic
$sql = 'SELECT user_id
FROM ' . BOOKMARKS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);

$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $to_topic_id,
'user_id' => (int) $row['user_id'],
);
}
$db->sql_freeresult($result);

if (sizeof($sql_ary))
{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}


$success_msg = 'TOPIC_SPLIT_SUCCESS';

// Update forum statistics


$success_msg = 'TOPIC_SPLIT_SUCCESS';

// Update forum statistics

		set_config('num_topics', $config['num_topics'] + 1, true);

		set_config_count('num_topics', 1, true);


// 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>');

Line 600Line 662
		}
else
{

		}
else
{

 
			if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status'))
{
include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx);
}


			// If the topic no longer exist, we will update the topic watch table.

			// If the topic no longer exist, we will update the topic watch table.

			// To not let it error out on users watching both topics, we just return on an error...
$db->sql_return_on_error(true);
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id);
$db->sql_return_on_error(false);

			phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', array($topic_id), $to_topic_id);








			$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);


			// If the topic no longer exist, we will update the bookmarks table.
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id);

		}

// Link to the new topic

		}

// Link to the new topic