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