]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/EmailRegistration/confirmregistrationform.php
Merge remote-tracking branch 'gitorious/1.0.x' into 1.0.x
[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
48 class ConfirmRegistrationForm extends Form
49 {
50     protected $code;
51     protected $nickname;
52     protected $email;
53
54     function __construct($out, $nickname, $email, $code)
55     {
56         parent::__construct($out);
57         $this->nickname = $nickname;
58         $this->email = $email;
59         $this->code = $code;
60     }
61
62     function formData()
63     {
64         $this->out->element('p', 'instructions',
65                             sprintf(_('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         $this->element('label', array('for' => 'nickname-ignore'), _('User name'));
74
75         $this->element('input', array('name' => 'nickname-ignore',
76                                       'type' => 'text',
77                                       'id' => 'nickname-ignore',
78                                       'disabled' => 'true',
79                                       'value' => $this->nickname));
80
81         $this->elementEnd('li');
82
83         $this->elementStart('li');
84
85         $this->element('label', array('for' => 'email-ignore'), _('Email'));
86
87         $this->element('input', array('name' => 'email-ignore',
88                                       'type' => 'text',
89                                       'id' => 'email-ignore',
90                                       'disabled' => 'true',
91                                       'value' => $this->email));
92
93         $this->elementEnd('li');
94
95         $this->elementStart('li');
96         // TRANS: Field label on account registration page.
97         $this->password('password1', _('Password'),
98                         // TRANS: Field title on account registration page.
99                         _('6 or more characters.'));
100         $this->elementEnd('li');
101         $this->elementStart('li');
102         // TRANS: Field label on account registration page. In this field the password has to be entered a second time.
103         $this->password('password2', _m('PASSWORD','Confirm'),
104                         // TRANS: Field title on account registration page.
105                         _('Same as password above.'));
106         $this->elementEnd('li');
107
108         $this->elementStart('li');
109
110         $this->element('input', array('name' => 'tos',
111                                       'type' => 'checkbox',
112                                       'class' => 'checkbox',
113                                       'id' => 'tos',
114                                       'value' => 'true'));
115         $this->text(' ');
116
117         $this->elementStart('label', array('class' => 'checkbox',
118                                            'for' => 'tos'));
119
120
121         $this->raw(sprintf(_('I agree to the <a href="%1$s">Terms of service</a> and '.
122                              '<a href="%1$s">Privacy policy</a> of this site.'),
123                            common_local_url('doc', array('title' => 'tos')),
124                            common_local_url('doc', array('title' => 'privacy'))));
125                            
126         $this->elementEnd('label');
127
128         $this->elementEnd('li');
129
130         $this->out->elementEnd('ul');
131     }
132
133     function method()
134     {
135         return 'post';
136     }
137
138     /**
139      * Buttons for form actions
140      *
141      * Submit and cancel buttons (or whatever)
142      * Sub-classes should overload this to show their own buttons.
143      *
144      * @return void
145      */
146
147     function formActions()
148     {
149         // TRANS: Button text for action to save a new bookmark.
150         $this->out->submit('submit', _m('BUTTON', 'Register'));
151     }
152
153     /**
154      * ID of the form
155      *
156      * Should be unique on the page. Sub-classes should overload this
157      * to show their own IDs.
158      *
159      * @return int ID of the form
160      */
161
162     function id()
163     {
164         return 'form_email_registration';
165     }
166
167     /**
168      * Action of the form.
169      *
170      * URL to post to. Should be overloaded by subclasses to give
171      * somewhere to post to.
172      *
173      * @return string URL to post to
174      */
175
176     function action()
177     {
178         return common_local_url('register');
179     }
180
181     function formClass()
182     {
183         return 'form_confirm_registration form_settings';
184     }
185 }