[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/templates/ -> Userlogin.php (source)

   1  <?php
   2  // @codingStandardsIgnoreFile
   3  /**
   4   * Html form for user login (since 1.22 with VForm appearance).
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License along
  17   * with this program; if not, write to the Free Software Foundation, Inc.,
  18   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19   * http://www.gnu.org/copyleft/gpl.html
  20   *
  21   * @file
  22   * @ingroup Templates
  23   */
  24  
  25  class UserloginTemplate extends BaseTemplate {
  26  
  27  	function execute() {
  28          global $wgCookieExpiration;
  29          $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
  30  ?>
  31  <div class="mw-ui-container">
  32      <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
  33      <?php if ( $this->haveData( 'languages' ) ) { ?>
  34          <div id="languagelinks">
  35              <p><?php $this->html( 'languages' ); ?></p>
  36          </div>
  37      <?php } ?>
  38      <div id="userloginForm">
  39          <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
  40              <?php if ( $this->data['loggedin'] ) { ?>
  41                  <div class="warningbox">
  42                      <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
  43                  </div>
  44              <?php } ?>
  45              <section class="mw-form-header">
  46                  <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
  47              </section>
  48  
  49              <?php if ( $this->data['message'] ) { ?>
  50                  <div class="<?php $this->text( 'messagetype' ); ?>box">
  51                      <?php if ( $this->data['messagetype'] == 'error' ) { ?>
  52                          <strong><?php $this->msg( 'loginerror' ); ?></strong>
  53                          <br />
  54                      <?php } ?>
  55                      <?php $this->html( 'message' ); ?>
  56                  </div>
  57              <?php } ?>
  58  
  59              <div class="mw-ui-vform-field">
  60                  <label for='wpName1'>
  61                      <?php
  62                      $this->msg( 'userlogin-yourname' );
  63  
  64                      if ( $this->data['secureLoginUrl'] ) {
  65                          echo Html::element( 'a', array(
  66                              'href' => $this->data['secureLoginUrl'],
  67                              'class' => 'mw-ui-flush-right mw-secure',
  68                          ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
  69                      }
  70                      ?>
  71                  </label>
  72                  <?php
  73                  $extraAttrs = array();
  74                  echo Html::input( 'wpName', $this->data['name'], 'text', array(
  75                      'class' => 'loginText mw-ui-input',
  76                      'id' => 'wpName1',
  77                      'tabindex' => '1',
  78                      'size' => '20',
  79                      // 'required' is blacklisted for now in Html.php due to browser issues.
  80                      // Keeping here in case that changes.
  81                      'required' => true,
  82                      // Set focus to this field if it's blank.
  83                      'autofocus' => !$this->data['name'],
  84                      'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
  85                  ) );
  86                  ?>
  87              </div>
  88  
  89              <div class="mw-ui-vform-field">
  90                  <label for='wpPassword1'>
  91                      <?php
  92                      $this->msg( 'userlogin-yourpassword' );
  93  
  94                      if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
  95                          echo ' ' . Linker::link(
  96                              SpecialPage::getTitleFor( 'PasswordReset' ),
  97                              $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
  98                              array( 'class' => 'mw-ui-flush-right' )
  99                          );
 100                      }
 101                      ?>
 102                  </label>
 103                  <?php
 104                  echo Html::input( 'wpPassword', null, 'password', array(
 105                      'class' => 'loginPassword mw-ui-input',
 106                      'id' => 'wpPassword1',
 107                      'tabindex' => '2',
 108                      'size' => '20',
 109                      // Set focus to this field if username is filled in.
 110                      'autofocus' => (bool)$this->data['name'],
 111                      'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
 112                  ) );
 113                  ?>
 114              </div>
 115  
 116              <?php
 117              if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
 118                  $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
 119                  $select->setAttribute( 'tabindex', 3 );
 120                  foreach ( $this->data['domainnames'] as $dom ) {
 121                      $select->addOption( $dom );
 122                  }
 123              ?>
 124                  <div class="mw-ui-vform-field" id="mw-user-domain-section">
 125                      <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
 126                      <?php echo $select->getHTML(); ?>
 127                  </div>
 128              <?php } ?>
 129  
 130              <?php
 131              if ( $this->haveData( 'extrafields' ) ) {
 132                  echo $this->data['extrafields'];
 133              }
 134              ?>
 135  
 136              <div class="mw-ui-vform-field">
 137                  <?php if ( $this->data['canremember'] ) { ?>
 138                      <div class="mw-ui-checkbox">
 139                          <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
 140                              <?php if ( $this->data['remember'] ) {
 141                                  echo 'checked="checked"';
 142                              } ?>
 143                          ><label for="wpRemember">
 144                              <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?></label>
 145                      </div>
 146                  <?php } ?>
 147              </div>
 148  
 149              <div class="mw-ui-vform-field">
 150                  <?php
 151                  echo Html::input( 'wpLoginAttempt', $this->getMsg( 'pt-login-button' )->text(), 'submit', array(
 152                      'id' => 'wpLoginAttempt',
 153                      'tabindex' => '6',
 154                      'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
 155                  ) );
 156                  ?>
 157              </div>
 158  
 159              <div class="mw-ui-vform-field" id="mw-userlogin-help">
 160                  <?php
 161                  echo Html::element(
 162                      'a',
 163                      array(
 164                          'href' => Skin::makeInternalOrExternalUrl(
 165                              wfMessage( 'helplogin-url' )->inContentLanguage()->text()
 166                          ),
 167                      ),
 168                      $this->getMsg( 'userlogin-helplink2' )->text()
 169                  );
 170                  ?>
 171              </div>
 172  
 173              <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
 174                  <?php if ( $this->data['loggedin'] ) { ?>
 175                      <div id="mw-createaccount-another">
 176                          <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a>
 177                      </div>
 178                  <?php } else { ?>
 179                      <div id="mw-createaccount-cta">
 180                          <?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>
 181                      </div>
 182                  <?php } ?>
 183              <?php } ?>
 184              <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
 185              <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
 186              <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
 187          </form>
 188      </div>
 189  </div>
 190  <?php
 191  
 192      }
 193  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1