Merge "SkinTemplate: extract formatLanguageName() from outputPage()"
[lhc/web/wiklou.git] / load.php
index 7fff7c4..f363c3f 100644 (file)
--- a/load.php
+++ b/load.php
  * @file
  * @author Roan Kattouw
  * @author Trevor Parscal
- *
  */
 
-// We want error messages to not be interpreted as CSS or JS
-function wfDie( $msg = '' ) {
-       header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
-       echo "/* $msg */";
-       die( 1 );
+// Bail if PHP is too low
+if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
+       // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
+       require( dirname( __FILE__ ) . '/includes/PHPVersionError.php' );
+       wfPHPVersionError( 'load.php' );
 }
 
-// Die on unsupported PHP versions
-if( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ){
-       $version = htmlspecialchars( $wgVersion );
-       wfDie( "MediaWiki $version requires at least PHP version 5.2.3." );
+if ( isset( $_SERVER['MW_COMPILED'] ) ) {
+       require ( 'phase3/includes/WebStart.php' );
+} else {
+       require ( __DIR__ . '/includes/WebStart.php' );
 }
 
-require ( dirname( __FILE__ ) . '/includes/WebStart.php' );
 wfProfileIn( 'load.php' );
 
 // URL safety checks
-//
-// See RawPage.php for details; summary is that MSIE can override the
-// Content-Type if it sees a recognized extension on the URL, such as
-// might be appended via PATH_INFO after 'load.php'.
-//
-// Some resources can contain HTML-like strings (e.g. in messages)
-// which will end up triggering HTML detection and execution.
-//
-if ( $wgRequest->isPathInfoBad() ) {
-       wfHttpError( 403, 'Forbidden',
-               'Invalid file extension found in PATH_INFO or QUERY_STRING.' );
+if ( !$wgRequest->checkUrlExtension() ) {
        return;
 }