diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 01205402d2..00fae0c47d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -186,6 +186,7 @@
  • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
  • [Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)
  • [Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)
  • +
  • [Fix] Do not mark global announcements as read if all topics in a forum become read (Bug #15729).
  • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e797b279c9..23ed190bcd 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1227,7 +1227,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } // Add 0 to forums array to mark global announcements correctly - $forum_id[] = 0; + // $forum_id[] = 0; if ($config['load_db_lastread'] && $user->data['is_registered']) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 57f416bee4..f9eb4ce4cd 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -251,6 +251,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { + // Add 0 to forums array to mark global announcements correctly + $forum_ids[] = 0; markread('topics', $forum_ids); $message = sprintf($user->lang['RETURN_FORUM'], '', ''); } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 40df716ac9..61741ceb81 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2531,7 +2531,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Mark this topic as read // We do not use post_time here, this is intended (post_time can have a date in the past if editing a message) - markread('topic', $data['forum_id'], $data['topic_id'], time()); + markread('topic', (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $data['topic_id'], time()); // if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -2539,7 +2539,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql = 'SELECT mark_time FROM ' . FORUMS_TRACK_TABLE . ' WHERE user_id = ' . $user->data['user_id'] . ' - AND forum_id = ' . $data['forum_id']; + AND forum_id = ' . (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']); $result = $db->sql_query($sql); $f_mark_time = (int) $db->sql_fetchfield('mark_time'); $db->sql_freeresult($result); @@ -2552,14 +2552,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) { // Update forum info - $sql = 'SELECT forum_last_post_time - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $data['forum_id']; + if ($topic_type == POST_GLOBAL) + { + $sql = 'SELECT MAX(topic_last_post_time) as forum_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = 0'; + } + else + { + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $data['forum_id']; + } $result = $db->sql_query($sql); $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); $db->sql_freeresult($result); - update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false); + update_forum_tracking_info((($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $forum_last_post_time, $f_mark_time, false); } // Send Notifications diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 1a2333ac8b..2668919e1d 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -179,7 +179,8 @@ if ($mark_read == 'topics') $token = request_var('hash', ''); if (check_link_hash($token, 'global')) { - markread('topics', $forum_id); + // Add 0 to forums array to mark global announcements correctly + markread('topics', array($forum_id, 0)); } $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); meta_refresh(3, $redirect_url); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fc96f0c901..51a8682229 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1582,10 +1582,10 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use // Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed. if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) { - markread('topic', $forum_id, $topic_id, $max_post_time); + markread('topic', (($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_id, $max_post_time); // Update forum info - $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); + $all_marked_read = update_forum_tracking_info((($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); } else {