* (bug 1010) fix broken Commons image link on Classic & Cologne Blue
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 5 Dec 2004 18:54:49 +0000 (18:54 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 5 Dec 2004 18:54:49 +0000 (18:54 +0000)
includes/Skin.php

index 186a883..4f3d0fe 100644 (file)
@@ -534,9 +534,12 @@ class Skin {
                if ( $wgOut->isArticleRelated() ) {
                        if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
                                $name = $wgTitle->getDBkey();
-                               $link = htmlspecialchars( Image::wfImageUrl( $name ) );
-                               $style = $this->getInternalLinkAttributes( $link, $name );
-                               $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
+                               $image = new Image( $wgTitle->getDBkey() );
+                               if( $image->exists() ) {
+                                       $link = htmlspecialchars( $image->getURL() );
+                                       $style = $this->getInternalLinkAttributes( $link, $name );
+                                       $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
+                               }
                        }
                        # This will show the "Approve" link if $wgUseApproval=true;
                        if ( isset ( $wgUseApproval ) && $wgUseApproval )