/**
* @param array $errors An array of arrays returned by Title::getUserPermissionsErrors
- * @return string The error-messages, formatted into a list.
+ * @return string The wikitext error-messages, formatted into a list.
*/
public function formatPermissionsErrorMessage( $errors ) {
- $text = '';
-
- if (sizeof( $errors ) > 1) {
+ global $wgParser;
+
+ $text = wfMsgExt( 'permissionserrorstext', array( 'parsemag' ), count( $errors ) ) . "\n\n";
- $text .= wfMsgExt( 'permissionserrorstext', array( 'parse' ), count( $errors ) ) . "\n";
+ if (count( $errors ) > 1) {
$text .= '<ul class="permissions-errors">' . "\n";
foreach( $errors as $error )
}
$text .= '</ul>';
} else {
- $text .= call_user_func_array( 'wfMsg', $errors[0]);
+ $text .= '<span class="permissions-errors">' . call_user_func_array( 'wfMsg', $errors[0]) . '</span>';
}
return $text;
}
}
- if ($action == 'protect')
- {
+ if ($action == 'protect') {
if ($this->getUserPermissionsErrors('edit', $user) != array()) {
$errors[] = array( 'protect-cantedit' ); // If they can't edit, they shouldn't protect.
}
}
} elseif( $action == 'move' && !( $this->isMovable() && $user->isAllowed( 'move' ) ) ) {
$errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
- } else if ( !$user->isAllowed( $action ) ) {
+ } else if ( !$user->isAllowed( $action ) ) {
$return = null;
$groups = array();
global $wgGroupPermissions;
- foreach( $wgGroupPermissions as $key => $value ) {
- if( isset( $value[$action] ) && $value[$action] == true ) {
- $groupName = User::getGroupName( $key );
- $groupPage = User::getGroupPage( $key );
- if( $groupPage ) {
- $groups[] = '[['.$groupPage->getPrefixedText().'|'.$groupName.']]';
- } else {
- $groups[] = $groupName;
- }
- }
- }
- $n = count( $groups );
- $groups = implode( ', ', $groups );
- switch( $n ) {
- case 0:
- case 1:
- case 2:
- $return = array( "badaccess-group$n", $groups );
- break;
- default:
- $return = array( 'badaccess-groups', $groups );
- }
+ foreach( $wgGroupPermissions as $key => $value ) {
+ if( isset( $value[$action] ) && $value[$action] == true ) {
+ $groupName = User::getGroupName( $key );
+ $groupPage = User::getGroupPage( $key );
+ if( $groupPage ) {
+ $groups[] = '[['.$groupPage->getPrefixedText().'|'.$groupName.']]';
+ } else {
+ $groups[] = $groupName;
+ }
+ }
+ }
+ $n = count( $groups );
+ $groups = implode( ', ', $groups );
+ switch( $n ) {
+ case 0:
+ case 1:
+ case 2:
+ $return = array( "badaccess-group$n", $groups );
+ break;
+ default:
+ $return = array( 'badaccess-groups', $groups );
+ }
$errors[] = $return;
}