3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('LACONICA')) { exit(1); }
22 class InviteAction extends Action {
24 function is_readonly() {
28 function handle($args) {
29 parent::handle($args);
30 if (!common_logged_in()) {
31 $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
32 common_config('site', 'name')));
34 } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
35 if ($this->trimmed('preview')) {
36 $this->show_preview();
37 } else if ($this->trimmed('send')) {
38 $this->send_invitation();
45 function show_preview() {
48 function send_invitation() {
51 function show_top($error=NULL) {
53 common_element('p', 'error', $error);
55 common_element_start('div', 'instructions');
56 common_element('p', NULL,
57 _('Use this form to invite your friends and colleagues to use this service.'));
58 common_element_end('div');
62 function show_form($error=NULL) {
66 common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
68 common_element_start('form', array('method' => 'post',
70 'action' => common_local_url('invite')));
72 common_textarea('addresses', _('Email addresses'),
73 $this->trimmed('addresses'),
74 _('Addresses of friends to invite (one per line)'));
76 common_textarea('personal', _('Personal message'),
77 $this->trimmed('personal'),
78 _('Optionally add a personal message to the invitation.'));
80 common_submit('preview', _('Preview'));
82 common_element_end('form');