Note that restrictions are rights, not groups. So now, cascading protection will...
[lhc/web/wiklou.git] / includes / Title.php
index dad2bc4..616cc3d 100644 (file)
@@ -1219,15 +1219,10 @@ class Title {
                                $right = 'protect';
                        }
                        if( '' != $right && !$user->isAllowed( $right ) ) {
-                               //Users with 'editprotected' permission can edit protected pages
-                               if( $action=='edit' && $user->isAllowed( 'editprotected' ) ) {
-                                       //Users with 'editprotected' permission cannot edit protected pages
-                                       //with cascading option turned on.
-                                       if($this->mCascadeRestriction) {
-                                               $errors[] = array( 'protectedpagetext', $right );
-                                       } else {
-                                               //Nothing, user can edit!
-                                       }
+                               // Users with 'editprotected' permission can edit protected
+                               // pages if protection is not with cascading option turned on.
+                               if( $action=='edit' && $user->isAllowed( 'editprotected' ) && !$this->areRestrictionsCascading() ) {
+                                       // Nothing, user can edit!
                                } else {
                                        $errors[] = array( 'protectedpagetext', $right );
                                }
@@ -1626,7 +1621,7 @@ class Title {
 
                wfProfileIn( __METHOD__ );
 
-               $dbr = wfGetDb( DB_SLAVE );
+               $dbr = wfGetDB( DB_SLAVE );
 
                if ( $this->getNamespace() == NS_IMAGE ) {
                        $tables = array ('imagelinks', 'page_restrictions');
@@ -1927,7 +1922,7 @@ class Title {
                if ($this->mLatestID !== false)
                        return $this->mLatestID;
 
-               $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB(DB_MASTER) : wfGetDB(DB_SLAVE);
+               $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
                return $this->mLatestID = $db->selectField( 'revision',
                        "max(rev_id)",
                        array('rev_page' => $this->getArticleID($flags)),