Esempio n. 1
0
function common_hook_themes_buildmenu($menu_config)
{
    global $core_config, $user_config, $icon_config;
    $main_menu = "";
    foreach ($menu_config as $menu_title => $array_menu) {
        foreach ($array_menu as $sub_menu) {
            $sub_menu_url = $sub_menu[0];
            $sub_menu_title = $sub_menu[1];
            $sub_menu_index = (int) ($sub_menu[2] ? $sub_menu[2] : 10) + 100;
            // devider or valid entry
            if ($sub_menu_url == '#' && $sub_menu_title == '-') {
                $m[$sub_menu_index . '.' . $sub_menu_title] = "<li class=\"divider\"></li>";
            } else {
                if ($sub_menu_url == '#') {
                    $m[$sub_menu_index . '.' . $sub_menu_title] = "<li>" . $sub_menu_title . "</li>";
                } else {
                    if ($sub_menu_url && $sub_menu_title) {
                        if (acl_checkurl($sub_menu_url)) {
                            $m[$sub_menu_index . '.' . $sub_menu_title] = "<li><a href='" . _u($sub_menu_url) . "'>" . $sub_menu_title . "</a></li>";
                        }
                    }
                }
            }
        }
        if (count($m)) {
            $main_menu .= "<li class='dropdown'><a href='#' data-toggle='dropdown' class='dropdown-toggle'>" . $menu_title . " <b class='caret'></b></a>";
            $main_menu .= "<ul class='dropdown-menu'>";
            ksort($m);
            foreach ($m as $mm) {
                $main_menu .= $mm;
            }
            unset($m);
            $main_menu .= "</ul>";
            $main_menu .= "</li>";
        }
    }
    $content = "\n\t\t<nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>\n\t\t\t<div class='navbar-inner'>\n\t\t\t\t<div class='container'>\n\t\t\t\t\t<div class='navbar-header'>\n\t\t\t\t\t\t<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='.navbar-collapse'>\n\t\t\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<a href='" . _u($core_config['main']['main_website_url']) . "' class='brand navbar-brand'>" . $core_config['main']['main_website_name'] . "</a>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='navbar-collapse collapse'>\n\t\t\t\t\t\t<ul class='nav navbar-nav'>\n\t\t\t\t\t\t\t<li class='active'><a href='" . _u(_HTTP_PATH_BASE_) . "'>" . _('Home') . "</a></li>\n\t\t\t\t\t\t\t" . $main_menu . "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<ul class='nav navbar-nav navbar-right'>\n\t\t\t\t\t\t\t<li><a href='" . _u('index.php?app=main&inc=core_auth&route=logout') . "'>" . $icon_config['logout'] . "</a></li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</nav>\n\t";
    return $content;
}
Esempio n. 2
0
/**
 * Check if visitor has been validated
 *
 * @return boolean TRUE if valid
 */
function auth_isvalid()
{
    if ($_SESSION['sid'] && $_SESSION['uid'] && $_SESSION['valid']) {
        $hash = user_session_get('', $_SESSION['sid']);
        if ($_SESSION['sid'] == $hash[key($hash)]['sid'] && $_SESSION['uid'] == $hash[key($hash)]['uid']) {
            return acl_checkurl($_SERVER['QUERY_STRING'], $_SESSION['uid']);
        }
    }
    return FALSE;
}