summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7d68083)
raw | patch | inline | side by side (parent: 7d68083)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 23 Jul 2010 09:34:37 +0000 (09:34 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 23 Jul 2010 09:34:37 +0000 (09:34 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19078 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc b/gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc
index 643a423035c84838c259d7d1f5d59e378f51e20c..dd2ae09ba2d139351dd30f2c3725ef96861cae97 100644 (file)
<?php
class filterSystemByIp extends filterLDAP{
- static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
- {
-
- // IP Range selection
- $filterByIP = preg_match("/__FilterByIP__/", $filter);
- $filter = preg_replace("/__FilterByIP__/","",$filter);
- $ipstart = "";
- $ipstop = "";
- if(preg_match("/__IPSTART__=/", $filter)){
- $ipstart = trim(preg_replace("/^.*__IPSTART__=([^_]*)__.*$/","\\1",$filter),"*");
- }
- if(preg_match("/__IPSTOP__=/", $filter)){
- $ipstop = trim(preg_replace("/^.*__IPSTOP__=([^_]*)__.*$/","\\1",$filter),"*");
- }
-
+ static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+ {
- // Get entries
- $filter= preg_replace("/__IPSTART.*$/","",$filter);
- $entries = filterLDAP::query($base, $scope, $filter, $attributes, $category, $objectStorage);
-
-
- // Filter entries by IP-Address
- if($filterByIP){
- foreach($entries as $key => $entry){
- if(!isset($entry['ipHostNumber'])){
- unset($entries[$key]);
- continue;
+ // IP Range selection
+ $filterByIP = preg_match("/__FilterByIP__/", $filter);
+ $filter = preg_replace("/__FilterByIP__/","",$filter);
+ $ipstart = "";
+ $ipstop = "";
+ if(preg_match("/__IPSTART__=/", $filter)){
+ $ipstart = trim(preg_replace("/^.*__IPSTART__=([^_]*)__.*$/","\\1",$filter),"*");
+ }
+ if(preg_match("/__IPSTOP__=/", $filter)){
+ $ipstop = trim(preg_replace("/^.*__IPSTOP__=([^_]*)__.*$/","\\1",$filter),"*");
}
- if(!tests::is_in_ip_range($ipstart,$ipstop, $entry['ipHostNumber'][0])){
- unset($entries[$key]);
- continue;
+
+
+ // Get entries
+ $filter= preg_replace("/__IPSTART.*$/","",$filter);
+ $entries = filterLDAP::query($base, $scope, $filter, $attributes, $category, $objectStorage);
+
+
+ // Filter entries by IP-Address
+ if($filterByIP){
+ foreach($entries as $key => $entry){
+ if(!isset($entry['ipHostNumber'])){
+ unset($entries[$key]);
+ continue;
+ }
+ if(!tests::is_in_ip_range($ipstart,$ipstop, $entry['ipHostNumber'][0])){
+ unset($entries[$key]);
+ continue;
+ }
+ }
}
- }
+ return(array_values($entries));
}
- return(array_values($entries));
- }
}
?>