mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Fix Bug #50035 - Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts"
Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10079 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
5f95f723d7
commit
d7925595dc
3 changed files with 91 additions and 0 deletions
|
@ -203,6 +203,7 @@
|
||||||
<li>[Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)</li>
|
<li>[Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)</li>
|
||||||
<li>[Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)</li>
|
<li>[Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)</li>
|
||||||
<li>[Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)</li>
|
<li>[Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)</li>
|
||||||
|
<li>[Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)</li>
|
||||||
<li>[Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).</li>
|
<li>[Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).</li>
|
||||||
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
|
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
|
||||||
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
|
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
|
||||||
|
|
|
@ -416,11 +416,14 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
|
||||||
|
|
||||||
// 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...
|
// To not let it error out on users watching both topics, we just return on an error...
|
||||||
|
// Same for Bookmarks
|
||||||
$db->sql_return_on_error(true);
|
$db->sql_return_on_error(true);
|
||||||
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
|
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
|
||||||
|
$db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
|
||||||
$db->sql_return_on_error(false);
|
$db->sql_return_on_error(false);
|
||||||
|
|
||||||
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
|
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
|
||||||
|
$db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
|
||||||
|
|
||||||
// Link to the new topic
|
// 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 . '&t=' . $to_topic_id) . '">', '</a>');
|
$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>');
|
||||||
|
|
|
@ -503,6 +503,45 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
|
||||||
// Update forum statistics
|
// Update forum statistics
|
||||||
set_config_count('num_topics', 1, true);
|
set_config_count('num_topics', 1, true);
|
||||||
|
|
||||||
|
// Add new topic to bookmarks
|
||||||
|
$bookmarks = array();
|
||||||
|
$sql = 'SELECT user_id
|
||||||
|
FROM ' . BOOKMARKS_TABLE . '
|
||||||
|
WHERE topic_id = ' . $topic_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$bookmarks[] = array(
|
||||||
|
'user_id' => (int) $row['user_id'],
|
||||||
|
'topic_id' => $to_topic_id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
if (sizeof($bookmarks))
|
||||||
|
{
|
||||||
|
$db->sql_multi_insert(BOOKMARKS_TABLE, $bookmarks);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new topic to watch-list
|
||||||
|
$notifications = array();
|
||||||
|
$sql = 'SELECT user_id, notify_status
|
||||||
|
FROM ' . TOPICS_WATCH_TABLE . '
|
||||||
|
WHERE topic_id = ' . $topic_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$notifications[] = array(
|
||||||
|
'user_id' => (int) $row['user_id'],
|
||||||
|
'topic_id' => $to_topic_id,
|
||||||
|
'notify_status' => (int) $row['notify_status'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
if (sizeof($notifications))
|
||||||
|
{
|
||||||
|
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $notifications);
|
||||||
|
}
|
||||||
|
|
||||||
// Link back to both topics
|
// 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>');
|
$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>');
|
||||||
}
|
}
|
||||||
|
@ -596,17 +635,65 @@ function merge_posts($topic_id, $to_topic_id)
|
||||||
|
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
|
// Add new topic to bookmarks
|
||||||
|
$bookmarks = array();
|
||||||
|
$sql = 'SELECT user_id
|
||||||
|
FROM ' . BOOKMARKS_TABLE . '
|
||||||
|
WHERE topic_id = ' . (int) $topic_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$bookmarks[] = array(
|
||||||
|
'user_id' => (int) $row['user_id'],
|
||||||
|
'topic_id' => (int) $to_topic_id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
if (sizeof($bookmarks))
|
||||||
|
{
|
||||||
|
// To not let it error out on users, who already bookmarked the topic, we just return on an error...
|
||||||
|
$db->sql_return_on_error(true);
|
||||||
|
$db->sql_multi_insert(BOOKMARKS_TABLE, $bookmarks);
|
||||||
|
$db->sql_return_on_error(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new topic to notifications
|
||||||
|
$notifications = array();
|
||||||
|
$sql = 'SELECT user_id, notify_status
|
||||||
|
FROM ' . TOPICS_WATCH_TABLE . '
|
||||||
|
WHERE topic_id = ' . (int) $topic_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$notifications[] = array(
|
||||||
|
'user_id' => (int) $row['user_id'],
|
||||||
|
'topic_id' => (int) $to_topic_id,
|
||||||
|
'notify_status' => (int) $row['notify_status'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
if (sizeof($notifications))
|
||||||
|
{
|
||||||
|
// To not let it error out on users, who already watch the topic, we just return on an error...
|
||||||
|
$db->sql_return_on_error(true);
|
||||||
|
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $notifications);
|
||||||
|
$db->sql_return_on_error(false);
|
||||||
|
}
|
||||||
|
|
||||||
$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $topic_id) . '">', '</a>');
|
$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $topic_id) . '">', '</a>');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 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...
|
// To not let it error out on users watching both topics, we just return on an error...
|
||||||
|
// Same for bookmarks
|
||||||
$db->sql_return_on_error(true);
|
$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_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id);
|
||||||
|
$db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id);
|
||||||
$db->sql_return_on_error(false);
|
$db->sql_return_on_error(false);
|
||||||
|
|
||||||
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
|
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
|
||||||
|
$db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link to the new topic
|
// Link to the new topic
|
||||||
|
|
Loading…
Add table
Reference in a new issue