Merge "Localisation updates from http://translatewiki.net."
[lhc/web/wiklou.git] / thumb.php
index 5fc4446..8307b48 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -25,7 +25,7 @@ define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
 if ( isset( $_SERVER['MW_COMPILED'] ) ) {
        require( 'core/includes/WebStart.php' );
 } else {
-       require( dirname( __FILE__ ) . '/includes/WebStart.php' );
+       require( __DIR__ . '/includes/WebStart.php' );
 }
 
 // Don't use fancy mime detection, just check the file extension for jpg/gif/png
@@ -71,9 +71,10 @@ function wfThumbHandle404() {
        }
        # Just get the URI path (REDIRECT_URL/REQUEST_URI is either a full URL or a path)
        if ( substr( $uriPath, 0, 1 ) !== '/' ) {
-               $uri = new Uri( $uriPath );
-               $uriPath = $uri->getPath();
-               if ( $uriPath === null ) {
+               $bits = wfParseUrl( $uriPath );
+               if ( $bits && isset( $bits['path'] ) ) {
+                       $uriPath = $bits['path'];
+               } else {
                        wfThumbError( 404, 'The source file for the specified thumbnail does not exist.' );
                        return;
                }