Example #1
0
<?php

session_name('KNSESSID');
session_start();
require_once __DIR__ . '/global.inc.php';
try {
    Router::loadPost();
    Router::loadGet();
    $published = true;
    if (isset($_GET['force']) && $_GET['force'] == '1') {
        $published = null;
    }
    KLib\RouterKorona::go($published);
} catch (Exception $e) {
    //LOG EXCEPTION
    if (!in_array($e->getCode(), array(200, 204, 542))) {
        KLib\Log::info($e->getCode() . ' ' . $e->getMessage());
        if (C::g('DEV')) {
            KLib\Log::warning("\n" . $e->getTraceAsString());
        }
        header('Content-Type: text/html');
    }
    //FORMAT EXCEPTION
    switch ($e->getCode()) {
        case 204:
            header('HTTP/1.1 204 OK');
            break;
        case 401:
            KLib\BaseController::run('error', 'authenticate', array('exception' => $e));
            break;
        case 403: