Exemplo n.º 1
0
        No2_Logger::err(__FILE__ . ': ' . $_->getMessage());
        header('HTTP/1.1 500 Internal Server Error');
        ?>
            <html>
                <head><title>500 Internal Server Error</title></head>
                <body>
                    <h1>500 Internal Server Error</h1>
                    <p>Please contact the site administrator</p>
                </body>
            </html>
        <?php 
        die;
    }
}
$view = $controller->view();
if (No2_HTTP::is_error($view->status()) && !$controller->can_render_errors()) {
    /*
     * The controller declined error handling, so we load the default error
     * controller to generate the response.
     */
    require_once APPDIR . '/controllers/error.class.php';
    $controller = new ErrorController($view->status());
    unset($view);
    goto invoke_it;
}
/* from this point, $controller and $view are set and valid. */
/*
 * Here we know the status code, log the request and render the requested ressource.
 */
No2_Logger::info("{$_SERVER['REMOTE_ADDR']} - {$_SERVER['REQUEST_METHOD']} - {$_SERVER['REQUEST_URI']} - {$view->status()}");
/* kindly ask the view to render the response */