Line 34 | Line 34 |
---|
// merge_topic is the quickmod action, merge_topics is the mcp_forum action, and merge_select is the mcp_topic action $merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false;
|
// merge_topic is the quickmod action, merge_topics is the mcp_forum action, and merge_select is the mcp_topic action $merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false;
|
if ($merge_select) { // Fixes a "bug" that makes forum_view use the same ordering as topic_view $request->overwrite('sk', null); $request->overwrite('sd', null); $request->overwrite('sk', null, \phpbb\request\request_interface::POST); $request->overwrite('sd', null, \phpbb\request\request_interface::POST); }
| |
$forum_id = $forum_info['forum_id']; $start = request_var('start', 0);
| $forum_id = $forum_info['forum_id']; $start = request_var('start', 0);
|
Line 76 | Line 67 |
---|
} break; }
|
} break; }
|
| /** * Get some data in order to execute other actions. * * @event core.mcp_forum_view_before * @var string action The action * @var array forum_info Array with forum infos * @var int start Start value * @var array topic_id_list Array of topics ids * @var array post_id_list Array of posts ids * @var array source_topic_ids Array of source topics ids * @var int to_topic_id Array of destination topics ids * @since 3.1.6-RC1 */ $vars = array( 'action', 'forum_info', 'start', 'topic_id_list', 'post_id_list', 'source_topic_ids', 'to_topic_id', ); extract($phpbb_dispatcher->trigger_event('core.mcp_forum_view_before', compact($vars)));
|
$pagination = $phpbb_container->get('pagination');
| $pagination = $phpbb_container->get('pagination');
|
Line 165 | Line 180 |
---|
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql";
|
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql";
|
| /** * Modify SQL query before MCP forum view topic list is queried * * @event core.mcp_view_forum_modify_sql * @var string sql SQL query for forum view topic list * @var int forum_id ID of the forum * @var string limit_time_sql SQL query part for limit time * @var string sort_order_sql SQL query part for sort order * @var int topics_per_page Number of topics per page * @var int start Start value * @since 3.1.2-RC1 */ $vars = array('sql', 'forum_id', 'limit_time_sql', 'sort_order_sql', 'topics_per_page', 'start'); extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_sql', compact($vars)));
|
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
$topic_list = $topic_tracking_info = array();
| $result = $db->sql_query_limit($sql, $topics_per_page, $start);
$topic_list = $topic_tracking_info = array();
|
Line 242 | Line 273 |
---|
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
|
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
|
'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'POSTS_DELETED') : '',
| 'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'TOPIC_DELETED') : '',
|
'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
| 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
|
Line 365 | Line 396 |
---|
*/ function merge_topics($forum_id, $topic_ids, $to_topic_id) {
|
*/ function merge_topics($forum_id, $topic_ids, $to_topic_id) {
|
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;
| global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher;
|
if (!sizeof($topic_ids)) {
| if (!sizeof($topic_ids)) {
|
Line 380 | Line 411 |
---|
$sync_topics = array_merge($topic_ids, array($to_topic_id));
|
$sync_topics = array_merge($topic_ids, array($to_topic_id));
|
$topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
| $all_topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
|
|
|
if (!sizeof($topic_data) || empty($topic_data[$to_topic_id]))
| if (!sizeof($all_topic_data) || empty($all_topic_data[$to_topic_id]))
|
{ $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; }
$sync_forums = array();
|
{ $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; }
$sync_forums = array();
|
foreach ($topic_data as $data)
| $topic_views = 0; foreach ($all_topic_data as $data)
|
{ $sync_forums[$data['forum_id']] = $data['forum_id'];
|
{ $sync_forums[$data['forum_id']] = $data['forum_id'];
|
| $topic_views = max($topic_views, $data['topic_views']);
|
}
|
}
|
$topic_data = $topic_data[$to_topic_id];
| $to_topic_data = $all_topic_data[$to_topic_id];
|
$post_id_list = request_var('post_id_list', array(0)); $start = request_var('start', 0);
| $post_id_list = request_var('post_id_list', array(0)); $start = request_var('start', 0);
|
Line 425 | Line 458 |
---|
return; }
|
return; }
|
$redirect = request_var('redirect', build_url(array('quickmod')));
| $redirect = request_var('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&i=main&mode=forum_view");
|
$s_hidden_fields = build_hidden_fields(array( 'i' => 'main',
| $s_hidden_fields = build_hidden_fields(array( 'i' => 'main',
|
Line 442 | Line 475 |
---|
if (confirm_box(true)) {
|
if (confirm_box(true)) {
|
$to_forum_id = $topic_data['forum_id'];
| $to_forum_id = $to_topic_data['forum_id'];
|
move_posts($post_id_list, $to_topic_id, false);
|
move_posts($post_id_list, $to_topic_id, false);
|
add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
| add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $to_topic_data['topic_title']);
// Update topic views count $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_views = ' . $topic_views . ' WHERE topic_id = ' . $to_topic_id; $db->sql_query($sql);
|
// Message and return links $success_msg = 'POSTS_MERGED_SUCCESS';
| // Message and return links $success_msg = 'POSTS_MERGED_SUCCESS';
|
Line 471 | Line 510 |
---|
$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 . '&t=' . $to_topic_id) . '">', '</a>'); $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect);
|
$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 . '&t=' . $to_topic_id) . '">', '</a>'); $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect);
|
| /** * Perform additional actions after merging topics. * * @event core.mcp_forum_merge_topics_after * @var array all_topic_data The data from all topics involved in the merge * @var int to_topic_id The ID of the topic into which the rest are merged * @since 3.1.11-RC1 */ $vars = array( 'all_topic_data', 'to_topic_id', ); extract($phpbb_dispatcher->trigger_event('core.mcp_forum_merge_topics_after', compact($vars)));
|
meta_refresh(3, $redirect); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
| meta_refresh(3, $redirect); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
|