MediaWiki  master
Userlogin.php
Go to the documentation of this file.
1 <?php
2 // @codingStandardsIgnoreFile
28 
29  function execute() {
31  $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
32 ?>
33 <div class="mw-ui-container">
34  <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
35  <?php if ( $this->haveData( 'languages' ) ) { ?>
36  <div id="languagelinks">
37  <p><?php $this->html( 'languages' ); ?></p>
38  </div>
39  <?php } ?>
40  <div id="userloginForm">
41  <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
42  <?php if ( $this->data['loggedin'] ) { ?>
43  <div class="warningbox">
44  <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
45  </div>
46  <?php } ?>
47  <section class="mw-form-header">
48  <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
49  </section>
50 
51  <?php if ( $this->data['message'] ) { ?>
52  <div class="<?php $this->text( 'messagetype' ); ?>box">
53  <?php if ( $this->data['messagetype'] == 'error' ) { ?>
54  <strong><?php $this->msg( 'loginerror' ); ?></strong>
55  <br />
56  <?php } ?>
57  <?php $this->html( 'message' ); ?>
58  </div>
59  <?php } ?>
60 
61  <?php if ( $this->data['formheader'] ) { ?>
62  <div class="mw-form-formheader">
63  <?php $this->html( 'formheader' ); /* extensions such as MobileFrontend add HTML here */ ?>
64  </div>
65  <?php } ?>
66  <div class="mw-ui-vform-field">
67  <label for="wpName1">
68  <?php
69  $this->msg( 'userlogin-yourname' );
70 
71  if ( $this->data['secureLoginUrl'] ) {
72  echo Html::element( 'a', [
73  'href' => $this->data['secureLoginUrl'],
74  'class' => 'mw-ui-flush-right mw-secure',
75  ], $this->getMsg( 'userlogin-signwithsecure' )->text() );
76  }
77  ?>
78  </label>
79  <?php
80  echo Html::input( 'wpName', $this->data['name'], 'text', [
81  'class' => 'loginText mw-ui-input',
82  'id' => 'wpName1',
83  'tabindex' => '1',
84  // 'required' is blacklisted for now in Html.php due to browser issues.
85  // Keeping here in case that changes.
86  'required' => true,
87  // Set focus to this field if it's blank.
88  'autofocus' => !$this->data['name'],
89  'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
90  ] );
91  ?>
92  </div>
93 
94  <div class="mw-ui-vform-field">
95  <label for="wpPassword1">
96  <?php
97  $this->msg( 'userlogin-yourpassword' );
98  ?>
99  </label>
100  <?php
101  echo Html::input( 'wpPassword', null, 'password', [
102  'class' => 'loginPassword mw-ui-input',
103  'id' => 'wpPassword1',
104  'tabindex' => '2',
105  // Set focus to this field if username is filled in.
106  'autofocus' => (bool)$this->data['name'],
107  'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
108  ] );
109  ?>
110  </div>
111 
112  <?php
113  if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
114  $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
115  $select->setAttribute( 'tabindex', 3 );
116  foreach ( $this->data['domainnames'] as $dom ) {
117  $select->addOption( $dom );
118  }
119  ?>
120  <div class="mw-ui-vform-field" id="mw-user-domain-section">
121  <label for="wpDomain"><?php $this->msg( 'yourdomainname' ); ?></label>
122  <?php echo $select->getHTML(); ?>
123  </div>
124  <?php } ?>
125 
126  <?php
127  if ( $this->haveData( 'extrafields' ) ) {
128  echo $this->data['extrafields'];
129  }
130  ?>
131 
132  <div class="mw-ui-vform-field">
133  <?php if ( $this->data['canremember'] ) { ?>
134  <div class="mw-ui-checkbox">
135  <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
136  <?php if ( $this->data['remember'] ) {
137  echo 'checked="checked"';
138  } ?>
139  ><label for="wpRemember">
140  <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?></label>
141  </div>
142  <?php } ?>
143  </div>
144 
145  <div class="mw-ui-vform-field">
146  <?php
147  $attrs = [
148  'id' => 'wpLoginAttempt',
149  'name' => 'wpLoginAttempt',
150  'tabindex' => '6',
151  ];
152  $modifiers = [
153  'mw-ui-progressive',
154  ];
155  echo Html::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers );
156  ?>
157  </div>
158 
159  <div class="mw-ui-vform-field mw-form-related-link-container" id="mw-userlogin-help">
160  <?php
161  echo Html::element(
162  'a',
163  [
165  wfMessage( 'helplogin-url' )->inContentLanguage()->text()
166  ),
167  ],
168  $this->getMsg( 'userlogin-helplink2' )->text()
169  );
170  ?>
171  </div>
172  <?php
173 
174  if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
175  echo Html::rawElement(
176  'div',
177  [
178  'class' => 'mw-ui-vform-field mw-form-related-link-container',
179  ],
180  Linker::link(
181  SpecialPage::getTitleFor( 'PasswordReset' ),
182  $this->getMsg( 'userlogin-resetpassword-link' )->escaped()
183  )
184  );
185  }
186 
187  if ( $this->haveData( 'createOrLoginHref' ) ) {
188  if ( $this->data['loggedin'] ) { ?>
189  <div class="mw-form-related-link-container mw-ui-vform-field">
190  <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"><?php $this->msg( 'userlogin-createanother' ); ?></a>
191  </div>
192  <?php } else { ?>
193  <div id="mw-createaccount-cta" class="mw-ui-vform-field">
194  <?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button"><?php $this->msg( 'userlogin-joinproject' ); ?></a>
195  </div>
196  <?php
197  }
198  }
199 
200  // Hidden fields
201  $fields = '';
202  if ( $this->haveData( 'uselang' ) ) {
203  $fields .= Html::hidden( 'uselang', $this->data['uselang'] );
204  }
205  if ( $this->haveData( 'token' ) ) {
206  $fields .= Html::hidden( 'wpLoginToken', $this->data['token'] );
207  }
208  if ( $this->data['cansecurelogin'] ) {
209  $fields .= Html::hidden( 'wpForceHttps', $this->data['stickhttps'] );
210  }
211  if ( $this->data['cansecurelogin'] && $this->haveData( 'fromhttp' ) ) {
212  $fields .= Html::hidden( 'wpFromhttp', $this->data['fromhttp'] );
213  }
214  echo $fields;
215 
216  ?>
217  </form>
218  </div>
219 </div>
220 <?php
221 
222  }
223 }
null means default in associative array form
Definition: hooks.txt:1816
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:80
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
Definition: Html.php:210
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:749
Class for generating HTML <select> or <datalist> elements.
Definition: XmlSelect.php:26
New base template for a skin's template extended from QuickTemplate this class features helper method...
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
Definition: hooks.txt:6
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
getMsg($name)
Get a Message object with its context set.
shown</td >< td > a href
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"&lt
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:203
$wgCookieExpiration
Default cookie lifetime, in seconds.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition: postgres.txt:22
static submitButton($contents, array $attrs, array $modifiers=[])
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enab...
Definition: Html.php:186
static input($name, $value= '', $type= 'text', array $attribs=[])
Convenience function to produce an "<input>" element.
Definition: Html.php:666
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
Definition: design.txt:12
static makeInternalOrExternalUrl($name)
If url string starts with http, consider as external URL, else internal.
Definition: Skin.php:1098
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:230