]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - includes/templates/PHP4.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / includes / templates / PHP4.php
1 <?php
2 /**
3  * Template used when the installer detects that this is PHP 4
4  *
5  * @file
6  * @ingroup Templates
7  */
8
9 if( !defined( 'MW_PHP4' ) ) {
10         die( "Not an entry point.");
11 }
12
13 if( isset( $_SERVER['SCRIPT_NAME'] ) ) {
14         // Probably IIS; doesn't set REQUEST_URI
15         $scriptUrl = $_SERVER['SCRIPT_NAME'];
16 } elseif( isset( $_SERVER['REQUEST_URI'] ) ) {
17         // We're trying SCRIPT_NAME first because it won't include PATH_INFO... hopefully
18         $scriptUrl = $_SERVER['REQUEST_URI'];
19 } else {
20         $scriptUrl = '';
21 }
22 if ( preg_match( '!^(.*)/(mw-)?config/[^/]*.php$!', $scriptUrl, $m ) ) {
23         $baseUrl = $m[1];
24 } elseif ( preg_match( '!^(.*)/[^/]*.php$!', $scriptUrl, $m ) ) {
25         $baseUrl = $m[1];
26 } else {
27         $baseUrl = dirname( $scriptUrl );
28 }
29
30 ?>
31 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32 <html xmlns='http://www.w3.org/1999/xhtml' lang='en'>
33         <head>
34                 <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?></title>
35                 <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
36                 <style type='text/css' media='screen'>
37                         html, body {
38                                 color: #000;
39                                 background-color: #fff;
40                                 font-family: sans-serif;
41                                 text-align: center;
42                         }
43
44                         p {
45                                 text-align: left;
46                                 margin-left: 2em;
47                                 margin-right: 2em;
48                         }
49
50                         h1 {
51                                 font-size: 150%;
52                         }
53                 </style>
54         </head>
55         <body>
56                 <img src="<?php echo htmlspecialchars( $baseUrl ) ?>/skins/common/images/mediawiki.png" alt='The MediaWiki logo' />
57
58                 <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?></h1>
59                 <div class='error'>
60 <p>
61                         MediaWiki requires PHP 5.1.x or higher. You are running PHP
62                         <?php echo htmlspecialchars( phpversion() ); ?>.
63 </p>
64 <?php
65 flush();
66 /**
67  * Test the *.php5 extension
68  */
69 $downloadOther = true;
70 if ( $baseUrl ) {
71         $testUrl = "$wgServer$baseUrl/php5.php5";
72         if( function_exists( 'file_get_contents' ) ) {
73                 $errorLevel = error_reporting();
74                 error_reporting( $errorLevel & !E_WARNING );
75                 
76                 ini_set( 'allow_url_fopen', '1' );
77                 $s = file_get_contents( $testUrl );
78                 
79                 error_reporting( $errorLevel );
80         }
81
82         if ( strpos( $s, 'yes' ) !== false ) {
83                 $encUrl = htmlspecialchars( str_replace( '.php', '.php5', $scriptUrl ) );
84                 echo "<p>You may be able to use MediaWiki using a <a href=\"$encUrl\">.php5</a> file extension.</p>";
85                 $downloadOther = false;
86         }
87 }
88 if ( $downloadOther ) {
89 ?>
90 <p>Please consider
91 <a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>.
92 PHP 4 is at the end of its lifecycle and will not receive further security updates.</p>
93 <p>If for some reason you really really need to run MediaWiki on PHP 4, you will need to
94 <a href="http://www.mediawiki.org/wiki/Download">download version 1.6.x</a>
95 from our website. </p>
96 <?php
97 }
98 ?>
99
100                 </div>
101         </body>
102 </html>