1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-02 23:12:46 +02:00

Merge branch '3.1.x' into 3.2.x

This commit is contained in:
Marc Alexander 2016-11-12 13:54:59 +01:00
commit 78db28286e
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -404,7 +404,7 @@ function mcp_resync_topics($topic_ids)
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request;
global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
if (!sizeof($topic_ids))
{
@ -419,9 +419,9 @@ function merge_topics($forum_id, $topic_ids, $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;
@ -429,13 +429,13 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$sync_forums = array();
$topic_views = 0;
foreach ($topic_data as $data)
foreach ($all_topic_data as $data)
{
$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->variable('post_id_list', array(0));
$start = $request->variable('start', 0);
@ -483,14 +483,14 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
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);
$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']
$to_topic_data['topic_title']
));
// Update topic views count
@ -524,6 +524,20 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$redirect = $request->variable('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);
}