From: Roan Kattouw Date: Mon, 15 Feb 2010 12:13:01 +0000 (+0000) Subject: API: Don't display range info for autoblocks (effectively disclosing the IP address... X-Git-Tag: 1.31.0-rc.0~37751 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=4d27e202cffa919e8966a0c682b89607a4e43a93;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );