$this->hideuserblocks = $wgRequest->getBool( 'hideuserblocks' );
$this->hidetempblocks = $wgRequest->getBool( 'hidetempblocks' );
$this->hideaddressblocks = $wgRequest->getBool( 'hideaddressblocks' );
- $this->scanRange = $wgRequest->getBool( 'range' );
}
/**
$conds['ipb_id'] = substr( $this->ip, 1 );
// Single IPs
} elseif ( IP::isIPAddress($this->ip) && strpos($this->ip,'/') === false ) {
- if( $this->scanRange && $iaddr = IP::toHex($this->ip) ) {
+ if( $iaddr = IP::toHex($this->ip) ) {
# Only scan ranges which start in this /16, this improves search speed
# Blocks should not cross a /16 boundary.
$range = substr( $iaddr, 0, 4 );
- $conds[] = "(ipb_address = '" . IP::sanitizeIP($this->ip) . "') OR
- (ipb_range_start LIKE '$range%' AND ipb_range_start <= '$iaddr' AND ipb_range_end >= '$iaddr')";
+ // Fixme -- encapsulate this sort of query-building.
+ $dbr = wfGetDB( DB_SLAVE );
+ $encIp = $dbr->addQuotes( IP::sanitizeIP($this->ip) );
+ $encRange = $dbr->addQuotes( "$range%" );
+ $encAddr = $dbr->addQuotes( $iaddr );
+ $conds[] = "(ipb_address = $encIp) OR
+ (ipb_range_start LIKE $encRange AND
+ ipb_range_start <= $encAddr
+ AND ipb_range_end >= $encAddr)";
} else {
$conds['ipb_address'] = IP::sanitizeIP($this->ip);
}
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', null, wfMsg( 'ipblocklist-legend' ) ) .
Xml::inputLabel( wfMsg( 'ipblocklist-username' ), 'ip', 'ip', /* size */ false, $this->ip ) .
- '<br/>' .
- Xml::checkLabel( wfMsg('ipblocklist-scanrange'), 'range', 'range', $this->scanRange ) .
- ' ' . Xml::submitButton( wfMsg( 'ipblocklist-submit' ) ) .
+ ' ' .
+ Xml::submitButton( wfMsg( 'ipblocklist-submit' ) ) .
Xml::closeElement( 'fieldset' )
);
}
'ipblocklist-sh-userblocks' => '$1 account blocks',
'ipblocklist-sh-tempblocks' => '$1 temporary blocks',
'ipblocklist-sh-addressblocks' => '$1 single IP blocks',
-'ipblocklist-scanrange' => 'For IPs, include all blocks that affect the address',
'ipblocklist-summary' => '', # do not translate or duplicate this message to other languages
'ipblocklist-submit' => 'Search',
'blocklistline' => '$1, $2 blocked $3 ($4)',