http://www.mediawiki.org/wiki/Special:Code/MediaWiki/56381

Revision: 56381
Author:   brion
Date:     2009-09-15 18:16:47 +0000 (Tue, 15 Sep 2009)

Log Message:
-----------
Merge r56325 from trunk

Modified Paths:
--------------
    branches/wmf-deployment-work/RELEASE-NOTES
    branches/wmf-deployment-work/includes/User.php

Modified: branches/wmf-deployment-work/RELEASE-NOTES
===================================================================
--- branches/wmf-deployment-work/RELEASE-NOTES  2009-09-15 18:12:33 UTC (rev 
56380)
+++ branches/wmf-deployment-work/RELEASE-NOTES  2009-09-15 18:16:47 UTC (rev 
56381)
@@ -470,6 +470,8 @@
   empty portlets are now present but hidden, adding an element to a portlet 
unhides it
 * (bug 19531) addPortletLink() now wraps inserted labels in a <span> element 
to be
   compatible with the CSS for the Vector skin
+* User::getBlockedStatus() works for all kinds of user objects and doesn't 
+  assume the user object is equal to the current-user object ($wgUser)
 
 == API changes in 1.16 ==
 

Modified: branches/wmf-deployment-work/includes/User.php
===================================================================
--- branches/wmf-deployment-work/includes/User.php      2009-09-15 18:12:33 UTC 
(rev 56380)
+++ branches/wmf-deployment-work/includes/User.php      2009-09-15 18:16:47 UTC 
(rev 56381)
@@ -1066,7 +1066,7 @@
         *                    done against master.
         */
        function getBlockedStatus( $bFromSlave = true ) {
-               global $wgEnableSorbs, $wgProxyWhitelist;
+               global $wgEnableSorbs, $wgProxyWhitelist, $wgUser;
 
                if ( -1 != $this->mBlockedby ) {
                        wfDebug( "User::getBlockedStatus: already loaded.\n" );
@@ -1086,9 +1086,25 @@
                $this->mBlockedby = 0;
                $this->mHideName = 0;
                $this->mAllowUsertalk = 0;
-               $ip = wfGetIP();
 
-               if ($this->isAllowed( 'ipblock-exempt' ) ) {
+               # Check if we are looking at an IP or a logged-in user
+               if ( $this->isIP( $this->getName() ) ) {
+                       $ip = $this->getName(); 
+               }
+               else {
+                       # Check if we are looking at the current user
+                       # If we don't, and the user is logged in, we don't know 
about
+                       # his IP / autoblock status, so ignore autoblock of 
current user's IP
+                       if ( $this->getID() != $wgUser->getID() ) {
+                               $ip = '';
+                       }
+                       else {
+                               # Get IP of current user
+                               $ip = wfGetIP();
+                       }
+               }
+
+               if ( $this->isAllowed( 'ipblock-exempt' ) ) {
                        # Exempt from all types of IP-block
                        $ip = '';
                }



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to