From cb4cef1d1032a7d4c9f9e244798e4ce19aa44f67 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 28 Apr 2008 17:08:29 +0000 Subject: [PATCH] * Honor upload restrictions in SpecialUpload.php and FileRevertForm.php * Add 'restriction-upload' => 'Upload' to MessageEn.php --- includes/FileRevertForm.php | 2 +- includes/SpecialUpload.php | 4 +++- languages/messages/MessagesEn.php | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/FileRevertForm.php b/includes/FileRevertForm.php index e4401d0574..6b845aba9d 100644 --- a/includes/FileRevertForm.php +++ b/includes/FileRevertForm.php @@ -38,7 +38,7 @@ class FileRevertForm { } elseif( !$wgUser->isLoggedIn() ) { $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); return; - } elseif( !$this->title->userCan( 'edit' ) ) { + } elseif( !$this->title->userCan( 'edit' ) || !$this->title->userCan( 'upload' ) ) { // The standard read-only thing doesn't make a whole lot of sense // here; surely it should show the image or something? -- RC $article = new Article( $this->title ); diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index f0a36d6155..25ee62ebd7 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -436,7 +436,9 @@ class UploadForm { * If the image is protected, non-sysop users won't be able * to modify it by uploading a new revision. */ - if( !$nt->userCan( 'edit' ) || !$nt->userCan( 'create' ) ) { + if( !$nt->userCan( 'edit' ) || + !$nt->userCan( 'create' ) || + !$nt->userCan( 'upload' ) ){ return self::PROTECTED_PAGE; } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index eeab3bacb7..66a8aababa 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2156,6 +2156,7 @@ You can change this page's protection level, but it will not affect the cascadin 'restriction-edit' => 'Edit', 'restriction-move' => 'Move', 'restriction-create' => 'Create', +'restriction-upload' => 'Upload', # Restriction levels 'restriction-level-sysop' => 'full protected', -- 2.20.1