|
From: Markus P. <mar...@us...> - 2005-04-25 01:40:20
|
Update of /cvsroot/mxbb/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25930 Modified Files: common.php Log Message: Added basic support for CH210 (ported from 2.7.6) Index: common.php =================================================================== RCS file: /cvsroot/mxbb/core/common.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** common.php 20 Apr 2005 00:20:13 -0000 1.31 --- common.php 25 Apr 2005 01:40:00 -0000 1.32 *************** *** 9,15 **** * description : * ------------------------------------------------------------------------- ! * copyright : (C) 2001 The phpBB Group ! * email : su...@ph... ! * * $Id$ */ --- 9,13 ---- * description : * ------------------------------------------------------------------------- ! * * $Id$ */ *************** *** 22,33 **** */ ! if ( !defined( 'IN_PORTAL' ) ) { ! die( "Hacking attempt" ); } ! define( 'IN_PHPBB', 1 ); @session_start(); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables set_magic_quotes_runtime(0); // Disable magic_quotes_runtime --- 20,36 ---- */ ! if ( !defined('IN_PORTAL') ) { ! die("Hacking attempt"); } ! define('IN_PHPBB', 1); @session_start(); + // ================================================================================ + // The following code is based on common.php from phpBB 2.0.14 + // ================================================================================ + + // error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables set_magic_quotes_runtime(0); // Disable magic_quotes_runtime *************** *** 59,62 **** --- 62,68 ---- // we can validate later with isset($test[$var]) (no in_array()) $test = array('HTTP_GET_VARS' => NULL, 'HTTP_POST_VARS' => NULL, 'HTTP_COOKIE_VARS' => NULL, 'HTTP_SERVER_VARS' => NULL, 'HTTP_ENV_VARS' => NULL, 'HTTP_POST_FILES' => NULL, 'phpEx' => NULL, 'phpbb_root_path' => NULL); + //+MOD: Added by mxBB + $test['mx_root_path'] = NULL; + //-MOD: Added by mxBB // Loop through each input array *************** *** 78,81 **** --- 84,90 ---- // PHP4+ path $not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path'); + //+MOD: Added by mxBB + $not_unset[] = 'mx_root_path'; + //-MOD: Added by mxBB // Not only will array_merge give a warning if a parameter *************** *** 100,104 **** unset($$var); } - unset($$var); } --- 109,112 ---- *************** *** 134,138 **** if( is_array($HTTP_POST_VARS) ) ! { while( list($k, $v) = each($HTTP_POST_VARS) ) { if( is_array($HTTP_POST_VARS[$k]) ) --- 142,147 ---- if( is_array($HTTP_POST_VARS) ) ! { ! while( list($k, $v) = each($HTTP_POST_VARS) ) { if( is_array($HTTP_POST_VARS[$k]) ) *************** *** 173,180 **** } // Define some basic configuration arrays this also prevents // malicious rewriting of language and otherarray values via // URI params ! $board_config = array(); $userdata = array(); --- 182,190 ---- } + // // Define some basic configuration arrays this also prevents // malicious rewriting of language and otherarray values via // URI params ! // $board_config = array(); $userdata = array(); *************** *** 183,278 **** $lang = array(); $nav_links = array(); ! $gen_simple_header = false; $mxbb_footer_addup = array(); ! @include_once( $mx_root_path . 'config.' . $phpEx ); ! if ( !defined( "MX_INSTALLED" ) ) { ! header( "Location: install/mx_install.$phpEx" ); exit; } ! str_replace( "//", "/", $phpbb_root_path ); ! include_once( $mx_root_path . 'config.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/constants.' . $phpEx ); ! include_once( $mx_root_path . 'includes/template.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/sessions.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/auth.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/db.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions_selects.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/bbcode.' . $phpEx ); ! include_once( $mx_root_path . 'includes/mx_constants.' . $phpEx ); ! include_once( $mx_root_path . 'includes/mx_functions.' . $phpEx ); ! include_once( $mx_root_path . 'includes/mx_functions_phpbb.' . $phpEx ); ! include_once( $mx_root_path . 'includes/mx_auth.' . $phpEx ); ! include_once( $mx_root_path . 'includes/mx_cache.' . $phpEx ); - // Changed my mind to make this a session var. one more query (see directly below) to make it all more foolproof ;) - /* - if ( !empty( $HTTP_SESSION_VARS['mx_config'] ) ) - { - $portal_config = $HTTP_SESSION_VARS['mx_config']; - } - else - { - $portal_config = get_info( PORTAL_TABLE, 'portal_id', 1 ); - $HTTP_SESSION_VARS['mx_config'] = $portal_config; - } - */ ! $portal_config = get_info( PORTAL_TABLE, 'portal_id', 1 ); ! define( 'PHPBB_URL', $portal_config['portal_phpbb_url'] ); ! define( 'PORTAL_URL', $portal_config['portal_url'] ); ! define( 'PORTAL_VERSION', $portal_config['portal_version'] ); // instatiate the mx_request_vars class ! $mx_request_vars = new mx_request_vars(); - // Obtain and encode users IP // I'm removing HTTP_X_FORWARDED_FOR ... this may well cause other problems such as // private range IP's appearing instead of the guilty routable IP, tough, don't // even bother complaining ... go scream and shout at the idiots out there who feel // "clever" is doing harm rather than good ... karma is a great thing ... :) ! $client_ip = ( !empty( $HTTP_SERVER_VARS['REMOTE_ADDR'] ) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty( $HTTP_ENV_VARS['REMOTE_ADDR'] ) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); ! $user_ip = encode_ip( $client_ip ); ! // Setup forum wide options, if this fails // then we output a CRITICAL_ERROR since // basic forum information is not available ! ! $sql = "SELECT * ! FROM " . CONFIG_TABLE; ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql ); } ! ! while ( $row = $db->sql_fetchrow( $result ) ) { ! $board_config[$row['config_name']] = $row['config_value']; } ! if ( file_exists( $phpbb_root_path . 'attach_mod' ) ) { ! include_once( $phpbb_root_path . 'attach_mod/attachment_mod.' . $phpEx ); } ! if ( file_exists( 'install' ) || file_exists( 'contrib' ) ) { ! mx_message_die( GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted' ); } // Show 'Board is disabled' message if needed. ! ! if ( $board_config['board_disable'] && !defined( "IN_ADMIN" ) && !defined( "IN_LOGIN" ) ) { ! mx_message_die( GENERAL_MESSAGE, 'Board_disable', 'Information' ); } --- 193,312 ---- $lang = array(); $nav_links = array(); ! $gen_simple_header = FALSE; $mxbb_footer_addup = array(); ! @include_once($mx_root_path . 'config.' . $phpEx); ! if( !defined('MX_INSTALLED') ) { ! header("Location: install/mx_install.$phpEx"); exit; } ! str_replace("//", "/", $phpbb_root_path); ! include_once($mx_root_path . 'config.' . $phpEx); ! include_once($phpbb_root_path . 'includes/constants.' . $phpEx); ! include_once($mx_root_path . 'includes/template.' . $phpEx); ! include_once($phpbb_root_path . 'includes/sessions.' . $phpEx); ! include_once($phpbb_root_path . 'includes/auth.' . $phpEx); ! include_once($phpbb_root_path . 'includes/functions.' . $phpEx); ! include_once($phpbb_root_path . 'includes/db.' . $phpEx); ! include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx); ! include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_constants.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_functions.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_functions_phpbb.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_auth.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_cache.' . $phpEx); ! $portal_config = get_info(PORTAL_TABLE, 'portal_id', 1); ! define('PHPBB_URL', $portal_config['portal_phpbb_url']); ! define('PORTAL_URL', $portal_config['portal_url']); ! define('PORTAL_VERSION', $portal_config['portal_version']); + // // instatiate the mx_request_vars class ! // $mx_request_vars = new mx_request_vars(); + // + // Obtain and encode users IP + // // I'm removing HTTP_X_FORWARDED_FOR ... this may well cause other problems such as // private range IP's appearing instead of the guilty routable IP, tough, don't // even bother complaining ... go scream and shout at the idiots out there who feel // "clever" is doing harm rather than good ... karma is a great thing ... :) + // + $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') ); + $user_ip = encode_ip($client_ip); ! // // Setup forum wide options, if this fails // then we output a CRITICAL_ERROR since // basic forum information is not available ! // ! if( @file_exists($phpbb_root_path . 'includes/class_config.' . $phpEx) && ! @file_exists($phpbb_root_path . 'includes/class_groups.' . $phpEx) ) { ! include($mx_root_path . 'includes/mx_functions_ch.'.$phpEx); } ! else { ! $sql = "SELECT * ! FROM " . CONFIG_TABLE; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql); ! } ! ! while ( $row = $db->sql_fetchrow($result) ) ! { ! $board_config[$row['config_name']] = $row['config_value']; ! } } ! //++ MX System ! // ! // if ( $language ) ! // { ! // $board_config['default_lang'] = $language; ! // setcookie('default_lang', $language, (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); ! // } ! // elseif ( isset($HTTP_COOKIE_VARS['default_lang']) ) ! // { ! // $board_config['default_lang'] = $HTTP_COOKIE_VARS['default_lang']; ! // } ! // if ( $style ) ! // { ! // $board_config['default_style'] = $style; ! // setcookie('default_style', $style, (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); ! // } ! // elseif ( isset($HTTP_COOKIE_VARS['default_style']) ) ! // { ! // $board_config['default_style'] = $HTTP_COOKIE_VARS['default_style']; ! // } ! // ! //-- MX System ! ! if( file_exists($phpbb_root_path . 'attach_mod') ) { ! include_once($phpbb_root_path . 'attach_mod/attachment_mod.' . $phpEx); } ! if( file_exists('install') || file_exists('contrib') ) { ! mx_message_die(GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted'); } + // // Show 'Board is disabled' message if needed. ! // ! if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") ) { ! mx_message_die(GENERAL_MESSAGE, 'Board_disable', 'Information'); } |