aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorRuslan Uzdenov <rxu@mail.ru>2009-08-05 12:51:48 +0000
committerRuslan Uzdenov <rxu@mail.ru>2009-08-05 12:51:48 +0000
commit914687075da7769583e2752701121deee61ff525 (patch)
treeca122a9398478936a573b43dacfadb8be6470b80 /phpBB/includes
parent58c0bd804fe40898b4c87444a07efb16e8e60750 (diff)
downloadforums-914687075da7769583e2752701121deee61ff525.tar
forums-914687075da7769583e2752701121deee61ff525.tar.gz
forums-914687075da7769583e2752701121deee61ff525.tar.bz2
forums-914687075da7769583e2752701121deee61ff525.tar.xz
forums-914687075da7769583e2752701121deee61ff525.zip
Fix bug #15729 - Global announcements marked as read if all new topics in forum are viewed
Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9926 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/functions_display.php2
-rw-r--r--phpBB/includes/functions_posting.php21
3 files changed, 18 insertions, 7 deletions
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'], '<a href="' . $redirect . '">', '</a>');
}
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