if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+// @todo XXX: Add documentation.
class InviteAction extends CurrentUserDesignAction
{
var $mode = null;
function sendInvitations()
{
- # CSRF protection
+ // CSRF protection
$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;
}
foreach ($addresses as $email) {
$email = trim($email);
- if (!Validate::email($email, common_config('email', 'check_domain'))) {
+ $valid = null;
+
+ if (Event::handle('StartValidateEmailInvite', array($user, $email, &$valid))) {
+ $valid = Validate::email($email, common_config('email', 'check_domain'));
+ Event::handle('EndValidateEmailInvite', array($user, $email, &$valid));
+ }
+
+ if (!$valid) {
// TRANS: Form validation message when providing an e-mail address that does not validate.
// TRANS: %s is an invalid e-mail address.
$this->showForm(sprintf(_('Invalid email address: %s.'), $email));
$this->elementStart('ul');
foreach ($this->already as $other) {
// TRANS: Used as list item for already subscribed users (%1$s is nickname, %2$s is e-mail address).
- $this->element('li', null, sprintf(_('%1$s (%2$s)'), $other->nickname, $other->email));
+ $this->element('li', null, sprintf(_m('INVITE','%1$s (%2$s)'), $other->nickname, $other->email));
}
$this->elementEnd('ul');
}
$this->elementStart('ul');
foreach ($this->subbed as $other) {
// TRANS: Used as list item for already registered people (%1$s is nickname, %2$s is e-mail address).
- $this->element('li', null, sprintf(_('%1$s (%2$s)'), $other->nickname, $other->email));
+ $this->element('li', null, sprintf(_m('INVITE','%1$s (%2$s)'), $other->nickname, $other->email));
}
$this->elementEnd('ul');
}
$this->textarea('addresses', _('Email addresses'),
$this->trimmed('addresses'),
// TRANS: Tooltip for field label for a list of e-mail addresses.
- _('Addresses of friends to invite (one per line)'));
+ _('Addresses of friends to invite (one per line).'));
$this->elementEnd('li');
$this->elementStart('li');
// TRANS: Field label for a personal message to send to invitees.
mail_send($recipients, $headers, $body);
}
-
- function showLocalNav()
- {
- $nav = new SubGroupNav($this, common_current_user());
- $nav->show();
- }
}