Fix retarded mistake in 57997, move break to within the if block or it defeats the...
[lhc/web/wiklou.git] / includes / RawPage.php
index ea698bc..34aa9fe 100644 (file)
@@ -109,19 +109,9 @@ class RawPage {
        }
 
        function view() {
-               global $wgOut, $wgScript;
-
-               $url = wfGetScriptUrl();
-               if( $url == '' ) {
-                       # This will make the next check fail with a confusing error
-                       # message, so we should mention it separately.
-                       wfHttpError( 500, 'Internal Server Error',
-                               "\$_SERVER['URL'] is not set.  Perhaps you're using CGI" .
-                               " and haven't set cgi.fix_pathinfo = 1 in php.ini?" );
-                       return;
-               }
+               global $wgOut, $wgScript, $wgRequest;
 
-               if( strcmp( $wgScript, $url ) ) {
+               if( $wgRequest->isPathInfoBad() ) {
                        # Internet Explorer will ignore the Content-Type header if it
                        # thinks it sees a file extension it recognizes. Make sure that
                        # all raw requests are done through the script node, which will
@@ -135,6 +125,7 @@ class RawPage {
                        #
                        # Just return a 403 Forbidden and get it over with.
                        wfHttpError( 403, 'Forbidden',
+                               'Invalid file extension found in PATH_INFO. ' . 
                                'Raw pages must be accessed through the primary script entry point.' );
                        return;
                }
@@ -144,7 +135,8 @@ class RawPage {
                $mode = $this->mPrivateCache ? 'private' : 'public';
                header( 'Cache-Control: '.$mode.', s-maxage='.$this->mSmaxage.', max-age='.$this->mMaxage );
                
-               if( HTMLFileCache::useFileCache() ) {
+               global $wgUseFileCache;
+               if( $wgUseFileCache and HTMLFileCache::useFileCache() ) {
                        $cache = new HTMLFileCache( $this->mTitle, 'raw' );
                        if( $cache->isFileCacheGood( /* Assume up to date */ ) ) {
                                $cache->loadFromFileCache();