// Remove base folders from the URL if webroot is hosted in a subfolder if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) { $url = substr($url, strlen(BASE_URL)); } /** * Include SilverStripe's core code */ require_once 'core/startup/ErrorControlChain.php'; require_once 'core/startup/ParameterConfirmationToken.php'; // Prepare tokens and execute chain $reloadToken = ParameterConfirmationToken::prepare_tokens(array('isTest', 'isDev', 'flush')); $chain = new ErrorControlChain(); $chain->then(function ($chain) use($reloadToken) { // If no redirection is necessary then we can disable error supression if (!$reloadToken) { $chain->setSuppression(false); } // Load in core require_once 'core/Core.php'; // Connect to database require_once 'model/DB.php'; global $databaseConfig; if ($databaseConfig) { DB::connect($databaseConfig); } // Check if a token is requesting a redirect if (!$reloadToken) { return; } // Otherwise, we start up the session if needed if (!isset($_SESSION) && Session::request_contains_session_id()) {