function func_execute_active_handler()
{
    if (isset($_GET['q'])) {
        $q = format_str($_GET['q']);
        $query = (array) explode('/', $q);
        $GLOBALS['page'] = $query[0];
    } else {
        $query = "";
        $GLOBALS['page'] = "";
    }
    $page = $GLOBALS['func_registry'][$GLOBALS['page']];
    if (!$page) {
        header('HTTP/1.0 404 Not Found');
        die('404 - Page not found.');
    }
    if (isset($page['security']) && $page['security']) {
        user_ensure_authenticated();
    }
    if (isset($page['admin']) && $page['admin']) {
        user_ensure_admin();
    }
    if (function_exists('config_log_request')) {
        config_log_request();
    }
    if (function_exists($page['callback'])) {
        return call_user_func($page['callback'], $query);
    }
    return false;
}
Beispiel #2
0
function menu_execute_active_handler()
{
    $query = (array) explode('/', $_GET['q']);
    $GLOBALS['page'] = $query[0];
    $page = $GLOBALS['menu_registry'][$GLOBALS['page']];
    if (!$page) {
        header('HTTP/1.0 404 Not Found');
        die('404 - Page not found.');
    }
    if ($page['security']) {
        user_ensure_authenticated();
    }
    if (function_exists('config_log_request')) {
        config_log_request();
    }
    if (function_exists($page['callback'])) {
        return call_user_func($page['callback'], $query);
    }
    return false;
}