indvdum@0: true, indvdum@0: '_GET' => true, indvdum@0: '_POST' => true, indvdum@0: '_COOKIE' => true, indvdum@0: '_REQUEST' => true, indvdum@0: '_SERVER' => true, indvdum@0: '_SESSION' => true, indvdum@0: '_ENV' => true, indvdum@0: '_FILES' => true, indvdum@0: 'phpEx' => true, indvdum@0: 'phpbb_root_path' => true indvdum@0: ); indvdum@0: indvdum@0: // Not only will array_merge and array_keys give a warning if indvdum@0: // a parameter is not an array, array_merge will actually fail. indvdum@0: // So we check if _SESSION has been initialised. indvdum@0: if (!isset($_SESSION) || !is_array($_SESSION)) indvdum@0: { indvdum@0: $_SESSION = array(); indvdum@0: } indvdum@0: indvdum@0: // Merge all into one extremely huge array; unset this later indvdum@0: $input = array_merge( indvdum@0: array_keys($_GET), indvdum@0: array_keys($_POST), indvdum@0: array_keys($_COOKIE), indvdum@0: array_keys($_SERVER), indvdum@0: array_keys($_SESSION), indvdum@0: array_keys($_ENV), indvdum@0: array_keys($_FILES) indvdum@0: ); indvdum@0: indvdum@0: foreach ($input as $varname) indvdum@0: { indvdum@0: if (isset($not_unset[$varname])) indvdum@0: { indvdum@0: // Hacking attempt. No point in continuing unless it's a COOKIE (so a cookie called GLOBALS doesn't lock users out completely) indvdum@0: if ($varname !== 'GLOBALS' || isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS'])) indvdum@0: { indvdum@0: exit; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $cookie = &$_COOKIE; indvdum@0: while (isset($cookie['GLOBALS'])) indvdum@0: { indvdum@0: if (!is_array($cookie['GLOBALS'])) indvdum@0: { indvdum@0: break; indvdum@0: } indvdum@0: indvdum@0: foreach ($cookie['GLOBALS'] as $registered_var => $value) indvdum@0: { indvdum@0: if (!isset($not_unset[$registered_var])) indvdum@0: { indvdum@0: unset($GLOBALS[$registered_var]); indvdum@0: } indvdum@0: } indvdum@0: $cookie = &$cookie['GLOBALS']; indvdum@0: } indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: unset($GLOBALS[$varname]); indvdum@0: } indvdum@0: indvdum@0: unset($input); indvdum@0: } indvdum@0: indvdum@0: // Register globals and magic quotes have been dropped in PHP 5.4 indvdum@0: if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) indvdum@0: { indvdum@0: /** indvdum@0: * @ignore indvdum@0: */ indvdum@0: define('STRIP', false); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: @set_magic_quotes_runtime(0); indvdum@0: indvdum@0: // Be paranoid with passed vars indvdum@0: if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get')) indvdum@0: { indvdum@0: deregister_globals(); indvdum@0: } indvdum@0: indvdum@0: define('STRIP', (get_magic_quotes_gpc()) ? true : false); indvdum@0: } indvdum@0: indvdum@0: // Prevent date/time functions from throwing E_WARNING on PHP 5.3 by setting a default timezone indvdum@0: if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) indvdum@0: { indvdum@0: // For PHP 5.1.0 the date/time functions have been rewritten indvdum@0: // and setting a timezone is required prior to calling any date/time function. indvdum@0: indvdum@0: // Since PHP 5.2.0 calls to date/time functions without having a timezone set indvdum@0: // result in E_STRICT errors being thrown. indvdum@0: // Note: We already exclude E_STRICT errors indvdum@0: // (to be exact: they are not included in E_ALL in PHP 5.2) indvdum@0: indvdum@0: // In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems indvdum@0: // because we show E_WARNING errors and do not set a default timezone. indvdum@0: // This is because we have our own timezone handling and work in UTC only anyway. indvdum@0: indvdum@0: // So what we basically want to do is set our timezone to UTC, indvdum@0: // but we don't know what other scripts (such as bridges) are involved, indvdum@0: // so we check whether a timezone is already set by calling date_default_timezone_get(). indvdum@0: indvdum@0: // Unfortunately, date_default_timezone_get() itself might throw E_WARNING indvdum@0: // if no timezone has been set, so we have to keep it quiet with @. indvdum@0: indvdum@0: // date_default_timezone_get() tries to guess the correct timezone first indvdum@0: // and then falls back to UTC when everything fails. indvdum@0: // We just set the timezone to whatever date_default_timezone_get() returns. indvdum@0: date_default_timezone_set(@date_default_timezone_get()); indvdum@0: } indvdum@0: indvdum@0: $starttime = explode(' ', microtime()); indvdum@0: $starttime = $starttime[1] + $starttime[0];