summaryrefslogtreecommitdiff
path: root/includes/templates
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/templates
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/templates')
-rw-r--r--includes/templates/NoLocalSettings.php29
-rw-r--r--includes/templates/PHP4.php100
-rw-r--r--includes/templates/Userlogin.php14
3 files changed, 133 insertions, 10 deletions
diff --git a/includes/templates/NoLocalSettings.php b/includes/templates/NoLocalSettings.php
index 75a7e95a..5f7e93c7 100644
--- a/includes/templates/NoLocalSettings.php
+++ b/includes/templates/NoLocalSettings.php
@@ -10,12 +10,31 @@ if ( isset( $wgVersion ) ) {
} else {
$wgVersion = 'VERSION';
}
-# Set the path in case we hit a page such as /index.php/Main_Page
-# Could use <base href> but then we have to worry about http[s]/port #/etc.
-$ext = strpos( $_SERVER['SCRIPT_NAME'], 'index.php5' ) === false ? 'php' : 'php5';
+
+$scriptName = $_SERVER['SCRIPT_NAME'];
+$ext = substr( $scriptName, strrpos( $scriptName, "." ) + 1 );
$path = '';
-if( isset( $_SERVER['SCRIPT_NAME'] )) {
- $path = htmlspecialchars( preg_replace('/index.php5?/', '', $_SERVER['SCRIPT_NAME']) );
+# 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;
+ }
+ }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
diff --git a/includes/templates/PHP4.php b/includes/templates/PHP4.php
new file mode 100644
index 00000000..058351a0
--- /dev/null
+++ b/includes/templates/PHP4.php
@@ -0,0 +1,100 @@
+<?php
+/**
+ * @file
+ * @ingroup Templates
+ */
+
+if( !defined( 'MW_PHP4' ) ) {
+ die( "Not an entry point.");
+}
+
+if( isset( $_SERVER['SCRIPT_NAME'] ) ) {
+ // Probably IIS; doesn't set REQUEST_URI
+ $scriptUrl = $_SERVER['SCRIPT_NAME'];
+} elseif( isset( $_SERVER['REQUEST_URI'] ) ) {
+ // We're trying SCRIPT_NAME first because it won't include PATH_INFO... hopefully
+ $scriptUrl = $_SERVER['REQUEST_URI'];
+} else {
+ $scriptUrl = '';
+}
+if ( preg_match( '!^(.*)/config/[^/]*.php$!', $scriptUrl, $m ) ) {
+ $baseUrl = $m[1];
+} elseif ( preg_match( '!^(.*)/[^/]*.php$!', $scriptUrl, $m ) ) {
+ $baseUrl = $m[1];
+} else {
+ $baseUrl = dirname( $scriptUrl );
+}
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
+ <head>
+ <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?></title>
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+ <style type='text/css' media='screen, projection'>
+ html, body {
+ color: #000;
+ background-color: #fff;
+ font-family: sans-serif;
+ text-align: center;
+ }
+
+ p {
+ text-align: left;
+ margin-left: 2em;
+ margin-right: 2em;
+ }
+
+ h1 {
+ font-size: 150%;
+ }
+ </style>
+ </head>
+ <body>
+ <img src="<?php echo htmlspecialchars( $baseUrl ) ?>/skins/common/images/mediawiki.png" alt='The MediaWiki logo' />
+
+ <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?></h1>
+ <div class='error'>
+<p>
+ MediaWiki requires PHP 5.0.0 or higher. You are running PHP
+ <?php echo htmlspecialchars( phpversion() ); ?>.
+</p>
+<?php
+flush();
+/**
+ * Test the *.php5 extension
+ */
+$downloadOther = true;
+if ( $baseUrl ) {
+ $testUrl = "$wgServer$baseUrl/php5.php5";
+ if( function_exists( 'file_get_contents' ) ) {
+ $errorLevel = error_reporting();
+ error_reporting( $errorLevel & !E_WARNING );
+
+ ini_set( 'allow_url_fopen', '1' );
+ $s = file_get_contents( $testUrl );
+
+ error_reporting( $errorLevel );
+ }
+
+ if ( strpos( $s, 'yes' ) !== false ) {
+ $encUrl = htmlspecialchars( str_replace( '.php', '.php5', $scriptUrl ) );
+ echo "<p>You may be able to use MediaWiki using a <a href=\"$encUrl\">.php5</a> file extension.</p>";
+ $downloadOther = false;
+ }
+}
+if ( $downloadOther ) {
+?>
+<p>Please consider
+<a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>.
+PHP 4 is at the end of its lifecycle and will not receive further security updates.</p>
+<p>If for some reason you really really need to run MediaWiki on PHP 4, you will need to
+<a href="http://www.mediawiki.org/wiki/Download">download version 1.6.x</a>
+from our website. </p>
+<?php
+}
+?>
+
+ </div>
+ </body>
+</html>
diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php
index deeeb274..c4a60b6c 100644
--- a/includes/templates/Userlogin.php
+++ b/includes/templates/Userlogin.php
@@ -16,7 +16,7 @@ class UserloginTemplate extends QuickTemplate {
?>
<div class="<?php $this->text('messagetype') ?>box">
<?php if ( $this->data['messagetype'] == 'error' ) { ?>
- <h2><?php $this->msg('loginerror') ?>:</h2>
+ <h2><?php $this->msg('loginerror') ?></h2>
<?php } ?>
<?php $this->html('message') ?>
</div>
@@ -54,7 +54,7 @@ class UserloginTemplate extends QuickTemplate {
$doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
}
?>
- <tr>
+ <tr id="mw-user-domain-section">
<td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
<td class="mw-input">
<select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
@@ -63,7 +63,8 @@ class UserloginTemplate extends QuickTemplate {
</select>
</td>
</tr>
- <?php } ?>
+ <?php }
+ if( $this->data['canremember'] ) { ?>
<tr>
<td></td>
<td class="mw-input">
@@ -74,6 +75,7 @@ class UserloginTemplate extends QuickTemplate {
/> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
</td>
</tr>
+ <?php } ?>
<tr>
<td></td>
<td class="mw-submit">
@@ -111,7 +113,7 @@ class UsercreateTemplate extends QuickTemplate {
?>
<div class="<?php $this->text('messagetype') ?>box">
<?php if ( $this->data['messagetype'] == 'error' ) { ?>
- <h2><?php $this->msg('loginerror') ?>:</h2>
+ <h2><?php $this->msg('loginerror') ?></h2>
<?php } ?>
<?php $this->html('message') ?>
</div>
@@ -196,6 +198,7 @@ class UsercreateTemplate extends QuickTemplate {
</td>
<?php } ?>
</tr>
+ <?php if( $this->data['canremember'] ) { ?>
<tr>
<td></td>
<td class="mw-input">
@@ -206,7 +209,8 @@ class UsercreateTemplate extends QuickTemplate {
/> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
</td>
</tr>
-<?php
+<?php }
+
$tabIndex = 8;
if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
foreach ( $this->data['extraInput'] as $inputItem ) { ?>