Add DTD to fix well-formedness errors in HTML5
[lhc/web/wiklou.git] / thumb.php
index 079ce72..b973cc6 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -49,7 +49,18 @@ function wfThumbMain() {
 
        // Actually fetch the image. Method depends on whether it is archived or not.
        if( $isOld ) {
-               $img = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $fileName );
+               // Format is <timestamp>!<name>
+               $bits = explode( '!', $fileName, 2 );
+               if( !isset($bits[1]) ) {
+                       wfThumbError( 404, wfMsg( 'badtitletext' ) );
+                       return;
+               }
+               $title = Title::makeTitleSafe( NS_FILE, $bits[1] );
+               if( is_null($title) ) {
+                       wfThumbError( 404, wfMsg( 'badtitletext' ) );
+                       return;
+               }
+               $img = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $fileName );
        } else {
                $img = wfLocalFile( $fileName );
        }