]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/ExtendedProfile/actions/profiledetailsettings.php
Cosmetic changes to common_redirect, clientError, serverError
[quix0rs-gnu-social.git] / plugins / ExtendedProfile / actions / profiledetailsettings.php
index f01c25fc5f4c51a8dbc9fe5c51b042447e68bb13..8d8a33ec4493e03b84541b8223e875971442a8bd 100644 (file)
@@ -23,9 +23,9 @@ if (!defined('STATUSNET')) {
 
 class ProfileDetailSettingsAction extends ProfileSettingsAction
 {
-
     function title()
     {
+        // TRANS: Title for extended profile settings.
         return _m('Extended profile settings');
     }
 
@@ -59,8 +59,8 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
             $this->showForm(
-                _m(
-                    'There was a problem with your session token. '
+                // TRANS: Client error displayed when the session token does not match or is not given.
+                _m('There was a problem with your session token. '
                     .   'Try again, please.'
                   )
             );
@@ -133,6 +133,7 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
             return;
         }
 
+        // TRANS: Success message after saving extended profile details.
         $this->showForm(_m('Details saved.'), true);
 
     }
@@ -266,10 +267,7 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
         $this->removeAll($user, 'website');
         $i = 0;
         foreach($sites as $site) {
-            if (!empty($site['value']) && !Validate::uri(
-                $site['value'],
-                array('allowed_schemes' => array('http', 'https')))
-            ) {
+            if (!empty($site['value']) && !common_valid_http_url($site['value'])) {
                 // TRANS: Exception thrown when entering an invalid URL.
                 // TRANS: %s is the invalid URL.
                 throw new Exception(sprintf(_m('Invalid URL: %s.'), $site['value']));
@@ -520,6 +518,7 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
             $result = $detail->insert();
             if (empty($result)) {
                 common_log_db_error($detail, 'INSERT', __FILE__);
+                // TRANS: Server error displayed when a field could not be saved in the database.
                 $this->serverError(_m('Could not save profile details.'));
             }
         } else {
@@ -532,6 +531,7 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
             $result = $detail->update($orig);
             if (empty($result)) {
                 common_log_db_error($detail, 'UPDATE', __FILE__);
+                // TRANS: Server error displayed when a field could not be saved in the database.
                 $this->serverError(_m('Could not save profile details.'));
             }
         }
@@ -620,7 +620,6 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
                 common_log_db_error($profile, 'UPDATE', __FILE__);
                 // TRANS: Server error thrown when user profile settings could not be saved.
                 $this->serverError(_m('Could not save profile.'));
-                return;
             }
 
             // Set the user tags
@@ -629,11 +628,9 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
             if (!$result) {
                 // TRANS: Server error thrown when user profile settings tags could not be saved.
                 $this->serverError(_m('Could not save tags.'));
-                return;
             }
 
             Event::handle('EndProfileSaveForm', array($this));
-            common_broadcast_profile($profile);
         }
     }