MediaWiki  REL1_24
Userlogin.php
Go to the documentation of this file.
00001 <?php
00002 // @codingStandardsIgnoreFile
00025 class UserloginTemplate extends BaseTemplate {
00026 
00027     function execute() {
00028         global $wgCookieExpiration;
00029         $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
00030 ?>
00031 <div class="mw-ui-container">
00032     <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
00033     <?php if ( $this->haveData( 'languages' ) ) { ?>
00034         <div id="languagelinks">
00035             <p><?php $this->html( 'languages' ); ?></p>
00036         </div>
00037     <?php } ?>
00038     <div id="userloginForm">
00039         <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
00040             <?php if ( $this->data['loggedin'] ) { ?>
00041                 <div class="warningbox">
00042                     <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
00043                 </div>
00044             <?php } ?>
00045             <section class="mw-form-header">
00046                 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
00047             </section>
00048 
00049             <?php if ( $this->data['message'] ) { ?>
00050                 <div class="<?php $this->text( 'messagetype' ); ?>box">
00051                     <?php if ( $this->data['messagetype'] == 'error' ) { ?>
00052                         <strong><?php $this->msg( 'loginerror' ); ?></strong>
00053                         <br />
00054                     <?php } ?>
00055                     <?php $this->html( 'message' ); ?>
00056                 </div>
00057             <?php } ?>
00058 
00059             <div class="mw-ui-vform-field">
00060                 <label for='wpName1'>
00061                     <?php
00062                     $this->msg( 'userlogin-yourname' );
00063 
00064                     if ( $this->data['secureLoginUrl'] ) {
00065                         echo Html::element( 'a', array(
00066                             'href' => $this->data['secureLoginUrl'],
00067                             'class' => 'mw-ui-flush-right mw-secure',
00068                         ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
00069                     }
00070                     ?>
00071                 </label>
00072                 <?php
00073                 $extraAttrs = array();
00074                 echo Html::input( 'wpName', $this->data['name'], 'text', array(
00075                     'class' => 'loginText mw-ui-input',
00076                     'id' => 'wpName1',
00077                     'tabindex' => '1',
00078                     'size' => '20',
00079                     // 'required' is blacklisted for now in Html.php due to browser issues.
00080                     // Keeping here in case that changes.
00081                     'required' => true,
00082                     // Set focus to this field if it's blank.
00083                     'autofocus' => !$this->data['name'],
00084                     'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
00085                 ) );
00086                 ?>
00087             </div>
00088 
00089             <div class="mw-ui-vform-field">
00090                 <label for='wpPassword1'>
00091                     <?php
00092                     $this->msg( 'userlogin-yourpassword' );
00093 
00094                     if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
00095                         echo ' ' . Linker::link(
00096                             SpecialPage::getTitleFor( 'PasswordReset' ),
00097                             $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
00098                             array( 'class' => 'mw-ui-flush-right' )
00099                         );
00100                     }
00101                     ?>
00102                 </label>
00103                 <?php
00104                 echo Html::input( 'wpPassword', null, 'password', array(
00105                     'class' => 'loginPassword mw-ui-input',
00106                     'id' => 'wpPassword1',
00107                     'tabindex' => '2',
00108                     'size' => '20',
00109                     // Set focus to this field if username is filled in.
00110                     'autofocus' => (bool)$this->data['name'],
00111                     'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
00112                 ) );
00113                 ?>
00114             </div>
00115 
00116             <?php
00117             if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
00118                 $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
00119                 $select->setAttribute( 'tabindex', 3 );
00120                 foreach ( $this->data['domainnames'] as $dom ) {
00121                     $select->addOption( $dom );
00122                 }
00123             ?>
00124                 <div class="mw-ui-vform-field" id="mw-user-domain-section">
00125                     <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
00126                     <?php echo $select->getHTML(); ?>
00127                 </div>
00128             <?php } ?>
00129 
00130             <?php
00131             if ( $this->haveData( 'extrafields' ) ) {
00132                 echo $this->data['extrafields'];
00133             }
00134             ?>
00135 
00136             <div class="mw-ui-vform-field">
00137                 <?php if ( $this->data['canremember'] ) { ?>
00138                     <div class="mw-ui-checkbox">
00139                         <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
00140                             <?php if ( $this->data['remember'] ) {
00141                                 echo 'checked="checked"';
00142                             } ?>
00143                         ><label for="wpRemember">
00144                             <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?></label>
00145                     </div>
00146                 <?php } ?>
00147             </div>
00148 
00149             <div class="mw-ui-vform-field">
00150                 <?php
00151                 echo Html::input( 'wpLoginAttempt', $this->getMsg( 'pt-login-button' )->text(), 'submit', array(
00152                     'id' => 'wpLoginAttempt',
00153                     'tabindex' => '6',
00154                     'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
00155                 ) );
00156                 ?>
00157             </div>
00158 
00159             <div class="mw-ui-vform-field" id="mw-userlogin-help">
00160                 <?php
00161                 echo Html::element(
00162                     'a',
00163                     array(
00164                         'href' => Skin::makeInternalOrExternalUrl(
00165                             wfMessage( 'helplogin-url' )->inContentLanguage()->text()
00166                         ),
00167                     ),
00168                     $this->getMsg( 'userlogin-helplink2' )->text()
00169                 );
00170                 ?>
00171             </div>
00172 
00173             <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
00174                 <?php if ( $this->data['loggedin'] ) { ?>
00175                     <div id="mw-createaccount-another">
00176                         <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a>
00177                     </div>
00178                 <?php } else { ?>
00179                     <div id="mw-createaccount-cta">
00180                         <?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button mw-ui-progressive"><?php $this->msg( 'userlogin-joinproject' ); ?></a>
00181                     </div>
00182                 <?php } ?>
00183             <?php } ?>
00184             <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
00185             <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
00186             <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
00187         </form>
00188     </div>
00189 </div>
00190 <?php
00191 
00192     }
00193 }