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