aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-08-28 15:50:33 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-08-28 15:50:33 +0000
commit1d37b69ddd79d9d6bc1346f3761a899d20305636 (patch)
tree7b795bcfea4d119c86b59a7471be36504b4f9c1b /phpBB/viewtopic.php
parent902285684d08394437650174fa9bdfe6904db85c (diff)
downloadforums-1d37b69ddd79d9d6bc1346f3761a899d20305636.tar
forums-1d37b69ddd79d9d6bc1346f3761a899d20305636.tar.gz
forums-1d37b69ddd79d9d6bc1346f3761a899d20305636.tar.bz2
forums-1d37b69ddd79d9d6bc1346f3761a899d20305636.tar.xz
forums-1d37b69ddd79d9d6bc1346f3761a899d20305636.zip
- some bugfixes
- using E_USER_WARNING if an error occurred within the ACP (sadly not able to use it as a default for trigger_error - it seems to be hardcoded in PHP) git-svn-id: file:///svn/phpbb/trunk@6320 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php42
1 files changed, 39 insertions, 3 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 14ab1f69ee..f05030493c 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -550,7 +550,6 @@ $template->assign_vars(array(
'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&amp;t=$topic_id",
'U_FORUM' => $server_path,
- 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
'U_VIEW_TOPIC' => $viewtopic_url,
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=previous"),
@@ -828,7 +827,14 @@ $db->sql_freeresult($result);
if (!sizeof($post_list))
{
- trigger_error('NO_TOPIC');
+ if ($sort_days)
+ {
+ trigger_error('NO_POSTS_TIME_FRAME');
+ }
+ else
+ {
+ trigger_error('NO_TOPIC');
+ }
}
// Holding maximum post time for marking topic read
@@ -1490,7 +1496,37 @@ if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'
markread('topic', $forum_id, $topic_id, $max_post_time);
// Update forum info
- 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($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false);
+}
+else
+{
+ $all_marked_read = true;
+}
+
+// If there are absolutely no more unread posts in this forum and unread posts shown, we can savely show the #unread link
+if ($all_marked_read && $post_unread)
+{
+ $template->assign_vars(array(
+ 'U_VIEW_UNREAD_POST' => '#unread',
+ ));
+}
+else if (!$all_marked_read)
+{
+ $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false;
+
+ // What can happen is that we are at the last displayed page. If so, we also display the #unread link based in $post_unread
+ if ($last_page && $post_unread)
+ {
+ $template->assign_vars(array(
+ 'U_VIEW_UNREAD_POST' => '#unread',
+ ));
+ }
+ else if (!$last_page)
+ {
+ $template->assign_vars(array(
+ 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
+ ));
+ }
}
// Change encoding if appropriate