Пример #1
0
 static function buildNavbar()
 {
     $html = '';
     $role = AuthHandler::getRole();
     $acl = $GLOBALS['acl'];
     $logged = $role !== ROLE_GUEST;
     // Put branding bar if we want one
     if (getConfiguration('branding.enable')) {
         $html .= ViewRenderer::renderToString('views/branding.php');
     }
     $html .= '<div id="navbar">';
     if ($logged) {
         $pages =& self::$pagesMember;
         // Put the right ref on the logout link
         $pages[4]['params'] = array('ref' => Utils::getRunningScript());
         // If we have no ride yet, the name of join.php is still "Join"
         if (!AuthHandler::isRideRegistered()) {
             $pages[1]['name'] = 'Join';
         }
     } else {
         $pages =& self::$pagesGuest;
     }
     $str = '<ol>';
     foreach ($pages as $page) {
         if ($acl->isAllowed($role, $page['href'])) {
             $str .= '<li><a href="' . Utils::buildLocalUrl($page['href'], isset($page['params']) ? $page['params'] : null) . '" ';
             if ($page['href'] == Utils::getRunningScript()) {
                 $str .= 'class="selected"';
             }
             $str .= '>' . _($page['name']) . '</a></li>';
         }
     }
     $str .= '</ol>';
     $html .= $str;
     $html .= self::buildLanguageSelector();
     $html .= self::buildRegionSelector();
     $html .= '<div class="clearFloat"></div></div>';
     return $html;
 }
Пример #2
0
        $messages[] = _("Please fill in password and confirmation");
    } else {
        if ($passw1 !== $passw2) {
            $valid = false;
            $messages[] = _("Password and confirmation field does not match");
        } else {
            // Valid
            $password = Utils::hashPassword($passw1);
        }
    }
}
$contactId = AuthHandler::getLoggedInUserId();
// If this contact already exists, it must be an update
$isUpdateContact = $contactId !== false;
// If there are any rides assigned with this contact, it is an update
$isUpdateRide = AuthHandler::isRideRegistered();
// XXX: Policy or something like that for the auth handler
$canUpdateEmail = AuthHandler::getAuthMode() != AuthHandler::AUTH_MODE_LDAP;
$action = $isUpdateRide ? 'update' : 'add';
if (RegionManager::getInstance()->isMultiRegion()) {
    if (!RegionManager::getInstance()->isValidRegion($region)) {
        $messages[] = _("Invalid region");
        $valid = false;
    }
} else {
    $region = RegionManager::getInstance()->getDefaultRegion();
}
if ($valid) {
    $db = DatabaseHelper::getInstance();
    try {
        if ($isUpdateRide) {