diff options
author | matthew.gregg <matthew.gregg@gmail.com> | 2008-07-18 20:34:17 -0400 |
---|---|---|
committer | matthew.gregg <matthew.gregg@gmail.com> | 2008-07-18 20:34:17 -0400 |
commit | 6dd211530fea743dedf142ced4ccd6c87e5ed54b (patch) | |
tree | 6c5141f004fa266a12902d798f11ecacaff8c624 /actions | |
parent | faa3933fbb54d0fc4a12145bd0aefa899db30dea (diff) |
Patch for PITS 00032, 00033, 00034
darcs-hash:20080719003417-982e4-7004f8a4dfb447f941457c30b0b2289eee5582e6.gz
Diffstat (limited to 'actions')
-rw-r--r-- | actions/profilesettings.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/actions/profilesettings.php b/actions/profilesettings.php index b703c8b2b..04526a212 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -52,8 +52,6 @@ class ProfilesettingsAction extends SettingsAction { common_input('location', _('Location'), ($this->arg('location')) ? $this->arg('location') : $profile->location, _('Where you are, like "City, State (or Region), Country"')); - common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'), - ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe); common_submit('submit', _('Save')); common_element_end('form'); common_show_footer(); @@ -66,8 +64,7 @@ class ProfilesettingsAction extends SettingsAction { $homepage = $this->trimmed('homepage'); $bio = $this->trimmed('bio'); $location = $this->trimmed('location'); - $autosubscribe = $this->boolean('autosubscribe'); - + # Some validation if (!Validate::string($nickname, array('min_length' => 1, @@ -94,6 +91,8 @@ class ProfilesettingsAction extends SettingsAction { } else if ($this->nickname_exists($nickname)) { $this->show_form(_('Nickname already in use. Try another one.')); return; + } else if (!is_null($language) && strlen($language) > 50) { + $this->show_form(_('Language is too long (max 50 chars).')); } $user = common_current_user(); @@ -117,6 +116,23 @@ class ProfilesettingsAction extends SettingsAction { return; } } + if ($user->language != $language) { + + common_debug('Updating user language from ' . $user->language . ' to ' . $language, + __FILE__); + + $original = clone($user); + + $user->language = $language; + + $result = $user->updateKeys($original); + + if ($result === FALSE) { + common_log_db_error($user, 'UPDATE', __FILE__); + common_server_error(_('Couldn\'t update user.')); + return; + } + } # XXX: XOR |