Example #1
0
$target = 'locale';
$languages = getDirs("../{$target}", $checkFn);
$params = $_GET;
for ($i = 0; $i < count($languages); $i++) {
    $language = $languages[$i];
    $params['lang'] = $language;
    $href = '?' . http_build_query($params);
    $icon = "themes/default/flags/" . strtolower(substr($language, 3)) . ".png";
    $languages[$i] = array($language, $href, $icon);
}
/* Generate menu */
$menu = array();
$menu['index.php'] = array(__('Home'), 0);
if ($user->isValid()) {
    $menu['info.php'] = array(__('My info'), 0);
    if ($user->isEnabled()) {
        if (configgetvalue('system', 'ucp', NULL, 'showMoneyflow')) {
            $menu['moneyflow.php'] = array(__('Moneyflow'), 0);
        }
        if (pluginExists('scratchcard')) {
            $menu['paywithcard.php'] = array(__('Fund by card'), 0);
        }
    }
}
if (configgetvalue('system', 'ucp', NULL, 'showTariffs')) {
    $menu['tariffs.php'] = array(__('Tariffs'), 0);
}
if (configgetvalue('system', 'ucp', NULL, 'showDocuments')) {
    $menu['documents.php'] = array(__('Documents'), 0);
}
if ($user->isValid() && pluginExists('message')) {
 /**
  * Check if user authorization is allowed 
  * according to site rules
  * 
  * @param User $usr
  */
 protected function authorize(User $usr)
 {
     if (!$usr->isEnabled()) {
         $this->doLogout();
         throw new RuntimeException("Account is disabled", static::EXCEPTION_ACCOUNT_DISABLED);
     }
 }