Index: trunk/phase3/includes/Linker.php |
— | — | @@ -460,6 +460,7 @@ |
461 | 461 | * @param boolean $thumb shows image as thumbnail in a frame |
462 | 462 | * @param string $manualthumb image name for the manual thumbnail |
463 | 463 | * @param string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom |
| 464 | + * @param string $time, timestamp of the file, set as false for current |
464 | 465 | * @return string |
465 | 466 | */ |
466 | 467 | function makeImageLinkObj( $title, $label, $alt, $align = '', $handlerParams = array(), $framed = false, |
— | — | @@ -482,7 +483,7 @@ |
483 | 484 | $frameParams['valign'] = $valign; |
484 | 485 | } |
485 | 486 | $file = wfFindFile( $title, $time ); |
486 | | - return $this->makeImageLink2( $title, $file, $frameParams, $handlerParams ); |
| 487 | + return $this->makeImageLink2( $title, $file, $frameParams, $handlerParams, $time ); |
487 | 488 | } |
488 | 489 | |
489 | 490 | /** |
— | — | @@ -508,8 +509,9 @@ |
509 | 510 | * |
510 | 511 | * @param array $handlerParams Associative array of media handler parameters, to be passed |
511 | 512 | * to transform(). Typical keys are "width" and "page". |
| 513 | + * @param string $time, timestamp of the file, set as false for current |
512 | 514 | */ |
513 | | - function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array() ) { |
| 515 | + function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false ) { |
514 | 516 | global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright; |
515 | 517 | if ( $file && !$file->allowInlineDisplay() ) { |
516 | 518 | wfDebug( __METHOD__.': '.$title->getPrefixedDBkey()." does not allow inline display\n" ); |
— | — | @@ -570,7 +572,7 @@ |
571 | 573 | if ( $fp['align'] == '' ) { |
572 | 574 | $fp['align'] = $wgContLang->isRTL() ? 'left' : 'right'; |
573 | 575 | } |
574 | | - return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp ).$postfix; |
| 576 | + return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp, $time ).$postfix; |
575 | 577 | } |
576 | 578 | |
577 | 579 | if ( $file && isset( $fp['frameless'] ) ) { |
— | — | @@ -590,7 +592,7 @@ |
591 | 593 | } |
592 | 594 | |
593 | 595 | if ( !$thumb ) { |
594 | | - $s = $this->makeBrokenImageLinkObj( $title ); |
| 596 | + $s = $this->makeBrokenImageLinkObj( $title, '', '', '', '', $time==true ); |
595 | 597 | } else { |
596 | 598 | $s = $thumb->toHtml( array( |
597 | 599 | 'desc-link' => true, |
— | — | @@ -620,7 +622,7 @@ |
621 | 623 | return $this->makeThumbLink2( $title, $file, $frameParams, $params ); |
622 | 624 | } |
623 | 625 | |
624 | | - function makeThumbLink2( Title $title, $file, $frameParams = array(), $handlerParams = array() ) { |
| 626 | + function makeThumbLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false ) { |
625 | 627 | global $wgStylePath, $wgContLang; |
626 | 628 | $exists = $file && $file->exists(); |
627 | 629 | |
— | — | @@ -680,7 +682,7 @@ |
681 | 683 | |
682 | 684 | $s = "<div class=\"thumb t{$fp['align']}\"><div class=\"thumbinner\" style=\"width:{$outerWidth}px;\">"; |
683 | 685 | if( !$exists ) { |
684 | | - $s .= $this->makeBrokenImageLinkObj( $title ); |
| 686 | + $s .= $this->makeBrokenImageLinkObj( $title, '', '', '', '', $time==true ); |
685 | 687 | $zoomicon = ''; |
686 | 688 | } elseif ( !$thumb ) { |
687 | 689 | $s .= htmlspecialchars( wfMsg( 'thumbnail_error', '' ) ); |
— | — | @@ -711,14 +713,15 @@ |
712 | 714 | * @param string $query Query string |
713 | 715 | * @param string $trail Link trail |
714 | 716 | * @param string $prefix Link prefix |
| 717 | + * @param bool $time, a file of a certain timestamp was requested |
715 | 718 | * @return string |
716 | 719 | */ |
717 | | - public function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 720 | + public function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '', $time = false ) { |
718 | 721 | global $wgEnableUploads; |
719 | 722 | if( $title instanceof Title ) { |
720 | 723 | wfProfileIn( __METHOD__ ); |
721 | | - $currentFile = wfFindFile( $title ); |
722 | | - if( $wgEnableUploads && !$currentFile ) { |
| 724 | + $currentExists = $time ? ( wfFindFile( $title ) != false ) : false; |
| 725 | + if( $wgEnableUploads && !$currentExists ) { |
723 | 726 | $upload = SpecialPage::getTitleFor( 'Upload' ); |
724 | 727 | if( $text == '' ) |
725 | 728 | $text = htmlspecialchars( $title->getPrefixedText() ); |