1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

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
This commit is contained in:
Paul S. Owen 2001-08-23 11:43:45 +00:00
parent 714f77f6ce
commit c7a0d17672

View File

@ -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 t.topic_poster = u.user_id
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id AND p.poster_id = u2.user_id
AND ( t.topic_type = " . POST_GLOBAL_ANNOUNCE . " AND t.topic_type = " . POST_ANNOUNCE . "
OR t.topic_type = " . POST_ANNOUNCE . " )
ORDER BY p.post_time DESC"; ORDER BY p.post_time DESC";
if(!$ta_result = $db->sql_query($sql)) 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_announcements = $db->sql_numrows($ta_result);
//
// Total topics ...
//
$total_topics += $total_announcements;
// //
// Define censored word matches // Define censored word matches
// //
@ -374,21 +378,21 @@ $template->assign_vars(array(
// //
// Okay, lets dump out the page ... // Okay, lets dump out the page ...
// //
if($total_topics || $total_announcements) if($total_topics)
{ {
// //
// First get announcements // 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 // 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++) for($i = 0; $i < $total_topics; $i++)
@ -461,10 +465,8 @@ if($total_topics || $total_announcements)
$topic_type = $lang['Topic_Moved'] . " "; $topic_type = $lang['Topic_Moved'] . " ";
$topic_id = $topic_rowset[$i]['topic_moved_id']; $topic_id = $topic_rowset[$i]['topic_moved_id'];
} }
else else
{ {
if($topic_rowset[$i]['topic_type'] == POST_ANNOUNCE) if($topic_rowset[$i]['topic_type'] == POST_ANNOUNCE)
{ {
$folder = $images['folder_announce']; $folder = $images['folder_announce'];
@ -520,7 +522,6 @@ if($total_topics || $total_announcements)
$folder_image = "<img src=\"$folder\" alt=\"" . $lang['No_new_posts'] . "\" />"; $folder_image = "<img src=\"$folder\" alt=\"" . $lang['No_new_posts'] . "\" />";
} }
} }
} }
$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");