diff options
Diffstat (limited to 'includes/templates')
-rw-r--r-- | includes/templates/NoLocalSettings.php | 48 | ||||
-rw-r--r-- | includes/templates/PHP4.php | 6 | ||||
-rw-r--r-- | includes/templates/Userlogin.php | 81 |
3 files changed, 89 insertions, 46 deletions
diff --git a/includes/templates/NoLocalSettings.php b/includes/templates/NoLocalSettings.php index 45b758a9..9001e3ba 100644 --- a/includes/templates/NoLocalSettings.php +++ b/includes/templates/NoLocalSettings.php @@ -1,5 +1,7 @@ <?php /** + * Template used when there is no LocalSettings.php file + * * @file * @ingroup Templates */ @@ -7,31 +9,20 @@ if ( !isset( $wgVersion ) ) { $wgVersion = 'VERSION'; } +$script = $_SERVER['SCRIPT_NAME']; +$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/'; +$path = str_replace( '//', '/', $path ); +$ext = pathinfo( $script, PATHINFO_EXTENSION ); -$scriptName = $_SERVER['SCRIPT_NAME']; -$ext = substr( $scriptName, strrpos( $scriptName, "." ) + 1 ); -$path = ''; -# Add any directories in the main folder that could contain an entrypoint (even possibly). -# We cannot just do a dir listing here, as we do not know where it is yet -# These must not also be the names of subfolders that may contain an entrypoint -$topdirs = array( 'extensions', 'includes' ); -foreach( $topdirs as $dir ){ - # Check whether a directory by this name is in the path - if( strrpos( $scriptName, "/" . $dir . "/" ) ){ - # If so, check whether it is the right folder - # First, get the number of directories up it is (to generate path) - $numToGoUp = substr_count( substr( $scriptName, strrpos( $scriptName, "/" . $dir . "/" ) + 1 ), "/" ); - # And generate the path using ..'s - for( $i = 0; $i < $numToGoUp; $i++ ){ - $realPath = "../" . $realPath; - } - # Checking existance (using the image here as it is something not likely to change, and to always be here) - if( file_exists( $realPath . "skins/common/images/mediawiki.png" ) ) { - # If so, get the path that we can use in this file, and stop looking - $path = substr( $scriptName, 0, strrpos( $scriptName, "/" . $dir . "/" ) + 1 ); - break; - } - } +# 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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -57,13 +48,16 @@ foreach( $topdirs as $dir ){ <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></h1> <div class='error'> + <p>LocalSettings.php not found.</p> + <p> <?php - if ( file_exists( 'config/LocalSettings.php' ) ) { - echo( 'To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory.' ); + 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 ) . "config/index." . htmlspecialchars( $ext ) . "\" title='setup'> set up the wiki</a> first." ); + echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> set up the wiki</a> first." ); } ?> + </p> </div> </body> diff --git a/includes/templates/PHP4.php b/includes/templates/PHP4.php index b071ebd5..69f7d55d 100644 --- a/includes/templates/PHP4.php +++ b/includes/templates/PHP4.php @@ -1,5 +1,7 @@ <?php /** + * Template used when the installer detects that this is PHP 4 + * * @file * @ingroup Templates */ @@ -17,7 +19,7 @@ if( isset( $_SERVER['SCRIPT_NAME'] ) ) { } else { $scriptUrl = ''; } -if ( preg_match( '!^(.*)/config/[^/]*.php$!', $scriptUrl, $m ) ) { +if ( preg_match( '!^(.*)/(mw-)?config/[^/]*.php$!', $scriptUrl, $m ) ) { $baseUrl = $m[1]; } elseif ( preg_match( '!^(.*)/[^/]*.php$!', $scriptUrl, $m ) ) { $baseUrl = $m[1]; @@ -56,7 +58,7 @@ if ( preg_match( '!^(.*)/config/[^/]*.php$!', $scriptUrl, $m ) ) { <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?></h1> <div class='error'> <p> - MediaWiki requires PHP 5.0.0 or higher. You are running PHP + MediaWiki requires PHP 5.1.x or higher. You are running PHP <?php echo htmlspecialchars( phpversion() ); ?>. </p> <?php diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 60f33767..99ab2d8e 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -1,9 +1,15 @@ <?php /** - * @defgroup Templates Templates + * Html forms for user login and account creation + * * @file * @ingroup Templates */ + +/** + * @defgroup Templates Templates + */ + if( !defined( 'MEDIAWIKI' ) ) die( -1 ); /** @@ -61,7 +67,7 @@ class UserloginTemplate extends QuickTemplate { </td> </tr> - <?php if( $this->data['usedomain'] ) { + <?php if( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) { $doms = ""; foreach( $this->data['domainnames'] as $dom ) { $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>"; @@ -77,17 +83,41 @@ class UserloginTemplate extends QuickTemplate { </td> </tr> <?php } + + if( $this->haveData( 'extrafields' ) ) { + echo $this->data['extrafields']; + } + if( $this->data['canremember'] ) { ?> <tr> <td></td> <td class="mw-input"> <?php - echo Html::input( 'wpRemember', '1', 'checkbox', array( - 'tabindex' => '4', - 'id' => 'wpRemember' - ) + ( $this->data['remember'] ? array( 'checked' ) : array() ) ); ?> - - <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label> + global $wgCookieExpiration, $wgLang; + echo Xml::checkLabel( + wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), + 'wpRemember', + 'wpRemember', + $this->data['remember'], + array( 'tabindex' => '8' ) + ) + ?> + </td> + </tr> +<?php } ?> +<?php if( $this->data['cansecurelogin'] ) { ?> + <tr> + <td></td> + <td class="mw-input"> + <?php + echo Xml::checkLabel( + wfMsg( 'securelogin-stick-https' ), + 'wpStickHTTPS', + 'wpStickHTTPS', + $this->data['stickHTTPS'], + array( 'tabindex' => '9' ) + ); + ?> </td> </tr> <?php } ?> @@ -97,13 +127,13 @@ class UserloginTemplate extends QuickTemplate { <?php echo Html::input( 'wpLoginAttempt', wfMsg( 'login' ), 'submit', array( 'id' => 'wpLoginAttempt', - 'tabindex' => '5' + 'tabindex' => '9' ) ); if ( $this->data['useemail'] && $this->data['canreset'] ) { - echo ' '; + echo ' '; echo Html::input( 'wpMailmypassword', wfMsg( 'mailmypassword' ), 'submit', array( 'id' => 'wpMailmypassword', - 'tabindex' => '6' + 'tabindex' => '10' ) ); } ?> @@ -145,6 +175,8 @@ class UsercreateTemplate extends QuickTemplate { </div> <div class="visualClear"></div> <?php } ?> + +<div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div> <div id="userlogin"> <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>"> @@ -240,21 +272,36 @@ class UsercreateTemplate extends QuickTemplate { </div> </td> <?php } ?> + <?php if( $this->data['usereason'] ) { ?> + </tr> + <tr> + <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td> + <td class="mw-input"> + <input type='text' class='loginText' name="wpReason" id="wpReason" + tabindex="7" + value="<?php $this->text('reason') ?>" size='20' /> + </td> + <?php } ?> </tr> <?php if( $this->data['canremember'] ) { ?> <tr> <td></td> <td class="mw-input"> - <input type='checkbox' name="wpRemember" - tabindex="7" - value="1" id="wpRemember" - <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?> - /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label> + <?php + global $wgCookieExpiration, $wgLang; + echo Xml::checkLabel( + wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), + 'wpRemember', + 'wpRemember', + $this->data['remember'], + array( 'tabindex' => '8' ) + ) + ?> </td> </tr> <?php } - $tabIndex = 8; + $tabIndex = 9; if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) { foreach ( $this->data['extraInput'] as $inputItem ) { ?> <tr> |