]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/profilesettings.php
float notices left
[quix0rs-gnu-social.git] / actions / profilesettings.php
index 15c455fe2e33579a2f58550c61fe93e4cb2e41a0..e65840bdaf513f9d6d30211fb6b27ee6a09a51b9 100644 (file)
@@ -46,10 +46,7 @@ class ProfilesettingsAction extends SettingsAction {
                                         ($this->arg('bio')) ? $this->arg('bio') : $profile->bio);
                common_input('location', _t('Location'),
                                         ($this->arg('location')) ? $this->arg('location') : $profile->location);
-               common_element('input', array('name' => 'submit',
-                                                                         'type' => 'submit',
-                                                                         'id' => 'submit',
-                                                                         'value' => _t('Save')));
+               common_submit('submit', _t('Save'));
                common_element_end('form');
                common_show_footer();
        }
@@ -73,6 +70,13 @@ class ProfilesettingsAction extends SettingsAction {
                $user->nickname = $this->arg('nickname');
                $user->email = $this->arg('email');
 
+               $val = $user->validate();
+               if ($val !== TRUE) {
+                       # XXX: better validation
+                       $this->show_form(_t('Error saving user; invalid.'));
+                       return;
+               }
+
                if (!$user->update($original)) {
                        common_server_error(_t('Couldnt update user.'));
                        return;
@@ -89,6 +93,13 @@ class ProfilesettingsAction extends SettingsAction {
                $profile->location = $this->arg('location');
                $profile->profileurl = common_profile_url($nickname);
 
+               $val = $profile->validate();
+               if ($val !== TRUE) {
+                       # XXX: some feedback here, please!
+                       $this->show_form(_t('Error saving profile; invalid.'));
+                       return;
+               }
+
                if (!$profile->update($orig_profile)) {
                        common_server_error(_t('Couldnt save profile.'));
                        return;