mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
New ip_in_range function
This commit is contained in:
parent
7e6b548b4c
commit
864a73e907
|
@ -306,6 +306,7 @@ class AbuseFilterParser {
|
|||
'rmwhitespace' => 'funcRMWhitespace',
|
||||
'count' => 'funcCount',
|
||||
'rcount' => 'funcRCount',
|
||||
'ip_in_range' => 'funcIPInRange',
|
||||
);
|
||||
|
||||
// Order is important. The punctuation-matching regex requires that
|
||||
|
@ -991,6 +992,18 @@ class AbuseFilterParser {
|
|||
return new AFPData( AFPData::DInt, $count );
|
||||
}
|
||||
|
||||
protected function funcIPInRange( $args ) {
|
||||
if( count( $args ) < 2 )
|
||||
throw new AFPExpection( "No params passed to ".__METHOD__ );
|
||||
|
||||
$ip = $args[0]->toString();
|
||||
$range = $args[1]->toString();
|
||||
|
||||
$result = IP::isInRange( $ip, $range );
|
||||
|
||||
return new AFPData( AFPData::DBool, $result );
|
||||
}
|
||||
|
||||
protected function funcCCNorm( $args ) {
|
||||
if( count( $args ) < 1 )
|
||||
throw new AFPExpection( "No params passed to ".__METHOD__ );
|
||||
|
|
Loading…
Reference in a new issue