From 4d27e202cffa919e8966a0c682b89607a4e43a93 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 15 Feb 2010 12:13:01 +0000 Subject: [PATCH] API: Don't display range info for autoblocks (effectively disclosing the IP address) in list=blocks, and don't list autoblocks when queried for a certain user's or IP's blocks. These constraints mirror the ones used by Special:Ipblocklist --- includes/api/ApiQueryBlocks.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index c41db20746..e720e82c22 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -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 ); -- 2.20.1