aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/mcp/mcp_forum.php162
-rw-r--r--phpBB/includes/mcp/mcp_main.php3
-rw-r--r--phpBB/includes/search/fulltext_mysql.php28
-rw-r--r--phpBB/language/en/common.php2
-rw-r--r--phpBB/language/en/mcp.php11
-rw-r--r--phpBB/mcp.php4
-rw-r--r--phpBB/search.php6
-rw-r--r--phpBB/styles/subSilver/template/mcp_forum.html3
-rw-r--r--phpBB/viewtopic.php3
9 files changed, 172 insertions, 50 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 3f11c96e21..52b9a5af73 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -22,7 +22,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
- if ($action == 'merge_select')
+ // 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
unset($_POST['sk'], $_POST['sd'], $_REQUEST['sk'], $_REQUEST['sd']);
@@ -32,14 +35,25 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$start = request_var('start', 0);
$topic_id_list = request_var('topic_id_list', array(0));
$post_id_list = request_var('post_id_list', array(0));
- $source_topic_id = request_var('t', 0);
+ $source_topic_ids = array(request_var('t', 0));
+ $to_topic_id = request_var('to_topic_id', 0);
// Resync Topics
- if ($action == 'resync')
+ switch ($action)
{
- $topic_ids = request_var('topic_id_list', array(0));
-
- mcp_resync_topics($topic_ids);
+ case 'resync':
+ $topic_ids = request_var('topic_id_list', array(0));
+ mcp_resync_topics($topic_ids);
+ break;
+
+ case 'merge_topics':
+ $source_topic_ids = $topic_id_list;
+ case 'merge_topic':
+ if ($to_topic_id)
+ {
+ merge_topics($forum_id, $source_topic_ids, $to_topic_id);
+ }
+ break;
}
$selected_ids = '';
@@ -50,8 +64,15 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$selected_ids .= '&post_id_list[' . $num . ']=' . $post_id;
}
}
+ else if (sizeof($topic_id_list) && $action == 'merge_topics')
+ {
+ foreach ($topic_id_list as $num => $topic_id)
+ {
+ $selected_ids .= '&topic_id_list[' . $num . ']=' . $topic_id;
+ }
+ }
- make_jumpbox($url . "&i=$id&action=$action&mode=$mode", $forum_id . (($action == 'merge_select') ? $selected_ids : ''), false, 'm_');
+ make_jumpbox($url . "&i=$id&action=$action&mode=$mode", $forum_id . (($merge_select) ? $selected_ids : ''), false, 'm_');
$topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : $config['topics_per_page'];
@@ -64,6 +85,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
$template->assign_vars(array(
+ 'ACTION' => $action,
'FORUM_NAME' => $forum_info['forum_name'],
'FORUM_DESCRIPTION' => generate_text_for_display($forum_info['forum_desc'], $forum_info['forum_desc_uid'], $forum_info['forum_desc_bitfield'], $forum_info['forum_desc_options']),
@@ -74,12 +96,13 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_CAN_REPORT' => $auth->acl_get('m_report', $forum_id),
'S_CAN_DELETE' => $auth->acl_get('m_delete', $forum_id),
+ 'S_CAN_MERGE' => $auth->acl_get('m_merge', $forum_id),
'S_CAN_MOVE' => $auth->acl_get('m_move', $forum_id),
'S_CAN_FORK' => $auth->acl_get('m_', $forum_id),
'S_CAN_LOCK' => $auth->acl_get('m_lock', $forum_id),
'S_CAN_SYNC' => $auth->acl_get('m_', $forum_id),
'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id),
- 'S_MERGE_SELECT' => ($action == 'merge_select') ? true : false,
+ 'S_MERGE_SELECT' => ($merge_select) ? true : false,
'S_CAN_MAKE_NORMAL' => $auth->acl_gets('f_sticky', 'f_announce', $forum_id),
'S_CAN_MAKE_STICKY' => $auth->acl_get('f_sticky', $forum_id),
'S_CAN_MAKE_ANNOUNCE' => $auth->acl_get('f_announce', $forum_id),
@@ -87,9 +110,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '',
- 'S_MCP_ACTION' => $url . "&i=$id&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
+ 'S_MCP_ACTION' => $url . "&i=$id&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''),
- 'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode" . (($action == 'merge_select') ? $selected_ids : ''), $forum_topics, $topics_per_page, $start),
+ 'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start),
'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start),
'TOTAL' => $forum_topics)
);
@@ -213,11 +236,19 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
}
else
{
+ if ($action == 'merge_topic' || $action == 'merge_topics')
+ {
+ $u_select_topic = $url . "&i=$id&mode=forum_view&action=$action&to_topic_id=" . $row['topic_id'] . $selected_ids;
+ }
+ else
+ {
+ $u_select_topic = $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids;
+ }
$topic_row = array_merge($topic_row, array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view"),
- 'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $source_topic_id) ? true : false,
- 'U_SELECT_TOPIC' => $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids,
+ 'S_SELECT_TOPIC' => ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false,
+ 'U_SELECT_TOPIC' => $u_select_topic,
'U_MCP_QUEUE' => $u_mcp_queue,
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports') : '',
'TOPIC_ID' => $row['topic_id'],
@@ -274,4 +305,111 @@ function mcp_resync_topics($topic_ids)
return;
}
+/**
+* Merge selected topics into selected topic
+*/
+function merge_topics($forum_id, $topic_ids, $to_topic_id)
+{
+ global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;
+
+ if (!$to_topic_id)
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
+ return;
+ }
+
+ $topic_data = get_topic_data(array($to_topic_id), 'm_merge');
+
+ if (!sizeof($topic_data))
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
+ return;
+ }
+
+ $topic_data = $topic_data[$to_topic_id];
+
+ $post_id_list = request_var('post_id_list', array(0));
+ $start = request_var('start', 0);
+
+ if (!sizeof($post_id_list) && sizeof($topic_ids))
+ {
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
+ $result = $db->sql_query($sql);
+
+ $post_id_list = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_id_list[] = $row['post_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+
+ if (!sizeof($post_id_list))
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
+ return;
+ }
+
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge')))
+ {
+ return;
+ }
+
+ $redirect = request_var('redirect', build_url(array('_f_', 'quickmod')));
+
+ $s_hidden_fields = build_hidden_fields(array(
+ 'i' => 'main',
+ 'f' => $forum_id,
+ 'post_id_list' => $post_id_list,
+ 'to_topic_id' => $to_topic_id,
+ 'mode' => 'forum_view',
+ 'action' => 'merge_topics',
+ 'start' => $start,
+ 'redirect' => $redirect,
+ 'topic_id_list' => $topic_ids)
+ );
+ $success_msg = $return_link = '';
+
+ if (confirm_box(true))
+ {
+ $to_forum_id = $topic_data['forum_id'];
+
+ move_posts($post_id_list, $to_topic_id);
+ add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
+
+ // Message and return links
+ $success_msg = 'POSTS_MERGED_SUCCESS';
+
+ // 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 = ' . $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
+ $db->sql_return_on_error(false);
+
+ $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
+
+ // Link to the new topic
+ $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 . '&amp;t=' . $to_topic_id) . '">', '</a>');
+ }
+ else
+ {
+ confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields);
+ }
+
+ $redirect = request_var('redirect', "index.$phpEx");
+ $redirect = reapply_sid($redirect);
+
+ if (!$success_msg)
+ {
+ return;
+ }
+ else
+ {
+ meta_refresh(3, append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$to_forum_id&amp;t=$to_topic_id"));
+ trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
+ }
+}
+
?> \ No newline at end of file
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 32a4edb6ca..ab43f53b6c 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -953,7 +953,8 @@ function mcp_fork_topic($topic_ids)
'bbcode_uid' => (string) $row['bbcode_uid'],
'post_edit_time' => (int) $row['post_edit_time'],
'post_edit_count' => (int) $row['post_edit_count'],
- 'post_edit_locked' => (int) $row['post_edit_locked']
+ 'post_edit_locked' => (int) $row['post_edit_locked'],
+ 'post_postcount' => 0,
);
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 7edfedc424..bd15f86334 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -114,9 +114,6 @@ class fulltext_mysql extends search_backend
{
global $config;
- $this->get_ignore_words();
- $this->get_synonyms();
-
if ($terms == 'all')
{
$match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#');
@@ -171,18 +168,6 @@ class fulltext_mysql extends search_backend
$this->split_words = $matches[1];
}
-
- if (sizeof($this->ignore_words))
- {
- $this->common_words = array_intersect($this->split_words, $this->ignore_words);
- $this->split_words = array_diff($this->split_words, $this->ignore_words);
- }
-
- if (sizeof($this->replace_synonym))
- {
- $this->split_words = str_replace($this->replace_synonym, $this->match_synonym, $this->split_words);
- }
-
foreach ($this->split_words as $i => $word)
{
$clean_word = preg_replace('#^[+\-|]#', '', $word);
@@ -214,9 +199,6 @@ class fulltext_mysql extends search_backend
{
global $config;
- $this->get_ignore_words();
- $this->get_synonyms();
-
// Split words
if ($this->pcre_properties)
{
@@ -255,16 +237,6 @@ class fulltext_mysql extends search_backend
$text = $matches[1];
}
- if (sizeof($this->ignore_words))
- {
- $text = array_diff($text, $this->ignore_words);
- }
-
- if (sizeof($this->replace_synonym))
- {
- $text = str_replace($this->replace_synonym, $this->match_synonym, $text);
- }
-
// remove too short or too long words
$text = array_values($text);
for ($i = 0, $n = sizeof($text); $i < $n; $i++)
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 4e20a602b2..18ac1e8af9 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -298,6 +298,8 @@ $lang = array_merge($lang, array(
'MCP' => 'Moderator Control Panel',
'MEMBERLIST' => 'Members',
'MEMBERLIST_EXPLAIN' => 'View complete list of members',
+ 'MERGE' => 'Merge',
+ 'MERGE_POSTS' => 'Merge posts',
'MERGE_TOPIC' => 'Merge topic',
'MESSAGE' => 'Message',
'MESSAGES' => 'Messages',
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index bf1a56610a..110e12ed88 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -81,10 +81,10 @@ $lang = array_merge($lang, array(
'EMPTY_TOPICS_REMOVED_WARNING' => 'Please note that one or several topics have been removed from the database because they were or become empty',
'FEEDBACK' => 'Feedback',
- 'FORK' => 'Fork',
- 'FORK_TOPIC' => 'Fork topic',
+ 'FORK' => 'Copy',
+ 'FORK_TOPIC' => 'Copy topic',
'FORK_TOPIC_CONFIRM' => 'Are you sure you want to copy this topic?',
- 'FORK_TOPICS' => 'Fork selected topics',
+ 'FORK_TOPICS' => 'Copy selected topics',
'FORK_TOPICS_CONFIRM' => 'Are you sure you want to copy the selected topics?',
'FORUM_DESC' => 'Description',
'FORUM_NAME' => 'Forum name',
@@ -188,8 +188,10 @@ $lang = array_merge($lang, array(
'MERGE_POSTS' => 'Merge posts',
'MERGE_POSTS_CONFIRM' => 'Are you sure you want to merge the selected posts?',
- 'MERGE_TOPIC_EXPLAIN' => 'Using the form below you can merge selected posts into another topic. These posts will not be reordered and will appear as if the users posted them to the new topic.<br />Please enter the destination topic id or click on the "Select" button to search for one',
+ 'MERGE_TOPIC_EXPLAIN' => 'Using the form below you can merge selected posts into another topic. These posts will not be reordered and will appear as if the users posted them to the new topic.<br />Please enter the destination topic id or click on "Select topic" to search for one',
'MERGE_TOPIC_ID' => 'Destination topic identification number',
+ 'MERGE_TOPICS' => 'Merge topics',
+ 'MERGE_TOPICS_CONFIRM' => 'Are you sure you want to merge the selected topics?',
'MODERATE_FORUM' => 'Moderate forum',
'MODERATE_TOPIC' => 'Moderate topic',
'MODERATE_POST' => 'Moderate post',
@@ -273,6 +275,7 @@ $lang = array_merge($lang, array(
'SELECT_ACTION' => 'Select desired action',
'SELECT_FORUM_GLOBAL_ANNOUNCEMENT' => 'Please select the forum you wish this global announcement to be displayed.',
'SELECT_FORUM_GLOBAL_ANNOUNCEMENTS' => 'One or more of the selected topics are global announcements. Please select the forum you wish these to be displayed.',
+ 'SELECT_MERGE' => 'Select for merging',
'SELECT_TOPICS_FROM' => 'Select topics from',
'SELECT_TOPIC' => 'Select topic',
'SELECT_USER' => 'Select user',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 3ff42be8d4..b2cd39c7af 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -168,6 +168,10 @@ if ($quickmod)
$module->set_active('logs', 'topic_logs');
break;
+ case 'merge_topic':
+ $module->set_active('main', 'forum_view');
+ break;
+
case 'split':
case 'merge':
$module->set_active('main', 'topic_view');
diff --git a/phpBB/search.php b/phpBB/search.php
index c01693ebba..d9210d25f3 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -462,7 +462,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$u_search .= ($search_id) ? '&amp;search_id=' . $search_id : '';
$u_search .= ($u_hilit) ? '&amp;keywords=' . $u_hilit : '';
$u_search .= ($topic_id) ? '&amp;t=' . $topic_id : '';
- $u_search .= ($author) ? '&amp;author=' . urlencode($author) : '';
+ $u_search .= ($author) ? '&amp;author=' . urlencode(htmlspecialchars_decode($author)) : '';
$u_search .= ($author_id) ? '&amp;author_id=' . $author_id : '';
$u_search .= ($u_search_forum) ? '&amp;fid%5B%5D=' . $u_search_forum : '';
$u_search .= (!$search_child) ? '&amp;sc=0' : '';
@@ -1048,8 +1048,8 @@ while ($row = $db->sql_fetchrow($result))
'KEYWORDS' => $keywords,
'TIME' => $user->format_date($row['search_time']),
- 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode($keywords)))
- );
+ 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords)))
+ ));
}
$db->sql_freeresult($result);
diff --git a/phpBB/styles/subSilver/template/mcp_forum.html b/phpBB/styles/subSilver/template/mcp_forum.html
index 34c2dd8e6b..f85dc48126 100644
--- a/phpBB/styles/subSilver/template/mcp_forum.html
+++ b/phpBB/styles/subSilver/template/mcp_forum.html
@@ -27,7 +27,7 @@
<!-- ENDIF -->
<td class="row1">
<!-- IF topicrow.S_SELECT_TOPIC -->
- <span class="genmed">[ <a href="{topicrow.U_SELECT_TOPIC}">{L_SELECT}</a> ]&nbsp;</span>
+ <span class="genmed">[ <a href="{topicrow.U_SELECT_TOPIC}">{L_SELECT_MERGE}</a> ]&nbsp;</span>
<!-- ENDIF -->
<p class="topictitle">{topicrow.NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
@@ -57,6 +57,7 @@
<select name="action">
<option value="" selected="selected">{L_SELECT_ACTION}</option>
<!-- IF S_CAN_DELETE --><option value="delete_topic">{L_DELETE}</option><!-- ENDIF -->
+ <!-- IF S_CAN_MERGE --><option value="merge_topics">{L_MERGE}</option><!-- ENDIF -->
<!-- IF S_CAN_MOVE --><option value="move">{L_MOVE}</option><!-- ENDIF -->
<!-- IF S_CAN_FORK --><option value="fork">{L_FORK}</option><!-- ENDIF -->
<!-- IF S_CAN_LOCK --><option value="lock">{L_LOCK}</option><option value="unlock">{L_UNLOCK}</option><!-- ENDIF -->
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index ba02cfae0c..76fb8f6d4e 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -496,7 +496,8 @@ $topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lo
$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '<option value="delete_topic">' . $user->lang['DELETE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? '<option value="move">' . $user->lang['MOVE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '<option value="split">' . $user->lang['SPLIT_TOPIC'] . '</option>' : '';
-$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' . $user->lang['MERGE_TOPIC'] . '</option>' : '';
+$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' . $user->lang['MERGE_POSTS'] . '</option>' : '';
+$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge_topic">' . $user->lang['MERGE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="fork">' . $user->lang['FORK_TOPIC'] . '</option>' : '';
$topic_mod .= ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '<option value="make_normal">' . $user->lang['MAKE_NORMAL'] . '</option>' : '';
$topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '<option value="make_sticky">' . $user->lang['MAKE_STICKY'] . '</option>' : '';