Ejemplo n.º 1
0
function tbg_get_timezones()
{
    return TBGI18n::getTimezones();
}
Ejemplo n.º 2
0
<?php

$themes = TBGContext::getThemes();
$languages = TBGI18n::getLanguages();
?>
<table style="clear: both; width: 700px; margin-top: 5px;" class="padded_table" cellpadding=0 cellspacing=0>
	<tr>
		<td><label for="requirelogin"><?php 
echo __('Require re-authentication');
?>
</label></td>
		<td>
			<select name="<?php 
echo TBGSettings::SETTING_ELEVATED_LOGIN_DISABLED;
?>
" id="disableelevatedlogin" style="width: 400px;"<?php 
if ($access_level != TBGSettings::ACCESS_FULL) {
    ?>
 disabled<?php 
}
?>
>
				<option value=0<?php 
if (TBGSettings::isElevatedLoginRequired()) {
    ?>
 selected<?php 
}
?>
><?php 
echo __('You need to re-enter your password to access the configuration section');
?>
Ejemplo n.º 3
0
 /**
  * "My account" page
  *  
  * @param TBGRequest $request
  */
 public function runMyAccount(TBGRequest $request)
 {
     $this->forward403unless($this->getUser()->hasPageAccess('account'));
     $notificationsettings = array();
     $i18n = $this->getI18n();
     $notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ISSUES] = $i18n->__('Automatically subscribe to issues I get involved in');
     $notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ARTICLES] = $i18n->__('Automatically subscribe to article I get involved in');
     $notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new issues that are created in my project(s)');
     $notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_NEW_ARTICLES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new articles that are created in my project(s)');
     $this->notificationsettings = $notificationsettings;
     $this->has_autopassword = TBGContext::hasMessage('auto_password');
     if ($this->has_autopassword) {
         $this->autopassword = TBGContext::getMessage('auto_password');
     }
     if ($request->isPost() && $request->hasParameter('mode')) {
         switch ($request['mode']) {
             case 'information':
                 if (!$request['buddyname'] || !$request['email']) {
                     $this->getResponse()->setHttpStatus(400);
                     return $this->renderJSON(array('error' => TBGContext::getI18n()->__('Please fill out all the required fields')));
                 }
                 $this->getUser()->setBuddyname($request['buddyname']);
                 $this->getUser()->setRealname($request['realname']);
                 $this->getUser()->setHomepage($request['homepage']);
                 $this->getUser()->setEmailPrivate((bool) $request['email_private']);
                 $this->getUser()->setUsesGravatar((bool) $request['use_gravatar']);
                 $this->getUser()->setTimezone($request->getRawParameter('timezone'));
                 $this->getUser()->setLanguage($request['profile_language']);
                 if ($this->getUser()->getEmail() != $request['email']) {
                     if (TBGEvent::createNew('core', 'changeEmail', $this->getUser(), array('email' => $request['email']))->triggerUntilProcessed()->isProcessed() == false) {
                         $this->getUser()->setEmail($request['email']);
                     }
                 }
                 $this->getUser()->save();
                 return $this->renderJSON(array('title' => TBGContext::getI18n()->__('Profile information saved')));
                 break;
             case 'settings':
                 $this->getUser()->setPreferredWikiSyntax($request['syntax_articles']);
                 $this->getUser()->setPreferredIssuesSyntax($request['syntax_issues']);
                 $this->getUser()->setPreferredCommentsSyntax($request['syntax_comments']);
                 $this->getUser()->setKeyboardNavigationEnabled($request['enable_keyboard_navigation']);
                 foreach ($notificationsettings as $setting => $description) {
                     if ($request->hasParameter('core_' . $setting)) {
                         $this->getUser()->setNotificationSetting($setting, true)->save();
                     } else {
                         $this->getUser()->setNotificationSetting($setting, false)->save();
                     }
                 }
                 TBGEvent::createNew('core', 'mainActions::myAccount::saveNotificationSettings')->trigger(compact('request'));
                 $this->getUser()->save();
                 return $this->renderJSON(array('title' => TBGContext::getI18n()->__('Profile settings saved')));
                 break;
             case 'module':
                 foreach (TBGContext::getModules() as $module_name => $module) {
                     if ($request['target_module'] == $module_name && $module->hasAccountSettings()) {
                         if ($module->postAccountSettings($request)) {
                             return $this->renderJSON(array('title' => TBGContext::getI18n()->__('Settings saved')));
                         } else {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('error' => TBGContext::getI18n()->__('An error occured')));
                         }
                     }
                 }
                 break;
         }
     }
     $this->rnd_no = rand();
     $this->languages = TBGI18n::getLanguages();
     $this->timezones = TBGI18n::getTimezones();
     $this->error = TBGContext::getMessageAndClear('error');
     $this->username_chosen = TBGContext::getMessageAndClear('username_chosen');
     $this->openid_used = TBGContext::getMessageAndClear('openid_used');
     $this->rsskey_generated = TBGContext::getMessageAndClear('rsskey_generated');
     $this->selected_tab = 'profile';
     if ($this->rsskey_generated) {
         $this->selected_tab = 'security';
     }
 }
