From 88717d88057ac0c51a2d7842305c808691404e6f Mon Sep 17 00:00:00 2001 From: Mike Cochrane Date: Sun, 20 Jul 2008 10:13:25 -0400 Subject: User definable timezones. Work in UTC internally and display per user/site default. http://laconi.ca/PITS/00011 darcs-hash:20080720141325-533db-87cb60501434c9dc0ac13716ba5d8b17754431f5.gz --- actions/profilesettings.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'actions/profilesettings.php') diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 04526a212..cfa4db0d7 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -88,6 +88,9 @@ class ProfilesettingsAction extends SettingsAction { } else if (!is_null($location) && strlen($location) > 255) { $this->show_form(_('Location is too long (max 255 chars).')); return; + } else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) { + $this->show_form(_('Timezone not selected.')); + return; } else if ($this->nickname_exists($nickname)) { $this->show_form(_('Nickname already in use. Try another one.')); return; @@ -99,31 +102,22 @@ class ProfilesettingsAction extends SettingsAction { $user->query('BEGIN'); - if ($user->nickname != $nickname) { + if ($user->nickname != $nickname || + $user->language != $language || + $user->timezone != $timezone) { common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname, __FILE__); - - $original = clone($user); - - $user->nickname = $nickname; - - $result = $user->updateKeys($original); - - if ($result === FALSE) { - common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); - return; - } - } - if ($user->language != $language) { - common_debug('Updating user language from ' . $user->language . ' to ' . $language, __FILE__); + common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone, + __FILE__); $original = clone($user); + $user->nickname = $nickname; $user->language = $language; + $user->timezone = $timezone; $result = $user->updateKeys($original); -- cgit v1.2.3-54-g00ecf