Example #1
0
 public function initialize()
 {
     $filename = THEBUGGENIE_PATH . 'i18n' . DS . $this->_language . DS . 'initialize.inc.php';
     if (file_exists($filename)) {
         Logging::log("Initiating with file '{$filename}", 'i18n');
         include $filename;
         Logging::log("Done Initiating", 'i18n');
     }
     if ($this->_strings === null) {
         if (Context::getCache()->fileHas(Cache::KEY_I18N . 'strings_' . $this->_language, false)) {
             Logging::log('Trying cached strings');
             $strings = Context::getCache()->fileGet(Cache::KEY_I18N . 'strings_' . $this->_language, false);
             $this->_strings = is_array($strings) ? $strings : null;
         }
         if ($this->_strings === null) {
             Logging::log('No usable cached strings available');
             $this->loadStrings();
             foreach (array_keys(Context::getModules()) as $module_name) {
                 $this->loadStrings($module_name);
             }
             if (is_array($this->_strings)) {
                 Context::getCache()->fileAdd(Cache::KEY_I18N . 'strings_' . $this->_language, $this->_strings, false);
             }
         }
     }
 }
Example #2
0
 protected function _listInstalled()
 {
     $this->cliEcho("\nInstalled modules:\n", 'green', 'bold');
     foreach (\thebuggenie\core\framework\Context::getModules() as $module_key => $module) {
         $this->cliEcho("{$module_key}: ", 'white', 'bold');
         $this->cliEcho($module->getDescription());
         $this->cliEcho("\n");
     }
     $this->cliEcho("\n");
 }
Example #3
0
 public function do_execute()
 {
     $hostname = $this->getProvidedArgument('hostname');
     $this->cliEcho('Checking scope availability ...');
     if (tables\ScopeHostnames::getTable()->getScopeIDForHostname($hostname) === null) {
         $this->cliEcho("available!\n");
         $this->cliEcho("Creating scope ...");
         $scope = new entities\Scope();
         $scope->addHostname($hostname);
         $scope->setName($this->getProvidedArgument('shortname'));
         $uploads_enabled = $this->getProvidedArgument('enable_uploads', 'yes') == 'yes';
         $scope->setUploadsEnabled((bool) $uploads_enabled);
         $scope->setMaxUploadLimit($this->getProvidedArgument('upload_limit', 0));
         $scope->setMaxProjects($this->getProvidedArgument('projects', 0));
         $scope->setMaxUsers($this->getProvidedArgument('users', 0));
         $scope->setMaxTeams($this->getProvidedArgument('teams', 0));
         $scope->setMaxWorkflowsLimit($this->getProvidedArgument('workflows', 0));
         $scope->setEnabled();
         $this->cliEcho(".");
         $scope->save();
         $this->cliEcho(".done!\n");
         $admin_user = $this->getProvidedArgument('scope_admin');
         if ($admin_user) {
             $user = entities\User::getByUsername($admin_user);
             if ($user instanceof entities\User) {
                 $this->cliEcho("Adding user {$admin_user} to scope\n");
                 $admin_group_id = (int) framework\Settings::get(framework\Settings::SETTING_ADMIN_GROUP, 'core', $scope->getID());
                 tables\UserScopes::getTable()->addUserToScope($user->getID(), $scope->getID(), $admin_group_id, true);
             } else {
                 $this->cliEcho("Could not add user {$admin_user} to scope (username not found)\n");
             }
         }
         if ($this->getProvidedArgument('remove_admin', 'no') == 'yes') {
             $this->cliEcho("Removing administrator user from scope\n");
             tables\UserScopes::getTable()->removeUserFromScope(1, $scope->getID());
         }
         foreach (framework\Context::getModules() as $module) {
             $module_name = $module->getName();
             if ($module_name == 'publish') {
                 continue;
             }
             if ($this->getProvidedArgument("install_module_{$module_name}", "no") == 'yes') {
                 $this->cliEcho("Installing module {$module_name}\n");
                 entities\Module::installModule($module_name, $scope);
             }
         }
     } else {
         $this->cliEcho("not available\n", 'red');
     }
     $this->cliEcho("\n");
 }
