From 1086051f0186d56c1243544080cefc454e29ef0c Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 24 Aug 2009 12:23:34 +0000 Subject: [PATCH] Added conversion handlers git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14115 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_filter.inc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index 5ab2eb86d..4d8260fc4 100644 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -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); } -- 2.30.2