]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/smssettings.php
Email notify-on-fave moved to Profile_prefs (run upgrade.php)
[quix0rs-gnu-social.git] / actions / smssettings.php
index e672b6d8affaa7ad0fff53ed4d52bb8da2739d72..d8e219db413c4c8dcbc60d01c44b68d84a83657b 100644 (file)
@@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/connectsettingsaction.php';
-
 /**
  * Settings for SMS
  *
@@ -44,7 +42,8 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php';
  *
  * @see      SettingsAction
  */
-class SmssettingsAction extends ConnectSettingsAction
+
+class SmssettingsAction extends SettingsAction
 {
     /**
      * Title of the page
@@ -121,7 +120,7 @@ class SmssettingsAction extends ConnectSettingsAction
         } else {
             $confirm = $this->getConfirmation();
             if ($confirm) {
-                $carrier = Sms_carrier::staticGet($confirm->address_extra);
+                $carrier = Sms_carrier::getKV($confirm->address_extra);
                 $this->element('p', 'form_unconfirmed',
                                $confirm->address . ' (' . $carrier->name . ')');
                 $this->element('p', 'form_guide',
@@ -150,7 +149,7 @@ class SmssettingsAction extends ConnectSettingsAction
                              ($this->arg('sms')) ? $this->arg('sms') : null,
                              // TRANS: SMS phone number input field instructions in SMS settings form.
                              _('Phone number, no punctuation or spaces, '.
-                               'with area code'));
+                               'with area code.'));
                 $this->elementEnd('li');
                 $this->elementEnd('ul');
                 $this->carrierSelect();
@@ -247,6 +246,7 @@ class SmssettingsAction extends ConnectSettingsAction
 
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
+            // TRANS: Client error displayed when the session token does not match or is not given.
             $this->showForm(_('There was a problem with your session token. '.
                               'Try again, please.'));
             return;
@@ -299,7 +299,6 @@ class SmssettingsAction extends ConnectSettingsAction
             common_log_db_error($user, 'UPDATE', __FILE__);
             // TRANS: Server error thrown on database error updating SMS preferences.
             $this->serverError(_('Could not update user.'));
-            return;
         }
 
         $user->query('COMMIT');
@@ -363,10 +362,9 @@ class SmssettingsAction extends ConnectSettingsAction
             common_log_db_error($confirm, 'INSERT', __FILE__);
             // TRANS: Server error thrown on database error adding SMS confirmation code.
             $this->serverError(_('Could not insert confirmation code.'));
-            return;
         }
 
-        $carrier = Sms_carrier::staticGet($carrier_id);
+        $carrier = Sms_carrier::getKV($carrier_id);
 
         mail_confirm_sms($confirm->code,
                          $user->nickname,
@@ -410,8 +408,7 @@ class SmssettingsAction extends ConnectSettingsAction
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
             // TRANS: Server error thrown on database error canceling SMS phone number confirmation.
-            $this->serverError(_('Could not delete email confirmation.'));
-            return;
+            $this->serverError(_('Could not delete SMS confirmation.'));
         }
 
         // TRANS: Message given after successfully canceling SMS phone number confirmation.
@@ -452,7 +449,6 @@ class SmssettingsAction extends ConnectSettingsAction
             common_log_db_error($user, 'UPDATE', __FILE__);
             // TRANS: Server error thrown on database error removing a registered SMS phone number.
             $this->serverError(_('Could not update user.'));
-            return;
         }
         $user->query('COMMIT');
 
@@ -473,7 +469,7 @@ class SmssettingsAction extends ConnectSettingsAction
     {
         $user = common_current_user();
 
-        $other = User::staticGet('sms', $sms);
+        $other = User::getKV('sms', $sms);
 
         if (!$other) {
             return false;
@@ -532,7 +528,7 @@ class SmssettingsAction extends ConnectSettingsAction
 
         if (!$code) {
             // TRANS: Message given saving SMS phone number confirmation code without having provided one.
-            $this->showForm(_('No code entered'));
+            $this->showForm(_('No code entered.'));
             return;
         }
 
@@ -551,6 +547,7 @@ class SmssettingsAction extends ConnectSettingsAction
         $user = common_current_user();
 
         if (!$user->incomingemail) {
+            // TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
             $this->showForm(_('No incoming email address.'));
             return;
         }
@@ -561,9 +558,11 @@ class SmssettingsAction extends ConnectSettingsAction
 
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            $this->serverError(_("Could not update user record."));
+            // TRANS: Server error displayed when the user could not be updated in SMS settings.
+            $this->serverError(_('Could not update user record.'));
         }
 
+        // TRANS: Confirmation text after updating SMS settings.
         $this->showForm(_('Incoming email address removed.'), true);
     }
 
@@ -584,9 +583,11 @@ class SmssettingsAction extends ConnectSettingsAction
 
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            $this->serverError(_("Could not update user record."));
+            // TRANS: Server error displayed when the user could not be updated in SMS settings.
+            $this->serverError(_('Could not update user record.'));
         }
 
+        // TRANS: Confirmation text after updating SMS settings.
         $this->showForm(_('New incoming email address added.'), true);
     }
 }