IPB Portal Script | > Written By Matthew Mecham | > Date started: 1st July 2003 | > Updated: 1st July 2004 (What a coincidence!) | +-------------------------------------------------------------------------- */ //----------------------------------------------- // USER CONFIGURABLE ELEMENTS //----------------------------------------------- // Define the path to where the forums directory is // located. This might be "./forums/" for example. // Don't forget the trailing slash! //define( 'ROOT_PATH', "./" ); define( 'ROOT_PATH', "./forums/" ); define( 'KERNEL_PATH', ROOT_PATH.'ips_kernel/' ); // Define the URL to this script. If you're happy to // use relative URLs - you can leave this blank. // You can also rename the script here. $this_script = 'index.php'; // Enable module usage? // (Vital for some mods and IPB enhancements) define ( 'USE_MODULES', 1 ); // Enable shut down features? // Uses PHPs register_shutdown_function to save // low priority tasks until end of exec define ( 'USE_SHUTDOWN', 0 ); //----------------------------------------------- // NO USER EDITABLE SECTIONS BELOW //----------------------------------------------- define ( 'IN_IPB', 1 ); define ( 'IN_DEV', 0 ); error_reporting (E_ERROR | E_WARNING | E_PARSE); set_magic_quotes_runtime(0); //=========================================================================== // DEBUG CLASS //=========================================================================== class Debug { function startTimer() { global $starttime; $mtime = microtime (); $mtime = explode (' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; } function endTimer() { global $starttime; $mtime = microtime (); $mtime = explode (' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = round (($endtime - $starttime), 5); return $totaltime; } } //=========================================================================== // INFO CLASS //=========================================================================== class info { var $member = array(); var $input = array(); var $session_id = ""; var $base_url = ""; var $vars = ""; var $lang_id = "en"; var $skin = ""; var $lang = ""; var $server_load = 0; var $version = "v2.0.0 "; var $lastclick = ""; var $location = ""; var $debug_html = ""; var $perm_id = ""; var $forum_read = array(); var $topic_cache = ""; var $session_type = ""; var $skin_global = ""; var $loaded_templates = array(); var $converge = ""; function info() { global $sess, $std, $DB, $INFO; $this->vars = &$INFO; $this->vars['AVATARS_URL'] = 'style_avatars'; $this->vars['EMOTICONS_URL'] = 'style_emoticons/<#EMO_DIR#>'; $this->vars['mime_img'] = 'style_images/<#IMG_DIR#>'; } } //=========================================================================== // MAIN PROGRAM //=========================================================================== //-------------------------------- // Import $INFO, now! //-------------------------------- $INFO = array(); require ROOT_PATH."conf_global.php"; //-------------------------------- // The clocks a' tickin' //-------------------------------- $Debug = new Debug; $Debug->startTimer(); //-------------------------------- // Load the DB driver and such //-------------------------------- $INFO['sql_driver'] = ! $INFO['sql_driver'] ? 'mysql' : strtolower($INFO['sql_driver']); require ( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php" ); $DB = new db_driver; $DB->obj['sql_database'] = $INFO['sql_database']; $DB->obj['sql_user'] = $INFO['sql_user']; $DB->obj['sql_pass'] = $INFO['sql_pass']; $DB->obj['sql_host'] = $INFO['sql_host']; $DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_queries.php'; $DB->obj['use_shutdown'] = USE_SHUTDOWN; //----------------------------------- // Required vars? //----------------------------------- if ( is_array( $DB->connect_vars ) and count( $DB->connect_vars ) ) { foreach( $DB->connect_vars as $k => $v ) { $DB->connect_vars[ $k ] = $INFO[ $k ]; } } //-------------------------------- // Get a DB connection //-------------------------------- $DB->connect(); //-------------------------------- // Make CONSTANT //-------------------------------- define( 'SQL_PREFIX', $DB->obj['sql_tbl_prefix'] ); define( 'SQL_DRIVER', $INFO['sql_driver'] ); //-------------------------------- // Wrap it all up in a nice easy to // transport super class //-------------------------------- $ibforums = new info(); //-------------------------------- // Require our global functions //-------------------------------- require ROOT_PATH."sources/functions.php"; require ROOT_PATH."sources/classes/class_display.php"; require ROOT_PATH."sources/classes/class_session.php"; require ROOT_PATH."sources/classes/class_forums.php"; require KERNEL_PATH."class_converge.php"; $std = new FUNC; $print = new display(); $sess = new session(); $forums = new forum_functions(); //-------------------------------- // Set up our vars //-------------------------------- $ibforums->input = $std->parse_incoming(); //-------------------------------- // Set converge //-------------------------------- $ibforums->converge = new class_converge( $DB ); //=========================================================================== // Get cache... //=========================================================================== $DB->simple_construct( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key IN ( 'badwords', 'emoticons', 'attachtypes','bbcode', 'multimod','ranks','profilefields', 'banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages' )" ) ); $DB->simple_exec(); while ( $r = $DB->fetch_row() ) { if ( $r['cs_key'] == 'settings' ) { $tmp = unserialize(stripslashes($r['cs_value'])); if ( is_array( $tmp ) and count( $tmp ) ) { foreach( $tmp as $k => $v ) { $ibforums->vars[ $k ] = $v; } } unset( $tmp ); } else { if ( $r['cs_array'] ) { $ibforums->cache[ $r['cs_key'] ] = unserialize(stripslashes($r['cs_value'])); } else { $ibforums->cache[ $r['cs_key'] ] = $r['cs_value']; } } } if ( ! isset( $ibforums->cache['systemvars'] ) ) { $DB->simple_exec_query( array( 'delete' => 'cache_store', 'where' => "cs_key='systemvars'" ) ); $DB->do_insert( 'cache_store', array( 'cs_key' => 'systemvars', 'cs_value' => addslashes(serialize(array())), 'cs_array' => 1 ) ); } //-------------------------------- // Set debug mode //-------------------------------- $DB->obj['debug'] = ($ibforums->vars['sql_debug'] == 1) ? intval($_GET['debug']) : 0; //-------------------------------- // Initialize the FUNC //-------------------------------- $std->FUNC_init(); //-------------------------------- // The rest :D //-------------------------------- $ibforums->member = $sess->authorise(); $std->load_skin(); $ibforums->lastclick = $sess->last_click; $ibforums->location = $sess->location; $ibforums->session_id = $sess->session_id; // Used in URLs $ibforums->my_session = $sess->session_id; // Used in code //-------------------------------- // Initialize the forums //-------------------------------- //-------------------------------- // Set up cache path //-------------------------------- if ( $ibforums->vars['ipb_cache_path'] ) { define( 'CACHE_PATH', $ibforums->vars['ipb_cache_path'] ); } else { define( 'CACHE_PATH', ROOT_PATH ); } $forums->strip_invisible = 1; $forums->forums_init(); list($ppu,$tpu) = explode( "&", $ibforums->member['view_prefs'] ); $ibforums->vars['display_max_topics'] = ($tpu > 0) ? $tpu : $ibforums->vars['display_max_topics']; $ibforums->vars['display_max_posts'] = ($ppu > 0) ? $ppu : $ibforums->vars['display_max_posts']; //=========================================================================== // Set up the session ID stuff //=========================================================================== if ( $ibforums->session_type == 'cookie' ) { $ibforums->session_id = ""; $ibforums->base_url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?'; } else { $ibforums->base_url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?s='.$ibforums->session_id.'&'; } $ibforums->js_base_url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?s='.$ibforums->session_id.'&'; //-------------------------------- // Set up the forum_read cookie //-------------------------------- $std->hdl_forum_read_cookie(); //=========================================================================== // Set up defaults //=========================================================================== $ibforums->skin_id = $ibforums->skin['_setid']; $ibforums->vars['img_url'] = 'style_images/' . $ibforums->skin['_imagedir']; //-------------------------------- // Set up our language choice //-------------------------------- if ($ibforums->vars['default_language'] == "") { $ibforums->vars['default_language'] = 'en'; } //-------------------------------- // Did we choose a language? //-------------------------------- If ( $ibforums->input['setlanguage'] and $ibforums->input['langid'] and $ibforums->member['id'] ) { if ( is_array( $ibforums->cache['languages'] ) and count( $ibforums->cache['languages'] ) ) { foreach( $ibforums->cache['languages'] as $idx => $data ) { if ( $data['ldir'] == $ibforums->input['langid'] ) { $DB->do_update( 'members', array( 'language' => $data['ldir'] ), 'id='.$ibforums->member['id'] ); $ibforums->member['language'] = $data['ldir']; } } } } $ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : $ibforums->vars['default_language']; if ( ($ibforums->lang_id != $ibforums->vars['default_language']) and (! is_dir( ROOT_PATH."lang/".$ibforums->lang_id ) ) ) { $ibforums->lang_id = $ibforums->vars['default_language']; } $ibforums->lang = $std->load_words($ibforums->lang, 'lang_global', $ibforums->lang_id); //-------------------------------- // Upload dir? //-------------------------------- $ibforums->vars['upload_dir'] = $ibforums->vars['upload_dir'] ? $ibforums->vars['upload_dir'] : ROOT_PATH.'uploads'; //=========================================================================== // DECONSTRUCTOR //=========================================================================== if ( USE_SHUTDOWN and $ibforums->input['act'] != 'task' ) { chdir( ROOT_PATH ); $ROOT_PATH = getcwd(); register_shutdown_function( array( &$std, 'my_deconstructor') ); } //-------------------------------- // Require and run //-------------------------------- require ROOT_PATH."sources/ipbportal.php"; $run = new ipdl(); $run->auto_run(); //+------------------------------------------------- // GLOBAL ROUTINES //+------------------------------------------------- function fatal_error($message="", $help="") { echo("$message

$help"); exit; } ?>