/** * Runs the Gleez environment * * @uses Gleez::_set_cookie * @uses Route::set * @uses Route::defaults * @uses Config::load * @uses I18n::initialize * @uses Module::load_modules */ public static function ready() { if (self::$_init) { // Do not allow execution twice return; } // Gleez is now initialized? self::$_init = TRUE; // Set default cookie salt and lifetime self::_set_cookie(); // Check database config file exist or not Gleez::$installed = file_exists(APPPATH . 'config/database.php'); if (Gleez::$installed) { // Database config reader and writer Kohana::$config->attach(new Config_Database()); } if (Kohana::$environment !== Kohana::DEVELOPMENT) { Gleez_Exception::$error_view = 'errors/stack'; } // Turn off notices and strict errors in production if (Kohana::$environment === Kohana::PRODUCTION) { // Turn off notices and strict errors error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT); } // Determine if we are running in a Windows environment Gleez::$isWindows = 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); // Initialize the locale from settings I18n::initialize(); // Disable the kohana powered headers // @todo Remove it, use Gleez::$expose Kohana::$expose = FALSE; /** * If database.php doesn't exist, then we assume that the Gleez is not * properly installed and send to the installer. */ if (!Gleez::$installed) { Session::$default = 'cookie'; Gleez_Exception::$error_view = 'errors/error'; // Static file serving (CSS, JS, images) Route::set('install/media', 'media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'install', 'action' => 'media', 'file' => NULL, 'directory' => 'install')); Route::set('install', '(install(/<action>))', array('action' => 'index|systemcheck|database|install|finalize'))->defaults(array('controller' => 'install', 'directory' => 'install')); return; } // Set the default session type Session::$default = Config::get('site.session_type'); // Initialize Gleez modules Module::load_modules(FALSE); // Load the active theme(s) Theme::load_themes(); }