Fix for 43393: use normal MW id convention
[lhc/web/wiklou.git] / includes / templates / Userlogin.php
1 <?php
2 /**
3 * @defgroup Templates Templates
4 * @file
5 * @ingroup Templates
6 */
7 if( !defined( 'MEDIAWIKI' ) ) die( -1 );
8
9 /**
10 * HTML template for Special:Userlogin form
11 * @ingroup Templates
12 */
13 class UserloginTemplate extends QuickTemplate {
14 function execute() {
15 if( $this->data['message'] ) {
16 ?>
17 <div class="<?php $this->text('messagetype') ?>box">
18 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
19 <h2><?php $this->msg('loginerror') ?></h2>
20 <?php } ?>
21 <?php $this->html('message') ?>
22 </div>
23 <div class="visualClear"></div>
24 <?php } ?>
25
26 <div id="loginstart"><?php $this->msgWiki( 'loginstart' ); ?></div>
27 <div id="userloginForm">
28 <form name="userlogin" method="post" action="<?php $this->text('action') ?>">
29 <h2><?php $this->msg('login') ?></h2>
30 <p id="userloginlink"><?php $this->html('link') ?></p>
31 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
32 <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
33 <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
34 <table>
35 <tr>
36 <td class="mw-label"><label for='wpName1'><?php $this->msg('yourname') ?></label></td>
37 <td class="mw-input">
38 <input type='text' class='loginText' name="wpName" id="wpName1"
39 tabindex="1"
40 value="<?php $this->text('name') ?>" size='20' />
41 </td>
42 </tr>
43 <tr>
44 <td class="mw-label"><label for='wpPassword1'><?php $this->msg('yourpassword') ?></label></td>
45 <td class="mw-input">
46 <input type='password' class='loginPassword' name="wpPassword" id="wpPassword1"
47 tabindex="2"
48 value="" size='20' />
49 </td>
50 </tr>
51 <?php if( $this->data['usedomain'] ) {
52 $doms = "";
53 foreach( $this->data['domainnames'] as $dom ) {
54 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
55 }
56 ?>
57 <tr id="mw-user-domain-section">
58 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
59 <td class="mw-input">
60 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
61 tabindex="3">
62 <?php echo $doms ?>
63 </select>
64 </td>
65 </tr>
66 <?php }
67 if( $this->data['canremember'] ) { ?>
68 <tr>
69 <td></td>
70 <td class="mw-input">
71 <input type='checkbox' name="wpRemember"
72 tabindex="4"
73 value="1" id="wpRemember"
74 <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
75 /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
76 </td>
77 </tr>
78 <?php } ?>
79 <tr>
80 <td></td>
81 <td class="mw-submit">
82 <input type='submit' name="wpLoginattempt" id="wpLoginattempt" tabindex="5" value="<?php $this->msg('login') ?>" />&nbsp;<?php if( $this->data['useemail'] && $this->data['canreset']) { ?><input type='submit' name="wpMailmypassword" id="wpMailmypassword"
83 tabindex="6"
84 value="<?php $this->msg('mailmypassword') ?>" />
85 <?php } ?>
86 </td>
87 </tr>
88 </table>
89 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
90 </form>
91 </div>
92 <div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
93 <?php
94
95 }
96 }
97
98 /**
99 * @ingroup Templates
100 */
101 class UsercreateTemplate extends QuickTemplate {
102 function addInputItem( $name, $value, $type, $msg ) {
103 $this->data['extraInput'][] = array(
104 'name' => $name,
105 'value' => $value,
106 'type' => $type,
107 'msg' => $msg,
108 );
109 }
110
111 function execute() {
112 if( $this->data['message'] ) {
113 ?>
114 <div class="<?php $this->text('messagetype') ?>box">
115 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
116 <h2><?php $this->msg('loginerror') ?></h2>
117 <?php } ?>
118 <?php $this->html('message') ?>
119 </div>
120 <div class="visualClear"></div>
121 <?php } ?>
122 <div id="userlogin">
123
124 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
125 <h2><?php $this->msg('createaccount') ?></h2>
126 <p id="userloginlink"><?php $this->html('link') ?></p>
127 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
128 <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
129 <table>
130 <tr>
131 <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
132 <td class="mw-input">
133 <input type='text' class='loginText' name="wpName" id="wpName2"
134 tabindex="1"
135 value="<?php $this->text('name') ?>" size='20' />
136 </td>
137 </tr>
138 <tr>
139 <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
140 <td class="mw-input">
141 <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2"
142 tabindex="2"
143 value="" size='20' />
144 </td>
145 </tr>
146 <?php if( $this->data['usedomain'] ) {
147 $doms = "";
148 foreach( $this->data['domainnames'] as $dom ) {
149 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
150 }
151 ?>
152 <tr>
153 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
154 <td class="mw-input">
155 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
156 tabindex="3">
157 <?php echo $doms ?>
158 </select>
159 </td>
160 </tr>
161 <?php } ?>
162 <tr>
163 <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
164 <td class="mw-input">
165 <input type='password' class='loginPassword' name="wpRetype" id="wpRetype"
166 tabindex="4"
167 value=""
168 size='20' />
169 </td>
170 </tr>
171 <tr>
172 <?php if( $this->data['useemail'] ) { ?>
173 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
174 <td class="mw-input">
175 <input type='text' class='loginText' name="wpEmail" id="wpEmail"
176 tabindex="5"
177 value="<?php $this->text('email') ?>" size='20' />
178 <div class="prefsectiontip">
179 <?php if( $this->data['emailrequired'] ) {
180 $this->msgWiki('prefs-help-email-required');
181 } else {
182 $this->msgWiki('prefs-help-email');
183 } ?>
184 </div>
185 </td>
186 <?php } ?>
187 <?php if( $this->data['userealname'] ) { ?>
188 </tr>
189 <tr>
190 <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
191 <td class="mw-input">
192 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
193 tabindex="6"
194 value="<?php $this->text('realname') ?>" size='20' />
195 <div class="prefsectiontip">
196 <?php $this->msgWiki('prefs-help-realname'); ?>
197 </div>
198 </td>
199 <?php } ?>
200 </tr>
201 <?php if( $this->data['canremember'] ) { ?>
202 <tr>
203 <td></td>
204 <td class="mw-input">
205 <input type='checkbox' name="wpRemember"
206 tabindex="7"
207 value="1" id="wpRemember"
208 <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
209 /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
210 </td>
211 </tr>
212 <?php }
213
214 $tabIndex = 8;
215 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
216 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
217 <tr>
218 <?php
219 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
220 ?><td class="mw-label"><label for="<?php
221 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
222 $this->msgWiki( $inputItem['msg'] ) ?></label><?php
223 } else {
224 ?><td><?php
225 }
226 ?></td>
227 <td class="mw-input">
228 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
229 echo htmlspecialchars( $inputItem['name'] ); ?>"
230 tabindex="<?php echo $tabIndex++; ?>"
231 value="<?php
232 if ( $inputItem['type'] != 'checkbox' ) {
233 echo htmlspecialchars( $inputItem['value'] );
234 } else {
235 echo '1';
236 }
237 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
238 <?php
239 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
240 echo 'checked="checked"';
241 ?> /> <?php
242 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
243 ?>
244 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
245 $this->msg( $inputItem['msg'] ) ?></label><?php
246 }
247 ?>
248 </td>
249 </tr>
250 <?php
251
252 }
253 }
254 ?>
255 <tr>
256 <td></td>
257 <td class="mw-submit">
258 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
259 tabindex="<?php echo $tabIndex++; ?>"
260 value="<?php $this->msg('createaccount') ?>" />
261 <?php if( $this->data['createemail'] ) { ?>
262 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
263 tabindex="<?php echo $tabIndex++; ?>"
264 value="<?php $this->msg('createaccountmail') ?>" />
265 <?php } ?>
266 </td>
267 </tr>
268 </table>
269 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
270 </form>
271 </div>
272 <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
273 <?php
274
275 }
276 }