]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/RequireValidatedEmail/confirmfirstemail.php
More info for a proper, fancy-url lighttpd setup
[quix0rs-gnu-social.git] / plugins / RequireValidatedEmail / confirmfirstemail.php
index bdf7c43a1b795b68a7ce4949ac3548b6eace2aa7..0019d1c6be90303aa020187b1c5741043b31a2b9 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2011, StatusNet, Inc.
  *
  * Action for confirming first email registration
- * 
+ *
  * PHP version 5
  *
  * This program is free software: you can redistribute it and/or modify
@@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-
 class ConfirmfirstemailAction extends Action
 {
     public $confirm;
@@ -59,40 +58,44 @@ class ConfirmfirstemailAction extends Action
      *
      * @return boolean true
      */
-
     function prepare($argarray)
     {
         parent::prepare($argarray);
         $user = common_current_user();
 
         if (!empty($user)) {
-            throw new ClientException(_('You are already logged in.'));
+            // TRANS: Client exception thrown when trying to register while already logged in.
+            throw new ClientException(_m('You are already logged in.'));
         }
 
         $this->code = $this->trimmed('code');
 
-        $this->confirm = Confirm_address::staticGet('code', $this->code);
+        $this->confirm = Confirm_address::getKV('code', $this->code);
 
         if (empty($this->confirm)) {
-            throw new ClientException(_('Confirmation code not found.'));
+            // TRANS: Client exception thrown when trying to register with a non-existing confirmation code.
+            throw new ClientException(_m('Confirmation code not found.'));
             return;
         }
 
-        $this->user = User::staticGet('id', $this->confirm->user_id);
+        $this->user = User::getKV('id', $this->confirm->user_id);
 
         if (empty($this->user)) {
-            throw new ServerException(_('No user for that confirmation code.'));
+            // TRANS: Client exception thrown when trying to register with a confirmation code that is not connected with a user.
+            throw new ServerException(_m('No user for that confirmation code.'));
         }
 
         $type = $this->confirm->address_type;
 
         if ($type != 'email') {
-            throw new ServerException(sprintf(_('Unrecognized address type %s.'), $type));
+            // TRANS: Client exception thrown when trying to register with a invalid e-mail address.
+            // TRANS: %s is the invalid e-mail address.
+            throw new ServerException(sprintf(_m('Unrecognized address type %s.'), $type));
         }
 
         if (!empty($this->user->email) && $this->user->email == $confirm->address) {
             // TRANS: Client error for an already confirmed email/jabber/sms address.
-            throw new ClientException(_('That address has already been confirmed.'));
+            throw new ClientException(_m('That address has already been confirmed.'));
         }
 
         if ($this->isPost()) {
@@ -103,10 +106,12 @@ class ConfirmfirstemailAction extends Action
             $confirm  = $this->trimmed('confirm');
 
             if (strlen($password) < 6) {
-                throw new ClientException(_('Password too short.'));
+                // TRANS: Client exception thrown when trying to register with too short a password.
+                throw new ClientException(_m('Password too short.'));
                 return;
             } else if (0 != strcmp($password, $confirm)) {
-                throw new ClientException(_("Passwords don't match."));
+                // TRANS: Client exception thrown when trying to register without providing the same password twice.
+                throw new ClientException(_m('Passwords do not match.'));
                 return;
             }
 
@@ -123,10 +128,9 @@ class ConfirmfirstemailAction extends Action
      *
      * @return void
      */
-
     function handle($argarray=null)
     {
-        $homepage = common_local_url('all', 
+        $homepage = common_local_url('all',
                                      array('nickname' => $this->user->nickname));
 
         if ($this->isPost()) {
@@ -162,7 +166,8 @@ class ConfirmfirstemailAction extends Action
     function showContent()
     {
         $this->element('p', 'instructions',
-                       sprintf(_('You have confirmed the email address for your new user account %s. '.
+                       // TRANS: Form instructions. %s is the nickname of the to be registered user.
+                       sprintf(_m('You have confirmed the email address for your new user account %s. '.
                                  'Use the form below to set your new password.'),
                                $this->user->nickname));
 
@@ -172,7 +177,8 @@ class ConfirmfirstemailAction extends Action
 
     function title()
     {
-        return _('Set a password');
+        // TRANS: Page title.
+        return _m('Set a password');
     }
 }
 
@@ -188,7 +194,8 @@ class ConfirmFirstEmailForm extends Form
 
     function formLegend()
     {
-        return _('Confirm email');
+        // TRANS: Form legend.
+        return _m('Confirm email address');
     }
 
     function action()
@@ -197,22 +204,32 @@ class ConfirmFirstEmailForm extends Form
                                 array('code' => $this->code));
     }
 
+    function formClass()
+    {
+        return 'form_settings';
+    }
+
     function formData()
     {
         $this->out->elementStart('ul', 'form_data');
         $this->out->elementStart('li');
-        $this->out->password('password', _('New password'),
-                             _('6 or more characters.'));
+        // TRANS: Field label.
+        $this->out->password('password', _m('New password'),
+                             // TRANS: Field title for password field.
+                             _m('6 or more characters.'));
         $this->out->elementEnd('li');
         $this->out->elementStart('li');
-        $this->out->password('confirm', _('Confirm'),
-                             _('Same as password above.'));
+        // TRANS: Field label for repeat password field.
+        $this->out->password('confirm', _m('LABEL','Confirm'),
+                             // TRANS: Field title for repeat password field.
+                             _m('Same as password above.'));
         $this->out->elementEnd('li');
         $this->out->elementEnd('ul');
     }
 
     function formActions()
     {
-        $this->out->submit('save', _('Save'));
+        // TRANS: Button text for completing registration by e-mail.
+        $this->out->submit('save', _m('BUTTON','Save'));
     }
 }