From 88832abbaa18358fec2b3e32b4de5905df043005 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 11 Jan 2006 03:55:37 +0000 Subject: [PATCH] * Improve the "uploads disabled" warning * OutputPage::sysopRequired() ==> OutputPage::permissionRequired() when blocking and uploading files --- RELEASE-NOTES | 2 ++ includes/SpecialBlockip.php | 5 +++-- includes/SpecialUpload.php | 24 ++++++++++++++++++------ languages/Language.php | 3 ++- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7e7dd8855a..d0b5524d74 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -202,6 +202,7 @@ i18n / Languages: a such distinction * (bug 4548) Update for Portuguese language (pt): time format * (bug 4530) Use consistent name for Kurdish +* Tweak default "upload disabled" text Parser: * (bug 2522) {{CURRENTDAY2}} now shows the current day number with two digits @@ -458,6 +459,7 @@ fully support the editing toolbar, but was found to be too confusing. size. This is necessary to limit server memory usage. * Cleanup and error checking on Special:Listredirects * Clear up some instances of old OutputPage::sysopRequired() function usage +* Improve "upload disabled" notice === Caveats === diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index c621ebecd3..8a1a841b74 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -12,10 +12,11 @@ function wfSpecialBlockip( $par ) { global $wgUser, $wgOut, $wgRequest; - if ( ! $wgUser->isAllowed('block') ) { - $wgOut->sysopRequired(); + if( !$wgUser->isAllowed( 'block' ) ) { + $wgOut->permissionRequired( 'block' ); return; } + $ipb = new IPBlockForm( $par ); $action = $wgRequest->getVal( 'action' ); diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 9a72a9eab8..1ea1969ede 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -99,17 +99,29 @@ class UploadForm { global $wgUser, $wgOut; global $wgEnableUploads, $wgUploadDirectory; - /** Show an error message if file upload is disabled */ - if( ! $wgEnableUploads ) { - $wgOut->addWikiText( wfMsg( 'uploaddisabled' ) ); + # Check uploading enabled + if( !$wgEnableUploads ) { + $wgOut->errorPage( 'uploaddisabled', 'uploaddisabledtext' ); return; } - /** Various rights checks */ - if( !$wgUser->isAllowed( 'upload' ) || $wgUser->isBlocked() ) { - $wgOut->errorpage( 'uploadnologin', 'uploadnologintext' ); + # Check permissions + if( $wgUser->isLoggedIn() ) { + if( !$wgUser->isAllowed( 'upload' ) ) { + $wgOut->permissionRequired( 'upload' ); + return; + } + } else { + $wgOut->errorPage( 'uploadnologin', 'uploadnologintext' ); + return; + } + + # Check blocks + if( $wgUser->isBlocked() ) { + $wgOut->blockedPage(); return; } + if( wfReadOnly() ) { $wgOut->readOnlyPage(); return; diff --git a/languages/Language.php b/languages/Language.php index 04f6d33fd1..8667917ca1 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1056,7 +1056,8 @@ created and by whom, and anything else you may know about it. If this is an imag 'uploadwarning' => 'Upload warning', 'savefile' => 'Save file', 'uploadedimage' => "uploaded \"[[$1]]\"", -'uploaddisabled' => 'Sorry, uploading is disabled.', +'uploaddisabled' => 'Uploads disabled', +'uploaddisabledtext' => 'File uploads are disabled on this wiki.', 'uploadscripted' => 'This file contains HTML or script code that my be erroneously be interpreted by a web browser.', 'uploadcorrupt' => 'The file is corrupt or has an incorrect extension. Please check the file and upload again.', 'uploadvirus' => 'The file contains a virus! Details: $1', -- 2.20.1