r24849 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24848‎ | r24849 | r24850 >
Date:07:05, 16 August 2007
Author:amidaniel
Status:old
Tags:
Comment:
* 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.).
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -966,22 +966,28 @@
967967 }
968968
969969 /**
970 - * @param array $errors An array returned by Title::getUserPermissionsErrors
 970+ * @param array $errors An array of arrays returned by Title::getUserPermissionsErrors
971971 * @return string The error-messages, formatted into a list.
972972 */
973973 public function formatPermissionsErrorMessage( $errors ) {
974974 $text = '';
975975
976 - $text .= wfMsgExt( 'permissionserrorstext', array( 'parse' ), count( $errors ) ) . "\n";
977 - $text .= '<ul class="permissions-errors">' . "\n";
 976+ if (sizeof( $errors ) > 1) {
978977
979 - foreach( $errors as $error )
980 - {
981 - $text .= '<li>';
982 - $text .= call_user_func_array( 'wfMsg', $error );
983 - $text .= "</li>\n";
 978+ $text .= wfMsgExt( 'permissionserrorstext', array( 'parse' ), count( $errors ) ) . "\n";
 979+ $text .= '<ul class="permissions-errors">' . "\n";
 980+
 981+ foreach( $errors as $error )
 982+ {
 983+ $text .= '<li>';
 984+ foreach ($error as $e) echo $e;
 985+ $text .= call_user_func_array( 'wfMsg', $error );
 986+ $text .= "</li>\n";
 987+ }
 988+ $text .= '</ul>';
 989+ } else {
 990+ $text .= call_user_func_array( 'wfMsg', $errors[0]);
984991 }
985 - $text .= '</ul>';
986992
987993 return $text;
988994 }
@@ -1322,4 +1328,4 @@
13231329 }
13241330 }
13251331
1326 -}
\ No newline at end of file
 1332+}
Index: trunk/phase3/includes/Title.php
@@ -1096,7 +1096,6 @@
10971097 * @return array Array of arrays of the arguments to wfMsg to explain permissions problems.
10981098 */
10991099 private function getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries = true ) {
1100 - global $wgContLang;
11011100 $fname = 'Title::userCan';
11021101 wfProfileIn( $fname );
11031102
@@ -1111,7 +1110,12 @@
11121111 }
11131112
11141113 if ( $this->isNamespaceProtected() ) {
1115 - $errors[] = (NS_MEDIAWIKI == $this->mNamespace ? array('protectedinterface') : array( 'namespaceprotected', $wgContLang->getNSText( $this->mNamespace ) ) );
 1114+ $ns = $this->getNamespace() == NS_MAIN
 1115+ ? wfMsg( 'nstab-main' )
 1116+ : $this->getNsText();
 1117+ $errors[] = (NS_MEDIAWIKI == $this->mNamespace
 1118+ ? array('protectedinterface')
 1119+ : array( 'namespaceprotected', $ns ) );
11161120 }
11171121
11181122 if( $this->mDbkeyform == '_' ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r24866Merged revisions 24755-24865 via svnmerge from...david23:08, 16 August 2007

Status & tagging log