| Index: trunk/phase3/includes/Linker.php |
| — | — | @@ -679,18 +679,10 @@ |
| 680 | 680 | wfProfileOut( __METHOD__ ); |
| 681 | 681 | return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); |
| 682 | 682 | } |
| | 683 | + |
| | 684 | + $href = $this->getUploadUrl( $title, $query ); |
| 683 | 685 | |
| 684 | | - $q = 'wpDestFile=' . $title->getPartialUrl(); |
| 685 | | - if( $query != '' ) |
| 686 | | - $q .= '&' . $query; |
| 687 | 686 | |
| 688 | | - if( $wgUploadNavigationUrl ) { |
| 689 | | - $href = wfAppendQuery( $wgUploadNavigationUrl, $q ); |
| 690 | | - } else { |
| 691 | | - $upload = SpecialPage::getTitleFor( 'Upload' ); |
| 692 | | - $href = $upload->getLocalUrl( $q ); |
| 693 | | - } |
| 694 | | - |
| 695 | 687 | list( $inside, $trail ) = self::splitTrail( $trail ); |
| 696 | 688 | |
| 697 | 689 | wfProfileOut( __METHOD__ ); |
| — | — | @@ -707,7 +699,28 @@ |
| 708 | 700 | return "<!-- ERROR -->{$prefix}{$text}{$trail}"; |
| 709 | 701 | } |
| 710 | 702 | } |
| | 703 | + |
| | 704 | + /** |
| | 705 | + * Get the URL to upload a certain file |
| | 706 | + * |
| | 707 | + * @param $destFile Title Title of the file to upload |
| | 708 | + * @param $query string Urlencoded query string to prepend |
| | 709 | + * @return string Urlencoded URL |
| | 710 | + */ |
| | 711 | + protected function getUploadUrl( $destFile, $query = '' ) { |
| | 712 | + global $wgUploadNavigationUrl; |
| | 713 | + $q = 'wpDestFile=' . $destFile->getPartialUrl(); |
| | 714 | + if( $query != '' ) |
| | 715 | + $q .= '&' . $query; |
| 711 | 716 | |
| | 717 | + if( $wgUploadNavigationUrl ) { |
| | 718 | + return wfAppendQuery( $wgUploadNavigationUrl, $q ); |
| | 719 | + } else { |
| | 720 | + $upload = SpecialPage::getTitleFor( 'Upload' ); |
| | 721 | + return $upload->getLocalUrl( $q ); |
| | 722 | + } |
| | 723 | + } |
| | 724 | + |
| 712 | 725 | /** |
| 713 | 726 | * Create a direct link to a given uploaded file. |
| 714 | 727 | * |
| — | — | @@ -729,7 +742,8 @@ |
| 730 | 743 | $url = $img->getURL(); |
| 731 | 744 | $class = 'internal'; |
| 732 | 745 | } else { |
| 733 | | - return $this->makeBrokenImageLinkObj( $title, $text, '', '', '', '', $time==true ); |
| | 746 | + $url = $this->getUploadUrl( $title ); |
| | 747 | + $class = 'new'; |
| 734 | 748 | } |
| 735 | 749 | $alt = htmlspecialchars( $title->getText() ); |
| 736 | 750 | if( $text == '' ) { |