Example #1
0
    if (!_DEBUG) {
        ob_start();
    }
    // What the visitor want to do ?
    $action = isset($_GET['action']) && !empty($_GET['action']) ? $_GET['action'] : _DEFAULT_ACTION;
    // Initiate Cookies
    Factory::getInstance('Cookie', _COOKIE_NAME);
    // Initiate Session
    Factory::getInstance('Session');
    // Initiate Lang
    Factory::getInstance('Lang');
    // What Params ? Priority to the requested
    $params = $_GET + $_POST;
    try {
        // Control !
        $output = Controller::check($action, $params);
    } catch (FileNotFoundException $e) {
        // 404
        header('HTTP/1.1 404 File Not Found');
        exit;
    }
    F::i('Session')->close();
    $output = Tools::parseOutput($output);
    if (!_DEBUG) {
        ob_end_clean();
    }
} catch (DatabaseException $e) {
    Record::note($e->__toString());
    die('DB Error : ' . $e->getMessage());
} catch (SessionException $e) {
    // Hacking attempt