Exemple #1
0
<?php

\System\Database::init();
if (Godmode\Router::entered($request)) {
    Godmode\Router::init();
    if ($request->logged_in()) {
        if (!\Godmode\Gatekeeper::canAccessGodmode($request->user)) {
            throw new \System\Error\AccessDenied();
        }
    } else {
        $url_login = \System\Router::get_url($request->host, 'god_login');
        if ($request->path != $url_login) {
            redirect_now($url_login);
        }
    }
}
<?php

$policy = function ($rq, $res) {
    $user = $rq->user->to_object();
    $user['name_full'] = $rq->user->get_name();
    $date = new DateTime();
    $rq->fconfig = array_merge_recursive($rq->fconfig, array('gm' => array('time' => $date->format('c'), 'user' => $user, 'menu' => Godmode\Router::get_menu())));
    return true;
};