From c2dd2358498ffa8eb1e14dc562d29dbabf00961f Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 18 Jan 2006 03:24:21 +0000 Subject: [PATCH] Bug 4429: "Protect" tab in page header --- includes/Title.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index c88e062c5c..cfe4d7b32a 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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; } -- 2.20.1