r41895 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41894‎ | r41895 | r41896 >
Date:20:45, 9 October 2008
Author:aaron
Status:old
Tags:
Comment:
More cleanup:
* Fix ipv6 range searches too
* Use nicer ip checks
* Trim address
Modified paths:
  • /trunk/phase3/includes/specials/SpecialIpblocklist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialIpblocklist.php
@@ -10,7 +10,7 @@
1111 function wfSpecialIpblocklist() {
1212 global $wgUser, $wgOut, $wgRequest;
1313
14 - $ip = $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) );
 14+ $ip = trim( $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) ) );
1515 $id = $wgRequest->getVal( 'id' );
1616 $reason = $wgRequest->getText( 'wpUnblockReason' );
1717 $action = $wgRequest->getText( 'action' );
@@ -245,10 +245,10 @@
246246 // No extra conditions
247247 } elseif ( substr( $this->ip, 0, 1 ) == '#' ) {
248248 $conds['ipb_id'] = substr( $this->ip, 1 );
249 - } elseif ( IP::toUnsigned( $this->ip ) !== false ) {
 249+ } elseif ( IP::isIPAddress($this->ip) && strpos($this->ip,'/') === false ) {
250250 $conds['ipb_address'] = IP::sanitizeIP($this->ip);
251251 $conds['ipb_auto'] = 0;
252 - } elseif( preg_match( '/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/', $this->ip, $matches ) ) {
 252+ } elseif( IP::isIPAddress($this->ip) ) {
253253 $conds['ipb_address'] = Block::normaliseRange( $this->ip );
254254 $conds['ipb_auto'] = 0;
255255 } else {

Status & tagging log