summaryrefslogtreecommitdiff
path: root/includes/templates/PHP4.php
blob: 69f7d55d2a0e9c9c5a850812216b779ebeddb930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
 * Template used when the installer detects that this is PHP 4
 *
 * @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( '!^(.*)/(mw-)?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' 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'>
			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.1.x 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>