From f4160884193d8d39cd328d64ba58105617ec76a1 Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Tue, 8 Aug 2006 18:08:46 +0000 Subject: [PATCH] Displaying all the groups with the permission, not only the first defined one, in OutputPage::permissionRequired; patch by Simetrical ( http://bugzilla.wikimedia.org/attachment.cgi?id=2205&action=view ), with several changes. --- includes/OutputPage.php | 34 +++++++++++++++++++--------------- languages/MessagesEn.php | 8 +++++--- languages/MessagesHe.php | 8 +++++--- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6208310007..6fc12f783a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -726,25 +726,29 @@ class OutputPage { $this->setArticleRelated( false ); $this->mBodytext = ''; - $group = ''; + $groups = array(); foreach( $wgGroupPermissions as $key => $value ) { if( isset( $value[$permission] ) && $value[$permission] == true ) { - $group = $key; - break; + $groupName = User::getGroupName( $key ); + $groupPage = User::getGroupPage( $key ); + if( $groupPage ) { + $skin =& $wgUser->getSkin(); + $groups[] = '"'.$skin->makeLinkObj( $groupPage, $groupName ).'"'; + } else { + $groups[] = '"'.$groupName.'"'; + } } } - if( $group == '' ) { - $message = wfMsgHtml( 'badaccess-nogroup' ); - } else { - $groupName = User::getGroupName( $group ); - $groupPage = User::getGroupPage( $group ); - if( $groupPage ) { - $skin =& $wgUser->getSkin(); - $groupLink = $skin->makeLinkObj( $groupPage, $groupName ); - } else { - $groupLink = $groupName; - } - $message = wfMsgHtml( 'badaccess-group', $groupLink ); + $n = count( $groups ); + $groups = implode( ', ', $groups ); + switch( $n ) { + case 0: + case 1: + case 2: + $message = wfMsgHtml( "badaccess-group$n", $groups ); + break; + default: + $message = wfMsgHtml( 'badaccess-groups', $groups ); } $this->addHtml( $message ); $this->returnToMain( false ); diff --git a/languages/MessagesEn.php b/languages/MessagesEn.php index a83f701f99..a8f62a2963 100644 --- a/languages/MessagesEn.php +++ b/languages/MessagesEn.php @@ -510,9 +510,11 @@ parent class in order maintain consistency across languages. 'jumptonavigation' => 'navigation', 'jumptosearch' => 'search', -'badaccess' => 'Permission error', -'badaccess-group' => 'The action you have requested is limited to users in the group "$1".', -'badaccess-nogroup' => 'You are not allowed to execute the action you have requested.', +'badaccess' => 'Permission error', +'badaccess-group0' => 'You are not allowed to execute the action you have requested.', +'badaccess-group1' => 'The action you have requested is limited to users in the group $1.', +'badaccess-group2' => 'The action you have requested is limited to users in one of the groups $1.', +'badaccess-groups' => 'The action you have requested is limited to users in one of the groups $1.', 'versionrequired' => 'Version $1 of MediaWiki required', 'versionrequiredtext' => 'Version $1 of MediaWiki is required to use this page. See [[Special:Version]]', diff --git a/languages/MessagesHe.php b/languages/MessagesHe.php index ada799e590..fe1c6ca55a 100644 --- a/languages/MessagesHe.php +++ b/languages/MessagesHe.php @@ -354,9 +354,11 @@ $messages = array( "jumptonavigation" => "ניווט", "jumptosearch" => "חיפוש", -"badaccess" => "שגיאה בהרשאות", -"badaccess-group" => 'הפעולה שביקשתם לבצע מוגבלת למשתמשים בקבוצה "$1".', -"badaccess-nogroup" => "אינכם מורשים לבצע את הפעולה שביקשתם.", +"badaccess" => "שגיאה בהרשאות", +"badaccess-group0" => "אינכם מורשים לבצע את הפעולה שביקשתם.", +"badaccess-group1" => "הפעולה שביקשתם לבצע מוגבלת למשתמשים בקבוצה $1.", +"badaccess-group2" => "הפעולה שביקשתם לבצע מוגבלת למשתמשים באחת הקבוצות $1.", +"badaccess-groups" => "הפעולה שביקשתם לבצע מוגבלת למשתמשים באחת הקבוצות $1.", "versionrequired" => "נדרשת גרסה $1 של מדיה־ויקי", "versionrequiredtext" => 'גרסה $1 של מדיה־ויקי נדרשת לשימוש בדף זה. -- 2.20.1