wfProfileOut() for new return added in c6396 (c4e407c)
[lhc/web/wiklou.git] / includes / templates / Usercreate.php
1 <?php
2 /**
3 * Html form for account creation
4 *
5 * @file
6 * @ingroup Templates
7 */
8
9 /**
10 * @defgroup Templates Templates
11 */
12
13 if( !defined( 'MEDIAWIKI' ) ) die( -1 );
14
15 /**
16 * @ingroup Templates
17 */
18 class UsercreateTemplate extends QuickTemplate {
19 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
20 $this->data['extraInput'][] = array(
21 'name' => $name,
22 'value' => $value,
23 'type' => $type,
24 'msg' => $msg,
25 'helptext' => $helptext,
26 );
27 }
28
29 function execute() {
30 if( $this->data['message'] ) {
31 ?>
32 <div class="<?php $this->text('messagetype') ?>box">
33 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
34 <strong><?php $this->msg( 'loginerror' )?></strong><br />
35 <?php } ?>
36 <?php $this->html('message') ?>
37 </div>
38 <div class="visualClear"></div>
39 <?php } ?>
40
41 <div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div>
42 <div id="userlogin">
43
44 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
45 <h2><?php $this->msg('createaccount') ?></h2>
46 <p id="userloginlink"><?php $this->html('link') ?></p>
47 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
48 <?php if( $this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
49 <table>
50 <tr>
51 <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
52 <td class="mw-input">
53 <?php
54 echo Html::input( 'wpName', $this->data['name'], 'text', array(
55 'class' => 'loginText',
56 'id' => 'wpName2',
57 'tabindex' => '1',
58 'size' => '20',
59 'required',
60 'autofocus'
61 ) ); ?>
62 </td>
63 </tr>
64 <tr>
65 <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
66 <td class="mw-input">
67 <?php
68 echo Html::input( 'wpPassword', null, 'password', array(
69 'class' => 'loginPassword',
70 'id' => 'wpPassword2',
71 'tabindex' => '2',
72 'size' => '20'
73 ) + User::passwordChangeInputAttribs() ); ?>
74 </td>
75 </tr>
76 <?php if( $this->data['usedomain'] ) {
77 $doms = "";
78 foreach( $this->data['domainnames'] as $dom ) {
79 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
80 }
81 ?>
82 <tr>
83 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
84 <td class="mw-input">
85 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
86 tabindex="3">
87 <?php echo $doms ?>
88 </select>
89 </td>
90 </tr>
91 <?php } ?>
92 <tr>
93 <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
94 <td class="mw-input">
95 <?php
96 echo Html::input( 'wpRetype', null, 'password', array(
97 'class' => 'loginPassword',
98 'id' => 'wpRetype',
99 'tabindex' => '4',
100 'size' => '20'
101 ) + User::passwordChangeInputAttribs() ); ?>
102 </td>
103 </tr>
104 <tr>
105 <?php if( $this->data['useemail'] ) { ?>
106 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
107 <td class="mw-input">
108 <?php
109 echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
110 'class' => 'loginText',
111 'id' => 'wpEmail',
112 'tabindex' => '5',
113 'size' => '20'
114 ) ); ?>
115 <div class="prefsectiontip">
116 <?php // duplicated in Preferences.php profilePreferences()
117 if( $this->data['emailrequired'] ) {
118 $this->msgWiki('prefs-help-email-required');
119 } else {
120 $this->msgWiki('prefs-help-email');
121 }
122 if( $this->data['emailothers'] ) {
123 $this->msgWiki('prefs-help-email-others');
124 } ?>
125 </div>
126 </td>
127 <?php } ?>
128 <?php if( $this->data['userealname'] ) { ?>
129 </tr>
130 <tr>
131 <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
132 <td class="mw-input">
133 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
134 tabindex="6"
135 value="<?php $this->text('realname') ?>" size='20' />
136 <div class="prefsectiontip">
137 <?php $this->msgWiki('prefs-help-realname'); ?>
138 </div>
139 </td>
140 <?php } ?>
141 <?php if( $this->data['usereason'] ) { ?>
142 </tr>
143 <tr>
144 <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td>
145 <td class="mw-input">
146 <input type='text' class='loginText' name="wpReason" id="wpReason"
147 tabindex="7"
148 value="<?php $this->text('reason') ?>" size='20' />
149 </td>
150 <?php } ?>
151 </tr>
152 <?php if( $this->data['canremember'] ) { ?>
153 <tr>
154 <td></td>
155 <td class="mw-input">
156 <?php
157 global $wgCookieExpiration, $wgLang;
158 echo Xml::checkLabel(
159 wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
160 'wpRemember',
161 'wpRemember',
162 $this->data['remember'],
163 array( 'tabindex' => '8' )
164 )
165 ?>
166 </td>
167 </tr>
168 <?php }
169
170 $tabIndex = 9;
171 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
172 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
173 <tr>
174 <?php
175 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
176 ?><td class="mw-label"><label for="<?php
177 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
178 $this->msgWiki( $inputItem['msg'] ) ?></label><?php
179 } else {
180 ?><td><?php
181 }
182 ?></td>
183 <td class="mw-input">
184 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
185 echo htmlspecialchars( $inputItem['name'] ); ?>"
186 tabindex="<?php echo $tabIndex++; ?>"
187 value="<?php
188 if ( $inputItem['type'] != 'checkbox' ) {
189 echo htmlspecialchars( $inputItem['value'] );
190 } else {
191 echo '1';
192 }
193 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
194 <?php
195 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
196 echo 'checked="checked"';
197 ?> /> <?php
198 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
199 ?>
200 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
201 $this->msgHtml( $inputItem['msg'] ) ?></label><?php
202 }
203 if( $inputItem['helptext'] !== false ) {
204 ?>
205 <div class="prefsectiontip">
206 <?php $this->msgWiki( $inputItem['helptext'] ); ?>
207 </div>
208 <?php } ?>
209 </td>
210 </tr>
211 <?php
212
213 }
214 }
215 ?>
216 <tr>
217 <td></td>
218 <td class="mw-submit">
219 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
220 tabindex="<?php echo $tabIndex++; ?>"
221 value="<?php $this->msg('createaccount') ?>" />
222 <?php if( $this->data['createemail'] ) { ?>
223 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
224 tabindex="<?php echo $tabIndex++; ?>"
225 value="<?php $this->msg('createaccountmail') ?>" />
226 <?php } ?>
227 </td>
228 </tr>
229 </table>
230 <?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
231 <?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
232 </form>
233 </div>
234 <div id="signupend"><?php $this->html( 'signupend' ); ?></div>
235 <?php
236
237 }
238 }