Code

Updated filtering
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Aug 2009 07:31:25 +0000 (07:31 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Aug 2009 07:31:25 +0000 (07:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13989 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_filter.inc
gosa-core/include/class_filterLDAP.inc

index b0e859650a58958cee13d47a381a3f41a94db0c4..5816218782f1589c9fa1ffa8772b8b92e2d44a7c 100755 (executable)
@@ -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;
   }
 
 
index 12983d7980b10985ddfbed8b216444280a41ec93..fae29782dbee488832bebacab900081c2b196a26 100755 (executable)
@@ -5,14 +5,7 @@ class filterLDAP {
   static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "", $objectBase= "")
   {
     global $config;
-
-    echo "Base: $base<br>";
-    echo "Scope: $scope<br>";
-    echo "filter: $filter<br>";
-    print_a($attributes);
-
     $ldap= $config->get_ldap_link(TRUE);
-
     $result= filterLDAP::get_list($base, $scope, $filter, $attributes,
                                   $category, $objectStorage, $objectBase,
                                   GL_SUBSEARCH | GL_SIZELIMIT);