summaryrefslogtreecommitdiff
path: root/thumb.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /thumb.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'thumb.php')
-rw-r--r--thumb.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/thumb.php b/thumb.php
index 677979a0..b973cc65 100644
--- a/thumb.php
+++ b/thumb.php
@@ -40,10 +40,31 @@ function wfThumbMain() {
}
unset( $params['r'] );
+ // Is this a thumb of an archived file?
+ $isOld = (isset( $params['archived'] ) && $params['archived']);
+ unset( $params['archived'] );
+
// Some basic input validation
$fileName = strtr( $fileName, '\\/', '__' );
- $img = wfLocalFile( $fileName );
+ // Actually fetch the image. Method depends on whether it is archived or not.
+ if( $isOld ) {
+ // 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 );
+ }
+
if ( !$img ) {
wfThumbError( 404, wfMsg( 'badtitletext' ) );
return;