MediaWiki  REL1_21
Usercreate.php
Go to the documentation of this file.
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></td>
00081                         <td class="mw-input">
00082                                 <?php if( $this->data['createemail'] ) {
00083                                         echo Xml::checkLabel(
00084                                                 wfMessage( 'createaccountmail' )->text(),
00085                                                 'wpCreateaccountMail',
00086                                                 'wpCreateaccountMail',
00087                                                 $this->data['createemailset'],
00088                                                 array( 'tabindex' => '2' )
00089                                         );
00090                                 } ?>
00091                         </td>
00092                 </tr>
00093                 <tr class="mw-row-password">
00094                         <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
00095                         <td class="mw-input">
00096 <?php
00097                         echo Html::input( 'wpPassword', null, 'password', array(
00098                                 'class' => 'loginPassword',
00099                                 'id' => 'wpPassword2',
00100                                 'tabindex' => '3',
00101                                 'size' => '20'
00102                         ) + User::passwordChangeInputAttribs() ); ?>
00103                         </td>
00104                 </tr>
00105         <?php if( $this->data['usedomain'] ) {
00106                 $doms = "";
00107                 foreach( $this->data['domainnames'] as $dom ) {
00108                         $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
00109                 }
00110         ?>
00111                 <tr id="mw-user-domain-section">
00112                         <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
00113                         <td class="mw-input">
00114                                 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
00115                                         tabindex="4">
00116                                         <?php echo $doms ?>
00117                                 </select>
00118                         </td>
00119                 </tr>
00120         <?php } ?>
00121                 <tr class="mw-row-password">
00122                         <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
00123                         <td class="mw-input">
00124                                 <?php
00125                 echo Html::input( 'wpRetype', null, 'password', array(
00126                         'class' => 'loginPassword',
00127                         'id' => 'wpRetype',
00128                         'tabindex' => '5',
00129                         'size' => '20'
00130                 ) + User::passwordChangeInputAttribs() ); ?>
00131                         </td>
00132                 </tr>
00133                 <tr>
00134                         <?php if( $this->data['useemail'] ) { ?>
00135                                 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
00136                                 <td class="mw-input">
00137                                         <?php
00138                 echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
00139                         'class' => 'loginText',
00140                         'id' => 'wpEmail',
00141                         'tabindex' => '6',
00142                         'size' => '20'
00143                 ) ); ?>
00144                                         <div class="prefsectiontip">
00145                                                 <?php  // duplicated in Preferences.php profilePreferences()
00146                                                         if( $this->data['emailrequired'] ) {
00147                                                                 $this->msgWiki('prefs-help-email-required');
00148                                                         } else {
00149                                                                 $this->msgWiki('prefs-help-email');
00150                                                         }
00151                                                         if( $this->data['emailothers'] ) {
00152                                                                 $this->msgWiki('prefs-help-email-others');
00153                                                         } ?>
00154                                         </div>
00155                                 </td>
00156                         <?php } ?>
00157                         <?php if( $this->data['userealname'] ) { ?>
00158                                 </tr>
00159                                 <tr>
00160                                         <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
00161                                         <td class="mw-input">
00162                                                 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
00163                                                         tabindex="7"
00164                                                         value="<?php $this->text('realname') ?>" size='20' />
00165                                                 <div class="prefsectiontip">
00166                                                         <?php $this->msgWiki('prefs-help-realname'); ?>
00167                                                 </div>
00168                                         </td>
00169                         <?php } ?>
00170                         <?php if( $this->data['usereason'] ) { ?>
00171                                 </tr>
00172                                 <tr>
00173                                         <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td>
00174                                         <td class="mw-input">
00175                                                 <input type='text' class='loginText' name="wpReason" id="wpReason"
00176                                                         tabindex="8"
00177                                                         value="<?php $this->text('reason') ?>" size='20' />
00178                                         </td>
00179                         <?php } ?>
00180                 </tr>
00181                 <?php if( $this->data['canremember'] ) { ?>
00182                 <tr>
00183                         <td></td>
00184                         <td class="mw-input">
00185                                 <?php
00186                                 global $wgCookieExpiration;
00187                                 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
00188                                 echo Xml::checkLabel(
00189                                         wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
00190                                         'wpRemember',
00191                                         'wpRemember',
00192                                         $this->data['remember'],
00193                                         array( 'tabindex' => '9' )
00194                                 )
00195                                 ?>
00196                         </td>
00197                 </tr>
00198 <?php   }
00199 
00200                 $tabIndex = 10;
00201                 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
00202                         foreach ( $this->data['extraInput'] as $inputItem ) { ?>
00203                 <tr>
00204                         <?php
00205                                 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
00206                                         ?><td class="mw-label"><label for="<?php
00207                                         echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
00208                                         $this->msgWiki( $inputItem['msg'] ) ?></label><?php
00209                                 } else {
00210                                         ?><td><?php
00211                                 }
00212                         ?></td>
00213                         <td class="mw-input">
00214                                 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
00215                                 echo htmlspecialchars( $inputItem['name'] ); ?>"
00216                                         tabindex="<?php echo $tabIndex++; ?>"
00217                                         value="<?php
00218                                 if ( $inputItem['type'] != 'checkbox' ) {
00219                                         echo htmlspecialchars( $inputItem['value'] );
00220                                 } else {
00221                                         echo '1';
00222                                 }
00223                                         ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
00224                                         <?php
00225                                 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
00226                                         echo 'checked="checked"';
00227                                         ?> /> <?php
00228                                         if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
00229                                                 ?>
00230                                 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
00231                                         $this->msgHtml( $inputItem['msg'] ) ?></label><?php
00232                                         }
00233                                 if( $inputItem['helptext'] !== false ) {
00234                                 ?>
00235                                 <div class="prefsectiontip">
00236                                         <?php $this->msgWiki( $inputItem['helptext'] ); ?>
00237                                 </div>
00238                                 <?php } ?>
00239                         </td>
00240                 </tr>
00241 <?php
00242                         }
00243                 }
00244 ?>
00245                 <tr>
00246                         <td></td>
00247                         <td class="mw-submit">
00248                                 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
00249                                         tabindex="<?php echo $tabIndex++; ?>"
00250                                         value="<?php $this->msg('createaccount') ?>" />
00251                         </td>
00252                 </tr>
00253         </table>
00254 <?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
00255 <?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
00256 </form>
00257 </div>
00258 <div id="signupend"><?php $this->html( 'signupend' ); ?></div>
00259 <?php
00260 
00261         }
00262 }