Ejemplo n.º 1
0
        exit;
    } elseif (file_exists($schema)) {
        // Validate config file if schema exists
        $config_validator->check(json_decode(Configurator::stripComments(file_get_contents($filename))), json_decode(file_get_contents($schema)));
        if (!$config_validator->isValid()) {
            echo "JSON ({$file}.json) does not validate. Violations:\n";
            foreach ($config_validator->getErrors() as $error) {
                echo sprintf("[%s] %s\n", $error['property'], $error['message']);
            }
            exit;
        }
    }
}
// Start loading config files
try {
    $config = Configurator::load($config_files);
} catch (Exception $e) {
    // TODO: show nice error page
    echo $e->getMessage();
    exit;
}
// Pass on the configuration
app\core\Config::setConfig($config);
// General getallheaders function
if (!function_exists("getallheaders")) {
    function getallheaders()
    {
        foreach ($_SERVER as $name => $value) {
            if (substr($name, 0, 5) == "HTTP_") {
                $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value;
            } else {