From: Aaron Schulz Date: Mon, 5 Mar 2007 18:17:45 +0000 (+0000) Subject: *Add /16 and /24 ranges with fix for 'newbies' sql error X-Git-Tag: 1.31.0-rc.0~53907 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=99778a97c28136b44e0458d7fb8d4c2c28d5cd01;p=lhc%2Fweb%2Fwiklou.git *Add /16 and /24 ranges with fix for 'newbies' sql error --- 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 ) ) ); }