API: (bug 17563) Fix regression from r46845 that changed the output for list=backlink...
[lhc/web/wiklou.git] / includes / ImagePage.php
index 1dc6fd6..9eed236 100644 (file)
@@ -117,8 +117,6 @@ class ImagePage extends Article {
                                $wgOut->addWikiText( $fol );
                        }
                        $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . '</div>' );
-               } else {
-                       $this->checkSharedConflict();
                }
 
                $this->closeShowImage();
@@ -483,17 +481,18 @@ EOT
 
                $descUrl = $this->img->getDescriptionUrl();
                $descText = $this->img->getDescriptionText();
-               $s = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml( 'sharedupload' );
+               $msg = '';
                if( $descUrl ) {
                        $sk = $wgUser->getSkin();
                        $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadwiki-linktext' ) );
                        $msg = ( $descText ) ? 'shareduploadwiki-desc' : 'shareduploadwiki';
                        $msg = wfMsgExt( $msg, array( 'parseinline', 'replaceafter' ), $link );
-                       if( $msg != '-' ) {
-                               # Show message only if not voided by local sysops
-                               $s .= $msg;
+                       if( $msg == '-' ) {
+                               $msg = '';
                        }
                }
+               $s  = "<div class='sharedUploadNotice'>";
+               $s .= wfMsgWikiHtml( 'sharedupload', $this->img->getRepo()->getDisplayName(), $msg );
                $s .= "</div>";
                $wgOut->addHTML( $s );
 
@@ -502,54 +501,6 @@ EOT
                }
        }
 
-       /*
-        * Check for files with the same name on the foreign repos.
-        */
-       protected function checkSharedConflict() {
-               global $wgOut, $wgUser;
-               
-               $repoGroup = RepoGroup::singleton();
-               if( !$repoGroup->hasForeignRepos() ) {
-                       return;
-               }
-               
-               $this->loadFile();
-               if( !$this->img->isLocal() ) {
-                       return;
-               }
-
-               $this->dupFile = null;
-               $repoGroup->forEachForeignRepo( array( $this, 'checkSharedConflictCallback' ) );
-               
-               if( !$this->dupFile )
-                       return;
-               $dupfile = $this->dupFile;
-               $same = (
-                       ($this->img->getSha1() == $dupfile->getSha1()) &&
-                       ($this->img->getSize() == $dupfile->getSize())
-               );
-
-               $sk = $wgUser->getSkin();
-               $descUrl = $dupfile->getDescriptionUrl();
-               if( $same ) {
-                       $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadduplicate-linktext' ) );
-                       $wgOut->addHTML( '<div id="shared-image-dup">' . wfMsgWikiHtml( 'shareduploadduplicate', $link ) . '</div>' );
-               } else {
-                       $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadconflict-linktext' ) );
-                       $wgOut->addHTML( '<div id="shared-image-conflict">' . wfMsgWikiHtml( 'shareduploadconflict', $link ) . '</div>' );
-               }
-       }
-
-       public function checkSharedConflictCallback( $repo ) {
-               $this->loadFile();
-               $dupfile = $repo->newFile( $this->img->getTitle() );
-               if( $dupfile && $dupfile->exists() ) {
-                       $this->dupFile = $dupfile;
-                       return $dupfile->exists();
-               }
-               return false;
-       }
-
        public function getUploadUrl() {
                $this->loadFile();
                $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
@@ -696,13 +647,15 @@ EOT
 
                $sk = $wgUser->getSkin();
                foreach ( $dupes as $file ) {
+                       $fromSrc = '';
                        if( $file->isLocal() )
                                $link = $sk->makeKnownLinkObj( $file->getTitle(), "" );
                        else {
                                $link = $sk->makeExternalLink( $file->getDescriptionUrl(),
                                        $file->getTitle()->getPrefixedText() );
+                               $fromSrc = wfMsg( 'shared-repo-from', $file->getRepo()->getDisplayName() );
                        }
-                       $wgOut->addHTML( "<li>{$link}</li>\n" );
+                       $wgOut->addHTML( "<li>{$link} {$fromSrc}</li>\n" );
                }
                $wgOut->addHTML( "</ul></div>\n" );
        }