r12601 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12600‎ | r12601 | r12602 >
Date:03:55, 11 January 2006
Author:robchurch
Status:old
Tags:
Comment:
* Improve the "uploads disabled" warning
* OutputPage::sysopRequired() ==> OutputPage::permissionRequired() when blocking and uploading files
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialBlockip.php
@@ -12,10 +12,11 @@
1313 function wfSpecialBlockip( $par ) {
1414 global $wgUser, $wgOut, $wgRequest;
1515
16 - if ( ! $wgUser->isAllowed('block') ) {
17 - $wgOut->sysopRequired();
 16+ if( !$wgUser->isAllowed( 'block' ) ) {
 17+ $wgOut->permissionRequired( 'block' );
1818 return;
1919 }
 20+
2021 $ipb = new IPBlockForm( $par );
2122
2223 $action = $wgRequest->getVal( 'action' );
Index: trunk/phase3/includes/SpecialUpload.php
@@ -99,17 +99,29 @@
100100 global $wgUser, $wgOut;
101101 global $wgEnableUploads, $wgUploadDirectory;
102102
103 - /** Show an error message if file upload is disabled */
104 - if( ! $wgEnableUploads ) {
105 - $wgOut->addWikiText( wfMsg( 'uploaddisabled' ) );
 103+ # Check uploading enabled
 104+ if( !$wgEnableUploads ) {
 105+ $wgOut->errorPage( 'uploaddisabled', 'uploaddisabledtext' );
106106 return;
107107 }
108108
109 - /** Various rights checks */
110 - if( !$wgUser->isAllowed( 'upload' ) || $wgUser->isBlocked() ) {
111 - $wgOut->errorpage( 'uploadnologin', 'uploadnologintext' );
 109+ # Check permissions
 110+ if( $wgUser->isLoggedIn() ) {
 111+ if( !$wgUser->isAllowed( 'upload' ) ) {
 112+ $wgOut->permissionRequired( 'upload' );
 113+ return;
 114+ }
 115+ } else {
 116+ $wgOut->errorPage( 'uploadnologin', 'uploadnologintext' );
112117 return;
 118+ }
 119+
 120+ # Check blocks
 121+ if( $wgUser->isBlocked() ) {
 122+ $wgOut->blockedPage();
 123+ return;
113124 }
 125+
114126 if( wfReadOnly() ) {
115127 $wgOut->readOnlyPage();
116128 return;
Index: trunk/phase3/RELEASE-NOTES
@@ -202,6 +202,7 @@
203203 a such distinction
204204 * (bug 4548) Update for Portuguese language (pt): time format
205205 * (bug 4530) Use consistent name for Kurdish
 206+* Tweak default "upload disabled" text
206207
207208 Parser:
208209 * (bug 2522) {{CURRENTDAY2}} now shows the current day number with two digits
@@ -458,6 +459,7 @@
459460 size. This is necessary to limit server memory usage.
460461 * Cleanup and error checking on Special:Listredirects
461462 * Clear up some instances of old OutputPage::sysopRequired() function usage
 463+* Improve "upload disabled" notice
462464
463465 === Caveats ===
464466
Index: trunk/phase3/languages/Language.php
@@ -1056,7 +1056,8 @@
10571057 'uploadwarning' => 'Upload warning',
10581058 'savefile' => 'Save file',
10591059 'uploadedimage' => "uploaded \"[[$1]]\"",
1060 -'uploaddisabled' => 'Sorry, uploading is disabled.',
 1060+'uploaddisabled' => 'Uploads disabled',
 1061+'uploaddisabledtext' => 'File uploads are disabled on this wiki.',
10611062 'uploadscripted' => 'This file contains HTML or script code that my be erroneously be interpreted by a web browser.',
10621063 'uploadcorrupt' => 'The file is corrupt or has an incorrect extension. Please check the file and upload again.',
10631064 'uploadvirus' => 'The file contains a virus! Details: $1',

Status & tagging log