Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1069,29 +1069,23 @@ |
1070 | 1070 | $this->mBodytext = ''; |
1071 | 1071 | |
1072 | 1072 | $groups = array(); |
1073 | | - foreach( $wgGroupPermissions as $key => $value ) { |
1074 | | - if( isset( $value[$permission] ) && $value[$permission] == true ) { |
1075 | | - $groupName = User::getGroupName( $key ); |
1076 | | - $groupPage = User::getGroupPage( $key ); |
1077 | | - if( $groupPage ) { |
1078 | | - $skin = $wgUser->getSkin(); |
1079 | | - $groups[] = $skin->makeLinkObj( $groupPage, $groupName ); |
1080 | | - } else { |
1081 | | - $groups[] = $groupName; |
1082 | | - } |
| 1073 | + foreach( User::getGroupsWithPermission( $permission ) as $key ) { |
| 1074 | + $groupName = User::getGroupName( $key ); |
| 1075 | + $groupPage = User::getGroupPage( $key ); |
| 1076 | + if( $groupPage ) { |
| 1077 | + $skin = $wgUser->getSkin(); |
| 1078 | + $groups[] = $skin->makeLinkObj( $groupPage, $groupName ); |
| 1079 | + } else { |
| 1080 | + $groups[] = $groupName; |
1083 | 1081 | } |
1084 | 1082 | } |
1085 | 1083 | $n = count( $groups ); |
1086 | | - $groups = implode( ', ', $groups ); |
1087 | | - switch( $n ) { |
1088 | | - case 0: |
1089 | | - case 1: |
1090 | | - case 2: |
1091 | | - $message = wfMsgHtml( "badaccess-group$n", $groups ); |
1092 | | - break; |
1093 | | - default: |
1094 | | - $message = wfMsgHtml( 'badaccess-groups', $groups ); |
| 1084 | + if ( $count > 0 ) { |
| 1085 | + $message = wfMsgHtml( 'badaccess-groups', array( $groups, $n ) ); |
1095 | 1086 | } |
| 1087 | + else { |
| 1088 | + $message = wfMsgHtml( "badaccess-group0", $groups ); |
| 1089 | + } |
1096 | 1090 | $this->addHtml( $message ); |
1097 | 1091 | $this->returnToMain(); |
1098 | 1092 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1308,29 +1308,23 @@ |
1309 | 1309 | } elseif ( !$user->isAllowed( $action ) ) { |
1310 | 1310 | $return = null; |
1311 | 1311 | $groups = array(); |
1312 | | - global $wgGroupPermissions; |
1313 | | - foreach( $wgGroupPermissions as $key => $value ) { |
1314 | | - if( isset( $value[$action] ) && $value[$action] == true ) { |
1315 | | - $groupName = User::getGroupName( $key ); |
1316 | | - $groupPage = User::getGroupPage( $key ); |
1317 | | - if( $groupPage ) { |
1318 | | - $groups[] = '[['.$groupPage->getPrefixedText().'|'.$groupName.']]'; |
1319 | | - } else { |
1320 | | - $groups[] = $groupName; |
1321 | | - } |
| 1312 | + foreach( User::getGroupsWithPermission( $action ) as $key ) { |
| 1313 | + $groupName = User::getGroupName( $key ); |
| 1314 | + $groupPage = User::getGroupPage( $key ); |
| 1315 | + if( $groupPage ) { |
| 1316 | + $groups[] = '[['.$groupPage->getPrefixedText().'|'.$groupName.']]'; |
| 1317 | + } else { |
| 1318 | + $groups[] = $groupName; |
1322 | 1319 | } |
1323 | 1320 | } |
1324 | 1321 | $n = count( $groups ); |
1325 | | - $groups = implode( ', ', $groups ); |
1326 | | - switch( $n ) { |
1327 | | - case 0: |
1328 | | - case 1: |
1329 | | - case 2: |
1330 | | - $return = array( "badaccess-group$n", $groups ); |
1331 | | - break; |
1332 | | - default: |
1333 | | - $return = array( 'badaccess-groups', $groups ); |
| 1322 | + if ( $n > 0 ) { |
| 1323 | + $groups = implode( ', ', $groups ); |
| 1324 | + $return = array( 'badaccess-groups', array( $groups, $n ) ); |
1334 | 1325 | } |
| 1326 | + else { |
| 1327 | + $return = array( "badaccess-group0", $groups ); |
| 1328 | + } |
1335 | 1329 | $errors[] = $return; |
1336 | 1330 | } |
1337 | 1331 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -719,9 +719,7 @@ |
720 | 720 | |
721 | 721 | 'badaccess' => 'Permission error', |
722 | 722 | 'badaccess-group0' => 'You are not allowed to execute the action you have requested.', |
723 | | -'badaccess-group1' => 'The action you have requested is limited to users in the group $1.', |
724 | | -'badaccess-group2' => 'The action you have requested is limited to users in one of the groups $1.', |
725 | | -'badaccess-groups' => 'The action you have requested is limited to users in one of the groups $1.', |
| 723 | +'badaccess-groups' => 'The action you have requested is limited to users in {{PLURAL:$2|the group|one of the groups}}: $1.', |
726 | 724 | |
727 | 725 | 'versionrequired' => 'Version $1 of MediaWiki required', |
728 | 726 | 'versionrequiredtext' => 'Version $1 of MediaWiki is required to use this page. |