From bb168db746fbcec566891f85c7cc2b1e8495ba36 Mon Sep 17 00:00:00 2001 From: Daniel Cannon Date: Thu, 16 Aug 2007 07:05:38 +0000 Subject: [PATCH] * Fix bug with Protected namespace message when protected namespace is NS_MAIN. * Clean up formatPermissionsErrorMessage .. no point building a list if there's only one item, and it casues lots of grossness on complicated custom messages (removing linebreaks, screwing up formatting, etc.). --- includes/OutputPage.php | 26 ++++++++++++++++---------- includes/Title.php | 8 ++++++-- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 30cfd7d9fc..1b47085f7b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -966,22 +966,28 @@ class OutputPage { } /** - * @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 .= ''; return $text; } @@ -1322,4 +1328,4 @@ class OutputPage { } } -} \ No newline at end of file +} diff --git a/includes/Title.php b/includes/Title.php index a996764dd5..73bf7ad74b 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1096,7 +1096,6 @@ class Title { * @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 ); @@ -1111,7 +1110,12 @@ class Title { } 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 == '_' ) { -- 2.20.1