} $user_helper_preferences = array(array('preference_name' => UserHelper::PREFERENCES_NAME_AND_LOGIN, 'preference_label' => $Language->getText('account_options', 'tuleap_name_and_login'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_NAME_AND_LOGIN), array('preference_name' => UserHelper::PREFERENCES_LOGIN_AND_NAME, 'preference_label' => $Language->getText('account_options', 'tuleap_login_and_name'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_LOGIN_AND_NAME), array('preference_name' => UserHelper::PREFERENCES_LOGIN, 'preference_label' => $Language->getText('account_options', 'tuleap_login'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_LOGIN), array('preference_name' => UserHelper::PREFERENCES_REAL_NAME, 'preference_label' => $Language->getText('account_options', 'real_name'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_REAL_NAME)); $plugins_prefs = array(); $em->processEvent('user_preferences_appearance', array('preferences' => &$plugins_prefs)); $all_csv_separator = array(); foreach (PFUser::$csv_separators as $separator) { $all_csv_separator[] = array('separator_name' => $separator, 'separator_label' => $Language->getText('account_options', $separator), 'is_selected' => $separator === user_get_preference("user_csv_separator")); } $all_csv_dateformat = array(); foreach (PFUser::$csv_dateformats as $dateformat) { $all_csv_dateformat[] = array('dateformat_name' => $dateformat, 'dateformat_label' => $Language->getText('account_preferences', $dateformat), 'is_selected' => $dateformat === user_get_preference("user_csv_dateformat")); } $user_access_info = $um->getUserAccessInfo($user); if (!$user_access_info) { $user_access_info = array('last_auth_success' => false, 'last_auth_failure' => false, 'nb_auth_failure' => false, 'prev_auth_success' => false); } $svn_token_handler = new SVN_TokenHandler(new SVN_TokenDao(), new RandomNumberGenerator(), PasswordHandlerFactory::getPasswordHandler()); $svn_token_presenters = array(); foreach ($svn_token_handler->getSVNTokensForUser($user) as $user_svn_token) { $svn_token_presenters[] = new SVN_TokenPresenter($user_svn_token); } $last_svn_token = ''; if (isset($_SESSION['last_svn_token'])) { $last_svn_token = $_SESSION['last_svn_token']; unset($_SESSION['last_svn_token']); } $presenter = new User_PreferencesPresenter($user, $can_change_realname, $can_change_email, $can_change_password, $extra_user_info, $user_access_info, $ssh_keys_extra_html, $svn_token_presenters, $third_paty_html, $csrf->fetchHTMLInput(), $tracker_formats, $all_themes, $languages_html, $user_helper_preferences, $plugins_prefs, $all_csv_separator, $all_csv_dateformat, $last_svn_token); $HTML->header(array('title' => $Language->getText('account_options', 'title'), 'body_class' => array('account-maintenance'))); $renderer = TemplateRendererFactory::build()->getRenderer(dirname(__FILE__) . '/../../templates/user'); $renderer->renderToPage('account-maintenance', $presenter); $HTML->footer(array());
* Tuleap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. */ require_once 'pre.php'; require_once 'account.php'; session_require(array('isloggedin' => 1)); $csrf = new CSRFSynchronizerToken('/account/index.php'); $csrf->check(); $request = HTTPRequest::instance(); $user = UserManager::instance()->getCurrentUser(); $svn_token_handler = new SVN_TokenHandler(new SVN_TokenDao(), new RandomNumberGenerator(), PasswordHandlerFactory::getPasswordHandler()); if ($request->exist('delete-svn-tokens') && $request->exist('svn-tokens-selected') && is_array($request->get('svn-tokens-selected'))) { if ($svn_token_handler->deleteSVNTokensForUser($user, $request->get('svn-tokens-selected'))) { $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('account_options', 'delete_svn_tokens_success')); } else { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_options', 'delete_svn_tokens_error')); } } if ($request->exist('generate-svn-token')) { $token = $svn_token_handler->generateSVNTokenForUser($user, $request->get('generate-svn-token-comment')); if ($token) { $_SESSION['last_svn_token'] = $token; $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('account_options', 'generate_svn_token_success')); } else { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_options', 'generate_svn_token_error')); }