Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2000,8 +2000,8 @@ |
2001 | 2001 | 'sharedupload-desc-here' => 'This file is from $1 and may be used by other projects. |
2002 | 2002 | The description on its [$2 file description page] there is shown below.', |
2003 | 2003 | 'shareddescriptionfollows' => '-', # do not translate or duplicate this message to other languages |
2004 | | -'noimage' => 'No file by this name exists, but you can $1.', |
2005 | | -'noimage-linktext' => 'upload one', |
| 2004 | +'filepage-nofile' => 'No file by this name exists.', |
| 2005 | +'filepage-nofile-link' => 'Click here to upload it.', |
2006 | 2006 | 'uploadnewversion-linktext' => 'Upload a new version of this file', |
2007 | 2007 | 'shared-repo-from' => 'from $1', |
2008 | 2008 | 'shared-repo' => 'a shared repository', |
— | — | @@ -2776,8 +2776,6 @@ |
2777 | 2777 | |
2778 | 2778 | In those cases, you will have to move or merge the page manually if desired.", |
2779 | 2779 | 'movearticle' => 'Move page:', |
2780 | | -'movenologin' => 'Not logged in', |
2781 | | -'movenologintext' => 'You must be a registered user and [[Special:UserLogin|logged in]] to move a page.', |
2782 | 2780 | 'movenotallowed' => 'You do not have permission to move pages.', |
2783 | 2781 | 'movenotallowedfile' => 'You do not have permission to move files.', |
2784 | 2782 | 'cant-move-user-page' => 'You do not have permission to move user pages (apart from subpages).', |
— | — | @@ -3843,7 +3841,7 @@ |
3844 | 3842 | 'version-hook-name' => 'Hook name', |
3845 | 3843 | 'version-hook-subscribedby' => 'Subscribed by', |
3846 | 3844 | 'version-version' => '(Version $1)', |
3847 | | -'version-svn-revision' => '(r$2)', # only translate this message to other languages if you have to change it |
| 3845 | +'version-svn-revision' => 'r$2', # only translate this message to other languages if you have to change it |
3848 | 3846 | 'version-license' => 'License', |
3849 | 3847 | 'version-software' => 'Installed software', |
3850 | 3848 | 'version-software-product' => 'Product', |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1171,7 +1171,7 @@ |
1172 | 1172 | |
1173 | 1173 | if( !$user->isAllowed( 'move' ) ) { |
1174 | 1174 | // User can't move anything |
1175 | | - $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed'); |
| 1175 | + $errors[] = array ('movenotallowed'); |
1176 | 1176 | } |
1177 | 1177 | } elseif ( $action == 'create' ) { |
1178 | 1178 | if( ( $this->isTalkPage() && !$user->isAllowed( 'createtalk' ) ) || |
— | — | @@ -1182,7 +1182,7 @@ |
1183 | 1183 | } elseif( $action == 'move-target' ) { |
1184 | 1184 | if( !$user->isAllowed( 'move' ) ) { |
1185 | 1185 | // User can't move anything |
1186 | | - $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed'); |
| 1186 | + $errors[] = array ('movenotallowed'); |
1187 | 1187 | } elseif( !$user->isAllowed( 'move-rootuserpages' ) |
1188 | 1188 | && $this->getNamespace() == NS_USER && !$this->isSubpage() ) |
1189 | 1189 | { |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -858,17 +858,12 @@ |
859 | 859 | |
860 | 860 | $nav_urls = array(); |
861 | 861 | $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() ); |
862 | | - if( $wgEnableUploads && $wgUser->isAllowed( 'upload' ) ) { |
863 | | - if( $wgUploadNavigationUrl ) { |
864 | | - $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl ); |
865 | | - } else { |
866 | | - $nav_urls['upload'] = array( 'href' => self::makeSpecialUrl( 'Upload' ) ); |
867 | | - } |
| 862 | + if( $wgUploadNavigationUrl ) { |
| 863 | + $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl ); |
| 864 | + } elseif( $wgEnableUploads && $wgUser->isAllowed( 'upload' ) ) { |
| 865 | + $nav_urls['upload'] = array( 'href' => self::makeSpecialUrl( 'Upload' ) ); |
868 | 866 | } else { |
869 | | - if( $wgUploadNavigationUrl ) |
870 | | - $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl ); |
871 | | - else |
872 | | - $nav_urls['upload'] = false; |
| 867 | + $nav_urls['upload'] = false; |
873 | 868 | } |
874 | 869 | $nav_urls['specialpages'] = array( 'href' => self::makeSpecialUrl( 'Specialpages' ) ); |
875 | 870 | |
Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -245,11 +245,7 @@ |
246 | 246 | |
247 | 247 | # Check permissions |
248 | 248 | if( !$wgUser->isAllowed( 'upload' ) ) { |
249 | | - if( !$wgUser->isLoggedIn() ) { |
250 | | - $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); |
251 | | - } else { |
252 | | - $wgOut->permissionRequired( 'upload' ); |
253 | | - } |
| 249 | + $wgOut->permissionRequired( 'upload' ); |
254 | 250 | return; |
255 | 251 | } |
256 | 252 | |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -275,7 +275,8 @@ |
276 | 276 | } |
277 | 277 | |
278 | 278 | protected function openShowImage() { |
279 | | - global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgLang, $wgContLang; |
| 279 | + global $wgOut, $wgUser, $wgImageLimits, $wgRequest, |
| 280 | + $wgLang, $wgContLang, $wgEnableUploads; |
280 | 281 | |
281 | 282 | $this->loadFile(); |
282 | 283 | |
— | — | @@ -468,12 +469,17 @@ |
469 | 470 | } |
470 | 471 | } else { |
471 | 472 | # Image does not exist |
472 | | - |
473 | | - $title = SpecialPage::getTitleFor( 'Upload' ); |
474 | | - $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'), |
475 | | - 'wpDestFile=' . urlencode( $this->displayImg->getName() ) ); |
| 473 | + $nofile = wfMsgHtml( 'filepage-nofile' ); |
| 474 | + if ( $wgEnableUploads && $wgUser->isAllowed( 'upload' ) ) { |
| 475 | + // Only show an upload link if the user can upload |
| 476 | + $nofile .= ' '.$sk->makeKnownLinkObj( |
| 477 | + SpecialPage::getTitleFor( 'Upload' ), |
| 478 | + wfMsgHtml('filepage-nofile-link'), |
| 479 | + 'wpDestFile=' . urlencode( $this->displayImg->getName() ) |
| 480 | + ); |
| 481 | + } |
476 | 482 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
477 | | - $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) ); |
| 483 | + $wgOut->addHTML( '<div id="mw-imagepage-nofile">' . $nofile . '</div>' ); |
478 | 484 | } |
479 | 485 | } |
480 | 486 | |
— | — | @@ -516,8 +522,10 @@ |
517 | 523 | * external editing (and instructions link) etc. |
518 | 524 | */ |
519 | 525 | protected function uploadLinksBox() { |
520 | | - global $wgUser, $wgOut; |
| 526 | + global $wgUser, $wgOut, $wgEnableUploads; |
521 | 527 | |
| 528 | + if( !$wgEnableUploads ) { return; } |
| 529 | + |
522 | 530 | $this->loadFile(); |
523 | 531 | if( !$this->img->isLocal() ) |
524 | 532 | return; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -155,6 +155,10 @@ |
156 | 156 | .inc |
157 | 157 | * Deprecated methods Title::getInterwikiLink, Title::userCanCreate(), |
158 | 158 | Title::userCanEdit() and Title::userCanMove() have been removed |
| 159 | +* Only show upload links on file description if $wgEnableUploads = true |
| 160 | + and user can upload |
| 161 | +* Don't say "You need to log in to upload/move", because it's possible that |
| 162 | + uploading/moving is disabled for registered users as well (e.g. only sysops) |
159 | 163 | |
160 | 164 | == API changes in 1.16 == |
161 | 165 | |
Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1255,8 +1255,8 @@ |
1256 | 1256 | 'sharedupload-desc-there', |
1257 | 1257 | 'sharedupload-desc-here', |
1258 | 1258 | 'shareddescriptionfollows', |
1259 | | - 'noimage', |
1260 | | - 'noimage-linktext', |
| 1259 | + 'filepage-nofile', |
| 1260 | + 'filepage-nofile-link', |
1261 | 1261 | 'uploadnewversion-linktext', |
1262 | 1262 | 'shared-repo-from', |
1263 | 1263 | 'shared-repo', |
— | — | @@ -1925,8 +1925,6 @@ |
1926 | 1926 | 'movepagetext', |
1927 | 1927 | 'movepagetalktext', |
1928 | 1928 | 'movearticle', |
1929 | | - 'movenologin', |
1930 | | - 'movenologintext', |
1931 | 1929 | 'movenotallowed', |
1932 | 1930 | 'movenotallowedfile', |
1933 | 1931 | 'cant-move-user-page', |