From 6dd211530fea743dedf142ced4ccd6c87e5ed54b Mon Sep 17 00:00:00 2001 From: "matthew.gregg" Date: Fri, 18 Jul 2008 20:34:17 -0400 Subject: Patch for PITS 00032, 00033, 00034 darcs-hash:20080719003417-982e4-7004f8a4dfb447f941457c30b0b2289eee5582e6.gz --- actions/profilesettings.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'actions/profilesettings.php') 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 -- cgit v1.2.3-54-g00ecf