API: Page prop=revisions by rev_id or (rev_page, rev_id), depending on mode, because...
[lhc/web/wiklou.git] / includes / ImagePage.php
index 49e7f2d..fb4fe24 100644 (file)
@@ -93,10 +93,11 @@ class ImagePage extends Article {
                        $showmeta = false;
                }
 
-               if( $this->displayImg->exists() )
+               if( !$diff && $this->displayImg->exists() )
                        $wgOut->addHTML( $this->showTOC($showmeta) );
 
-               $this->openShowImage();
+               if( !$diff )
+                       $this->openShowImage();
 
                # No need to display noarticletext, we use our own message, output in openShowImage()
                if( $this->getID() ) {
@@ -128,11 +129,7 @@ class ImagePage extends Article {
                        array( 'id' => 'filelinks' ),
                        wfMsg( 'imagelinks' ) ) . "\n" );
                $this->imageDupes();
-               // TODO: We may want to find local images redirecting to a foreign 
-               // file: "The following local files redirect to this file"
-               if( $this->img->isLocal() ) {
-                       $this->imageRedirects();
-               }
+               $this->imageRedirects();
                $this->imageLinks();
 
                if( $showmeta ) {
@@ -249,6 +246,7 @@ class ImagePage extends Article {
                $r .= "{| id=mw_metadata class=mw_metadata\n";
                foreach ( $metadata as $type => $stuff ) {
                        foreach ( $stuff as $v ) {
+                               # FIXME, why is this using escapeId for a class?!
                                $class = Sanitizer::escapeId( $v['id'] );
                                if( $type == 'collapsed' ) {
                                        $class .= ' collapsable';
@@ -555,7 +553,7 @@ EOT
        public function getUploadUrl() {
                $this->loadFile();
                $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
-               return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
+               return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) . '&wpForReUpload=1' );
        }
 
        /**
@@ -920,7 +918,8 @@ class ImageHistoryList {
                                'alt' => wfMsg( 'filehist-thumbtext', $wgLang->timeAndDate( $timestamp, true ) ),
                                'file-link' => true,
                        );
-                       $row .= '</td><td>' . $thumbnail->toHtml( $options );
+                       $row .= '</td><td>' . ( $thumbnail ? $thumbnail->toHtml( $options ) : 
+                                                                                                       wfMsgHtml( 'filehist-nothumb' ) );
                } else {
                        $row .= '</td><td>' . wfMsgHtml( 'filehist-nothumb' );
                }
@@ -965,13 +964,17 @@ class ImageHistoryList {
 class ImageHistoryPseudoPager extends ReverseChronologicalPager {
        function __construct( $imagePage ) {
                parent::__construct();
-               $this->mImagePage =& $imagePage;
-               $this->mTitle = $imagePage->getTitle();
+               $this->mImagePage = $imagePage;
+               $this->mTitle = clone( $imagePage->getTitle() );
                $this->mTitle->setFragment( '#filehistory' );
                $this->mImg = NULL;
                $this->mHist = array();
                $this->mRange = array( 0, 0 ); // display range
        }
+       
+       function getTitle() {
+               return $this->mTitle;
+       }
 
        function getQueryInfo() {
                return false;