From 17241937d4db71327703289c46144bf10cd6e67b Mon Sep 17 00:00:00 2001 From: Daniel Jagszent Date: Thu, 19 Sep 2024 17:03:00 +0200 Subject: [PATCH] fix getUserPermissionsErrors hook --- README.md | 2 ++ SourceProtection.class.php | 11 ++++++----- extension.json | 2 +- i18n/en.json | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 78e61a0..d1d83de 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ It will also block the viewing of the readonly form. 1.1.3 MediaWiki 1.39x compatible +1.1.4 Fix Permission error page (getUserPermissionsErrors hook) + ### Compatibility * PHP 8+ diff --git a/SourceProtection.class.php b/SourceProtection.class.php index c0943c2..760d7a8 100644 --- a/SourceProtection.class.php +++ b/SourceProtection.class.php @@ -85,13 +85,14 @@ public static function disableActions( Title $title, User $user, $action, &$resu ); // Also disable the version difference options if ( isset( $_GET['diff'] ) ) { - return [ "no access" ]; + $result = wfMessage( 'sourceprotection-no-access'); + return false; } if ( isset( $_GET['action'] ) ) { - $actie = $_GET['action']; - if ( in_array( $actie, - $actionNotAllowed ) ) { - return [ "no access" ]; + $getAction = $_GET['action']; + if ( in_array( $getAction, $actionNotAllowed ) ) { + $result = wfMessage( 'sourceprotection-no-access'); + return false; } } diff --git a/extension.json b/extension.json index 0b3fc09..fa4c190 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "SourceProtection", - "version": "1.1.3", + "version": "1.1.4", "author": [ "[https://www.wikibase-solutions.com/author/charlot Sen-Sai]" ], diff --git a/i18n/en.json b/i18n/en.json index 163d1f2..f1810d5 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -4,5 +4,6 @@ "Sen-Sai" ] }, - "sourceprotection-desc": "Removes View Source tab and (if Pageforms is installed the edit-Form tab) & History tab from menu and disable as many action functions for users with no edit permissions. It will also block the viewing of the readonly form." + "sourceprotection-desc": "Removes View Source tab and (if Pageforms is installed the edit-Form tab) & History tab from menu and disable as many action functions for users with no edit permissions. It will also block the viewing of the readonly form.", + "sourceprotection-no-access": "You are not allowed to do this action. [{{fullurl:Special:ListUsers|group=sysop}} Contact an administrator] when you think this is an error." }