From fd9bcd6b8ec0ba9779eee01c58b89a5e2ebfea61 Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 7 Aug 2009 07:31:25 +0000 Subject: [PATCH] Updated filtering git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13989 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_filter.inc | 17 ++++++++++++----- gosa-core/include/class_filterLDAP.inc | 7 ------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index b0e859650..581621878 100755 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -330,16 +330,16 @@ class filter { $e_unset= (string)$element->unset; if ($this->elementValues[$tag] == "") { - $e_unset= preg_replace('/\$/', $this->elementValues[$tag], $e_unset); + $e_unset= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_unset); $filter= preg_replace("/\\$$tag/", $e_unset, $filter); } else { - $e_set= preg_replace('/\$/', $this->elementValues[$tag], $e_set); + $e_set= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_set); $filter= preg_replace("/\\$$tag/", $e_set, $filter); } } - $result= call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, - $this->category, $this->objectStorage, $this->objectBase); + $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, + $this->category, $this->objectStorage, $this->objectBase)); } @@ -349,7 +349,14 @@ class filter { function isValid() { - return (false); + foreach ($this->elements as $tag => $element) { + if (isset($element->regex)){ + if (!preg_match('/'.(string)$element->regex.'/', $this->elementValues[$tag])){ + return false; + } + } + } + return true; } diff --git a/gosa-core/include/class_filterLDAP.inc b/gosa-core/include/class_filterLDAP.inc index 12983d798..fae29782d 100755 --- a/gosa-core/include/class_filterLDAP.inc +++ b/gosa-core/include/class_filterLDAP.inc @@ -5,14 +5,7 @@ class filterLDAP { static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "", $objectBase= "") { global $config; - - echo "Base: $base
"; - echo "Scope: $scope
"; - echo "filter: $filter
"; - print_a($attributes); - $ldap= $config->get_ldap_link(TRUE); - $result= filterLDAP::get_list($base, $scope, $filter, $attributes, $category, $objectStorage, $objectBase, GL_SUBSEARCH | GL_SIZELIMIT); -- 2.30.2