|
From: Markus P. <mar...@us...> - 2005-04-24 21:33:46
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31294 Modified Files: mx_functions.php mx_functions_phpbb.php Log Message: Massive code cleanup in the includes folder. Also optimized code in several functions. Index: mx_functions_phpbb.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_phpbb.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mx_functions_phpbb.php 16 Apr 2005 01:55:03 -0000 1.6 --- mx_functions_phpbb.php 24 Apr 2005 21:33:36 -0000 1.7 *************** *** 29,33 **** * - mx_message_die (from functions.php) * - mx_block_message (a message_die kind of function for blocks) ! * - mx_redirect (from functions_post.php) */ --- 29,34 ---- * - mx_message_die (from functions.php) * - mx_block_message (a message_die kind of function for blocks) ! * - mx_redirect (from functions.php) ! * - mx_generate_pagination (from functions.php) */ *************** *** 63,114 **** // 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); - // } // 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']; --- 64,98 ---- // Convert the bbcode to html // ! function mx_decode($bbtext, $bbcode_uid) { ! $mytext = stripslashes($bbtext); ! $mytext = bbencode_second_pass($mytext, $bbcode_uid); ! $mytext = mx_smilies_pass($mytext); ! $mytext = str_replace("\n", "\n<br />\n", $mytext); ! $mytext = make_clickable($mytext); return $mytext; } + // // Initialise user settings on page load ! function mx_init_userprefs($userdata) { global $board_config, $theme, $images; ! global $template, $lang, $phpEx, $phpbb_root_path, $mx_root_path; ! global $nav_links; 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']; *************** *** 116,150 **** } ! 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; --- 100,136 ---- } ! 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($mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx) || !file_exists($phpbb_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; *************** *** 153,185 **** } ! $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; --- 139,178 ---- } ! $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, $phpbb_root_path, $mx_root_path; $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE themes_id = $style"; ! if ( !($result = $db->sql_query($sql)) ) { $style = 1; *************** *** 187,208 **** 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; --- 180,202 ---- 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; *************** *** 210,227 **** 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 mx_Template( $mx_root_path . $template_path . $template_name, $board_config, $db ); } else { ! $template = new mx_Template( $mx_root_path . $template_path . $template_name, $board_config, $db ); } --- 204,221 ---- 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 mx_Template($mx_root_path . $template_path . $template_name); } else { ! $template = new mx_Template($mx_root_path . $template_path . $template_name); } *************** *** 230,285 **** 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; $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 ) ) { --- 224,296 ---- 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; + @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, $nav_links, $gen_simple_header, $images, $mx_root_path; ! global $userdata, $user_ip, $session_length; ! global $mx_starttime; ! ! if(defined('HAS_DIED')) ! { ! die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?"); ! } ! ! define('HAS_DIED', 1); ! $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 ) ) { *************** *** 304,347 **** } ! 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 mx_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: --- 315,364 ---- } ! 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 mx_Template($mx_root_path . 'templates/' . $board_config['board_template']); } ! if ( empty($theme) ) { ! $theme = mx_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: *************** *** 372,378 **** 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 == '' ) --- 389,397 ---- 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 == '' ) *************** *** 387,393 **** --- 406,415 ---- 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 ) ) { *************** *** 400,430 **** 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 ); } } --- 422,456 ---- 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); } } *************** *** 456,500 **** } ! // MX - Redeclarations of functions from function.php ! function mx_redirect( $url, $redirect_msg = '', $redirect_link = '' ) { global $db, $lang; ! 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=' . PORTAL_URL . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . PORTAL_URL . $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); } } --- 482,534 ---- } ! ! function mx_redirect($url, $redirect_msg = '', $redirect_link = '') { global $db, $lang; ! if ( empty($redirect_msg) ) { $redirect_msg = $lang['Page_Not_Authorised']; } ! if ( empty($redirect_link) ) { $redirect_link = $lang['Redirect_login']; } ! if ( defined('HEADER_INC') ) { ! $message = $redirect_msg . '<br /><br />' . sprintf($redirect_link, '<a href="' . PORTAL_URL . $url . '">', "</a>") . '<br /><br />'; ! mx_message_die(GENERAL_MESSAGE, $message); ! } ! // ! // Save any possible changes made in session variables, otherwise we will loose them. ! // See comments here: ! // http://www.php.net/session ! // http://www.php.net/session_write_close ! // ! @session_write_close(); ! @session_start(); ! ! if ( !empty($db) ) ! { ! $db->sql_close(); } ! ! if ( strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") ) { ! mx_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=' . PORTAL_URL . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . PORTAL_URL . $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; } *************** *** 503,507 **** // 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') { --- 537,541 ---- // 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') { Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** mx_functions.php 19 Apr 2005 21:52:43 -0000 1.37 --- mx_functions.php 24 Apr 2005 21:33:36 -0000 1.38 *************** *** 49,113 **** // ****************************************************************** // ****************************************************************** ! function get_info( $table, $idfield = "", $id = 0, $idfield2 = "", $id2 = 0 ) { global $db; ! $sql = "SELECT * FROM $table ! WHERE $idfield = '$id' "; ! $sql .= ($idfield2 != "" && $id2 != "") ? "AND $idfield2 = '$id2' " : ""; [...1136 lines suppressed...] } ! ! $module = $db->sql_fetchrowset($result); ! ! $mx_module_copy = '<h1>' . $lang['mx_copy'] . '</h1><hr /><br />'; ! $mx_module_copy .= $lang['mx_copy_text'] . '<br /><br />'; ! $mx_module_copy .= $lang['mx_modules_text'] . '<br />'; ! ! for( $i = 0; $i < count($module); $i++ ) { ! if( !empty($module[$i]['module_version']) ) { $mx_module_copy .= '<br />' . $module[$i]['module_version'] . ', ' . $module[$i]['module_copy']; } } ! ! $mx_module_copy = $mx_module_copy . '<br /><br /><hr />'; ! mx_message_die(GENERAL_MESSAGE, $mx_module_copy, 'Modules info and copyrights'); } |