]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/invite.php
updated
[quix0rs-gnu-social.git] / actions / invite.php
index 9631f7a7f09d2674098ef0d806dbefacf4acf8ad..4bba8893d6d136a194b0e419b89f9fb7fb5a2862 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -17,9 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
-class InviteAction extends Action
+class InviteAction extends CurrentUserDesignAction
 {
     var $mode = null;
     var $error = null;
@@ -38,7 +38,7 @@ class InviteAction extends Action
         if (!common_config('invite', 'enabled')) {
             $this->clientError(_('Invites have been disabled.'));
         } else if (!common_logged_in()) {
-            $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'),
+            $this->clientError(sprintf(_('You must be logged in to invite other users to use %s.'),
                                         common_config('site', 'name')));
             return;
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -68,7 +68,7 @@ class InviteAction extends Action
 
         foreach ($addresses as $email) {
             $email = trim($email);
-            if (!Validate::email($email, true)) {
+            if (!Validate::email($email, common_config('email', 'check_domain'))) {
                 $this->showForm(sprintf(_('Invalid email address: %s'), $email));
                 return;
             }
@@ -98,6 +98,12 @@ class InviteAction extends Action
         $this->showPage();
     }
 
+    function showScripts()
+    {
+        parent::showScripts();
+        $this->autofocus('addresses');
+    }
+
     function title()
     {
         if ($this->mode == 'sent') {
@@ -122,7 +128,7 @@ class InviteAction extends Action
             $this->element('p', null, _('You are already subscribed to these users:'));
             $this->elementStart('ul');
             foreach ($this->already as $other) {
-                $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                $this->element('li', null, sprintf(_('%1$s (%2$s)'), $other->nickname, $other->email));
             }
             $this->elementEnd('ul');
         }
@@ -130,7 +136,7 @@ class InviteAction extends Action
             $this->element('p', null, _('These people are already users and you were automatically subscribed to them:'));
             $this->elementStart('ul');
             foreach ($this->subbed as $other) {
-                $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                $this->element('li', null, sprintf(_('%1$s (%2$s)'), $other->nickname, $other->email));
             }
             $this->elementEnd('ul');
         }
@@ -188,7 +194,8 @@ class InviteAction extends Action
                         _('Optionally add a personal message to the invitation.'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
-        $this->submit('send', _('Send'));
+        // TRANS: Send button for inviting friends
+        $this->submit('send', _m('BUTTON', 'Send'));
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
     }
@@ -216,9 +223,11 @@ class InviteAction extends Action
         $recipients = array($email);
 
         $headers['From'] = mail_notify_from();
-        $headers['To'] = $email;
+        $headers['To'] = trim($email);
+        // TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral singular 3rd-person pronoun in English.
         $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
 
+        // TRANS: Body text for invitation email. Note that 'them' is correct as a gender-neutral singular 3rd-person pronoun in English.
         $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n".
                           "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
                           "You can also share news about yourself, your thoughts, or your life online with people who know about you. ".