From: Aaron Schulz Date: Thu, 9 Oct 2008 20:45:38 +0000 (+0000) Subject: More cleanup: X-Git-Tag: 1.31.0-rc.0~44828 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=6c5bb522d12879e19a043d25d33857042c6d94ee;p=lhc%2Fweb%2Fwiklou.git More cleanup: * Fix ipv6 range searches too * Use nicer ip checks * Trim address --- diff --git a/includes/specials/SpecialIpblocklist.php b/includes/specials/SpecialIpblocklist.php index 9ff59b467d..6787a25c08 100644 --- a/includes/specials/SpecialIpblocklist.php +++ b/includes/specials/SpecialIpblocklist.php @@ -10,7 +10,7 @@ function wfSpecialIpblocklist() { global $wgUser, $wgOut, $wgRequest; - $ip = $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) ); + $ip = trim( $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) ) ); $id = $wgRequest->getVal( 'id' ); $reason = $wgRequest->getText( 'wpUnblockReason' ); $action = $wgRequest->getText( 'action' ); @@ -245,10 +245,10 @@ class IPUnblockForm { // No extra conditions } elseif ( substr( $this->ip, 0, 1 ) == '#' ) { $conds['ipb_id'] = substr( $this->ip, 1 ); - } elseif ( IP::toUnsigned( $this->ip ) !== false ) { + } elseif ( IP::isIPAddress($this->ip) && strpos($this->ip,'/') === false ) { $conds['ipb_address'] = IP::sanitizeIP($this->ip); $conds['ipb_auto'] = 0; - } elseif( preg_match( '/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/', $this->ip, $matches ) ) { + } elseif( IP::isIPAddress($this->ip) ) { $conds['ipb_address'] = Block::normaliseRange( $this->ip ); $conds['ipb_auto'] = 0; } else {