Merge "Revert "Introducing ContentGetParserOutput hook.""
[lhc/web/wiklou.git] / includes / templates / Userlogin.php
1 <?php
2 /**
3 * Html form for user login.
4 *
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.
9 *
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.
14 *
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
19 *
20 * @file
21 * @ingroup Templates
22 */
23
24 /**
25 * @defgroup Templates Templates
26 */
27
28 /**
29 * HTML template for Special:Userlogin form
30 * @ingroup Templates
31 */
32 class UserloginTemplate extends QuickTemplate {
33 function execute() {
34 if ( $this->data['message'] ) {
35 ?>
36 <div class="<?php $this->text( 'messagetype' ); ?>box">
37 <?php
38 if ( $this->data['messagetype'] == 'error' ) {
39 ?><strong><?php $this->msg( 'loginerror' ); ?></strong><br /><?php
40 }
41 ?>
42 <?php $this->html( 'message' ); ?>
43 </div>
44 <div class="visualClear"></div><?php
45
46 }
47 ?>
48 <div id="loginstart"><?php $this->msgWiki( 'loginstart' ); ?></div>
49 <div id="userloginForm">
50 <form name="userlogin" method="post" action="<?php $this->text( 'action' ); ?>">
51 <h2><?php $this->msg( 'login' ); ?></h2>
52 <p id="userloginlink"><?php $this->html( 'link' ); ?></p>
53 <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?>
54 <div id="userloginprompt"><?php $this->msgWiki( 'loginprompt' ); ?></div>
55 <?php
56 if ( $this->haveData( 'languages' ) ) {
57 ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php
58 }
59 ?>
60 <table>
61 <tr>
62 <td class="mw-label"><label for='wpName1'><?php $this->msg( 'yourname' ); ?></label></td>
63 <td class="mw-input">
64 <?php
65 echo Html::input( 'wpName', $this->data['name'], 'text', array(
66 'class' => 'loginText',
67 'id' => 'wpName1',
68 'tabindex' => '1',
69 'size' => '20',
70 'required'
71 # Can't do + array( 'autofocus' ) because + for arrays in PHP
72 # only works right for associative arrays! Thanks, PHP.
73 ) + ( $this->data['name'] ? array() : array( 'autofocus' => '' ) ) ); ?>
74
75 </td>
76 </tr>
77 <tr>
78 <td class="mw-label"><label for='wpPassword1'><?php $this->msg( 'yourpassword' ); ?></label></td>
79 <td class="mw-input">
80 <?php
81 echo Html::input( 'wpPassword', null, 'password', array(
82 'class' => 'loginPassword',
83 'id' => 'wpPassword1',
84 'tabindex' => '2',
85 'size' => '20'
86 ) + ( $this->data['name'] ? array( 'autofocus' ) : array() ) ); ?>
87
88 </td>
89 </tr>
90 <?php
91 if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
92 $doms = "";
93 foreach ( $this->data['domainnames'] as $dom ) {
94 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
95 }
96 ?>
97 <tr id="mw-user-domain-section">
98 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
99 <td class="mw-input">
100 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
101 tabindex="3">
102 <?php echo $doms ?>
103 </select>
104 </td>
105 </tr>
106 <?php
107 }
108
109 if ( $this->haveData( 'extrafields' ) ) {
110 echo $this->data['extrafields'];
111 }
112
113 if ( $this->data['canremember'] ) {
114 ?>
115 <tr>
116 <td></td>
117 <td class="mw-input">
118 <?php
119 global $wgCookieExpiration;
120 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
121 echo Xml::checkLabel(
122 wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
123 'wpRemember',
124 'wpRemember',
125 $this->data['remember'],
126 array( 'tabindex' => '8' )
127 )
128 ?>
129 </td>
130 </tr>
131 <?php
132 }
133
134 if ( $this->data['cansecurelogin'] ) {
135 ?>
136 <tr>
137 <td></td>
138 <td class="mw-input">
139 <?php
140 echo Xml::checkLabel(
141 wfMessage( 'securelogin-stick-https' )->text(),
142 'wpStickHTTPS',
143 'wpStickHTTPS',
144 $this->data['stickHTTPS'],
145 array( 'tabindex' => '9' )
146 );
147 ?>
148 </td>
149 </tr>
150 <?php
151 }
152 ?>
153 <tr>
154 <td></td>
155 <td class="mw-submit">
156 <?php
157 echo Html::input( 'wpLoginAttempt', wfMessage( 'login' )->text(), 'submit', array(
158 'id' => 'wpLoginAttempt',
159 'tabindex' => '9'
160 ) );
161 if ( $this->data['useemail'] && $this->data['canreset'] ) {
162 if ( $this->data['resetlink'] === true ) {
163 echo '&#160;';
164 echo Linker::link(
165 SpecialPage::getTitleFor( 'PasswordReset' ),
166 wfMessage( 'userlogin-resetlink' )
167 );
168 } elseif ( $this->data['resetlink'] === null ) {
169 echo '&#160;';
170 echo Html::input(
171 'wpMailmypassword',
172 wfMessage( 'mailmypassword' )->text(),
173 'submit', array(
174 'id' => 'wpMailmypassword',
175 'tabindex' => '10'
176 )
177 );
178 }
179 }
180 ?>
181 </td>
182 </tr>
183 </table>
184 <?php
185 if ( $this->haveData( 'uselang' ) ) {
186 ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php
187 }
188
189 if ( $this->haveData( 'token' ) ) {
190 ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php
191 }
192 ?>
193 </form>
194 </div>
195 <div id="loginend"><?php $this->html( 'loginend' ); ?></div>
196 <?php
197
198 }
199 }