Index: includes/Linker.php =================================================================== --- includes/Linker.php (revision 60582) +++ includes/Linker.php (working copy) @@ -666,25 +666,38 @@ * @return string */ public function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '', $time = false ) { - global $wgEnableUploads; + global $wgEnableUploads, $wgUploadNavigationUrl; if( $title instanceof Title ) { wfProfileIn( __METHOD__ ); $currentExists = $time ? ( wfFindFile( $title ) != false ) : false; - if( $wgEnableUploads && !$currentExists ) { - $upload = SpecialPage::getTitleFor( 'Upload' ); + if( ($wgUploadNavigationUrl || $wgEnableUploads) && !$currentExists ) { if( $text == '' ) $text = htmlspecialchars( $title->getPrefixedText() ); + $redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title ); if( $redir ) { + wfProfileOut( __METHOD__ ); return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); } + $q = 'wpDestFile=' . $title->getPartialUrl(); if( $query != '' ) $q .= '&' . $query; + + if( $wgUploadNavigationUrl ) { + if( strpos( $wgUploadNavigationUrl, "?" ) === false ) + $href = $wgUploadNavigationUrl . "?" . $q; + else + $href = $wgUploadNavigationUrl . "&" . $q; + } else { + $upload = SpecialPage::getTitleFor( 'Upload' ); + $href = $upload->escapeLocalUrl( $q ); + } + list( $inside, $trail ) = self::splitTrail( $trail ); $style = $this->getInternalLinkAttributesObj( $title, $text, 'new' ); wfProfileOut( __METHOD__ ); - return '' . $prefix . $text . $inside . '' . $trail; } else { wfProfileOut( __METHOD__ ); @@ -716,9 +729,7 @@ $url = $img->getURL(); $class = 'internal'; } else { - $upload = SpecialPage::getTitleFor( 'Upload' ); - $url = $upload->getLocalUrl( 'wpDestFile=' . urlencode( $title->getDBkey() ) ); - $class = 'new'; + return $this->makeBrokenImageLinkObj( $title, $text, '', '', '', '', $time==true ); } $alt = htmlspecialchars( $title->getText() ); if( $text == '' ) {