Merge "Add ss_active_users in SiteStats::isSane"
[mediawiki.git] / includes / templates / Usercreate.php
blob28b5d7927ec1e7965b73f05a104b14f7a15dc0da
1 <?php
2 /**
3 * Html form for account creation.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup Templates
24 /**
25 * @defgroup Templates Templates
28 if ( !defined( 'MEDIAWIKI' ) ) {
29 die( -1 );
32 /**
33 * @ingroup Templates
35 class UsercreateTemplate extends QuickTemplate {
36 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
37 $this->data['extraInput'][] = array(
38 'name' => $name,
39 'value' => $value,
40 'type' => $type,
41 'msg' => $msg,
42 'helptext' => $helptext,
46 function execute() {
47 if ( $this->data['message'] ) {
49 <div class="<?php $this->text( 'messagetype' ); ?>box">
50 <?php
51 if ( $this->data['messagetype'] == 'error' ) {
52 ?><strong><?php $this->msg( 'loginerror' ); ?></strong><br /><?php
54 $this->html( 'message' );
56 </div>
57 <div class="visualClear"></div>
58 <?php
62 <div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div>
63 <div id="userlogin">
65 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text( 'action' ); ?>">
66 <h2><?php $this->msg( 'createaccount' ); ?></h2>
67 <p id="userloginlink"><?php $this->html( 'link' ); ?></p>
68 <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?>
69 <?php
70 if ( $this->haveData( 'languages' ) ) {
71 ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php
74 <table>
75 <tr>
76 <td class="mw-label"><label for='wpName2'><?php $this->msg( 'yourname' ); ?></label></td>
77 <td class="mw-input">
78 <?php
79 echo Html::input( 'wpName', $this->data['name'], 'text', array(
80 'class' => 'loginText',
81 'id' => 'wpName2',
82 'tabindex' => '1',
83 'size' => '20',
84 'required',
85 'autofocus'
86 ) ); ?>
87 </td>
88 </tr>
89 <tr>
90 <td></td>
91 <td class="mw-input">
92 <?php
93 if ( $this->data['createemail'] ) {
94 echo Xml::checkLabel(
95 wfMessage( 'createaccountmail' )->text(),
96 'wpCreateaccountMail',
97 'wpCreateaccountMail',
98 $this->data['createemailset'],
99 array( 'tabindex' => '2' )
103 </td>
104 </tr>
105 <tr class="mw-row-password">
106 <td class="mw-label"><label for='wpPassword2'><?php $this->msg( 'yourpassword' ); ?></label></td>
107 <td class="mw-input">
108 <?php
109 echo Html::input( 'wpPassword', null, 'password', array(
110 'class' => 'loginPassword',
111 'id' => 'wpPassword2',
112 'tabindex' => '3',
113 'size' => '20'
114 ) + User::passwordChangeInputAttribs() ); ?>
115 </td>
116 </tr>
117 <?php
118 if ( $this->data['usedomain'] ) {
119 $doms = "";
120 foreach ( $this->data['domainnames'] as $dom ) {
121 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
124 <tr id="mw-user-domain-section">
125 <td class="mw-label"><?php $this->msg( 'yourdomainname' ); ?></td>
126 <td class="mw-input">
127 <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>"
128 tabindex="4">
129 <?php echo $doms ?>
130 </select>
131 </td>
132 </tr>
133 <?php
136 <tr class="mw-row-password">
137 <td class="mw-label"><label for='wpRetype'><?php $this->msg( 'yourpasswordagain' ); ?></label></td>
138 <td class="mw-input">
139 <?php
140 echo Html::input( 'wpRetype', null, 'password', array(
141 'class' => 'loginPassword',
142 'id' => 'wpRetype',
143 'tabindex' => '5',
144 'size' => '20'
145 ) + User::passwordChangeInputAttribs() ); ?>
146 </td>
147 </tr>
148 <tr>
149 <?php
150 if ( $this->data['useemail'] ) {
152 <td class="mw-label"><label for='wpEmail'><?php $this->msg( 'youremail' ); ?></label></td>
153 <td class="mw-input">
154 <?php
155 echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
156 'class' => 'loginText',
157 'id' => 'wpEmail',
158 'tabindex' => '6',
159 'size' => '20'
160 ) ); ?>
161 <div class="prefsectiontip">
162 <?php // duplicated in Preferences.php profilePreferences()
163 if ( $this->data['emailrequired'] ) {
164 $this->msgWiki( 'prefs-help-email-required' );
165 } else {
166 $this->msgWiki( 'prefs-help-email' );
168 if ( $this->data['emailothers'] ) {
169 $this->msgWiki( 'prefs-help-email-others' );
170 } ?>
171 </div>
172 </td>
173 <?php
176 if ( $this->data['userealname'] ) {
178 </tr>
179 <tr>
180 <td class="mw-label"><label for='wpRealName'><?php $this->msg( 'yourrealname' ); ?></label></td>
181 <td class="mw-input">
182 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
183 tabindex="7"
184 value="<?php $this->text( 'realname' ); ?>" size='20' />
185 <div class="prefsectiontip">
186 <?php $this->msgWiki( 'prefs-help-realname' ); ?>
187 </div>
188 </td>
189 <?php
192 if ( $this->data['usereason'] ) {
194 </tr>
195 <tr>
196 <td class="mw-label"><label for='wpReason'><?php $this->msg( 'createaccountreason' ); ?></label></td>
197 <td class="mw-input">
198 <input type='text' class='loginText' name="wpReason" id="wpReason"
199 tabindex="8"
200 value="<?php $this->text( 'reason' ); ?>" size='20' />
201 </td>
202 <?php
205 </tr>
206 <?php
207 if ( $this->data['canremember'] ) {
209 <tr>
210 <td></td>
211 <td class="mw-input">
212 <?php
213 global $wgCookieExpiration;
214 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
215 echo Xml::checkLabel(
216 wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
217 'wpRemember',
218 'wpRemember',
219 $this->data['remember'],
220 array( 'tabindex' => '9' )
223 </td>
224 </tr>
225 <?php
228 $tabIndex = 10;
229 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
230 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
231 <tr>
232 <?php
233 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
234 ?><td class="mw-label"><label for="<?php
235 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
236 $this->msgWiki( $inputItem['msg'] ); ?></label><?php
237 } else {
238 ?><td><?php
240 ?></td>
241 <td class="mw-input">
242 <input type="<?php echo htmlspecialchars( $inputItem['type'] ); ?>" name="<?php
243 echo htmlspecialchars( $inputItem['name'] ); ?>"
244 tabindex="<?php echo $tabIndex++; ?>"
245 value="<?php
246 if ( $inputItem['type'] != 'checkbox' ) {
247 echo htmlspecialchars( $inputItem['value'] );
248 } else {
249 echo '1';
251 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
252 <?php
253 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) ) {
254 echo 'checked="checked"';
256 ?> /> <?php
257 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
259 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
260 $this->msgHtml( $inputItem['msg'] ); ?></label><?php
262 if ( $inputItem['helptext'] !== false ) {
264 <div class="prefsectiontip">
265 <?php $this->msgWiki( $inputItem['helptext'] ); ?>
266 </div><?php
269 </td>
270 </tr>
271 <?php
275 <tr>
276 <td></td>
277 <td class="mw-submit">
278 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
279 tabindex="<?php echo $tabIndex++; ?>"
280 value="<?php $this->msg( 'createaccount' ); ?>" />
281 </td>
282 </tr>
283 </table>
284 <?php
285 if ( $this->haveData( 'uselang' ) ) {
286 ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php
288 if ( $this->haveData( 'token' ) ) {
289 ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php
292 </form>
293 </div>
294 <div id="signupend"><?php $this->html( 'signupend' ); ?></div>
295 <?php