X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Finvite.php;h=4bba8893d6d136a194b0e419b89f9fb7fb5a2862;hb=85c2cf64229d08828f3d234741752b05b2f352c0;hp=5dcc836526317e7b124dd4c03ea2bca6606cdb2f;hpb=aec6456c9181ea97e11eb74c5eaf868c2406bebb;p=quix0rs-gnu-social.git diff --git a/actions/invite.php b/actions/invite.php index 5dcc836526..4bba8893d6 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -1,7 +1,7 @@ . */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class InviteAction extends CurrentUserDesignAction { @@ -35,8 +35,10 @@ class InviteAction extends CurrentUserDesignAction function handle($args) { parent::handle($args); - if (!common_logged_in()) { - $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'), + 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.'), common_config('site', 'name'))); return; } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { @@ -66,7 +68,7 @@ class InviteAction extends CurrentUserDesignAction 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; } @@ -96,6 +98,12 @@ class InviteAction extends CurrentUserDesignAction $this->showPage(); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('addresses'); + } + function title() { if ($this->mode == 'sent') { @@ -120,7 +128,7 @@ class InviteAction extends CurrentUserDesignAction $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'); } @@ -128,7 +136,7 @@ class InviteAction extends CurrentUserDesignAction $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'); } @@ -186,7 +194,8 @@ class InviteAction extends CurrentUserDesignAction _('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'); } @@ -214,9 +223,11 @@ class InviteAction extends CurrentUserDesignAction $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. ".