From 99778a97c28136b44e0458d7fb8d4c2c28d5cd01 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 5 Mar 2007 18:17:45 +0000 Subject: [PATCH] *Add /16 and /24 ranges with fix for 'newbies' sql error --- includes/SpecialContributions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index e1d9f9d6f7..0a2ac33198 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -70,14 +70,19 @@ class ContribsFinder { if ( $this->username == 'newbies' ) { $max = $this->dbr->selectField( 'user', 'max(user_id)', false, 'make_sql' ); - $condition = '>' . (int)($max - $max / 100); + $condition = 'rev_user >' . (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 ); @@ -262,6 +267,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