From 30aeac65dccceab18e19318e5981118f150c0647 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 4 Oct 2002 13:09:10 +0000 Subject: Well, here are all my changes ... don't blame me if things break :D git-svn-id: file:///svn/phpbb/trunk@2923 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 92 +++++++++++++------------------------------- 1 file changed, 27 insertions(+), 65 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9b3d079e31..7ba27c61c2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -165,15 +165,15 @@ function get_moderators(&$forum_moderators, $forum_id = false) // function get_forum_rules($mode, &$rules, &$forum_id) { - global $SID, $acl, $lang, $phpEx; + global $SID, $auth, $lang, $phpEx; - $rules .= ( ( $acl->get_acl($forum_id, 'forum', 'post') ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '
'; - $rules .= ( ( $acl->get_acl($forum_id, 'forum', 'reply') ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '
'; - $rules .= ( ( $acl->get_acl($forum_id, 'forum', 'edit') ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '
'; - $rules .= ( ( $acl->get_acl($forum_id, 'forum', 'delete') || $acl->get_acl($forum_id, 'mod', 'delete') ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '
'; - $rules .= ( ( $acl->get_acl($forum_id, 'forum', 'attach') ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '
'; + $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'post') ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '
'; + $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'reply') ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '
'; + $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'edit') ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '
'; + $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'delete') || $auth->get_acl($forum_id, 'mod', 'delete') ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '
'; + $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'attach') ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '
'; - if ( $acl->get_acl($forum_id, 'mod') ) + if ( $auth->get_acl($forum_id, 'mod') ) { $rules .= sprintf($lang['Rules_moderate'], '', ''); } @@ -183,7 +183,7 @@ function get_forum_rules($mode, &$rules, &$forum_id) function make_jumpbox($action, $match_forum_id = 0) { - global $SID, $acl, $template, $lang, $db, $nav_links, $phpEx; + global $SID, $auth, $template, $lang, $db, $nav_links, $phpEx; // $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id // FROM (( " . FORUMS_TABLE . " f @@ -209,7 +209,7 @@ function make_jumpbox($action, $match_forum_id = 0) { if ( $row['forum_left_id'] > $last_forum_right_id ) { - if ( $acl->get_acl($row['forum_id'], 'forum', 'list') ) + if ( $auth->get_acl($row['forum_id'], 'forum', 'list') ) { $selected = ( $row['forum_id'] == $match_forum_id ) ? 'selected="selected"' : ''; $boxstring .= ''; @@ -496,80 +496,41 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add $on_page = floor($start_item / $per_page) + 1; - $page_string = ''; - if ( $total_pages > 10 ) + $page_string = ( $on_page == 1 ) ? '1' : '' . $lang['Previous'] . '  1'; + + if ( $total_pages > 5 ) { - $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages; + $start_cnt = min(max(1, $on_page - 4), $total_pages - 5); + $end_cnt = max(min($total_pages, $on_page + 4), 6); + + $page_string .= ( $start_cnt > 1 ) ? ' ... ' : ', '; - for($i = 1; $i < $init_page_max + 1; $i++) + for($i = $start_cnt + 1; $i < $end_cnt; $i++) { $page_string .= ( $i == $on_page ) ? '' . $i . '' : '' . $i . ''; - if ( $i < $init_page_max ) + if ( $i < $end_cnt - 1 ) { - $page_string .= ", "; + $page_string .= ', '; } } - if ( $total_pages > 3 ) - { - if ( $on_page > 1 && $on_page < $total_pages ) - { - $page_string .= ( $on_page > 5 ) ? ' ... ' : ', '; - - $init_page_min = ( $on_page > 4 ) ? $on_page : 5; - $init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4; - - for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++) - { - $page_string .= ($i == $on_page) ? '' . $i . '' : '' . $i . ''; - if ( $i < $init_page_max + 1 ) - { - $page_string .= ', '; - } - } - - $page_string .= ( $on_page < $total_pages - 4 ) ? ' ... ' : ', '; - } - else - { - $page_string .= ' ... '; - } - - for($i = $total_pages - 2; $i < $total_pages + 1; $i++) - { - $page_string .= ( $i == $on_page ) ? '' . $i . '' : '' . $i . ''; - if( $i < $total_pages ) - { - $page_string .= ", "; - } - } - } + $page_string .= ( $end_cnt < $total_pages ) ? ' ... ' : ', '; } else { - for($i = 1; $i < $total_pages + 1; $i++) + $page_string .= ', '; + + for($i = 2; $i < $total_pages; $i++) { $page_string .= ( $i == $on_page ) ? '' . $i . '' : '' . $i . ''; - if ( $i < $total_pages ) + if ( $i < $total_pages ) { $page_string .= ', '; } } } - if ( $add_prevnext_text ) - { - if ( $on_page > 1 ) - { - $page_string = ' ' . $lang['Previous'] . '  ' . $page_string; - } - - if ( $on_page < $total_pages ) - { - $page_string .= '  ' . $lang['Next'] . ''; - } - - } + $page_string .= ( $on_page == $total_pages ) ? '' . $total_pages . '' : '' . $total_pages . '  ' . $lang['Next'] . ''; $page_string = $lang['Goto_page'] . ' ' . $page_string; @@ -640,9 +601,10 @@ function obtain_word_list(&$orig_word, &$replacement_word) // failures, etc. // -> ERROR : Use for any error, a simple page will be output // +// $errno, $errstr, $errfile, $errline function message_die($msg_code, $msg_text = '', $msg_title = '') { - global $db, $session, $acl, $template, $board_config, $theme, $lang, $userdata, $user_ip; + global $db, $session, $auth, $template, $board_config, $theme, $lang, $userdata, $user_ip; global $phpEx, $phpbb_root_path, $nav_links, $starttime; switch ( $msg_code ) -- cgit v1.2.1