X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Finvite.php;h=9fa6a76f671f471a83b13b590db846401fd6b039;hb=03022c6e601f223c92216af9748c764786cf46c2;hp=62609f56641cf33794e4c2e8a3d4acd6ad24b14c;hpb=03ce6aee2eb228aaf32c0b095284b95722d661b2;p=quix0rs-gnu-social.git diff --git a/actions/invite.php b/actions/invite.php index 62609f5664..9fa6a76f67 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 Action +class InviteAction extends CurrentUserDesignAction { var $mode = null; + var $error = null; + var $already = null; + var $subbed = null; + var $sent = null; - function isReadOnly() + function isReadOnly($args) { return false; } @@ -31,7 +35,9 @@ class InviteAction extends Action function handle($args) { parent::handle($args); - if (!common_logged_in()) { + 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; @@ -92,6 +98,12 @@ class InviteAction extends Action $this->showPage(); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('addresses'); + } + function title() { if ($this->mode == 'sent') { @@ -163,20 +175,27 @@ class InviteAction extends Action function showInviteForm() { $this->elementStart('form', array('method' => 'post', - 'id' => 'invite', + 'id' => 'form_invite', + 'class' => 'form_settings', 'action' => common_local_url('invite'))); + $this->elementStart('fieldset'); + $this->element('legend', null, 'Send an invitation'); $this->hidden('token', common_session_token()); + $this->elementStart('ul', 'form_data'); + $this->elementStart('li'); $this->textarea('addresses', _('Email addresses'), $this->trimmed('addresses'), _('Addresses of friends to invite (one per line)')); - + $this->elementEnd('li'); + $this->elementStart('li'); $this->textarea('personal', _('Personal message'), $this->trimmed('personal'), _('Optionally add a personal message to the invitation.')); - + $this->elementEnd('li'); + $this->elementEnd('ul'); $this->submit('send', _('Send')); - + $this->elementEnd('fieldset'); $this->elementEnd('form'); } @@ -203,7 +222,7 @@ class InviteAction extends Action $recipients = array($email); $headers['From'] = mail_notify_from(); - $headers['To'] = $email; + $headers['To'] = trim($email); $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n". @@ -222,9 +241,14 @@ class InviteAction extends Action common_root_url(), $personal, common_local_url('showstream', array('nickname' => $user->nickname)), - common_local_url('register', array('code' => $invite->code))); + common_local_url((!common_config('site', 'openidonly')) ? 'register' : 'openidlogin', array('code' => $invite->code))); mail_send($recipients, $headers, $body); } + function showLocalNav() + { + $nav = new SubGroupNav($this, common_current_user()); + $nav->show(); + } }