public static function Start($forceStart) { if (ini_get('session.auto_start')) { return; } $existingSession = isset($_COOKIE[session_name()]); if (isset($_COOKIE[session_name()])) { /** * Prevent errors from illegal characters in session_id */ if (!preg_match('/^[a-z0-9\\-]/', $_COOKIE[session_name()])) { unset($_COOKIE[session_name()]); } } if (!self::$_Started && ($existingSession || $forceStart)) { session_start(); /** * Security hash to prevent fixation and hijacking. */ if (!$existingSession) { self::Reset(); } else { $previousSecurityHash = isset($_SESSION[self::SecurityKey]) ? $_SESSION[self::SecurityKey] : null; if ($previousSecurityHash != self::CurrentSecurityHash()) { self::Reset(); } } self::$_Started = true; } }
protected static function Report($errorMessage, $backTrace, $file, $line) { $htmlError = self::BuildBackTrace($errorMessage, $backTrace, $file, $line, true); $textError = self::BuildBackTrace($errorMessage, $backTrace, $file, $line, false); header('Status: 503 Service Temporarily Unavailable'); if (HTTPContext::Enabled()) { echo $htmlError; die; } else { echo $textError; } $userReported = true; if (!$userReported) { /** * Redirect frontend user to generic error */ Util::redirect('/error/500/'); } }
public static function Close() { HTTPContext::Close(); }