From 3df62c225d4fcd54dc6824104e151f197f358c68 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 27 Feb 2007 22:17:35 +0000 Subject: [PATCH] * Allow /16 and /24 CIDR ips --- includes/SpecialContributions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index bc448882a2..c3e31e96df 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -71,13 +71,18 @@ class ContribsFinder { if ( $this->username == 'newbies' ) { $max = $this->dbr->selectField( 'user', 'max(user_id)', false, 'make_sql' ); $condition = '>' . (int)($max - $max / 100); + } else if ( preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/(24|16)/", $this->username) ) { + $abcd = explode( ".", $this->username ); + if( substr( $this->username, -2 ) == 24 ) $ipmask = $abcd[0] . '.' . $abcd[1] . '.' . $abcd[2] . '.%'; + else $ipmask=$abcd[0] . '.' . $abcd[1] . '.%'; + $condition = 'rev_user_text LIKE ' . $this->dbr->addQuotes($ipmask); } if ( $condition == '' ) { $condition = ' rev_user_text=' . $this->dbr->addQuotes( $this->username ); $index = 'usertext_timestamp'; } else { - $condition = ' rev_user '.$condition ; + #$condition = ' rev_user '.$condition ; $index = 'user_timestamp'; } return array( $index, $condition ); @@ -253,6 +258,8 @@ function wfSpecialContributions( $par = null ) { if ( $target == 'newbies' ) { $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') ); + } else if ( preg_match( "/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/(24|16)/", $target ) ) { + $wgOut->setSubtitle( wfMsgHtml( 'contribsub', $target ) ); } else { $wgOut->setSubtitle( wfMsgHtml( 'contribsub', contributionsSub( $nt ) ) ); } -- 2.20.1