MediaWiki r10003 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r10002‎ | r10003 (on ViewVC)‎ | r10004 >
Date:21:40, 7 July 2005
Author:timstarling
Status:old
Tags:
Comment:
new feature: $wgBlockAllowsUTEdit
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php	(revision 10002)
+++ trunk/phase3/includes/User.php	(revision 10003)
@@ -512,6 +512,20 @@
 		$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
Index: trunk/phase3/includes/EditPage.php
===================================================================
--- trunk/phase3/includes/EditPage.php	(revision 10002)
+++ trunk/phase3/includes/EditPage.php	(revision 10003)
@@ -149,7 +149,7 @@
 			$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 @@
 				# 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: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 10002)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 10003)
@@ -673,6 +673,7 @@
 $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.

Status & tagging log

  • 01:58, 13 October 2010 ^demon (Talk | contribs) changed the status of r10003 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox