Esempio n. 1
0
<?php

if (class_exists('cfg')) {
    // scans the entire config directory (/config/..)
    // iterates through all the folders in the config directory
    foreach (cfg::scanDirectory() as $config_file) {
        // looks for the route config - special config parsing
        switch ($config_file) {
            case 'errors.ini':
                $errors = cfg::registerErrorsConfig();
                break;
            case 'routes.ini':
                $routes = cfg::registerRoutesConfig();
                break;
            default:
                // normal config parsing (not a routes config)
                cfg::registerConfig($config_file);
        }
    }
    if (defined('BASE_DIRECTORY')) {
        define('HOST_PATH', $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        // remove the base directory path and removing any / characters from left or right of the path
        $parameters = explode('/', trim(str_replace(strtolower(BASE_DIRECTORY), '', HOST_PATH), '/'));
        // registering the users request parameters (url path)
        $path = trim(str_replace(strtolower(BASE_DIRECTORY) . '/', '', HOST_PATH));
        #var_dump(HOST_PATH);
        #var_dump($_SERVER['REQUEST_URI']);
        //var_dump(BASE_DIRECTORY); // $_SERVER['REQUEST_URI']
        //var_dump($_SERVER); // $_SERVER['REQUEST_URI']
        //var_dump($path); // $_SERVER['REQUEST_URI']
        //var_dump(ltrim($path, $_SERVER['HTTP_HOST'].'/'));