Exemplo n.º 1
0
    lib::log_exception($e);
    print lib::debugbox();
    exit;
}
# if the application's setup code doesn't define a class named Dispatch,
# create one here which is just empty
if (!class_exists('Dispatch')) {
    class Dispatch extends AbstractDispatch
    {
    }
}
try {
    $dispatch = new Dispatch();
    $dispatch->parse_request();
    $dispatch->invoke_form_handler();
    $dispatch->find_controller_class();
    $dispatch->create_controller();
    $dispatch->render();
} catch (HTTPException $e) {
    header("HTTP/1.1 " . $e->getCode() . ' ' . $e->getMessage());
    header("Content-type: text/html");
    if ($loc = $e->location()) {
        header("Location: {$loc}");
    }
    print $e->body();
    print lib::debugbox();
} catch (DataException $e) {
    header("HTTP/1.1 404 Data Exception");
    if ($j = $e->value()) {
        $json = new JSON();
        $j = $json->encode($j);