wfMsgForContentNoTrans() was removed
[mediawiki.git] / includes / templates / Userlogin.php
blob4a0b413f430e400bb027517d42611cec4468d2af
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * Html form for user login (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
21 * @file
22 * @ingroup Templates
25 class UserloginTemplate extends BaseTemplate {
27 function execute() {
28 global $wgCookieExpiration;
29 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
31 <div class="mw-ui-container">
32 <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
33 <?php if ( $this->haveData( 'languages' ) ) { ?>
34 <div id="languagelinks">
35 <p><?php $this->html( 'languages' ); ?></p>
36 </div>
37 <?php } ?>
38 <div id="userloginForm">
39 <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
40 <?php if ( $this->data['loggedin'] ) { ?>
41 <div class="warningbox">
42 <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
43 </div>
44 <?php } ?>
45 <section class="mw-form-header">
46 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
47 </section>
49 <?php if ( $this->data['message'] ) { ?>
50 <div class="<?php $this->text( 'messagetype' ); ?>box">
51 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
52 <strong><?php $this->msg( 'loginerror' ); ?></strong>
53 <br />
54 <?php } ?>
55 <?php $this->html( 'message' ); ?>
56 </div>
57 <?php } ?>
59 <?php if ( $this->data['formheader'] ) { ?>
60 <div class="mw-form-formheader">
61 <?php $this->html( 'formheader' ); /* extensions such as MobileFrontend add html here */ ?>
62 </div>
63 <?php } ?>
64 <div class="mw-ui-vform-field">
65 <label for='wpName1'>
66 <?php
67 $this->msg( 'userlogin-yourname' );
69 if ( $this->data['secureLoginUrl'] ) {
70 echo Html::element( 'a', array(
71 'href' => $this->data['secureLoginUrl'],
72 'class' => 'mw-ui-flush-right mw-secure',
73 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
76 </label>
77 <?php
78 echo Html::input( 'wpName', $this->data['name'], 'text', array(
79 'class' => 'loginText mw-ui-input',
80 'id' => 'wpName1',
81 'tabindex' => '1',
82 // 'required' is blacklisted for now in Html.php due to browser issues.
83 // Keeping here in case that changes.
84 'required' => true,
85 // Set focus to this field if it's blank.
86 'autofocus' => !$this->data['name'],
87 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
88 ) );
90 </div>
92 <div class="mw-ui-vform-field">
93 <label for='wpPassword1'>
94 <?php
95 $this->msg( 'userlogin-yourpassword' );
97 </label>
98 <?php
99 echo Html::input( 'wpPassword', null, 'password', array(
100 'class' => 'loginPassword mw-ui-input',
101 'id' => 'wpPassword1',
102 'tabindex' => '2',
103 // Set focus to this field if username is filled in.
104 'autofocus' => (bool)$this->data['name'],
105 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
106 ) );
108 </div>
110 <?php
111 if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
112 $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
113 $select->setAttribute( 'tabindex', 3 );
114 foreach ( $this->data['domainnames'] as $dom ) {
115 $select->addOption( $dom );
118 <div class="mw-ui-vform-field" id="mw-user-domain-section">
119 <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
120 <?php echo $select->getHTML(); ?>
121 </div>
122 <?php } ?>
124 <?php
125 if ( $this->haveData( 'extrafields' ) ) {
126 echo $this->data['extrafields'];
130 <div class="mw-ui-vform-field">
131 <?php if ( $this->data['canremember'] ) { ?>
132 <div class="mw-ui-checkbox">
133 <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
134 <?php if ( $this->data['remember'] ) {
135 echo 'checked="checked"';
136 } ?>
137 ><label for="wpRemember">
138 <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?></label>
139 </div>
140 <?php } ?>
141 </div>
143 <div class="mw-ui-vform-field">
144 <?php
145 $attrs = array(
146 'id' => 'wpLoginAttempt',
147 'name' => 'wpLoginAttempt',
148 'tabindex' => '6',
150 $modifiers = array(
151 'mw-ui-constructive',
153 echo Html::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers );
155 </div>
157 <div class="mw-ui-vform-field mw-form-related-link-container" id="mw-userlogin-help">
158 <?php
159 echo Html::element(
160 'a',
161 array(
162 'href' => Skin::makeInternalOrExternalUrl(
163 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
166 $this->getMsg( 'userlogin-helplink2' )->text()
169 </div>
170 <?php
172 if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
173 echo Html::rawElement(
174 'div',
175 array(
176 'class' => 'mw-ui-vform-field mw-form-related-link-container',
178 Linker::link(
179 SpecialPage::getTitleFor( 'PasswordReset' ),
180 $this->getMsg( 'userlogin-resetpassword-link' )->escaped()
185 if ( $this->haveData( 'createOrLoginHref' ) ) {
186 if ( $this->data['loggedin'] ) { ?>
187 <div class="mw-form-related-link-container mw-ui-vform-field">
188 <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"><?php $this->msg( 'userlogin-createanother' ); ?></a>
189 </div>
190 <?php } else { ?>
191 <div id="mw-createaccount-cta" class="mw-form-related-link-container mw-ui-vform-field">
192 <?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button mw-ui-progressive"><?php $this->msg( 'userlogin-joinproject' ); ?></a>
193 </div>
194 <?php
198 // Hidden fields
199 $fields = '';
200 if ( $this->haveData( 'uselang' ) ) {
201 $fields .= Html::hidden( 'uselang', $this->data['uselang'] );
203 if ( $this->haveData( 'token' ) ) {
204 $fields .= Html::hidden( 'wpLoginToken', $this->data['token'] );
206 if ( $this->data['cansecurelogin'] ) {
207 $fields .= Html::hidden( 'wpForceHttps', $this->data['stickhttps'] );
209 if ( $this->data['cansecurelogin'] && $this->haveData( 'fromhttp' ) ) {
210 $fields .= Html::hidden( 'wpFromhttp', $this->data['fromhttp'] );
212 echo $fields;
215 </form>
216 </div>
217 </div>
218 <?php