|
From: Markus P. <mar...@us...> - 2005-04-25 12:07:30
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19498 Modified Files: mx_functions_phpbb.php Log Message: Fixed ViewOnline extension for mxBB Portal Pages Index: mx_functions_phpbb.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_phpbb.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mx_functions_phpbb.php 24 Apr 2005 21:33:36 -0000 1.7 --- mx_functions_phpbb.php 25 Apr 2005 12:07:20 -0000 1.8 *************** *** 534,537 **** --- 534,590 ---- // + // ViewOnline extension for mxBB Portal Pages... + // + function mx_get_viewonline_info($session_page) + { + global $db, $lang, $phpEx; + + // + // Cache Page Information in static variables. + // + static $mx_pages_data = false, $mx_pages_count = 0; + + // + // Prevent from reading pages information more than once. + // + if( $pages_data === false ) + { + $sql = "SELECT page_id, page_name FROM " . PAGE_TABLE . " ORDER BY page_id"; + if( !($result = $db->sql_query($sql)) ) + { + $mx_pages_count = 0; + } + else + { + $mx_pages_count = $db->sql_numrows($result); + $mx_pages_data = $db->sql_fetchrowset($result); + } + } + + // + // Compute Page Identifier + // + $page_id = MX_PORTAL_PAGES_OFFSET - $session_page; + + // + // Return array($location, $location_url) OR false when page not found. + // + if( $page_id > 0 && $mx_pages_count > 0 ) + { + for( $i = 0; $i < $mx_pages_count; $i++ ) + { + if( $mx_pages_data[$i]['page_id'] == $page_id ) + { + return array( + $lang['Page'] . ': ' . $mx_pages_data[$i]['page_name'], + PORTAL_URL . "index.$phpEx?page=" . $mx_pages_data[$i]['page_id'] + ); + } + } + } + return false; + } + + // // Pagination routine, generates // page number sequence |