r51029 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51028‎ | r51029 | r51030 >
Date:19:16, 26 May 2009
Author:robin
Status:ok
Tags:
Comment:
Per comment at r50961: keep the messages saying "you need to be logged in to ...", but only show it when normal logged-in users can upload
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1130,6 +1130,8 @@
11311131 'uploadbtn',
11321132 'reupload',
11331133 'reuploaddesc',
 1134+ 'uploadnologin',
 1135+ 'uploadnologintext',
11341136 'upload_directory_missing',
11351137 'upload_directory_read_only',
11361138 'uploaderror',
@@ -1922,6 +1924,8 @@
19231925 'movepagetext',
19241926 'movepagetalktext',
19251927 'movearticle',
 1928+ 'movenologin',
 1929+ 'movenologintext',
19261930 'movenotallowed',
19271931 'movenotallowedfile',
19281932 'cant-move-user-page',
Index: trunk/phase3/includes/Title.php
@@ -1171,7 +1171,14 @@
11721172
11731173 if( !$user->isAllowed( 'move' ) ) {
11741174 // User can't move anything
1175 - $errors[] = array ('movenotallowed');
 1175+ global $wgGroupPermissions;
 1176+ if( $user->isAnon() && ( $wgGroupPermissions['user']['move']
 1177+ || $wgGroupPermissions['autoconfirmed']['move'] ) ) {
 1178+ // custom message if logged-in users without any special rights can move
 1179+ $errors[] = array ( 'movenologintext' );
 1180+ } else {
 1181+ $errors[] = array ('movenotallowed');
 1182+ }
11761183 }
11771184 } elseif ( $action == 'create' ) {
11781185 if( ( $this->isTalkPage() && !$user->isAllowed( 'createtalk' ) ) ||
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -244,8 +244,15 @@
245245 }
246246
247247 # Check permissions
 248+ global $wgGroupPermissions;
248249 if( !$wgUser->isAllowed( 'upload' ) ) {
249 - $wgOut->permissionRequired( 'upload' );
 250+ if( !$wgUser->isLoggedIn() && ( $wgGroupPermissions['user']['upload']
 251+ || $wgGroupPermissions['autoconfirmed']['upload'] ) ) {
 252+ // Custom message if logged-in users without any special rights can upload
 253+ $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' );
 254+ } else {
 255+ $wgOut->permissionRequired( 'upload' );
 256+ }
250257 return;
251258 }
252259
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1820,6 +1820,8 @@
18211821 'uploadbtn' => 'Upload file',
18221822 'reupload' => 'Re-upload',
18231823 'reuploaddesc' => 'Cancel upload and return to the upload form',
 1824+'uploadnologin' => 'Not logged in',
 1825+'uploadnologintext' => 'You must be [[Special:UserLogin|logged in]] to upload files.',
18241826 'upload_directory_missing' => 'The upload directory ($1) is missing and could not be created by the webserver.',
18251827 'upload_directory_read_only' => 'The upload directory ($1) is not writable by the webserver.',
18261828 'uploaderror' => 'Upload error',
@@ -2773,6 +2775,8 @@
27742776
27752777 In those cases, you will have to move or merge the page manually if desired.",
27762778 'movearticle' => 'Move page:',
 2779+'movenologin' => 'Not logged in',
 2780+'movenologintext' => 'You must be a registered user and [[Special:UserLogin|logged in]] to move a page.',
27772781 'movenotallowed' => 'You do not have permission to move pages.',
27782782 'movenotallowedfile' => 'You do not have permission to move files.',
27792783 'cant-move-user-page' => 'You do not have permission to move user pages (apart from subpages).',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50961Fixing part of bug 14688 (upload restrictions):...robin20:45, 24 May 2009

Status & tagging log