new feature: $wgBlockAllowsUTEdit
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 7 Jul 2005 21:40:25 +0000 (21:40 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 7 Jul 2005 21:40:25 +0000 (21:40 +0000)
includes/DefaultSettings.php
includes/EditPage.php
includes/User.php

index c598379..0beccfb 100644 (file)
@@ -673,6 +673,7 @@ $wgSysopUserBans        = true; # Allow sysops to ban logged-in users
 $wgSysopRangeBans              = true; # Allow sysops to ban IP ranges
 
 $wgAutoblockExpiry             = 86400; # Number of seconds before autoblock entries expire
+$wgBlockAllowsUTEdit    = false; # Blocks allow users to edit their own user talk page
 
 /**
  * Permission keys given to users in each group.
index 3bc5ade..562682a 100644 (file)
@@ -149,7 +149,7 @@ class EditPage {
                        $wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
                        return;
                }
-               if ( !$this->preview && !$this->diff && $wgUser->isBlocked( !$this->save ) ) {
+               if ( !$this->preview && !$this->diff && $wgUser->isBlockedFrom( $this->mTitle, !$this->save ) ) {
                        # When previewing, don't check blocked state - will get caught at save time.
                        # Also, check when starting edition is done against slave to improve performance.
                        $this->blockedIPpage();
@@ -348,7 +348,7 @@ class EditPage {
                                # Error messages or other handling should be performed by the filter function
                                return;
                        }
-                       if ( $wgUser->isBlocked( false ) ) {
+                       if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
                                # Check block state against master, thus 'false'.
                                $this->blockedIPpage();
                                return;
index 2d676c6..58118b5 100644 (file)
@@ -512,6 +512,20 @@ class User {
                $this->getBlockedStatus( $bFromSlave );
                return $this->mBlockedby !== 0;
        }
+
+       /**
+        * Check if user is blocked from editing a particular article
+        */
+       function isBlockedFrom( $title, $bFromSlave = false ) {
+               global $wgBlockAllowsUTEdit;
+               if ( $wgBlockAllowsUTEdit && $title->getText() === $this->getName() && 
+                 $title->getNamespace() == NS_USER_TALK )
+               {
+                       return false;
+               } else {
+                       return $this->isBlocked( $bFromSlave );
+               }
+       }
        
        /**
         * Get name of blocker