Make variant selection menu toggleable by keyboard
[lhc/web/wiklou.git] / thumb.php
index ede30e6..b9826a7 100644 (file)
--- a/thumb.php
+++ b/thumb.php
  */
 
 define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
-       require( 'core/includes/WebStart.php' );
-} else {
-       require( __DIR__ . '/includes/WebStart.php' );
-}
+require __DIR__ . '/includes/WebStart.php';
 
 // Don't use fancy mime detection, just check the file extension for jpg/gif/png
 $wgTrivialMimeDetection = true;
@@ -66,9 +62,15 @@ function wfThumbHandle404() {
 
        # Set action base paths so that WebRequest::getPathInfo()
        # recognizes the "X" as the 'title' in ../thumb_handler.php/X urls.
-       $wgArticlePath = false; # Don't let a "/*" article path clober our action path
+       # Note: If Custom per-extension repo paths are set, this may break.
+       $repo = RepoGroup::singleton()->getLocalRepo();
+       $oldArticlePath = $wgArticlePath;
+       $wgArticlePath = $repo->getZoneUrl( 'thumb' ) . '/$1';
 
        $matches = WebRequest::getPathInfo();
+
+       $wgArticlePath = $oldArticlePath;
+
        if ( !isset( $matches['title'] ) ) {
                wfThumbError( 404, 'Could not determine the name of the requested thumbnail.' );
                return;
@@ -126,7 +128,7 @@ function wfStreamThumb( array $params ) {
                $img = new UnregisteredLocalFile( null, $repo,
                        # Temp files are hashed based on the name without the timestamp.
                        # The thumbnails will be hashed based on the entire name however.
-                       # @TODO: fix this convention to actually be reasonable.
+                       # @todo fix this convention to actually be reasonable.
                        $repo->getZonePath( 'public' ) . '/' . $repo->getTempHashPath( $fileName ) . $fileName
                );
        } elseif ( $isOld ) {