Merge "Show the revision list immediately on "umerge" log action links"
[lhc/web/wiklou.git] / includes / templates / Userlogin.php
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * Html form for user login (since 1.22 with VForm appearance).
5 *
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.
10 *
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.
15 *
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
20 *
21 * @file
22 * @ingroup Templates
23 */
24
25 class UserloginTemplate extends BaseTemplate {
26
27 function execute() {
28 global $wgCookieExpiration;
29 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
30 ?>
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 <section class="mw-form-header">
41 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
42 </section>
43
44 <?php if ( $this->data['message'] ) { ?>
45 <div class="<?php $this->text( 'messagetype' ); ?>box">
46 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
47 <strong><?php $this->msg( 'loginerror' ); ?></strong>
48 <br />
49 <?php } ?>
50 <?php $this->html( 'message' ); ?>
51 </div>
52 <?php } ?>
53
54 <div class="mw-ui-vform-field">
55 <label for='wpName1'>
56 <?php
57 $this->msg( 'userlogin-yourname' );
58
59 if ( $this->data['secureLoginUrl'] ) {
60 echo Html::element( 'a', array(
61 'href' => $this->data['secureLoginUrl'],
62 'class' => 'mw-ui-flush-right mw-secure',
63 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
64 }
65 ?>
66 </label>
67 <?php
68 $extraAttrs = array();
69 echo Html::input( 'wpName', $this->data['name'], 'text', array(
70 'class' => 'loginText mw-ui-input',
71 'id' => 'wpName1',
72 'tabindex' => '1',
73 'size' => '20',
74 // 'required' is blacklisted for now in Html.php due to browser issues.
75 // Keeping here in case that changes.
76 'required' => true,
77 // Set focus to this field if it's blank.
78 'autofocus' => !$this->data['name'],
79 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
80 ) );
81 ?>
82 </div>
83
84 <div class="mw-ui-vform-field">
85 <label for='wpPassword1'>
86 <?php
87 $this->msg( 'userlogin-yourpassword' );
88
89 if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
90 echo ' ' . Linker::link(
91 SpecialPage::getTitleFor( 'PasswordReset' ),
92 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
93 array( 'class' => 'mw-ui-flush-right' )
94 );
95 }
96 ?>
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 'size' => '20',
104 // Set focus to this field if username is filled in.
105 'autofocus' => (bool)$this->data['name'],
106 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
107 ) );
108 ?>
109 </div>
110
111 <?php
112 if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
113 $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
114 $select->setAttribute( 'tabindex', 3 );
115 foreach ( $this->data['domainnames'] as $dom ) {
116 $select->addOption( $dom );
117 }
118 ?>
119 <div class="mw-ui-vform-field" id="mw-user-domain-section">
120 <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
121 <?php echo $select->getHTML(); ?>
122 </div>
123 <?php } ?>
124
125 <?php
126 if ( $this->haveData( 'extrafields' ) ) {
127 echo $this->data['extrafields'];
128 }
129 ?>
130
131 <div class="mw-ui-vform-field">
132 <?php if ( $this->data['canremember'] ) { ?>
133 <div class="mw-ui-checkbox">
134 <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
135 <?php if ( $this->data['remember'] ) {
136 echo 'checked="checked"';
137 } ?>
138 ><label for="wpRemember">
139 <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?></label>
140 </div>
141 <?php } ?>
142 </div>
143
144 <div class="mw-ui-vform-field">
145 <?php
146 echo Html::input( 'wpLoginAttempt', $this->getMsg( 'pt-login-button' )->text(), 'submit', array(
147 'id' => 'wpLoginAttempt',
148 'tabindex' => '6',
149 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
150 ) );
151 ?>
152 </div>
153
154 <div class="mw-ui-vform-field" id="mw-userlogin-help">
155 <?php
156 echo Html::element(
157 'a',
158 array(
159 'href' => Skin::makeInternalOrExternalUrl(
160 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
161 ),
162 ),
163 $this->getMsg( 'userlogin-helplink2' )->text()
164 );
165 ?>
166 </div>
167
168 <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
169 <div id="mw-createaccount-cta">
170 <?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>
171 </div>
172 <?php } ?>
173 <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
174 <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
175 <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
176 </form>
177 </div>
178 </div>
179 <?php
180
181 }
182 }