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