Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php |
— | — | @@ -306,6 +306,7 @@ |
307 | 307 | 'rmwhitespace' => 'funcRMWhitespace', |
308 | 308 | 'count' => 'funcCount', |
309 | 309 | 'rcount' => 'funcRCount', |
| 310 | + 'ip_in_range' => 'funcIPInRange', |
310 | 311 | ); |
311 | 312 | |
312 | 313 | // Order is important. The punctuation-matching regex requires that |
— | — | @@ -991,6 +992,18 @@ |
992 | 993 | return new AFPData( AFPData::DInt, $count ); |
993 | 994 | } |
994 | 995 | |
| 996 | + protected function funcIPInRange( $args ) { |
| 997 | + if( count( $args ) < 2 ) |
| 998 | + throw new AFPExpection( "No params passed to ".__METHOD__ ); |
| 999 | + |
| 1000 | + $ip = $args[0]->toString(); |
| 1001 | + $range = $args[1]->toString(); |
| 1002 | + |
| 1003 | + $result = IP::isInRange( $ip, $range ); |
| 1004 | + |
| 1005 | + return new AFPData( AFPData::DBool, $result ); |
| 1006 | + } |
| 1007 | + |
995 | 1008 | protected function funcCCNorm( $args ) { |
996 | 1009 | if( count( $args ) < 1 ) |
997 | 1010 | throw new AFPExpection( "No params passed to ".__METHOD__ ); |