API: Don't display range info for autoblocks (effectively disclosing the IP address...
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 15 Feb 2010 12:13:01 +0000 (12:13 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 15 Feb 2010 12:13:01 +0000 (12:13 +0000)
includes/api/ApiQueryBlocks.php

index c41db20..e720e82 100644 (file)
@@ -94,6 +94,7 @@ class ApiQueryBlocks extends ApiQueryBase {
                        foreach ( (array)$params['users'] as $u )
                                $this->prepareUsername( $u );
                        $this->addWhereFld( 'ipb_address', $this->usernames );
+                       $this->addWhereFld( 'ipb_auto', 0 );
                }
                if ( isset( $params['ip'] ) )
                {
@@ -114,7 +115,8 @@ class ApiQueryBlocks extends ApiQueryBase {
                        $this->addWhere( array(
                                'ipb_range_start' . $db->buildLike( $prefix, $db->anyString() ),
                                "ipb_range_start <= '$lower'",
-                               "ipb_range_end >= '$upper'"
+                               "ipb_range_end >= '$upper'",
+                               'ipb_auto' => 0
                        ) );
                }
                if ( !$wgUser->isAllowed( 'hideuser' ) )
@@ -148,7 +150,7 @@ class ApiQueryBlocks extends ApiQueryBase {
                                $block['expiry'] = Block::decodeExpiry( $row->ipb_expiry, TS_ISO_8601 );
                        if ( $fld_reason )
                                $block['reason'] = $row->ipb_reason;
-                       if ( $fld_range )
+                       if ( $fld_range && !$row->ipb_auto )
                        {
                                $block['rangestart'] = IP::hexToQuad( $row->ipb_range_start );
                                $block['rangeend'] = IP::hexToQuad( $row->ipb_range_end );