|
From: Ruslan U. <rx...@ph...> - 2009-08-05 12:52:32
|
Author: rxu
Date: Wed Aug 5 13:51:48 2009
New Revision: 9926
Log:
Fix bug #15729 - Global announcements marked as read if all new topics in forum are viewed
Authorised by: AcydBurn
Modified:
branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
branches/phpBB-3_0_0/phpBB/includes/functions.php
branches/phpBB-3_0_0/phpBB/includes/functions_display.php
branches/phpBB-3_0_0/phpBB/includes/functions_posting.php
branches/phpBB-3_0_0/phpBB/viewforum.php
branches/phpBB-3_0_0/phpBB/viewtopic.php
Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
==============================================================================
*** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original)
--- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Wed Aug 5 13:51:48 2009
***************
*** 186,191 ****
--- 186,192 ----
<li>[Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)</li>
<li>[Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)</li>
<li>[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)</li>
+ <li>[Fix] Do not mark global announcements as read if all topics in a forum become read (Bug #15729).</li>
<li>[Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)</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>
Modified: branches/phpBB-3_0_0/phpBB/includes/functions.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/functions.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/functions.php Wed Aug 5 13:51:48 2009
***************
*** 1227,1233 ****
}
// Add 0 to forums array to mark global announcements correctly
! $forum_id[] = 0;
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
--- 1227,1233 ----
}
// Add 0 to forums array to mark global announcements correctly
! // $forum_id[] = 0;
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
Modified: branches/phpBB-3_0_0/phpBB/includes/functions_display.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/functions_display.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/functions_display.php Wed Aug 5 13:51:48 2009
***************
*** 251,256 ****
--- 251,258 ----
}
else
{
+ // Add 0 to forums array to mark global announcements correctly
+ $forum_ids[] = 0;
markread('topics', $forum_ids);
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
}
Modified: branches/phpBB-3_0_0/phpBB/includes/functions_posting.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/functions_posting.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/functions_posting.php Wed Aug 5 13:51:48 2009
***************
*** 2531,2537 ****
// 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());
//
if ($config['load_db_lastread'] && $user->data['is_registered'])
--- 2531,2537 ----
// 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', (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $data['topic_id'], time());
//
if ($config['load_db_lastread'] && $user->data['is_registered'])
***************
*** 2539,2545 ****
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
! AND forum_id = ' . $data['forum_id'];
$result = $db->sql_query($sql);
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
$db->sql_freeresult($result);
--- 2539,2545 ----
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . $user->data['user_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,2565 ****
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'];
$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);
}
// Send Notifications
--- 2552,2574 ----
if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered'])
{
// Update forum info
! 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((($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $forum_last_post_time, $f_mark_time, false);
}
// Send Notifications
Modified: branches/phpBB-3_0_0/phpBB/viewforum.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/viewforum.php (original)
--- branches/phpBB-3_0_0/phpBB/viewforum.php Wed Aug 5 13:51:48 2009
***************
*** 179,185 ****
$token = request_var('hash', '');
if (check_link_hash($token, 'global'))
{
! markread('topics', $forum_id);
}
$redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
meta_refresh(3, $redirect_url);
--- 179,186 ----
$token = request_var('hash', '');
if (check_link_hash($token, 'global'))
{
! // 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);
Modified: branches/phpBB-3_0_0/phpBB/viewtopic.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/viewtopic.php (original)
--- branches/phpBB-3_0_0/phpBB/viewtopic.php Wed Aug 5 13:51:48 2009
***************
*** 1582,1591 ****
// 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);
// 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);
}
else
{
--- 1582,1591 ----
// 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', (($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_id, $max_post_time);
// Update forum info
! $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
{
|