aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_topic.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-03-31 12:35:44 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-03-31 12:35:44 +0000
commit3abc3dd3310e5c26eb58312c7f6f505f9de63644 (patch)
tree3344bd74b234983da4f5c789f9c91a4665825d86 /phpBB/includes/mcp/mcp_topic.php
parentf6d1fa57b269370583dca8bf0f2f3347d00d5e4a (diff)
downloadforums-3abc3dd3310e5c26eb58312c7f6f505f9de63644.tar
forums-3abc3dd3310e5c26eb58312c7f6f505f9de63644.tar.gz
forums-3abc3dd3310e5c26eb58312c7f6f505f9de63644.tar.bz2
forums-3abc3dd3310e5c26eb58312c7f6f505f9de63644.tar.xz
forums-3abc3dd3310e5c26eb58312c7f6f505f9de63644.zip
#5396, #5266, #5147
git-svn-id: file:///svn/phpbb/trunk@7246 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/mcp/mcp_topic.php')
-rw-r--r--phpBB/includes/mcp/mcp_topic.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 2b793a4d6a..427c7e63d2 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -504,13 +504,23 @@ function merge_posts($topic_id, $to_topic_id)
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- if ($row = $db->sql_fetchrow($result))
+ if ($row)
{
$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $topic_id) . '">', '</a>');
}
+ else
+ {
+ // 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 topic_id = ' . $topic_id);
+ $db->sql_return_on_error(false);
- $db->sql_freeresult($result);
+ $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . $topic_id);
+ }
// 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>');