diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2006-10-20 13:48:44 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-10-20 13:48:44 +0000 |
| commit | f4da66a9328d12a3a5cb3a36feb184a4686ca2f3 (patch) | |
| tree | 85fe8abffa4507ce66c4a52e241a58bc5f454353 /phpBB/viewtopic.php | |
| parent | b572e0db8f18d36d71c7ad645839bb9b0cdb5f38 (diff) | |
| download | forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar.gz forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar.bz2 forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar.xz forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.zip | |
- adjust unread query a bit to cope with large topics (thanks bart!)
- fixing some bugs
- more username_clean work
git-svn-id: file:///svn/phpbb/trunk@6513 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewtopic.php')
| -rw-r--r-- | phpBB/viewtopic.php | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a163ba5bb2..ba090f10a2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -69,27 +69,32 @@ if ($view && !$post_id) $topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0; - $sql = 'SELECT p.post_id, p.topic_id, p.forum_id - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE t.topic_id = $topic_id - AND p.topic_id = t.topic_id - " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . " - AND (p.post_time > $topic_last_read - OR p.post_id = t.topic_last_post_id) - ORDER BY p.post_time ASC"; + $sql = 'SELECT post_id, topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . " + AND post_time > $topic_last_read + ORDER BY post_time ASC"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$row) { + $sql = 'SELECT topic_last_post_id as post_id, topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if (!$row) + { // Setup user environment so we can process lang string $user->setup('viewtopic'); - $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); - - meta_refresh(3, $redirect); - trigger_error($user->lang['NO_UNREAD_POSTS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect . '">', '</a>')); + trigger_error('NO_TOPIC'); } $post_id = $row['post_id']; |
