Code

Added conversion handlers
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 24 Aug 2009 12:23:34 +0000 (12:23 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 24 Aug 2009 12:23:34 +0000 (12:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14115 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_filter.inc

index 5ab2eb86dd8c5659d88c79a2c973be7be281d90d..4d8260fc457e7b37938a64a68fa968b1dd79ad78 100644 (file)
@@ -374,8 +374,16 @@ class filter {
         if (!isset($element['set']) || !isset($element['unset'])) {
           continue;
         }
-        $e_set= is_array($element['set'])?"":$element['set'];
-        $e_unset= is_array($element['unset'])?"":$element['unset'];
+
+        // Handle converters if present
+        if (isset($this->converter[$tag])) {
+          preg_match('/([^:]+)::(.*)$/', $this->converter[$tag], $m);
+          $e_set= call_user_func(array($m[1], $m[2]), preg_replace('/\$/', $this->elementValues[$tag], is_array($element['set'])?"":$element['set']));
+          $e_unset= call_user_func(array($m[1], $m[2]), preg_replace('/\$/', $this->elementValues[$tag], is_array($element['unset'])?"":$element['unset']));
+        } else {
+          $e_set= is_array($element['set'])?"":$element['set'];
+          $e_unset= is_array($element['unset'])?"":$element['unset'];
+        }
 
         if ($this->elementValues[$tag] == "") {
           $e_unset= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_unset);
@@ -386,11 +394,9 @@ class filter {
         }
       }
 
-      $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes,
-                               $this->category, $this->objectStorage));
+      $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, $this->category, $this->objectStorage));
     }
     
-
     return ($result);
   }