Bug 4429: "Protect" tab in page header
authorRob Church <robchurch@users.mediawiki.org>
Wed, 18 Jan 2006 03:24:21 +0000 (03:24 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 18 Jan 2006 03:24:21 +0000 (03:24 +0000)
includes/Title.php

index c88e062..cfe4d7b 100644 (file)
@@ -827,16 +827,28 @@ class Title {
         * @return boolean
         * @access public
         */
-       function isProtected($action = '') {
+       function isProtected( $action = '' ) {
+               global $wgRestrictionLevels;
                if ( -1 == $this->mNamespace ) { return true; }
-               if($action == 'edit' || $action == '') {
-                       $a = $this->getRestrictions("edit");
-                       if ( in_array( 'sysop', $a ) ) { return true; }
+                               
+               if( $action == 'edit' || $action == '' ) {
+                       $r = $this->getRestrictions( 'edit' );
+                       foreach( $wgRestrictionLevels as $level ) {
+                               if( in_array( $level, $r ) && $level != '' ) {
+                                       return( true );
+                               }
+                       }
                }
-               if($action == 'move' || $action == '') {
-                       $a = $this->getRestrictions("move");
-                       if ( in_array( 'sysop', $a ) ) { return true; }
+               
+               if( $action == 'move' || $action == '' ) {
+                       $r = $this->getRestrictions( 'move' );
+                       foreach( $wgRestrictionLevels as $level ) {
+                               if( in_array( $level, $r ) && $level != '' ) {
+                                       return( true );
+                               }
+                       }
                }
+
                return false;
        }