start(); class root { function kill( $msg ) { die( "Fatal Error: ". $msg ."" ); } } $bin = new root; $reqVer = array( "core" => "1.1", "functions" => "1.0", "session" => "1.0", "display" => "1.1", "query" => "1.0", "binBase" => "1.0", "module" => "1.0", ); $lang = array(); require_once LP ."lang_global.php"; require_once LP ."core.php"; if ( CORE_VER < $reqVer['core'] ) $bin->kill( sprintf( $lang['libVer'], "core", $reqVer['core'] ) ); $conf = array(); if ( !file_exists( RP ."config.php" ) ) $bin->kill( sprintf( $lang['not_exists'], RP ."config.php" ) ); if ( !is_writable( RP ."config.php" ) ) $bin->kill( sprintf( $lang['not_writable'], RP ."config.php" ) ); require_once RP ."config.php"; $bin = new core( $conf, $lang, PROG_VER, PROG_NAME ); $db = ""; define( "SKINDIR", RP . $bin->conf['skin_dir'] ."/" ); if ( IN_SITE != 3 ) define( "LANGDIR", $bin->conf['language'] ."/" ); $libFiles = array( "functions", "session", "display", "binBase", "module" ); foreach ( $libFiles as $k => $lib ) { if ( !file_exists( LP . $lib .".php" ) ) $bin->kill( sprintf( $lang['noLib'], $lib ) ); require_once LP . $lib .".php"; if ( constant( $lib ."_VERSION" ) < $reqVer[$lib] ) $bin->kill( sprintf( $lang['libVer'], $lib, $reqVer[$lib] ) ); } $bin->module = new module; if ( IN_SITE != 3 && $bin->conf['uses_database'] ) { foreach ( $db as $driver ) { $driver = $driver->name; $db->$driver->inf = $bin->conf['db'][$db->$driver->name]; if ( method_exists( $db->$driver, "connect" ) ) $db->$driver->connect(); } } class skin {} $bin->skin = new skin; $bin->display = new display( SKINDIR, ( IN_SITE == 3 ) ? "" : LANGDIR ); $bin->func = new functions; $bin->sess = new session; if ( IN_SITE != 3 && $bin->conf['uses_sessions'] ) { session_set_save_handler( array( &$bin->sess, '_open' ), array( &$bin->sess, '_close' ), array( &$bin->sess, '_read' ), array( &$bin->sess, '_write' ), array( &$bin->sess, '_destroy' ), array( &$bin->sess, '_gc' ) ); session_start(); } if ( file_exists( SP ."globals.php" ) ) { require_once( SP ."globals.php" ); $bin->globals = new globals(); } if ( isset( $bin->URL[0] ) && $bin->URL[0] == '!GET!' && isset( $bin->URL[1] ) && isset( $bin->URL[2] ) && file_exists( SKINDIR. 'images/'. $bin->URL[2] ) && !strstr( $bin->URL[2], "/" ) ) { if ( $bin->URL[1] == '!CSS!' ) $bin->display->getCSS( $bin->URL[2] ); elseif ( $bin->URL[1] == '!JS!' ) $bin->display->getJS( $bin->URL[2] ); } else { if ( IN_SITE != 3 && $bin->conf['uses_sessions'] ) { if ( $bin->sess->eatCookie( "_s" ) || $bin->sess->eatCookie( "_r" ) ) $bin->sess->restore(); elseif ( IN_SITE == 2 ) $bin->URL[0] = "login"; else $bin->sess->createGuest(); } if ( IN_SITE != 3 && !$bin->conf['offline'] && !IN_DEV || ( IN_DEV && ADMIN ) ) $offline = 0; elseif ( IN_SITE != 3 && $bin->conf['offline'] ) $offline = 1; elseif ( IN_SITE != 3 && IN_DEV && !ADMIN ) $offline = 2; if ( IN_SITE != 3 && !isset( $bin->URL[0] ) || $bin->URL[0] == "" || preg_match( "#^(.+?)/(.+?)$#i", $bin->URL[0] ) || !file_exists( SP . $bin->URL[0] .".php" ) ) $bin->URL[0] = "index"; if ( IN_SITE != 3 ) { require_once SP . $bin->URL[0] .".php"; $page = new $bin->URL[0]; } else $page = new setup(); $bin->display->output['content'] = $page->output; $bin->getDebug( DEBUG_LEVEL ); if ( !defined( "SUPPRESS" ) ) $bin->display->showPage( $offline ); } if ( $bin->conf['uses_database'] ) { foreach ( $db as $driver ) { $driver = $driver->name; if ( method_exists( $db->$driver, "close" ) ) $db->$driver->close(); } } ?>