From b58fca84e6eb70e55db6ba61a999bd94829b2ee7 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 19 Feb 2002 22:09:08 +0000 Subject: [PATCH] Fix bug #520039, moved topics with wrong goto page links git-svn-id: file:///svn/phpbb/trunk@2198 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewforum.php | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 054cae5587..ebf6d88b85 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -443,8 +443,12 @@ if( $total_topics ) { for($i = 0; $i < $total_topics; $i++) { + $topic_id = $topic_rowset[$i]['topic_id']; + $topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title']; + $replies = $topic_rowset[$i]['topic_replies']; + $topic_type = $topic_rowset[$i]['topic_type']; if( $topic_type == POST_ANNOUNCE ) @@ -465,38 +469,6 @@ if( $total_topics ) $topic_type .= $lang['Topic_Poll'] . " "; } - $topic_id = $topic_rowset[$i]['topic_id']; - - $replies = $topic_rowset[$i]['topic_replies']; - - if( ( $replies + 1 ) > $board_config['posts_per_page'] ) - { - $total_pages = ceil(($replies+1)/$board_config['posts_per_page']); - $goto_page = ' [ ' . $lang['Goto_page'] . '' . $lang['Goto_page'] . ': '; - - $times = 1; - for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) - { - $goto_page .= '' . $times . ''; - if( $times == 1 && $total_pages > 4 ) - { - $goto_page .= ' ... '; - $times = $total_pages - 3; - $j += ( $total_pages - 4 ) * $board_config['posts_per_page']; - } - else if ( $times < $total_pages ) - { - $goto_page .= ', '; - } - $times++; - } - $goto_page .= ' ] '; - } - else - { - $goto_page = ''; - } - if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED ) { $topic_type = $lang['Topic_Moved'] . " "; @@ -604,6 +576,34 @@ if( $total_topics ) $newest_post_img = ''; } } + + if( ( $replies + 1 ) > $board_config['posts_per_page'] ) + { + $total_pages = ceil(($replies+1)/$board_config['posts_per_page']); + $goto_page = ' [ ' . $lang['Goto_page'] . '' . $lang['Goto_page'] . ': '; + + $times = 1; + for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) + { + $goto_page .= '' . $times . ''; + if( $times == 1 && $total_pages > 4 ) + { + $goto_page .= ' ... '; + $times = $total_pages - 3; + $j += ( $total_pages - 4 ) * $board_config['posts_per_page']; + } + else if ( $times < $total_pages ) + { + $goto_page .= ', '; + } + $times++; + } + $goto_page .= ' ] '; + } + else + { + $goto_page = ''; + } $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");