Fix whitespace, brace style
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 2 Jan 2008 01:13:41 +0000 (01:13 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 2 Jan 2008 01:13:41 +0000 (01:13 +0000)
includes/OutputPage.php
includes/Title.php

index 0c691ab..faf533a 100644 (file)
@@ -981,14 +981,14 @@ class OutputPage {
 
        /**
         * @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 )
@@ -999,7 +999,7 @@ class OutputPage {
                        }
                        $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;
index c788707..4afa47f 100644 (file)
@@ -1188,8 +1188,7 @@ class Title {
                        }
                }
 
-               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.
                        }
@@ -1218,32 +1217,32 @@ class Title {
                        }
                } 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;
                }