diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-03-21 01:38:58 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-03-21 01:38:58 +0000 |
commit | 93ab935dc837f05de435597c904be5f84bb8deff (patch) | |
tree | 13a6c2cab3a42060e2ecea30d49003dab133ff2d /phpBB | |
parent | 1a36478d596067e6e54c7a9229642a112702afa0 (diff) | |
download | forums-93ab935dc837f05de435597c904be5f84bb8deff.tar forums-93ab935dc837f05de435597c904be5f84bb8deff.tar.gz forums-93ab935dc837f05de435597c904be5f84bb8deff.tar.bz2 forums-93ab935dc837f05de435597c904be5f84bb8deff.tar.xz forums-93ab935dc837f05de435597c904be5f84bb8deff.zip |
Update goto page code
git-svn-id: file:///svn/phpbb/trunk@2385 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/search.php | 45 |
1 files 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 = '[ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': '; + $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] ); + $goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $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 .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>'; + if( $times == 1 && $total_pages > 4 ) { - if( $j + $board_config['topics_per_page'] >= $replies + 1 ) - { - $goto_page .= ' ... <a href="' . $base_url . '">' . $times . '</a>'; - } + $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 .= '<a href="' . $base_url . '">' . $times . '</a>'; + $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 = '<img src="' . $folder_new . '" alt="' . $lang['New_posts'] . '" title="' . $lang['New_posts'] . '" />'; - $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_post'] . "\" title=\"" . $lang['View_newest_post'] . "\" border=\"0\" /></a> "; + $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else { @@ -1023,7 +1016,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id ) { $folder_image = '<img src="' . $folder_new . '" alt="' . $lang['New_posts'] . '" title="' . $lang['New_posts'] . '" />'; - $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_post'] . "\" title=\"" . $lang['View_newest_post'] . "\" border=\"0\" /></a> "; + $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else { |