From 74d60e4c1a2400d8f62966c6310decc40ed8f3b4 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 2 Aug 2002 16:39:02 +0000 Subject: [PATCH] Pagination updates ... new function for on_page git-svn-id: file:///svn/phpbb/trunk@2810 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e932100724..365b9c2fe9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -458,7 +458,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add $total_pages = ceil($num_items/$per_page); - if ( $total_pages == 1 ) + if ( $total_pages == 1 || !$num_items ) { return ''; } @@ -545,6 +545,13 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add return $page_string; } +function on_page($num_items, $per_page, $start) +{ + global $lang; + + return sprintf($lang['Page_of'], floor( $start / $per_page ) + 1, max(ceil( $num_items / $per_page ), 1) ); +} + // // Obtain list of naughty words and build preg style replacement arrays for use by the // calling script, note that the vars are passed as references this just makes it easier @@ -587,6 +594,13 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $display_header switch ( $msg_code ) { case MESSAGE: + if ( !$userdata ) + { + $userdata = $session->start(); + $acl = new auth('admin', $userdata); + $session->configure($userdata); + } + if ( !defined('HEADER_INC') ) { $page = ( !defined('IN_ADMIN') ) ? 'includes/page_header.' : 'admin/page_header_admin.';