2 // @codingStandardsIgnoreFile
4 * Html form for account creation (since 1.22 with VForm appearance).
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 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 General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
25 class UsercreateTemplate
extends BaseTemplate
{
27 * Extensions (AntiSpoof and TitleBlacklist) call this in response to
28 * UserCreateForm hook to add checkboxes to the create account form.
30 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
31 $this->data
['extraInput'][] = array(
36 'helptext' => $helptext,
41 global $wgCookieExpiration;
42 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
44 <div
class="mw-ui-container">
45 <?php
if ( $this->haveData( 'languages' ) ) { ?
>
46 <div id
="languagelinks">
47 <p
><?php
$this->html( 'languages' ); ?
></p
>
50 if ( !wfMessage( 'signupstart' )->isDisabled() ) { ?
>
51 <div id
="signupstart"><?php
$this->msgWiki( 'signupstart' ); ?
></div
>
53 <div id
="userloginForm">
54 <form name
="userlogin2" id
="userlogin2" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
55 <section
class="mw-form-header">
56 <?php
$this->html( 'header' ); ?
>
58 <!-- This element is used by the mediawiki
.special
.userlogin
.signup
.js module
. -->
60 id
="mw-createacct-status-area"
61 <?php
if ( $this->data
['message'] ) { ?
>
62 class="<?php echo $this->data['messagetype']; ?>box"
64 style
="display: none;"
67 <?php
if ( $this->data
['message'] ) { ?
>
68 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
69 <strong
><?php
$this->msg( 'createacct-error' ); ?
></strong
>
72 <?php
$this->html( 'message' ); ?
>
76 <div
class="mw-ui-vform-field">
78 <?php
$this->msg( 'userlogin-yourname' ); ?
>
80 <span
class="mw-ui-flush-right"><?php
echo $this->getMsg( 'createacct-helpusername' )->parse(); ?
></span
>
83 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
84 'class' => 'mw-ui-input loginText',
89 'placeholder' => $this->getMsg( $this->data
['loggedin'] ?
90 'createacct-another-username-ph' : 'userlogin-yourname-ph' )->text(),
95 <div
class="mw-ui-vform-field">
96 <?php
if ( $this->data
['createemail'] ) { ?
>
97 <div
class="mw-ui-checkbox">
98 <input name
="wpCreateaccountMail" type
="checkbox" value
="1" id
="wpCreateaccountMail" tabindex
="2"
99 <?php
if ( $this->data
['createemailset'] ) {
100 echo 'checked="checked"';
102 ><label
for="wpCreateaccountMail">
103 <?php
$this->msg( 'createaccountmail' ); ?
>
109 <div
class="mw-ui-vform-field mw-row-password">
110 <label
for='wpPassword2'><?php
$this->msg( 'userlogin-yourpassword' ); ?
></label
>
112 echo Html
::input( 'wpPassword', null, 'password', array(
113 'class' => 'mw-ui-input loginPassword',
114 'id' => 'wpPassword2',
118 'placeholder' => $this->getMsg( 'createacct-yourpassword-ph' )->text()
119 ) + User
::passwordChangeInputAttribs() );
124 if ( $this->data
['usedomain'] ) {
125 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
126 $select->setAttribute( 'tabindex', 4 );
127 foreach ( $this->data
['domainnames'] as $dom ) {
128 $select->addOption( $dom );
131 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
132 <label
for="wpDomain"><?php
$this->msg( 'yourdomainname' ); ?
></label
>
134 <?php
echo $select->getHTML(); ?
>
139 <div
class="mw-ui-vform-field mw-row-password">
140 <label
for='wpRetype'><?php
$this->msg( 'createacct-yourpasswordagain' ); ?
></label
>
142 echo Html
::input( 'wpRetype', null, 'password', array(
143 'class' => 'mw-ui-input loginPassword',
148 'placeholder' => $this->getMsg( 'createacct-yourpasswordagain-ph' )->text()
149 ) + User
::passwordChangeInputAttribs() );
153 <div
class="mw-ui-vform-field">
154 <?php
if ( $this->data
['useemail'] ) { ?
>
155 <label
for='wpEmail'>
157 $this->msg( $this->data
['emailrequired'] ?
158 'createacct-emailrequired' :
159 'createacct-emailoptional'
164 echo Html
::input( 'wpEmail', $this->data
['email'], 'email', array(
165 'class' => 'mw-ui-input loginText',
169 'required' => $this->data
['emailrequired'],
170 'placeholder' => $this->getMsg( $this->data
['loggedin'] ?
171 'createacct-another-email-ph' : 'createacct-email-ph' )->text()
177 <?php
if ( $this->data
['userealname'] ) { ?
>
178 <div
class="mw-ui-vform-field">
179 <label
for='wpRealName'><?php
$this->msg( 'createacct-realname' ); ?
></label
>
180 <input type
='text' class='mw-ui-input loginText' name
="wpRealName" id
="wpRealName"
182 value
="<?php $this->text( 'realname' ); ?>" size
='20' />
183 <div
class="prefsectiontip">
184 <?php
$this->msgWiki( $this->data
['loggedin'] ?
'createacct-another-realname-tip' : 'prefs-help-realname' ); ?
>
189 <?php
if ( $this->data
['usereason'] ) { ?
>
190 <div
class="mw-ui-vform-field">
191 <label
for='wpReason'><?php
$this->msg( 'createacct-reason' ); ?
></label
>
192 <?php
echo Html
::input( 'wpReason', $this->data
['reason'], 'text', array(
193 'class' => 'mw-ui-input loginText',
197 'placeholder' => $this->getMsg( 'createacct-reason-ph' )->text()
204 if ( isset( $this->data
['extraInput'] ) && is_array( $this->data
['extraInput'] ) ) {
205 foreach ( $this->data
['extraInput'] as $inputItem ) { ?
>
206 <div
class="mw-ui-vform-field">
208 // If it's a checkbox, output the whole thing (assume it has a msg).
209 if ( $inputItem['type'] == 'checkbox' ) {
211 <div
class="mw-ui-checkbox">
213 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
214 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
215 type
="checkbox" value
="1"
216 tabindex
="<?php echo $tabIndex++; ?>"
217 <?php
if ( !empty( $inputItem['value'] ) ) {
218 echo 'checked="checked"';
220 ><label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
221 <?php
$this->msgHtml( $inputItem['msg'] ); ?
>
227 // TODO (bug 31909) support other input types, e.g. select boxes.
229 <?php
if ( !empty( $inputItem['msg'] ) ) { ?
>
230 <label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
231 <?php
$this->msgWiki( $inputItem['msg'] ); ?
>
235 type
="<?php echo htmlspecialchars( $inputItem['type'] ); ?>"
237 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
238 tabindex
="<?php echo $tabIndex++; ?>"
239 value
="<?php echo htmlspecialchars( $inputItem['value'] ); ?>"
240 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
243 <?php
if ( $inputItem['helptext'] !== false ) { ?
>
244 <div
class="prefsectiontip">
245 <?php
$this->msgWiki( $inputItem['helptext'] ); ?
>
253 // A separate placeholder for any inserting any extrafields, e.g used by ConfirmEdit extension
254 if ( $this->haveData( 'extrafields' ) ) {
255 echo $this->data
['extrafields'];
260 <div
class="mw-ui-vform-field mw-submit">
262 echo Html
::submitButton(
263 $this->getMsg( $this->data
['loggedin'] ?
'createacct-another-submit' : 'createacct-submit' ),
265 'id' => 'wpCreateaccount',
266 'name' => 'wpCreateaccount',
267 'tabindex' => $tabIndex++
271 'mw-ui-constructive',
276 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
277 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpCreateaccountToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
279 <?php
if ( !wfMessage( 'signupend' )->isDisabled() ) { ?
>
280 <div id
="signupend"><?php
$this->html( 'signupend' ); ?
></div
>
283 <div
class="mw-createacct-benefits-container">
284 <h2
><?php
$this->msg( 'createacct-benefit-heading' ); ?
></h2
>
285 <div
class="mw-createacct-benefits-list">
287 for ( $benefitIdx = 1; $benefitIdx <= $this->data
['benefitCount']; $benefitIdx++
) {
288 // Pass each benefit's head text (by default a number) as a parameter to the body's message for PLURAL handling.
289 $headUnescaped = $this->getMsg( "createacct-benefit-head$benefitIdx" )->text();
291 <div
class="mw-number-text <?php $this->msg( "createacct
-benefit
-icon
$benefitIdx" ); ?>">
292 <h3
><?php
$this->msg( "createacct-benefit-head$benefitIdx" ); ?
></h3
>
293 <p
><?php
echo $this->getMsg( "createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped(); ?
></p
>