Ejemplo n.º 1
0
Archivo: Boot.php Proyecto: eryx/labs
    array_walk_recursive($_FILES, 'array_stripslashes_files');
}
require_once "Core/Common.php";
function __autoload($class)
{
    $class = str_replace('_', '/', $class);
    if (preg_match("#^(.*)/Model/(.*)#i", $class, $regs)) {
        $class = strtolower($regs[1]) . '/models/' . $regs[2];
    }
    require_once $class . ".php";
}
//spl_autoload_register('__autoload');
try {
    $reqs = new Core_Request();
    if (isset($config['routes'])) {
        $reqs->router($config['routes']);
    }
    $ctr = str_replace(array('-', '.'), ' ', $reqs->ctr);
    $ctr = str_replace(' ', '', ucwords($ctr)) . 'Controller';
    $pat = SYS_ROOT . "app/{$reqs->mod}/controllers/";
    if (file_exists($pat . "{$ctr}.php")) {
        require_once $pat . "{$ctr}.php";
    } else {
        if (file_exists($pat . "IndexController.php")) {
            require_once $pat . "IndexController.php";
            $ctr = "IndexController";
        } else {
            throw new Exception('Invalid Request');
        }
    }
    $controller = new $ctr($reqs);