From 93ab935dc837f05de435597c904be5f84bb8deff Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 21 Mar 2002 01:38:58 +0000 Subject: [PATCH] Update goto page code git-svn-id: file:///svn/phpbb/trunk@2385 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 8d23987962..f5b3ef26ba 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -825,13 +825,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) if( $userdata['session_logged_in'] && $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) { - if( !empty($tracking_topics['' . $topic_id . '']) && !empty($tracking_forums['' . $forum_id . '']) ) + if( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) ) { - $topic_last_read = ( $tracking_topics['' . $topic_id . ''] > $tracking_forums['' . $forum_id . ''] ) ? $tracking_topics['' . $topic_id . ''] : $tracking_forums['' . $forum_id . '']; + $topic_last_read = ( $tracking_topics[$topic_id] > $tracking_forums[$forum_id] ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id]; } - else if( !empty($tracking_topics['' . $topic_id . '']) || !empty($tracking_forums['' . $forum_id . '']) ) + else if( !empty($tracking_topics[$topic_id]) || !empty($tracking_forums[$forum_id]) ) { - $topic_last_read = ( !empty($tracking_topics['' . $topic_id . '']) ) ? $tracking_topics['' . $topic_id . ''] : $tracking_forums['' . $forum_id . '']; + $topic_last_read = ( !empty($tracking_topics[$topic_id]) ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id]; } if( $searchset[$i]['post_time'] > $topic_last_read ) @@ -867,7 +867,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) } else { - $message = ""; + $message = ''; if( count($orig_word) ) { @@ -897,35 +897,28 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) $views = $searchset[$i]['topic_views']; $replies = $searchset[$i]['topic_replies']; - if( $replies > $board_config['topics_per_page'] ) + if( ( $replies + 1 ) > $board_config['posts_per_page'] ) { - $goto_page = '[ ' . $lang['Goto_page'] . '' . $lang['Goto_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']) { - $base_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j&highlight=$highlight_active"); - - if( $times > 4 ) + $goto_page .= '' . $times . ''; + if( $times == 1 && $total_pages > 4 ) { - if( $j + $board_config['topics_per_page'] >= $replies + 1 ) - { - $goto_page .= ' ... ' . $times . ''; - } + $goto_page .= ' ... '; + $times = $total_pages - 3; + $j += ( $total_pages - 4 ) * $board_config['posts_per_page']; } - else + else if ( $times < $total_pages ) { - if( $times != 1 ) - { - $goto_page .= ', '; - } - - $goto_page .= '' . $times . ''; + $goto_page .= ', '; } - $times++; } - $goto_page .= ' ]'; + $goto_page .= ' ] '; } else { @@ -975,7 +968,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) { if( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) { - if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_all"]) ) + if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { $unread_topics = true; @@ -1008,7 +1001,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) { $folder_image = '' . $lang['New_posts'] . ''; - $newest_post_img = "\"" "; + $newest_post_img = '' . $lang['View_newest_post'] . ' '; } else { @@ -1023,7 +1016,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) { $folder_image = '' . $lang['New_posts'] . ''; - $newest_post_img = "\"" "; + $newest_post_img = '' . $lang['View_newest_post'] . ' '; } else {