Example #4
0
 protected function _upgradeFrom3dot2(framework\Request $request)
 {
     set_time_limit(0);
     \thebuggenie\core\entities\tables\Milestones::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGMilestone::getB2DBTable());
     \thebuggenie\core\entities\tables\Projects::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGProjectsTable::getTable());
     \thebuggenie\core\entities\tables\Log::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGLogTable::getTable());
     \thebuggenie\core\entities\tables\Users::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGUsersTable::getTable());
     \thebuggenie\core\entities\tables\Issues::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGIssuesTable::getTable());
     \thebuggenie\core\entities\tables\Workflows::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGWorkflowsTable::getTable());
     \thebuggenie\core\entities\tables\IssueSpentTimes::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGIssueSpentTimesTable::getTable());
     \thebuggenie\core\entities\tables\Comments::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGCommentsTable::getTable());
     \thebuggenie\core\entities\tables\SavedSearches::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGSavedSearchesTable::getTable());
     \thebuggenie\core\entities\tables\Settings::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGSettingsTable::getTable());
     \thebuggenie\core\entities\tables\Notifications::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGNotificationsTable::getTable());
     \thebuggenie\core\entities\tables\Permissions::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGPermissionsTable::getTable());
     \thebuggenie\core\entities\Dashboard::getB2DBTable()->create();
     \thebuggenie\core\entities\DashboardView::getB2DBTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_32\TBGDashboardViewsTable::getTable());
     \thebuggenie\core\entities\ApplicationPassword::getB2DBTable()->create();
     \thebuggenie\core\entities\NotificationSetting::getB2DBTable()->create();
     $transaction = \b2db\Core::startTransaction();
     // Upgrade user passwords
     switch ($request['upgrade_passwords']) {
         case 'manual':
             $password = $request['manual_password'];
             foreach (\thebuggenie\core\entities\tables\Users::getTable()->selectAll() as $user) {
                 $user->setPassword($password);
                 $user->save();
             }
             break;
         case 'auto':
             $field = $request['upgrade_passwords_pick'] == 'username' ? 'username' : 'email';
             foreach (\thebuggenie\core\entities\tables\Users::getTable()->selectAll() as $user) {
                 if ($field == 'username' && trim($user->getUsername())) {
                     $user->setPassword(trim($user->getUsername()));
                     $user->save();
                 } elseif ($field == 'email' && trim($user->getEmail())) {
                     $user->setPassword(trim($user->getEmail()));
                     $user->save();
                 }
             }
             break;
     }
     $adminuser = \thebuggenie\core\entities\User::getB2DBTable()->selectById(1);
     $adminuser->setPassword($request['admin_password']);
     $adminuser->save();
     // Add new settings
     framework\Settings::saveSetting(framework\Settings::SETTING_SERVER_TIMEZONE, 'core', date_default_timezone_get(), 0, 1);
     foreach ($request->getParameter('status') as $scope_id => $status_id) {
         $scope = \thebuggenie\core\entities\tables\Scopes::getTable()->selectById((int) $scope_id);
         if ($scope instanceof \thebuggenie\core\entities\Scope) {
             $epic = new \thebuggenie\core\entities\Issuetype();
             $epic->setName('Epic');
             $epic->setIcon('epic');
             $epic->setDescription('Issue type suited for entering epics');
             $epic->setScope($scope_id);
             $epic->save();
             framework\Settings::saveSetting('issuetype_epic', $epic->getID(), 'core', $scope_id);
             foreach (\thebuggenie\core\entities\tables\Workflows::getTable()->getAll((int) $scope_id) as $workflow) {
                 $transition = new \thebuggenie\core\entities\WorkflowTransition();
                 $steps = $workflow->getSteps();
                 $step = array_shift($steps);
                 $step->setLinkedStatusID((int) $status_id);
                 $step->save();
                 $transition->setOutgoingStep($step);
                 $transition->setName('Issue created');
                 $transition->setWorkflow($workflow);
                 $transition->setScope($scope);
                 $transition->setDescription('This is the initial transition for issues using this workflow');
                 $transition->save();
                 $workflow->setInitialTransition($transition);
                 $workflow->save();
             }
             \thebuggenie\core\entities\ActivityType::loadFixtures($scope);
         }
     }
     $transaction->commitAndEnd();
     framework\Context::finishUpgrading();
     foreach (framework\Context::getModules() as $module) {
         $module->upgrade();
     }
     $this->upgrade_complete = true;
 }
