<?php

/**
 * @package boot
 */
// Set appropriate error reporting:
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
// Turn off old-style magic:
ini_set('magic_quotes_runtime', false);
// Redirect to installer if it exists
if (!file_exists(CONFIG)) {
    $bInsideInstaller = (bool) preg_match('%(/|\\\\)install(/|\\\\)index.php$%', $_SERVER['SCRIPT_FILENAME']);
    if (!$bInsideInstaller && Symphony::isInstallerAvailable()) {
        header(sprintf('Location: %s/install/', URL));
        exit;
    } else {
        if (!$bInsideInstaller) {
            die('<h2>Error</h2><p>Could not locate Symphony configuration file. Please check <code>manifest/config.php</code> exists.</p>');
        }
    }
} else {
    // Load configuration file:
    include CONFIG;
    Symphony::initialiseConfiguration($settings);
    Symphony::initialiseErrorHandler();
    Symphony::initialiseDatabase();
    Symphony::initialiseExtensionManager();
    // Handle custom admin paths, #702
    $adminPath = Symphony::Configuration()->get('admin-path', 'symphony');
    $adminPath = is_null($adminPath) ? 'symphony' : $adminPath;
    if (isset($_GET['symphony-page']) && strpos($_GET['symphony-page'], $adminPath, 0) === 0) {