]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/invite.php
38ce38907b729762da05f218fb5651edceaa8bd0
[quix0rs-gnu-social.git] / actions / invite.php
1 <?php
2 /*
3  * Laconica - a distributed open-source microblogging tool
4  * Copyright (C) 2008, Controlez-Vous, Inc.
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 if (!defined('LACONICA')) { exit(1); }
21
22 class InviteAction extends Action {
23         
24         function is_readonly() {                                
25                 return false;
26         }
27         
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')));
33                         return;
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();
39                         }
40                 } else {
41                         $this->show_form();
42                 }
43         }
44         
45         function show_preview() {
46         }
47         
48         function send_invitation() {
49         }
50         
51         function show_top($error=NULL) {
52                 if ($error) {
53                         common_element('p', 'error', $error);
54                 } else {
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');
59                 }
60         }
61
62         function show_form($error=NULL) {
63                 
64                 global $config;
65
66                 common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
67
68                 common_element_start('form', array('method' => 'post',
69                                                                                    'id' => 'invite',
70                                                                                    'action' => common_local_url('invite')));
71
72                 common_textarea('addresses', _('Email addresses'),
73                                                 $this->trimmed('addresses'),
74                                                 _('Addresses of friends to invite (one per line)'));
75                 
76                 common_textarea('personal', _('Personal message'),
77                                                 $this->trimmed('personal'),
78                                                 _('Optionally add a personal message to the invitation.'));
79                 
80                 common_submit('preview', _('Preview'));
81
82                 common_element_end('form');
83                 
84                 common_show_footer();
85         }
86 }