PHP4.php 2.6 KB

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