diff options
Diffstat (limited to 'includes/templates')
-rw-r--r-- | includes/templates/NoLocalSettings.mustache | 39 | ||||
-rw-r--r-- | includes/templates/NoLocalSettings.php | 97 | ||||
-rw-r--r-- | includes/templates/Usercreate.php | 25 | ||||
-rw-r--r-- | includes/templates/Userlogin.php | 75 |
4 files changed, 104 insertions, 132 deletions
diff --git a/includes/templates/NoLocalSettings.mustache b/includes/templates/NoLocalSettings.mustache new file mode 100644 index 00000000..54579491 --- /dev/null +++ b/includes/templates/NoLocalSettings.mustache @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<html lang="en" dir="ltr"> + <head> + <meta charset="UTF-8" /> + <title>MediaWiki {{wgVersion}}</title> + <style media="screen"> + html, body { + color: #000; + background-color: #fff; + font-family: sans-serif; + text-align: center; + } + + h1 { + font-size: 150%; + } + </style> + </head> + <body> + <img src="{{path}}resources/assets/mediawiki.png" alt="The MediaWiki logo" /> + + <h1>MediaWiki {{wgVersion}}</h1> + <div class="error"> + {{#localSettingsExists}} + <p>LocalSettings.php not readable.</p> + <p>Please correct file permissions and try again.</p> + {{/localSettingsExists}} + {{^localSettingsExists}} + <p>LocalSettings.php not found.</p> + {{#installerStarted}} + <p>Please <a href="{{path}}mw-config/index.{{ext}}">complete the installation</a> and download LocalSettings.php.</p> + {{/installerStarted}} + {{^installerStarted}} + <p>Please <a href="{{path}}mw-config/index.{{ext}}">set up the wiki</a> first.</p> + {{/installerStarted}} + {{/localSettingsExists}} + </div> + </body> +</html>
\ No newline at end of file diff --git a/includes/templates/NoLocalSettings.php b/includes/templates/NoLocalSettings.php deleted file mode 100644 index 5b88dfd1..00000000 --- a/includes/templates/NoLocalSettings.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -// @codingStandardsIgnoreFile -/** - * Template used when there is no LocalSettings.php file. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Templates - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - die( "NoLocalSettings.php is not a valid MediaWiki entry point\n" ); -} - -if ( !isset( $wgVersion ) ) { - $wgVersion = 'VERSION'; -} - -# bug 30219 : can not use pathinfo() on URLs since slashes do not match -$matches = array(); -$ext = 'php'; -$path = '/'; -foreach ( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) { - if ( !preg_match( '/\.(php5?)$/', $part, $matches ) ) { - $path .= "$part/"; - } else { - $ext = $matches[1] == 'php5' ? 'php5' : 'php'; - } -} - -# Check to see if the installer is running -if ( !function_exists( 'session_name' ) ) { - $installerStarted = false; -} else { - session_name( 'mw_installer_session' ); - $oldReporting = error_reporting( E_ALL & ~E_NOTICE ); - $success = session_start(); - error_reporting( $oldReporting ); - $installerStarted = ( $success && isset( $_SESSION['installData'] ) ); -} -?> -<!DOCTYPE html> -<html lang="en" dir="ltr"> - <head> - <meta charset="UTF-8" /> - <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></title> - <style media='screen'> - html, body { - color: #000; - background-color: #fff; - font-family: sans-serif; - text-align: center; - } - - h1 { - font-size: 150%; - } - </style> - </head> - <body> - <img src="<?php echo htmlspecialchars( $path ) ?>resources/assets/mediawiki.png" alt='The MediaWiki logo' /> - - <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></h1> - <div class='error'> - <?php if ( !file_exists( MW_CONFIG_FILE ) ) { ?> - <p>LocalSettings.php not found.</p> - <p> - <?php - if ( $installerStarted ) { - echo "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\">complete the installation</a> and download LocalSettings.php."; - } else { - echo "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\">set up the wiki</a> first."; - } - ?> - </p> - <?php } else { ?> - <p>LocalSettings.php not readable.</p> - <p>Please correct file permissions and try again.</p> - <?php } ?> - - </div> - </body> -</html> diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index 01da0bd7..f09b6bba 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -53,7 +53,7 @@ class UsercreateTemplate extends BaseTemplate { <div id="userloginForm"> <form name="userlogin2" id="userlogin2" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>"> <section class="mw-form-header"> - <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?> + <?php $this->html( 'header' ); ?> </section> <!-- This element is used by the mediawiki.special.userlogin.signup.js module. --> <div @@ -217,8 +217,10 @@ class UsercreateTemplate extends BaseTemplate { <?php if ( !empty( $inputItem['value'] ) ) { echo 'checked="checked"'; } ?> - ><label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"></label> - </div><?php $this->msgHtml( $inputItem['msg'] ); ?> + ><label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"> + <?php $this->msg( $inputItem['msg'] ); ?> + </label> + </div> <?php } else { // Not a checkbox. @@ -248,20 +250,25 @@ class UsercreateTemplate extends BaseTemplate { } } - // JS attempts to move the image CAPTCHA below this part of the form, - // so skip one index. + // A separate placeholder for any inserting any extrafields, e.g used by ConfirmEdit extension + if ( $this->haveData( 'extrafields' ) ) { + echo $this->data['extrafields']; + } + // skip one index. $tabIndex++; ?> <div class="mw-ui-vform-field mw-submit"> <?php - echo Html::input( - 'wpCreateaccount', + echo Html::submitButton( $this->getMsg( $this->data['loggedin'] ? 'createacct-another-submit' : 'createacct-submit' ), - 'submit', array( - 'class' => "mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive", 'id' => 'wpCreateaccount', + 'name' => 'wpCreateaccount', 'tabindex' => $tabIndex++ + ), + array( + 'mw-ui-block', + 'mw-ui-constructive', ) ); ?> diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 8bba4265..345bb71b 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -70,12 +70,10 @@ class UserloginTemplate extends BaseTemplate { ?> </label> <?php - $extraAttrs = array(); echo Html::input( 'wpName', $this->data['name'], 'text', array( 'class' => 'loginText mw-ui-input', 'id' => 'wpName1', 'tabindex' => '1', - 'size' => '20', // 'required' is blacklisted for now in Html.php due to browser issues. // Keeping here in case that changes. 'required' => true, @@ -90,14 +88,6 @@ class UserloginTemplate extends BaseTemplate { <label for='wpPassword1'> <?php $this->msg( 'userlogin-yourpassword' ); - - if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) { - echo ' ' . Linker::link( - SpecialPage::getTitleFor( 'PasswordReset' ), - $this->getMsg( 'userlogin-resetpassword-link' )->parse(), - array( 'class' => 'mw-ui-flush-right' ) - ); - } ?> </label> <?php @@ -105,7 +95,6 @@ class UserloginTemplate extends BaseTemplate { 'class' => 'loginPassword mw-ui-input', 'id' => 'wpPassword1', 'tabindex' => '2', - 'size' => '20', // Set focus to this field if username is filled in. 'autofocus' => (bool)$this->data['name'], 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text() @@ -148,15 +137,19 @@ class UserloginTemplate extends BaseTemplate { <div class="mw-ui-vform-field"> <?php - echo Html::input( 'wpLoginAttempt', $this->getMsg( 'pt-login-button' )->text(), 'submit', array( + $attrs = array( 'id' => 'wpLoginAttempt', + 'name' => 'wpLoginAttempt', 'tabindex' => '6', - 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive' - ) ); + ); + $modifiers = array( + 'mw-ui-constructive', + ); + echo Html::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers ); ?> </div> - <div class="mw-ui-vform-field" id="mw-userlogin-help"> + <div class="mw-ui-vform-field mw-form-related-link-container" id="mw-userlogin-help"> <?php echo Html::element( 'a', @@ -169,21 +162,51 @@ class UserloginTemplate extends BaseTemplate { ); ?> </div> + <?php - <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?> - <?php if ( $this->data['loggedin'] ) { ?> - <div id="mw-createaccount-another"> - <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a> + if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) { + echo Html::rawElement( + 'div', + array( + 'class' => 'mw-ui-vform-field mw-form-related-link-container', + ), + Linker::link( + SpecialPage::getTitleFor( 'PasswordReset' ), + $this->getMsg( 'userlogin-resetpassword-link' )->escaped() + ) + ); + } + + if ( $this->haveData( 'createOrLoginHref' ) ) { + if ( $this->data['loggedin'] ) { ?> + <div class="mw-form-related-link-container mw-ui-vform-field"> + <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"><?php $this->msg( 'userlogin-createanother' ); ?></a> </div> <?php } else { ?> - <div id="mw-createaccount-cta"> - <?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> + <div id="mw-createaccount-cta" class="mw-form-related-link-container mw-ui-vform-field"> + <?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> </div> - <?php } ?> - <?php } ?> - <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?> - <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?> - <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?> + <?php + } + } + + // Hidden fields + $fields = ''; + if ( $this->haveData( 'uselang' ) ) { + $fields .= Html::hidden( 'uselang', $this->data['uselang'] ); + } + if ( $this->haveData( 'token' ) ) { + $fields .= Html::hidden( 'wpLoginToken', $this->data['token'] ); + } + if ( $this->data['cansecurelogin'] ) { + $fields .= Html::hidden( 'wpForceHttps', $this->data['stickhttps'] ); + } + if ( $this->data['cansecurelogin'] && $this->haveData( 'fromhttp' ) ) { + $fields .= Html::hidden( 'wpFromhttp', $this->data['fromhttp'] ); + } + echo $fields; + + ?> </form> </div> </div> |