|
From: <mxb...@li...> - 2005-03-16 00:16:38
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9296 Modified Files: mx_functions.php Log Message: Moved all cloned phpBB function into its own includes script. Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mx_functions.php 6 Mar 2005 01:10:14 -0000 1.25 --- mx_functions.php 16 Mar 2005 00:16:27 -0000 1.26 *************** *** 22,113 **** /** * Included functions in this file: - * - mx_smilies_pass (from bbcode.php - validated for phpbb 2.0.10) - * - mx_decode * - get_info * - get_exists * - get_list * - get_list_formatted * - get_list_static * - get_list_multiple * - get_list_opt - * - read_block_config * - poll_select - * - mx_init_userprefs (from functions.php - validated for phpbb 2.0.10) - * - mx_setup_style (from functions.php - validated for phpbb 2.0.10) - * - mx_message_die (from functions.php - validated for phpbb 2.0.10) - * - mx_block_info * - mx_url - * - mx_generate_smilies (from functions_post.php - validated for phpbb 2.0.10) - * - mx_redirect (from functions_post.php - validated for phpbb 2.0.10) - * - mx_get_groups * - mx_this_url * - post_icons * - mx_add_search_words */ - function mx_smilies_pass( $message ) - { - static $orig, $repl; - - if ( !isset( $orig ) ) - { - global $db, $board_config; - $orig = $repl = array(); - - $sql = 'SELECT * FROM ' . SMILIES_TABLE; - if ( !$result = $db->sql_query( $sql ) ) - { - mx_message_die( GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql ); - } - $smilies = $db->sql_fetchrowset( $result ); - - if ( count( $smilies ) ) - { - usort( $smilies, 'smiley_sort' ); - } - - for( $i = 0; $i < count( $smilies ); $i++ ) - { - $orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote( $smilies[$i]['code'], "/" ) . "(?=.\W|\W.|\W$)/"; - $repl[] = '<img src="' . PHPBB_URL . $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />'; - } - } - - if ( count( $orig ) ) - { - $message = preg_replace( $orig, $repl, ' ' . $message . ' ' ); - $message = substr( $message, 1, -1 ); - } - return $message; - } - // Convert the bbcode to html - function mx_decode( $bbtext, $bbcode_uid ) - { - global $board_config; - - $mytext = stripslashes( $bbtext ); - $mytext = bbencode_second_pass( $mytext, $bbcode_uid ); - - $smilies_path = $board_config['smilies_path']; - $board_config['smilies_path'] = PHPBB_URL . $board_config['smilies_path']; - $mytext = smilies_pass( $mytext ); - $board_config['smilies_path'] = $smilies_path; - - $mytext = str_replace( "\n", "\n<br />\n", $mytext ); - $mytext = make_clickable( $mytext ); - - return $mytext; - } - // Old mx_decode function - // function mx_decode($message, $bbcode_uid ) { - // $message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message); - // $message = bbencode_second_pass($message, $bbcode_uid) ; - // $message = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); - // $message = make_clickable($message); - // $message = mx_smilies_pass($message); - // $message = str_replace("\n", "\n<br />\n", $message); - // $message = str_replace("\'","'",$message); - // return($message); - // } // ****************************************************************** // ****************************************************************** --- 22,49 ---- /** * Included functions in this file: * - get_info + * - get_old_items * - get_exists * - get_list + * - get_mx_select_list * - get_list_formatted * - get_list_static * - get_list_multiple * - get_list_opt * - poll_select * - mx_url * - mx_this_url * - post_icons + * - get_page_id + * - mx_db_remove + * - mx_db_add + * - mx_do_install_upgrade + * - mx_get_groups * - mx_add_search_words + * - mx_remove_search_post + * - qsort_multiarray + * - compose_mx_copy */ // ****************************************************************** // ****************************************************************** *************** *** 572,1076 **** } - - // Initialise user settings on page load - function mx_init_userprefs( $userdata ) - { - global $board_config, $theme, $images; - global $template, $lang, $phpEx, $mx_root_path, $phpbb_root_path; - - if ( $userdata['user_id'] != ANONYMOUS ) - { - if ( !empty( $userdata['user_lang'] ) ) - { - $board_config['default_lang'] = $userdata['user_lang']; - } - - if ( !empty( $userdata['user_dateformat'] ) ) - { - $board_config['default_dateformat'] = $userdata['user_dateformat']; - } - - if ( isset( $userdata['user_timezone'] ) ) - { - $board_config['board_timezone'] = $userdata['user_timezone']; - } - } - - if ( !file_exists( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ) ) - { - $board_config['default_lang'] = 'english'; - } - - if ( file_exists( $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ) ) - { - include( $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); - } - - if ( file_exists( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ) ) - { - include( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); - } - - if ( defined( 'IN_ADMIN' ) ) - { - if ( !file_exists( $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx ) || !file_exists( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx ) ) - { - $board_config['default_lang'] = 'english'; - } - - include( $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx ); - include( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx ); - } - // Set up style - if ( !$board_config['override_user_style'] ) - { - if ( $userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0 ) - { - if ( $theme = mx_setup_style( $userdata['user_style'] ) ) - { - return; - } - } - } - - $theme = mx_setup_style( $board_config['default_style'] ); - // Mozilla navigation bar - // Default items that should be valid on all pages. - // Defined here to correctly assign the Language Variables - // and be able to change the variables within code. - $nav_links['top'] = array ( 'url' => append_sid( $phpbb_root_path . 'index.' . $phpEx ), - 'title' => sprintf( $lang['Forum_Index'], $board_config['sitename'] ) - ); - $nav_links['search'] = array ( 'url' => append_sid( $phpbb_root_path . 'search.' . $phpEx ), - 'title' => $lang['Search'] - ); - $nav_links['help'] = array ( 'url' => append_sid( $phpbb_root_path . 'faq.' . $phpEx ), - 'title' => $lang['FAQ'] - ); - $nav_links['author'] = array ( 'url' => append_sid( $phpbb_root_path . 'memberlist.' . $phpEx ), - 'title' => $lang['Memberlist'] - ); - - return; - } - - function mx_setup_style( $style, $only_template = false ) - { - global $db, $board_config, $template, $images, $mx_root_path, $phpbb_root_path; - - $sql = "SELECT * - FROM " . THEMES_TABLE . " - WHERE themes_id = $style"; - if ( !( $result = $db->sql_query( $sql ) ) ) - { - $style = 1; - $sql = "SELECT * - FROM " . THEMES_TABLE . " - WHERE themes_id = $style"; - if ( !( $result = $db->sql_query( $sql ) ) ) - { - mx_message_die( CRITICAL_ERROR, 'Could not query database for theme info' ); - } - } - - if ( !( $row = $db->sql_fetchrow( $result ) ) ) - { - mx_message_die( CRITICAL_ERROR, "Could not get theme data for themes_id [$style]" ); - } - - $template_path = 'templates/' ; - $template_name = $row['template_name'] ; - // MX FIX for uninstalled themes ... use subSilver instead - if ( !file_exists( $mx_root_path . $template_path . $template_name . '/mx_login.tpl' ) ) - { - $template_path = 'templates/' ; - $template_name = 'subSilver' ; - - $style = 1; - $sql = "SELECT * - FROM " . THEMES_TABLE . " - WHERE themes_id = $style"; - if ( !( $result = $db->sql_query( $sql ) ) ) - { - mx_message_die( CRITICAL_ERROR, 'Could not query database for theme info' ); - } - if ( !( $row = $db->sql_fetchrow( $result ) ) ) - { - mx_message_die( CRITICAL_ERROR, "Could not get theme data for themes_id [$style]" ); - } - - $template = new Template( $mx_root_path . $template_path . $template_name, $board_config, $db ); - } - else - { - $template = new Template( $mx_root_path . $template_path . $template_name, $board_config, $db ); - } - - if ( $only_template ) - { - return $row; - } - // call when only_template is false. - define( 'TEMPLATE_ROOT_PATH', $template_path . $template_name . '/' ); - - if ( $template ) - { - $current_template_path = $template_path . $template_name; - - if ( file_exists( $mx_root_path . $template_path . $template_name . '/' . $template_name . '.cfg' ) ) - { - @include( $mx_root_path . $template_path . $template_name . '/' . $template_name . '.cfg' ); - } - else - { - @include( $phpbb_root_path . $template_path . $template_name . '/' . $template_name . '.cfg' ); - } - - if ( !defined( 'TEMPLATE_CONFIG' ) ) - { - mx_message_die( CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__ ); - } - - $img_lang = ( file_exists( $phpbb_root_path . $current_template_path . '/images/lang_' . $board_config['default_lang'] ) ) ? $board_config['default_lang'] : 'english'; - while ( list( $key, $value ) = @each( $images ) ) - { - if ( !is_array( $value ) ) - { - $images[$key] = str_replace( '{LANG}', 'lang_' . $img_lang, $value ); - } - } - } - return $row; - } - // This is general replacement for die(), allows templated - // output in users (or default) language, etc. - // $msg_code can be one of these constants: - // GENERAL_MESSAGE : Use for any simple text message, eg. results - // of an operation, authorisation failures, etc. - // GENERAL ERROR : Use for any error which occurs _AFTER_ the - // common.php include and session code, ie. most errors in - // pages/functions - // CRITICAL_MESSAGE : Used when basic config data is available but - // a session may not exist, eg. banned users - // CRITICAL_ERROR : Used when config data cannot be obtained, eg - // no database connection. Should _not_ be used in 99.5% of cases - function mx_message_die( $msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '' ) - { - global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $mx_root_path, $nav_links, $gen_simple_header, $images; - global $userdata, $user_ip, $session_length, $page_title; - global $starttime; - - $sql_store = $sql; - // Get SQL error if we are debugging. Do this as soon as possible to prevent - // subsequent queries from overwriting the status of sql_error() - if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) - { - $sql_error = $db->sql_error(); - - $debug_text = ''; - - if ( $sql_error['message'] != '' ) - { - $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message']; - } - - if ( $sql_store != '' ) - { - $debug_text .= "<br /><br />$sql_store"; - } - - if ( $err_line != '' && $err_file != '' ) - { - $debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file; - } - } - - if ( empty( $userdata ) && ( $msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR ) ) - { - $userdata = session_pagestart( $user_ip, PAGE_INDEX ); - mx_init_userprefs( $userdata ); - } - // If the header hasn't been output then do it - if ( !defined( 'HEADER_INC' ) && $msg_code != CRITICAL_ERROR ) - { - if ( empty( $lang ) ) - { - if ( !empty( $board_config['default_lang'] ) ) - { - include( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); - } - else - { - include( $mx_root_path . 'language/lang_english/lang_main.' . $phpEx ); - } - } - - if ( empty( $template ) ) - { - $template = new Template( $mx_root_path . 'templates/' . $board_config['board_template'] ); - } - if ( empty( $theme ) ) - { - $theme = setup_style( $board_config['default_style'] ); - } - // Load the Page Header - if ( !defined( 'IN_ADMIN' ) ) - { - include( $mx_root_path . 'includes/page_header.' . $phpEx ); - } - else - { - include( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); - } - } - - switch ( $msg_code ) - { - case GENERAL_MESSAGE: - if ( $msg_title == '' ) - { - $msg_title = $lang['Information']; - } - break; - - case CRITICAL_MESSAGE: - if ( $msg_title == '' ) - { - $msg_title = $lang['Critical_Information']; - } - break; - - case GENERAL_ERROR: - if ( $msg_text == '' ) - { - $msg_text = $lang['An_error_occured']; - } - - if ( $msg_title == '' ) - { - $msg_title = $lang['General_Error']; - } - break; - - case CRITICAL_ERROR: - // Critical errors mean we cannot rely on _ANY_ DB information being - // available so we're going to dump out a simple echo'd statement - include( $mx_root_path . 'language/lang_english/lang_main.' . $phpEx ); - - if ( $msg_text == '' ) - { - $msg_text = $lang['A_critical_error']; - } - - if ( $msg_title == '' ) - { - $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>'; - } - break; - } - // Add on DEBUG info if we've enabled debug mode and this is an error. This - // prevents debug info being output for general messages should DEBUG be - // set TRUE by accident (preventing confusion for the end user!) - if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) - { - if ( $debug_text != '' ) - { - $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text; - } - } - - if ( $msg_code != CRITICAL_ERROR ) - { - if ( !empty( $lang[$msg_text] ) ) - { - $msg_text = $lang[$msg_text]; - } - - if ( !defined( 'IN_ADMIN' ) ) - { - $template->set_filenames( array( 'message_body' => 'message_body.tpl' ) - ); - } - else - { - $template->set_filenames( array( 'message_body' => 'admin/admin_message_body.tpl' ) - ); - } - $template->assign_vars( array( 'MESSAGE_TITLE' => $msg_title, - 'MESSAGE_TEXT' => $msg_text ) - ); - $template->pparse( 'message_body' ); - - if ( !defined( 'IN_ADMIN' ) ) - { - include( $mx_root_path . 'includes/page_tail.' . $phpEx ); - } - else - { - include( $mx_root_path . 'admin/page_footer_admin.' . $phpEx ); - } - } - else - { - echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>"; - } - - exit; - } - - function mx_block_info( $msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '' ) - { - global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $mx_root_path, $nav_links, $gen_simple_header; - global $userdata, $user_ip, $session_length; - global $starttime; - - $sql_store = $sql; - // Get SQL error if we are debugging. Do this as soon as possible to prevent - // subsequent queries from overwriting the status of sql_error() - if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) - { - $sql_error = $db->sql_error(); - - $debug_text = ''; - - if ( $sql_error['message'] != '' ) - { - $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message']; - } - - if ( $sql_store != '' ) - { - $debug_text .= "<br /><br />$sql_store"; - } - - if ( $err_line != '' && $err_file != '' ) - { - $debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file; - } - } - - if ( empty( $userdata ) && ( $msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR ) ) - { - $userdata = session_pagestart( $user_ip, PAGE_INDEX ); - init_userprefs( $userdata ); - } - // If the header hasn't been output then do it - if ( !defined( 'HEADER_INC' ) && $msg_code != CRITICAL_ERROR ) - { - if ( empty( $lang ) ) - { - if ( !empty( $board_config['default_lang'] ) ) - { - include( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); - } - else - { - include( $mx_root_path . 'language/lang_english/lang_main.' . $phpEx ); - } - } - - if ( empty( $template ) ) - { - $template = new Template( $mx_root_path . 'templates/' . $board_config['board_template'] ); - } - if ( empty( $theme ) ) - { - $theme = setup_style( $board_config['default_style'] ); - } - // Load the Page Header - if ( !defined( 'IN_ADMIN' ) ) - { - include( $mx_root_path . 'includes/page_header.' . $phpEx ); - } - else - { - include( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); - } - } - - switch ( $msg_code ) - { - case GENERAL_MESSAGE: - if ( $msg_title == '' ) - { - $msg_title = $lang['Information']; - } - break; - - case CRITICAL_MESSAGE: - if ( $msg_title == '' ) - { - $msg_title = $lang['Critical_Information']; - } - break; - - case GENERAL_ERROR: - if ( $msg_text == '' ) - { - $msg_text = $lang['An_error_occured']; - } - - if ( $msg_title == '' ) - { - $msg_title = $lang['General_Error']; - } - break; - - case CRITICAL_ERROR: - // Critical errors mean we cannot rely on _ANY_ DB information being - // available so we're going to dump out a simple echo'd statement - include( $mx_root_path . 'language/lang_english/lang_main.' . $phpEx ); - - if ( $msg_text == '' ) - { - $msg_text = $lang['A_critical_error']; - } - - if ( $msg_title == '' ) - { - $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>'; - } - break; - } - // Add on DEBUG info if we've enabled debug mode and this is an error. This - // prevents debug info being output for general messages should DEBUG be - // set TRUE by accident (preventing confusion for the end user!) - if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) - { - if ( $debug_text != '' ) - { - $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text; - } - } - - if ( $msg_code != CRITICAL_ERROR ) - { - if ( !empty( $lang[$msg_text] ) ) - { - $msg_text = $lang[$msg_text]; - } - - if ( !defined( 'IN_ADMIN' ) ) - { - $template->set_filenames( array( 'message_body' => 'message_body.tpl' ) - ); - } - else - { - $template->set_filenames( array( 'message_body' => 'admin/admin_message_body.tpl' ) - ); - } - - $template->assign_vars( array( 'MESSAGE_TITLE' => $msg_title, - 'MESSAGE_TEXT' => $msg_text ) - ); - $template->pparse( 'message_body' ); - } - else - { - echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>"; - } - } - function mx_url() { --- 508,511 ---- *************** *** 1138,1289 **** return ( $url ); } - // Fill smiley templates (or just the variables) with smileys - // Either in a window or inline - function mx_generate_smilies( $mode, $page_id ) - { - global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path, $phpbb_root_path; - global $user_ip, $session_length, $starttime; - global $userdata; - - $inline_columns = 4; - $inline_rows = 5; - $window_columns = 8; - - if ( $mode == 'window' ) - { - $userdata = session_pagestart( $user_ip, $page_id ); - mx_init_userprefs( $userdata ); - - $gen_simple_header = true; - // $page_title = $lang['Review_topic'] . " - $topic_title"; - $page_title = $lang['Emoticons'] . " - $topic_title"; - include( $mx_root_path . 'includes/page_header.' . $phpEx ); - - $template->set_filenames( array( 'smiliesbody' => 'mx_posting_smilies.tpl' ) - ); - } - - $sql = "SELECT emoticon, code, smile_url - FROM " . SMILIES_TABLE . " - ORDER BY smilies_id"; - if ( $result = $db->sql_query( $sql ) ) - { - $num_smilies = 0; - $rowset = array(); - while ( $row = $db->sql_fetchrow( $result ) ) - { - if ( empty( $rowset[$row['smile_url']] ) ) - { - $rowset[$row['smile_url']]['code'] = str_replace( '\\', '\\\\', str_replace( "'", "\\'", $row['code'] ) ); - $rowset[$row['smile_url']]['emoticon'] = $row['emoticon']; - $num_smilies++; - } - } - - if ( $num_smilies ) - { - $smilies_count = ( $mode == 'inline' ) ? min( 19, $num_smilies ) : $num_smilies; - $smilies_split_row = ( $mode == 'inline' ) ? $inline_columns - 1 : $window_columns - 1; - - $s_colspan = 0; - $row = 0; - $col = 0; - - while ( list( $smile_url, $data ) = @each( $rowset ) ) - { - if ( !$col ) - { - $template->assign_block_vars( 'smilies_row', array() ); - } - - $template->assign_block_vars( 'smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], - 'SMILEY_IMG' => PHPBB_URL . $board_config['smilies_path'] . '/' . $smile_url, - 'SMILEY_DESC' => $data['emoticon'] ) - ); - - $s_colspan = max( $s_colspan, $col + 1 ); - - if ( $col == $smilies_split_row ) - { - if ( $mode == 'inline' && $row == $inline_rows - 1 ) - { - break; - } - $col = 0; - $row++; - } - else - { - $col++; - } - } - - if ( $mode == 'inline' && $num_smilies > $inline_rows * $inline_columns ) - { - $template->assign_block_vars( 'switch_smilies_extra', array() ); - - $template->assign_vars( array( 'L_MORE_SMILIES' => $lang['More_emoticons'], - 'U_MORE_SMILIES' => append_sid( PORTAL_URL . "more_smilies.$phpEx?mode=smilies" ) ) - ); - } - - $template->assign_vars( array( 'FIELD' => 'block_info', - 'L_EMOTICONS' => $lang['Emoticons'], - 'L_CLOSE_WINDOW' => $lang['Close_window'], - 'S_SMILIES_COLSPAN' => $s_colspan ) - ); - } - } - - if ( $mode == 'window' ) - { - $template->pparse( 'smiliesbody' ); - - include( $mx_root_path . 'includes/page_tail.' . $phpEx ); - } - } - - // MX - Redeclarations of functions from function.php - function mx_redirect( $url, $redirect_msg = '', $redirect_link = '' ) - { - global $db, $board_config, $template, $lang, $page_id; - - if ( $redirect_msg == '' ) - { - $redirect_msg = $lang['Page_Not_Authorised']; - } - if ( $redirect_link == '' ) - { - $redirect_link = $lang['Redirect_login']; - } - - if ( !defined( 'HEADER_INC' ) ) - { - if ( !empty( $db ) ) - { - $db->sql_close(); - } - - if ( strstr( urldecode( $url ), "\n" ) || strstr( urldecode( $url ), "\r" ) ) - { - message_die( GENERAL_ERROR, 'Tried to redirect to potentially insecure url.' ); - } - // Redirect via an HTML form for PITA webservers - if ( @preg_match( '/Microsoft|WebSTAR|Xitami/', getenv( 'SERVER_SOFTWARE' ) ) ) - { - header( 'Refresh: 0; URL=' . PORTAL_URL . $url ); - echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $server_protocol . $server_name . $server_port . $script_name . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $server_protocol . $server_name . $server_port . $script_name . $url . '">HERE</a> to be redirected</div></body></html>'; - exit; - } - // Behave as per HTTP/1.1 spec for others - header( 'Location: ' . PORTAL_URL . $url ); - exit; - } - else - { - $message = $redirect_msg . '<br /><br />' . sprintf( $redirect_link, '<a href="' . $url . '">', "</a>" ) . '<br /><br />'; - mx_message_die( GENERAL_MESSAGE, $message ); - } - } // MX add-on --- 573,576 ---- *************** *** 1971,2075 **** } - // - // Pagination routine, generates - // page number sequence - // Only difference from standard phpbb function is you can use more settings - - function mx_generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE, $use_next_symbol = false,$use_previous_symbol = false,$add_preinfo_text = TRUE, $name_id = 'start') - { - global $lang; - - $total_pages = ceil($num_items/$per_page); - - if ( $total_pages == 1 ) - { - return ''; - } - - $previous_string = $use_next_symbol ? '«' : $lang['Previous']; - $next_string = $use_previous_symbol ? '»' : $lang['Next']; - - $on_page = floor($start_item / $per_page) + 1; - - $page_string = ''; - if ( $total_pages > 10 ) - { - $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages; - - for($i = 1; $i < $init_page_max + 1; $i++) - { - $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&".$name_id."=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>'; - if ( $i < $init_page_max ) - { - $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) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&".$name_id."=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>'; - 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 ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&".$name_id."=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>'; - if( $i < $total_pages ) - { - $page_string .= ","; - } - } - } - } - else - { - for($i = 1; $i < $total_pages + 1; $i++) - { - $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&".$name_id."=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>'; - if ( $i < $total_pages ) - { - $page_string .= ','; - } - } - } - - if ( $add_prevnext_text ) - { - if ( $on_page > 1 ) - { - $page_string = ' <a href="' . append_sid($base_url . "&".$name_id."=" . ( ( $on_page - 2 ) * $per_page ) ) . '">' . $previous_string . '</a> ' . $page_string; - } - - if ( $on_page < $total_pages ) - { - $page_string .= ' <a href="' . append_sid($base_url . "&".$name_id."=" . ( $on_page * $per_page ) ) . '">' . $next_string . '</a>'; - } - - } - $pre_text = $add_preinfo_text ? $lang['Goto_page'] : ''; - $page_string = $pre_text . ' ' . $page_string; - - return $page_string; - } - function compose_mx_copy( ) { --- 1258,1261 ---- |