MediaWiki
REL1_20
|
00001 <?php 00028 if( !defined( 'MEDIAWIKI' ) ) die( -1 ); 00029 00033 class UsercreateTemplate extends QuickTemplate { 00034 function addInputItem( $name, $value, $type, $msg, $helptext = false ) { 00035 $this->data['extraInput'][] = array( 00036 'name' => $name, 00037 'value' => $value, 00038 'type' => $type, 00039 'msg' => $msg, 00040 'helptext' => $helptext, 00041 ); 00042 } 00043 00044 function execute() { 00045 if( $this->data['message'] ) { 00046 ?> 00047 <div class="<?php $this->text('messagetype') ?>box"> 00048 <?php if ( $this->data['messagetype'] == 'error' ) { ?> 00049 <strong><?php $this->msg( 'loginerror' )?></strong><br /> 00050 <?php } ?> 00051 <?php $this->html('message') ?> 00052 </div> 00053 <div class="visualClear"></div> 00054 <?php } ?> 00055 00056 <div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div> 00057 <div id="userlogin"> 00058 00059 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>"> 00060 <h2><?php $this->msg('createaccount') ?></h2> 00061 <p id="userloginlink"><?php $this->html('link') ?></p> 00062 <?php $this->html('header'); /* pre-table point for form plugins... */ ?> 00063 <?php if( $this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?> 00064 <table> 00065 <tr> 00066 <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td> 00067 <td class="mw-input"> 00068 <?php 00069 echo Html::input( 'wpName', $this->data['name'], 'text', array( 00070 'class' => 'loginText', 00071 'id' => 'wpName2', 00072 'tabindex' => '1', 00073 'size' => '20', 00074 'required', 00075 'autofocus' 00076 ) ); ?> 00077 </td> 00078 </tr> 00079 <tr> 00080 <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td> 00081 <td class="mw-input"> 00082 <?php 00083 echo Html::input( 'wpPassword', null, 'password', array( 00084 'class' => 'loginPassword', 00085 'id' => 'wpPassword2', 00086 'tabindex' => '2', 00087 'size' => '20' 00088 ) + User::passwordChangeInputAttribs() ); ?> 00089 </td> 00090 </tr> 00091 <?php if( $this->data['usedomain'] ) { 00092 $doms = ""; 00093 foreach( $this->data['domainnames'] as $dom ) { 00094 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>"; 00095 } 00096 ?> 00097 <tr> 00098 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td> 00099 <td class="mw-input"> 00100 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>" 00101 tabindex="3"> 00102 <?php echo $doms ?> 00103 </select> 00104 </td> 00105 </tr> 00106 <?php } ?> 00107 <tr> 00108 <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td> 00109 <td class="mw-input"> 00110 <?php 00111 echo Html::input( 'wpRetype', null, 'password', array( 00112 'class' => 'loginPassword', 00113 'id' => 'wpRetype', 00114 'tabindex' => '4', 00115 'size' => '20' 00116 ) + User::passwordChangeInputAttribs() ); ?> 00117 </td> 00118 </tr> 00119 <tr> 00120 <?php if( $this->data['useemail'] ) { ?> 00121 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td> 00122 <td class="mw-input"> 00123 <?php 00124 echo Html::input( 'wpEmail', $this->data['email'], 'email', array( 00125 'class' => 'loginText', 00126 'id' => 'wpEmail', 00127 'tabindex' => '5', 00128 'size' => '20' 00129 ) ); ?> 00130 <div class="prefsectiontip"> 00131 <?php // duplicated in Preferences.php profilePreferences() 00132 if( $this->data['emailrequired'] ) { 00133 $this->msgWiki('prefs-help-email-required'); 00134 } else { 00135 $this->msgWiki('prefs-help-email'); 00136 } 00137 if( $this->data['emailothers'] ) { 00138 $this->msgWiki('prefs-help-email-others'); 00139 } ?> 00140 </div> 00141 </td> 00142 <?php } ?> 00143 <?php if( $this->data['userealname'] ) { ?> 00144 </tr> 00145 <tr> 00146 <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td> 00147 <td class="mw-input"> 00148 <input type='text' class='loginText' name="wpRealName" id="wpRealName" 00149 tabindex="6" 00150 value="<?php $this->text('realname') ?>" size='20' /> 00151 <div class="prefsectiontip"> 00152 <?php $this->msgWiki('prefs-help-realname'); ?> 00153 </div> 00154 </td> 00155 <?php } ?> 00156 <?php if( $this->data['usereason'] ) { ?> 00157 </tr> 00158 <tr> 00159 <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td> 00160 <td class="mw-input"> 00161 <input type='text' class='loginText' name="wpReason" id="wpReason" 00162 tabindex="7" 00163 value="<?php $this->text('reason') ?>" size='20' /> 00164 </td> 00165 <?php } ?> 00166 </tr> 00167 <?php if( $this->data['canremember'] ) { ?> 00168 <tr> 00169 <td></td> 00170 <td class="mw-input"> 00171 <?php 00172 global $wgCookieExpiration; 00173 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) ); 00174 echo Xml::checkLabel( 00175 wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(), 00176 'wpRemember', 00177 'wpRemember', 00178 $this->data['remember'], 00179 array( 'tabindex' => '8' ) 00180 ) 00181 ?> 00182 </td> 00183 </tr> 00184 <?php } 00185 00186 $tabIndex = 9; 00187 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) { 00188 foreach ( $this->data['extraInput'] as $inputItem ) { ?> 00189 <tr> 00190 <?php 00191 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) { 00192 ?><td class="mw-label"><label for="<?php 00193 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php 00194 $this->msgWiki( $inputItem['msg'] ) ?></label><?php 00195 } else { 00196 ?><td><?php 00197 } 00198 ?></td> 00199 <td class="mw-input"> 00200 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php 00201 echo htmlspecialchars( $inputItem['name'] ); ?>" 00202 tabindex="<?php echo $tabIndex++; ?>" 00203 value="<?php 00204 if ( $inputItem['type'] != 'checkbox' ) { 00205 echo htmlspecialchars( $inputItem['value'] ); 00206 } else { 00207 echo '1'; 00208 } 00209 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>" 00210 <?php 00211 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) ) 00212 echo 'checked="checked"'; 00213 ?> /> <?php 00214 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) { 00215 ?> 00216 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php 00217 $this->msgHtml( $inputItem['msg'] ) ?></label><?php 00218 } 00219 if( $inputItem['helptext'] !== false ) { 00220 ?> 00221 <div class="prefsectiontip"> 00222 <?php $this->msgWiki( $inputItem['helptext'] ); ?> 00223 </div> 00224 <?php } ?> 00225 </td> 00226 </tr> 00227 <?php 00228 00229 } 00230 } 00231 ?> 00232 <tr> 00233 <td></td> 00234 <td class="mw-submit"> 00235 <input type='submit' name="wpCreateaccount" id="wpCreateaccount" 00236 tabindex="<?php echo $tabIndex++; ?>" 00237 value="<?php $this->msg('createaccount') ?>" /> 00238 <?php if( $this->data['createemail'] ) { ?> 00239 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail" 00240 tabindex="<?php echo $tabIndex++; ?>" 00241 value="<?php $this->msg('createaccountmail') ?>" /> 00242 <?php } ?> 00243 </td> 00244 </tr> 00245 </table> 00246 <?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?> 00247 <?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?> 00248 </form> 00249 </div> 00250 <div id="signupend"><?php $this->html( 'signupend' ); ?></div> 00251 <?php 00252 00253 } 00254 }