Ejemplo n.º 4
0
 /**
  * Reinitialize the i18n object, used only when changing the language in the middle of something
  * 
  * @param string $language The language code to change to
  */
 public static function reinitializeI18n($language = null)
 {
     if (!$language) {
         self::$_i18n = new TBGI18n(TBGSettings::get('language'));
     } else {
         TBGLogging::log('Changing language to ' . $language);
         self::$_i18n = new TBGI18n($language);
         self::$_i18n->initialize();
     }
 }
Ejemplo n.º 5
0
 public function componentReglang()
 {
     $this->languages = TBGI18n::getLanguages();
     $this->timezones = tbg_get_timezones();
 }
Ejemplo n.º 6
0
 /**
  * "My account" page
  *  
  * @param TBGRequest $request
  */
 public function runMyAccount(TBGRequest $request)
 {
     $this->forward403unless(TBGContext::getUser()->hasPageAccess('account'));
     if ($request->isMethod(TBGRequest::POST) && $request->hasParameter('mode')) {
         switch ($request->getParameter('mode')) {
             case 'information':
                 if (!$request->getParameter('buddyname') || !$request->getParameter('email')) {
                     return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('Please fill out all the required fields')));
                 }
                 TBGContext::getUser()->setBuddyname($request->getParameter('buddyname'));
                 TBGContext::getUser()->setRealname($request->getParameter('realname'));
                 TBGContext::getUser()->setHomepage($request->getParameter('homepage'));
                 TBGContext::getUser()->setEmailPrivate((bool) $request->getParameter('email_private'));
                 if (TBGContext::getUser()->getEmail() != $request->getParameter('email')) {
                     if (TBGEvent::createNew('core', 'changeEmail', TBGContext::getUser(), array('email' => $request->getParameter('email')))->triggerUntilProcessed()->isProcessed() == false) {
                         TBGContext::getUser()->setEmail($request->getParameter('email'));
                     }
                 }
                 TBGContext::getUser()->save();
                 return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('Account information saved'), 'content' => ''));
                 break;
             case 'settings':
                 TBGContext::getUser()->setUsesGravatar((bool) $request->getParameter('use_gravatar'));
                 TBGContext::getUser()->setTimezone($request->getParameter('timezone'));
                 TBGContext::getUser()->setLanguage($request->getParameter('profile_language'));
                 TBGContext::getUser()->save();
                 return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('Profile settings saved'), 'content' => ''));
                 break;
             case 'module':
                 foreach (TBGContext::getModules() as $module_name => $module) {
                     if ($request->getParameter('target_module') == $module_name && $module->hasAccountSettings()) {
                         if ($module->postAccountSettings($request)) {
                             return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('Settings saved'), 'content' => ''));
                         } else {
                             return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('An error occured')));
                         }
                     }
                 }
                 break;
         }
     }
     $this->rnd_no = rand();
     $this->languages = TBGI18n::getLanguages();
     $this->getResponse()->setPage('account');
 }
 public function componentReglang()
 {
     $this->languages = TBGI18n::getLanguages();
 }