From c93a40ed0c8d2570dfc82719a3b56590cf7a92f8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 3 Mar 2007 17:41:21 +0000 Subject: Fixing the following bugs: #8444 (language dependent buttons no longer include the dimensions to allow bigger/smaller translated images) #8414 #8396 #8388 #8216 thanks to bartvb and kellanved for providing possible fixes... git-svn-id: file:///svn/phpbb/trunk@7114 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewforum.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'phpBB/viewforum.php') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 58ee68a38e..1092bdb90f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -405,20 +405,31 @@ $sql_array = array( // the number of stickies are not known $sql = $db->sql_build_query('SELECT', $sql_array); $sql = str_replace('{SQL_TOPIC_TYPE}', ($store_reverse) ? POST_NORMAL : POST_STICKY, $sql); -$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); +$result = $db->sql_query_limit($sql, $sql_limit); $shadow_topic_list = array(); + +// Total number of normal or sticky topics that have been retrieved +$start_count = 0; + +// Number of normal or sticky topics that have been placed $num_rows = 0; + while ($row = $db->sql_fetchrow($result)) { - if ($row['topic_status'] == ITEM_MOVED) + $start_count++; + + if ($start_count >= $sql_start) { - $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; - } + if ($row['topic_status'] == ITEM_MOVED) + { + $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; + } - $rowset[$row['topic_id']] = $row; - $topic_list[] = $row['topic_id']; - $num_rows++; + $rowset[$row['topic_id']] = $row; + $topic_list[] = $row['topic_id']; + $num_rows++; + } } $db->sql_freeresult($result); @@ -427,7 +438,9 @@ if ($num_rows < $sql_limit) { $sql = $db->sql_build_query('SELECT', $sql_array); $sql = str_replace('{SQL_TOPIC_TYPE}', ($store_reverse) ? POST_STICKY : POST_NORMAL, $sql); - $result = $db->sql_query_limit($sql, $sql_limit - $num_rows, $sql_start); + + // Start at $sql_start - number of sticky topics on the previous page ($start_count - $num_rows) + $result = $db->sql_query_limit($sql, $sql_limit - $num_rows, $sql_start - ($start_count - $num_rows)); while ($row = $db->sql_fetchrow($result)) { -- cgit v1.2.1