From c7a0d176722ff508ba8dbefe2e1407efca06e46c Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 23 Aug 2001 11:43:45 +0000 Subject: Fixed problem with not all topics being displayed when there were announcements git-svn-id: file:///svn/phpbb/trunk@916 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewforum.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'phpBB/viewforum.php') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index bc47f2c9c9..ad8d132cdc 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -255,8 +255,7 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i AND t.topic_poster = u.user_id AND p.post_id = t.topic_last_post_id AND p.poster_id = u2.user_id - AND ( t.topic_type = " . POST_GLOBAL_ANNOUNCE . " - OR t.topic_type = " . POST_ANNOUNCE . " ) + AND t.topic_type = " . POST_ANNOUNCE . " ORDER BY p.post_time DESC"; if(!$ta_result = $db->sql_query($sql)) { @@ -264,6 +263,11 @@ if(!$ta_result = $db->sql_query($sql)) } $total_announcements = $db->sql_numrows($ta_result); +// +// Total topics ... +// +$total_topics += $total_announcements; + // // Define censored word matches // @@ -374,21 +378,21 @@ $template->assign_vars(array( // // Okay, lets dump out the page ... // -if($total_topics || $total_announcements) +if($total_topics) { // // First get announcements // - while( $row = $db->sql_fetchrow($ta_result) ) + while( $ta_row = $db->sql_fetchrow($ta_result) ) { - $topic_rowset[] = $row; + $topic_rowset[] = $ta_row; } // // Now get everything else // - while( $row = $db->sql_fetchrow($t_result) ) + while( $t_row = $db->sql_fetchrow($t_result) ) { - $topic_rowset[] = $row; + $topic_rowset[] = $t_row; } for($i = 0; $i < $total_topics; $i++) @@ -461,10 +465,8 @@ if($total_topics || $total_announcements) $topic_type = $lang['Topic_Moved'] . " "; $topic_id = $topic_rowset[$i]['topic_moved_id']; } - else { - if($topic_rowset[$i]['topic_type'] == POST_ANNOUNCE) { $folder = $images['folder_announce']; @@ -520,7 +522,6 @@ if($total_topics || $total_announcements) $folder_image = "\"""; } } - } $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); -- cgit v1.2.1