]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/EmailRegistration/confirmregistrationform.php
Localisation updates from http://translatewiki.net.
[quix0rs-gnu-social.git] / plugins / EmailRegistration / confirmregistrationform.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2011, StatusNet, Inc.
5  *
6  * Registration confirmation form
7  *
8  * PHP version 5
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * @category  Email registration
24  * @package   StatusNet
25  * @author    Evan Prodromou <evan@status.net>
26  * @copyright 2011 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
28  * @link      http://status.net/
29  */
30
31 if (!defined('STATUSNET')) {
32     // This check helps protect against security problems;
33     // your code file can't be executed directly from the web.
34     exit(1);
35 }
36
37 /**
38  * Registration confirmation form
39  *
40  * @category  Email registration
41  * @package   StatusNet
42  * @author    Evan Prodromou <evan@status.net>
43  * @copyright 2011 StatusNet, Inc.
44  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
45  * @link      http://status.net/
46  */
47 class ConfirmRegistrationForm extends Form
48 {
49     protected $code;
50     protected $nickname;
51     protected $email;
52
53     function __construct($out, $nickname, $email, $code)
54     {
55         parent::__construct($out);
56         $this->nickname = $nickname;
57         $this->email = $email;
58         $this->code = $code;
59     }
60
61     function formData()
62     {
63         $this->out->element('p', 'instructions',
64                             // TRANS: Form instructions.
65                             sprintf(_m('Enter a password to confirm your new account.')));
66
67         $this->hidden('code', $this->code);
68
69         $this->out->elementStart('ul', 'form_data');
70
71         $this->elementStart('li');
72
73         // TRANS: Field label in e-mail registration form.
74         $this->element('label', array('for' => 'nickname-ignore'), _m('LABEL','User name'));
75
76         $this->element('input', array('name' => 'nickname-ignore',
77                                       'type' => 'text',
78                                       'id' => 'nickname-ignore',
79                                       'disabled' => 'true',
80                                       'value' => $this->nickname));
81
82         $this->elementEnd('li');
83
84         $this->elementStart('li');
85
86         // TRANS: Field label.
87         $this->element('label', array('for' => 'email-ignore'), _m('Email address'));
88
89         $this->element('input', array('name' => 'email-ignore',
90                                       'type' => 'text',
91                                       'id' => 'email-ignore',
92                                       'disabled' => 'true',
93                                       'value' => $this->email));
94
95         $this->elementEnd('li');
96
97         $this->elementStart('li');
98         // TRANS: Field label on account registration page.
99         $this->password('password1', _m('Password'),
100                         // TRANS: Field title on account registration page.
101                         _m('6 or more characters.'));
102         $this->elementEnd('li');
103         $this->elementStart('li');
104         // TRANS: Field label on account registration page. In this field the password has to be entered a second time.
105         $this->password('password2', _m('PASSWORD','Confirm'),
106                         // TRANS: Field title on account registration page.
107                         _m('Same as password above.'));
108         $this->elementEnd('li');
109
110         $this->elementStart('li');
111
112         $this->element('input', array('name' => 'tos',
113                                       'type' => 'checkbox',
114                                       'class' => 'checkbox',
115                                       'id' => 'tos',
116                                       'value' => 'true'));
117         $this->text(' ');
118
119         $this->elementStart('label', array('class' => 'checkbox',
120                                            'for' => 'tos'));
121
122         // TRANS: Checkbox title for terms of service and privacy policy.
123         $this->raw(sprintf(_m('I agree to the <a href="%1$s">Terms of service</a> and '.
124                              '<a href="%1$s">Privacy policy</a> of this site.'),
125                            common_local_url('doc', array('title' => 'tos')),
126                            common_local_url('doc', array('title' => 'privacy'))));
127
128         $this->elementEnd('label');
129
130         $this->elementEnd('li');
131
132         $this->out->elementEnd('ul');
133     }
134
135     function method()
136     {
137         return 'post';
138     }
139
140     /**
141      * Buttons for form actions
142      *
143      * Submit and cancel buttons (or whatever)
144      * Sub-classes should overload this to show their own buttons.
145      *
146      * @return void
147      */
148
149     function formActions()
150     {
151         // TRANS: Button text for action to register.
152         $this->out->submit('submit', _m('BUTTON', 'Register'));
153     }
154
155     /**
156      * ID of the form
157      *
158      * Should be unique on the page. Sub-classes should overload this
159      * to show their own IDs.
160      *
161      * @return int ID of the form
162      */
163
164     function id()
165     {
166         return 'form_email_registration';
167     }
168
169     /**
170      * Action of the form.
171      *
172      * URL to post to. Should be overloaded by subclasses to give
173      * somewhere to post to.
174      *
175      * @return string URL to post to
176      */
177
178     function action()
179     {
180         return common_local_url('register');
181     }
182
183     function formClass()
184     {
185         return 'form_confirm_registration form_settings';
186     }
187 }