Example #5
0
 /**
  * Return associated configuration sections
  *
  * @param I18n $i18n The translation object
  *
  * @return array
  */
 public static function getConfigSections($i18n)
 {
     $config_sections = array('general' => array(), self::CONFIGURATION_SECTION_MODULES => array());
     if (Context::getScope()->getID() == 1) {
         $config_sections['general'][self::CONFIGURATION_SECTION_SCOPES] = array('route' => 'configure_scopes', 'description' => $i18n->__('Scopes'), 'icon' => 'scopes', 'details' => $i18n->__('Scopes are self-contained Bug Genie environments. Configure them here.'));
     }
     $config_sections['general'][self::CONFIGURATION_SECTION_SETTINGS] = array('route' => 'configure_settings', 'description' => $i18n->__('Settings'), 'icon' => 'general_small', 'details' => $i18n->__('Every setting in the bug genie can be adjusted in this section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_THEMES] = array('route' => 'configuration_themes', 'description' => $i18n->__('Theme'), 'icon' => 'themes', 'details' => $i18n->__('Configure the selected theme from this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ROLES] = array('route' => 'configure_roles', 'description' => $i18n->__('Roles'), 'icon' => 'roles', 'details' => $i18n->__('Configure roles in this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_AUTHENTICATION] = array('route' => 'configure_authentication', 'description' => $i18n->__('Authentication'), 'icon' => 'authentication', 'details' => $i18n->__('Configure the authentication method in this section'));
     if (Context::getScope()->isUploadsEnabled()) {
         $config_sections['general'][self::CONFIGURATION_SECTION_UPLOADS] = array('route' => 'configure_files', 'description' => $i18n->__('Uploads and attachments'), 'icon' => 'files', 'details' => $i18n->__('All settings related to file uploads are controlled from this section.'));
     }
     $config_sections['general'][self::CONFIGURATION_SECTION_IMPORT] = array('route' => 'import_home', 'description' => $i18n->__('Import data'), 'icon' => 'import_small', 'details' => $i18n->__('Import data from CSV files and other sources.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_PROJECTS] = array('route' => 'configure_projects', 'description' => $i18n->__('Projects'), 'icon' => 'projects', 'details' => $i18n->__('Set up all projects in this configuration section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ISSUETYPES] = array('route' => 'configure_issuetypes', 'icon' => 'issuetypes', 'description' => $i18n->__('Issue types'), 'details' => $i18n->__('Manage issue types and configure issue fields for each issue type here'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ISSUEFIELDS] = array('route' => 'configure_issuefields', 'icon' => 'resolutiontypes', 'description' => $i18n->__('Issue fields'), 'details' => $i18n->__('Status types, resolution types, categories, custom fields, etc. are configurable from this section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_WORKFLOW] = array('route' => 'configure_workflow', 'icon' => 'workflow', 'description' => $i18n->__('Workflow'), 'details' => $i18n->__('Set up and edit workflow configuration from this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_USERS] = array('route' => 'configure_users', 'description' => $i18n->__('Users, teams and clients'), 'icon' => 'users', 'details' => $i18n->__('Manage users, user teams and clients from this section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_MODULES] = array('route' => 'configure_modules', 'description' => $i18n->__('Manage modules'), 'icon' => 'modules', 'details' => $i18n->__('Manage Bug Genie extensions from this section. New modules are installed from here.'), 'module' => 'core');
     foreach (Context::getModules() as $module) {
         if ($module->hasConfigSettings() && $module->isEnabled()) {
             $config_sections[self::CONFIGURATION_SECTION_MODULES][] = array('route' => array('configure_module', array('config_module' => $module->getName())), 'description' => Context::geti18n()->__($module->getConfigTitle()), 'icon' => $module->getName(), 'details' => Context::geti18n()->__($module->getConfigDescription()), 'module' => $module->getName());
         }
     }
     return $config_sections;
 }
Example #6
0
                        <?php 
        }
        ?>
                        </ul>
                    <?php 
    }
    ?>
                <?php 
}
?>
            </div>
            <?php 
\thebuggenie\core\framework\Event::createNew('core', 'account_tab_panes')->trigger();
?>
            <?php 
foreach (\thebuggenie\core\framework\Context::getModules() as $module_name => $module) {
    ?>
                <?php 
    if ($module->hasAccountSettings()) {
        ?>
                    <div id="tab_settings_<?php 
        echo $module_name;
        ?>
_pane" style="display: none;">
                        <form accept-charset="<?php 
        echo \thebuggenie\core\framework\Context::getI18n()->getCharset();
        ?>
" action="<?php 
        echo make_url('account_save_module_settings', array('target_module' => $module_name));
        ?>
" onsubmit="TBG.Main.Profile.updateModuleSettings('<?php 
Example #7
0
 public function runConfigureAuthentication(framework\Request $request)
 {
     $modules = array();
     $allmods = framework\Context::getModules();
     foreach ($allmods as $mod) {
         if ($mod->getType() == entities\Module::MODULE_AUTH) {
             $modules[] = $mod;
         }
     }
     $this->modules = $modules;
 }
Example #8
0
 /**
  * "My account" page
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runMyAccount(framework\Request $request)
 {
     $this->forward403unless($this->getUser()->hasPageAccess('account'));
     $categories = \thebuggenie\core\entities\Category::getAll();
     $projects = [];
     $project_subscription_key = \thebuggenie\core\framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS;
     $category_subscription_key = \thebuggenie\core\framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS_CATEGORY;
     $category_notification_key = \thebuggenie\core\framework\Settings::SETTINGS_USER_NOTIFY_NEW_ISSUES_MY_PROJECTS_CATEGORY;
     $subscriptionssettings = framework\Settings::getSubscriptionsSettings();
     $notificationsettings = framework\Settings::getNotificationSettings();
     $selected_project_subscriptions = [];
     $selected_category_subscriptions = [];
     $selected_category_notifications = [];
     $this->all_projects_subscription = $this->getUser()->getNotificationSetting($project_subscription_key, false)->isOn();
     foreach (\thebuggenie\core\entities\Project::getAll() as $project_id => $project) {
         if ($project->hasAccess()) {
             $projects[$project_id] = $project;
             if ($this->getUser()->getNotificationSetting($project_subscription_key . '_' . $project_id, false)->isOn()) {
                 $selected_project_subscriptions[] = $project_id;
             }
         }
     }
     foreach ($categories as $category_id => $category) {
         if ($this->getUser()->getNotificationSetting($category_subscription_key . '_' . $category_id, false)->isOn()) {
             $selected_category_subscriptions[] = $category_id;
         }
         if ($this->getUser()->getNotificationSetting($category_notification_key . '_' . $category_id, false)->isOn()) {
             $selected_category_notifications[] = $category_id;
         }
     }
     $this->selected_project_subscriptions = $this->all_projects_subscription ? [] : $selected_project_subscriptions;
     $this->projects = $projects;
     $this->selected_category_subscriptions = $selected_category_subscriptions;
     $this->selected_category_notifications = $selected_category_notifications;
     $this->categories = $categories;
     $this->subscriptionssettings = $subscriptionssettings;
     $this->notificationsettings = $notificationsettings;
     $this->has_autopassword = framework\Context::hasMessage('auto_password');
     if ($this->has_autopassword) {
         $this->autopassword = framework\Context::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' => framework\Context::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 (\thebuggenie\core\framework\Event::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' => framework\Context::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']);
                 $this->getUser()->save();
                 return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Profile settings saved')));
                 break;
             case 'notificationsettings':
                 $this->getUser()->setDesktopNotificationsNewTabEnabled($request['enable_desktop_notifications_new_tab']);
                 foreach ($subscriptionssettings as $setting => $description) {
                     if ($setting == framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS_CATEGORY) {
                         foreach ($categories as $category_id => $category) {
                             if ($request->hasParameter('core_' . $setting . '_' . $category_id)) {
                                 $this->getUser()->setNotificationSetting($setting . '_' . $category_id, true)->save();
                             } else {
                                 $this->getUser()->setNotificationSetting($setting . '_' . $category_id, false)->save();
                             }
                         }
                     } elseif ($setting == framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS) {
                         if ($request->hasParameter('core_' . $setting . '_all')) {
                             $this->getUser()->setNotificationSetting($setting, true)->save();
                             foreach (\thebuggenie\core\entities\Project::getAll() as $project_id => $project) {
                                 $this->getUser()->setNotificationSetting($setting . '_' . $project_id, false)->save();
                             }
                         } else {
                             $this->getUser()->setNotificationSetting($setting, false)->save();
                             foreach (\thebuggenie\core\entities\Project::getAll() as $project_id => $project) {
                                 if ($request->hasParameter('core_' . $setting . '_' . $project_id)) {
                                     $this->getUser()->setNotificationSetting($setting . '_' . $project_id, true)->save();
                                 } else {
                                     $this->getUser()->setNotificationSetting($setting . '_' . $project_id, false)->save();
                                 }
                             }
                         }
                     } else {
                         if ($request->hasParameter('core_' . $setting)) {
                             $this->getUser()->setNotificationSetting($setting, true)->save();
                         } else {
                             $this->getUser()->setNotificationSetting($setting, false)->save();
                         }
                     }
                 }
                 foreach ($notificationsettings as $setting => $description) {
                     if ($setting == framework\Settings::SETTINGS_USER_NOTIFY_NEW_ISSUES_MY_PROJECTS_CATEGORY) {
                         foreach ($categories as $category_id => $category) {
                             if ($request->hasParameter('core_' . $setting . '_' . $category_id)) {
                                 $this->getUser()->setNotificationSetting($setting . '_' . $category_id, true)->save();
                             } else {
                                 $this->getUser()->setNotificationSetting($setting . '_' . $category_id, false)->save();
                             }
                         }
                     } else {
                         if ($request->hasParameter('core_' . $setting)) {
                             if ($setting == framework\Settings::SETTINGS_USER_NOTIFY_GROUPED_NOTIFICATIONS) {
                                 $this->getUser()->setNotificationSetting($setting, $request->getParameter('core_' . $setting))->save();
                             } else {
                                 $this->getUser()->setNotificationSetting($setting, true)->save();
                             }
                         } else {
                             $this->getUser()->setNotificationSetting($setting, false)->save();
                         }
                     }
                 }
                 \thebuggenie\core\framework\Event::createNew('core', 'mainActions::myAccount::saveNotificationSettings')->trigger(compact('request', 'categories'));
                 $this->getUser()->save();
                 return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Notification settings saved')));
                 break;
             case 'module':
                 foreach (framework\Context::getModules() as $module_name => $module) {
                     if ($request['target_module'] == $module_name && $module->hasAccountSettings()) {
                         if ($module->postAccountSettings($request)) {
                             return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Settings saved')));
                         } else {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('error' => framework\Context::getI18n()->__('An error occured')));
                         }
                     }
                 }
                 break;
         }
     }
     $this->rnd_no = rand();
     $this->languages = framework\I18n::getLanguages();
     $this->timezones = framework\I18n::getTimezones();
     $this->error = framework\Context::getMessageAndClear('error');
     $this->username_chosen = framework\Context::getMessageAndClear('username_chosen');
     $this->openid_used = framework\Context::getMessageAndClear('openid_used');
     $this->rsskey_generated = framework\Context::getMessageAndClear('rsskey_generated');
     $this->selected_tab = 'profile';
     if ($this->rsskey_generated) {
         $this->selected_tab = 'security';
     }
 }
Example #9
0
 /**
  * "My account" page
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runMyAccount(framework\Request $request)
 {
     $this->forward403unless($this->getUser()->hasPageAccess('account'));
     $notificationsettings = array();
     $i18n = $this->getI18n();
     $notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ISSUES] = $i18n->__('Automatically subscribe to issues I get involved in');
     $notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ARTICLES] = $i18n->__('Automatically subscribe to article I get involved in');
     $notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new issues that are created in my project(s)');
     $notificationsettings[framework\Settings::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 = framework\Context::hasMessage('auto_password');
     if ($this->has_autopassword) {
         $this->autopassword = framework\Context::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' => framework\Context::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 (\thebuggenie\core\framework\Event::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' => framework\Context::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();
                     }
                 }
                 \thebuggenie\core\framework\Event::createNew('core', 'mainActions::myAccount::saveNotificationSettings')->trigger(compact('request'));
                 $this->getUser()->save();
                 return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Profile settings saved')));
                 break;
             case 'module':
                 foreach (framework\Context::getModules() as $module_name => $module) {
                     if ($request['target_module'] == $module_name && $module->hasAccountSettings()) {
                         if ($module->postAccountSettings($request)) {
                             return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Settings saved')));
                         } else {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('error' => framework\Context::getI18n()->__('An error occured')));
                         }
                     }
                 }
                 break;
         }
     }
     $this->rnd_no = rand();
     $this->languages = framework\I18n::getLanguages();
     $this->timezones = framework\I18n::getTimezones();
     $this->error = framework\Context::getMessageAndClear('error');
     $this->username_chosen = framework\Context::getMessageAndClear('username_chosen');
     $this->openid_used = framework\Context::getMessageAndClear('openid_used');
     $this->rsskey_generated = framework\Context::getMessageAndClear('rsskey_generated');
     $this->selected_tab = 'profile';
     if ($this->rsskey_generated) {
         $this->selected_tab = 'security';
     }
 }