/** * Begin the application. This causes the environment to be setup as necessary. * * @param string Path to application configuration directory. See {@link $_configDir}. * @param string Path to application root directory. See {@link $_rootDir}. * @param boolean True to load default data (config, DB, etc) */ public function beginApplication($configDir = '.', $rootDir = '.', $loadDefaultData = true) { if ($this->_initialized) { return; } if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { self::undoMagicQuotes($_GET); self::undoMagicQuotes($_POST); self::undoMagicQuotes($_COOKIE); self::undoMagicQuotes($_REQUEST); } if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) { @set_magic_quotes_runtime(false); } @ini_set('memory_limit', 128 * 1024 * 1024); ignore_user_abort(true); @ini_set('output_buffering', false); while (@ob_end_clean()) { } error_reporting(E_ALL | E_STRICT & ~8192); set_error_handler(array('XenForo_Application', 'handlePhpError')); set_exception_handler(array('XenForo_Application', 'handleException')); //@ini_set('pcre.backtrack_limit', 1000000); date_default_timezone_set('UTC'); self::$time = time(); self::$host = empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST']; self::$secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'; require XenForo_Autoloader::getInstance()->autoloaderClassToFile('Lgpl_utf8'); $this->_configDir = $configDir; $this->_rootDir = $rootDir; $this->addLazyLoader('requestPaths', array($this, 'loadRequestPaths')); if ($loadDefaultData) { $this->loadDefaultData(); } $this->_initialized = true; }
/** * Begin the application. This causes the environment to be setup as necessary. * * @param string Path to application configuration directory. See {@link $_configDir}. * @param string Path to application root directory. See {@link $_rootDir}. * @param boolean True to load default data (config, DB, etc) */ public function beginApplication($configDir = '.', $rootDir = '.', $loadDefaultData = true) { if ($this->_initialized) { return; } if (!defined('PHP_VERSION_ID')) { $version = explode('.', PHP_VERSION); define('PHP_VERSION_ID', $version[0] * 10000 + $version[1] * 100 + $version[2]); } if (self::$_initConfig['undoMagicQuotes'] && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { self::undoMagicQuotes($_GET); self::undoMagicQuotes($_POST); self::undoMagicQuotes($_COOKIE); self::undoMagicQuotes($_REQUEST); } if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) { @set_magic_quotes_runtime(false); } if (self::$_initConfig['setMemoryLimit']) { self::setMemoryLimit(64 * 1024 * 1024); } ignore_user_abort(true); if (self::$_initConfig['resetOutputBuffering']) { @ini_set('output_buffering', false); @ini_set('zlib.output_compression', 0); // see http://bugs.php.net/bug.php?id=36514 // and http://xenforo.com/community/threads/53637/ if (!@ini_get('output_handler')) { $level = ob_get_level(); while ($level) { @ob_end_clean(); $newLevel = ob_get_level(); if ($newLevel >= $level) { break; } $level = $newLevel; } } } error_reporting(E_ALL | E_STRICT & ~8192); set_error_handler(array('XenForo_Application', 'handlePhpError')); set_exception_handler(array('XenForo_Application', 'handleException')); register_shutdown_function(array('XenForo_Application', 'handleFatalError')); //@ini_set('pcre.backtrack_limit', 1000000); date_default_timezone_set('UTC'); self::$time = time(); self::$host = empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST']; self::$secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'; require XenForo_Autoloader::getInstance()->autoloaderClassToFile('Lgpl_utf8'); $this->_configDir = $configDir; $this->_rootDir = $rootDir; $this->addLazyLoader('requestPaths', array($this, 'loadRequestPaths')); if ($loadDefaultData) { $this->loadDefaultData(); } // this is a minor hack as people sometimes set _SERVER[HTTPS] in config.php, // so the value may have changed compared to above self::$secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'; $this->_initialized = true; }