}
/**
- * @param array $errors An array returned by Title::getUserPermissionsErrors
+ * @param array $errors An array of arrays returned by Title::getUserPermissionsErrors
* @return string The error-messages, formatted into a list.
*/
public function formatPermissionsErrorMessage( $errors ) {
$text = '';
- $text .= wfMsgExt( 'permissionserrorstext', array( 'parse' ), count( $errors ) ) . "\n";
- $text .= '<ul class="permissions-errors">' . "\n";
+ if (sizeof( $errors ) > 1) {
- foreach( $errors as $error )
- {
- $text .= '<li>';
- $text .= call_user_func_array( 'wfMsg', $error );
- $text .= "</li>\n";
+ $text .= wfMsgExt( 'permissionserrorstext', array( 'parse' ), count( $errors ) ) . "\n";
+ $text .= '<ul class="permissions-errors">' . "\n";
+
+ foreach( $errors as $error )
+ {
+ $text .= '<li>';
+ foreach ($error as $e) echo $e;
+ $text .= call_user_func_array( 'wfMsg', $error );
+ $text .= "</li>\n";
+ }
+ $text .= '</ul>';
+ } else {
+ $text .= call_user_func_array( 'wfMsg', $errors[0]);
}
- $text .= '</ul>';
return $text;
}
}
}
-}
\ No newline at end of file
+}
* @return array Array of arrays of the arguments to wfMsg to explain permissions problems.
*/
private function getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries = true ) {
- global $wgContLang;
$fname = 'Title::userCan';
wfProfileIn( $fname );
}
if ( $this->isNamespaceProtected() ) {
- $errors[] = (NS_MEDIAWIKI == $this->mNamespace ? array('protectedinterface') : array( 'namespaceprotected', $wgContLang->getNSText( $this->mNamespace ) ) );
+ $ns = $this->getNamespace() == NS_MAIN
+ ? wfMsg( 'nstab-main' )
+ : $this->getNsText();
+ $errors[] = (NS_MEDIAWIKI == $this->mNamespace
+ ? array('protectedinterface')
+ : array( 'namespaceprotected', $ns ) );
}
if( $this->mDbkeyform == '_' ) {