summaryrefslogtreecommitdiff
path: root/actions/profilesettings.php
diff options
context:
space:
mode:
authorMike Cochrane <mikec@mikenz.geek.nz>2008-07-20 10:13:25 -0400
committerMike Cochrane <mikec@mikenz.geek.nz>2008-07-20 10:13:25 -0400
commit88717d88057ac0c51a2d7842305c808691404e6f (patch)
tree891a722a92bbc9e91799367cbbd0506f6725bdea /actions/profilesettings.php
parent060fecf5ec59202c5eaf3448f9723a81820d5735 (diff)
User definable timezones. Work in UTC internally and display per user/site default. http://laconi.ca/PITS/00011
darcs-hash:20080720141325-533db-87cb60501434c9dc0ac13716ba5d8b17754431f5.gz
Diffstat (limited to 'actions/profilesettings.php')
-rw-r--r--actions/profilesettings.php26
1 files changed, 10 insertions, 16 deletions
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);