Index: trunk/phase3/includes/filerepo/LocalRepo.php |
— | — | @@ -104,9 +104,6 @@ |
105 | 105 | if( !$row ) { |
106 | 106 | return false; |
107 | 107 | } |
108 | | - if( $row->rd_namespace != NS_IMAGE ) { |
109 | | - return false; |
110 | | - } |
111 | 108 | return Title::makeTitle( $row->rd_namespace, $row->rd_title ); |
112 | 109 | } |
113 | 110 | } |
Index: trunk/phase3/includes/filerepo/FileRepo.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | |
95 | 95 | # Now try redirects |
96 | 96 | $redir = $this->checkRedirect( $title ); |
97 | | - if( $redir ) { |
| 97 | + if( $redir && $redir->getNamespace() == NS_IMAGE) { |
98 | 98 | $img = $this->newFile( $redir ); |
99 | 99 | if( !$img ) { |
100 | 100 | return false; |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -38,6 +38,8 @@ |
39 | 39 | const AS_OK = 230; |
40 | 40 | const AS_END = 231; |
41 | 41 | const AS_SPAM_ERROR = 232; |
| 42 | + const AS_IMAGE_REDIRECT_ANON = 233; |
| 43 | + const AS_IMAGE_REDIRECT_LOGGED = 234; |
42 | 44 | |
43 | 45 | var $mArticle; |
44 | 46 | var $mTitle; |
— | — | @@ -699,6 +701,17 @@ |
700 | 702 | return self::AS_HOOK_ERROR; |
701 | 703 | } |
702 | 704 | |
| 705 | + # Check image redirect |
| 706 | + if ( $wgTitle->getNamespace() == NS_IMAGE && |
| 707 | + Title::newFromRedirect( $this->textbox1 ) instanceof Title && |
| 708 | + !$wgUser->isAllowed( 'upload' ) ) { |
| 709 | + if( $wgUser->isAnon() ) { |
| 710 | + return self::AS_IMAGE_REDIRECT_ANON; |
| 711 | + } else { |
| 712 | + return self::AS_IMAGE_REDIRECT_LOGGED; |
| 713 | + } |
| 714 | + } |
| 715 | + |
703 | 716 | # Reintegrate metadata |
704 | 717 | if ( $this->mMetaData != '' ) $this->textbox1 .= "\n" . $this->mMetaData ; |
705 | 718 | $this->mMetaData = '' ; |
— | — | @@ -2196,6 +2209,10 @@ |
2197 | 2210 | $this->blockedPage(); |
2198 | 2211 | return false; |
2199 | 2212 | |
| 2213 | + case self::AS_IMAGE_REDIRECT_ANON: |
| 2214 | + $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); |
| 2215 | + return false; |
| 2216 | + |
2200 | 2217 | case self::AS_READ_ONLY_PAGE_ANON: |
2201 | 2218 | $this->userNotLoggedInPage(); |
2202 | 2219 | return false; |
— | — | @@ -2216,6 +2233,10 @@ |
2217 | 2234 | case self::AS_BLANK_ARTICLE: |
2218 | 2235 | $wgOut->redirect( $wgTitle->getFullURL() ); |
2219 | 2236 | return false; |
| 2237 | + |
| 2238 | + case self::AS_IMAGE_REDIRECT_LOGGED: |
| 2239 | + $wgOut->permissionRequired( 'upload' ); |
| 2240 | + return false; |
2220 | 2241 | } |
2221 | 2242 | } |
2222 | 2243 | } |