Line 46 | Line 46 |
---|
$forum_id = request_var('f', 0); $to_topic_id = request_var('to_topic_id', 0); $to_forum_id = request_var('to_forum_id', 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);
|
$post_id_list = request_var('post_id_list', array(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));
// 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 104 | Line 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 113 | Line 131 |
---|
{ $posts_per_page = $total; }
|
{ $posts_per_page = $total; }
|
if (!empty($sort_days_old) && $sort_days_old != $sort_days)
| if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page)
|
{ $start = 0;
|
{ $start = 0;
|
| }
// Make sure $start is set to the last page if it exceeds the amount if ($start < 0 || $start >= $total) { $start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
|
}
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
| }
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
|
Line 222 | Line 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_CHECKED' => ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? true : false,
| '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,
'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''),
| 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''),
|
Line 251 | Line 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 279 | Line 304 |
---|
$s_hidden_fields = build_hidden_fields(array( 'st_old' => $sort_days,
|
$s_hidden_fields = build_hidden_fields(array( 'st_old' => $sort_days,
|
| 'post_ids' => $post_id_list,
|
));
$template->assign_vars(array(
| ));
$template->assign_vars(array(
|
Line 292 | Line 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&i=$id&mode=$mode&action=$action&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&i=$id&mode=$mode&action=$action&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 303 | Line 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 328 | Line 356 |
---|
*/ 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;
| global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;
|
$post_id_list = request_var('post_id_list', array(0)); $forum_id = request_var('forum_id', 0);
| $post_id_list = request_var('post_id_list', array(0)); $forum_id = request_var('forum_id', 0);
|
Line 370 | Line 398 |
---|
return; }
|
return; }
|
$forum_info = get_forum_data(array($to_forum_id), 'm_split');
| $forum_info = get_forum_data(array($to_forum_id), 'f_post');
|
if (!sizeof($forum_info)) {
|
if (!sizeof($forum_info)) {
|
$template->assign_var('MESSAGE', $user->lang['NOT_MODERATOR']);
| $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']);
|
return; }
| return; }
|
Line 488 | Line 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';
|
| // Update forum statistics 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'] . '&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 . '&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'] . '&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 . '&t=' . $to_topic_id) . '">', '</a>');
|
Line 588 | Line 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
|