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 239Line 249

'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_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 320Line 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 505Line 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';



$success_msg = 'TOPIC_SPLIT_SUCCESS';


Line 608Line 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