]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/templates/Userlogin.php
MediaWiki 1.15.3
[autoinstallsdev/mediawiki.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 <?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
91 </form>
92 </div>
93 <div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
94 <?php
95
96         }
97 }
98
99 /**
100  * @ingroup Templates
101  */
102 class UsercreateTemplate extends QuickTemplate {
103         function addInputItem( $name, $value, $type, $msg ) {
104                 $this->data['extraInput'][] = array(
105                         'name' => $name,
106                         'value' => $value,
107                         'type' => $type,
108                         'msg' => $msg,
109                 );
110         }
111         
112         function execute() {
113                 if( $this->data['message'] ) {
114 ?>
115         <div class="<?php $this->text('messagetype') ?>box">
116                 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
117                         <h2><?php $this->msg('loginerror') ?></h2>
118                 <?php } ?>
119                 <?php $this->html('message') ?>
120         </div>
121         <div class="visualClear"></div>
122 <?php } ?>
123 <div id="userlogin">
124
125 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
126         <h2><?php $this->msg('createaccount') ?></h2>
127         <p id="userloginlink"><?php $this->html('link') ?></p>
128         <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
129         <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
130         <table>
131                 <tr>
132                         <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
133                         <td class="mw-input">
134                                 <input type='text' class='loginText' name="wpName" id="wpName2"
135                                         tabindex="1"
136                                         value="<?php $this->text('name') ?>" size='20' />
137                         </td>
138                 </tr>
139                 <tr>
140                         <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
141                         <td class="mw-input">
142                                 <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2"
143                                         tabindex="2"
144                                         value="" size='20' />
145                         </td>
146                 </tr>
147         <?php if( $this->data['usedomain'] ) {
148                 $doms = "";
149                 foreach( $this->data['domainnames'] as $dom ) {
150                         $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
151                 }
152         ?>
153                 <tr>
154                         <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
155                         <td class="mw-input">
156                                 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
157                                         tabindex="3">
158                                         <?php echo $doms ?>
159                                 </select>
160                         </td>
161                 </tr>
162         <?php } ?>
163                 <tr>
164                         <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
165                         <td class="mw-input">
166                                 <input type='password' class='loginPassword' name="wpRetype" id="wpRetype"
167                                         tabindex="4"
168                                         value=""
169                                         size='20' />
170                         </td>
171                 </tr>
172                 <tr>
173                         <?php if( $this->data['useemail'] ) { ?>
174                                 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
175                                 <td class="mw-input">
176                                         <input type='text' class='loginText' name="wpEmail" id="wpEmail"
177                                                 tabindex="5"
178                                                 value="<?php $this->text('email') ?>" size='20' />
179                                         <div class="prefsectiontip">
180                                                 <?php if( $this->data['emailrequired'] ) {
181                                                                         $this->msgWiki('prefs-help-email-required');
182                                                       } else {
183                                                                         $this->msgWiki('prefs-help-email');
184                                                       } ?>
185                                         </div>
186                                 </td>
187                         <?php } ?>
188                         <?php if( $this->data['userealname'] ) { ?>
189                                 </tr>
190                                 <tr>
191                                         <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
192                                         <td class="mw-input">
193                                                 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
194                                                         tabindex="6"
195                                                         value="<?php $this->text('realname') ?>" size='20' />
196                                                 <div class="prefsectiontip">
197                                                         <?php $this->msgWiki('prefs-help-realname'); ?>
198                                                 </div>
199                                         </td>
200                         <?php } ?>
201                 </tr>
202                 <?php if( $this->data['canremember'] ) { ?>
203                 <tr>
204                         <td></td>
205                         <td class="mw-input">
206                                 <input type='checkbox' name="wpRemember"
207                                         tabindex="7"
208                                         value="1" id="wpRemember"
209                                         <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
210                                         /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
211                         </td>
212                 </tr>
213 <?php   }
214
215                 $tabIndex = 8;
216                 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
217                         foreach ( $this->data['extraInput'] as $inputItem ) { ?>
218                 <tr>
219                         <?php 
220                                 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
221                                         ?><td class="mw-label"><label for="<?php 
222                                         echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
223                                         $this->msgWiki( $inputItem['msg'] ) ?></label><?php
224                                 } else {
225                                         ?><td><?php
226                                 }
227                         ?></td>
228                         <td class="mw-input">
229                                 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
230                                 echo htmlspecialchars( $inputItem['name'] ); ?>"
231                                         tabindex="<?php echo $tabIndex++; ?>"
232                                         value="<?php 
233                                 if ( $inputItem['type'] != 'checkbox' ) {
234                                         echo htmlspecialchars( $inputItem['value'] );
235                                 } else {
236                                         echo '1';
237                                 }                                       
238                                         ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
239                                         <?php 
240                                 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
241                                         echo 'checked="checked"'; 
242                                         ?> /> <?php 
243                                         if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
244                                                 ?>
245                                 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
246                                         $this->msgHtml( $inputItem['msg'] ) ?></label><?php
247                                         }
248                                 ?>
249                         </td>
250                 </tr>
251 <?php                           
252                                 
253                         }
254                 }
255 ?>
256                 <tr>
257                         <td></td>
258                         <td class="mw-submit">
259                                 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
260                                         tabindex="<?php echo $tabIndex++; ?>"
261                                         value="<?php $this->msg('createaccount') ?>" />
262                                 <?php if( $this->data['createemail'] ) { ?>
263                                 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
264                                         tabindex="<?php echo $tabIndex++; ?>"
265                                         value="<?php $this->msg('createaccountmail') ?>" />
266                                 <?php } ?>
267                         </td>
268                 </tr>
269         </table>
270 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
271 </form>
272 </div>
273 <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
274 <?php
275
276         }
277 }