Code

Enabled sorting
[gosa.git] / gosa-core / include / class_filter.inc
index 286725978de42d16a0ae507d2dd0f39f7e2a7513..efd72574e18683c237523fd59872278ea2f73ec6 100644 (file)
@@ -351,8 +351,16 @@ class filter {
       $smarty->assign("$tag", $htmlCode);
     }
 
+    // Try to load template from plugin the folder first...
+    $file = get_template_path($this->xmlData['definition']['template'], true);
+
+    // ... if this fails, try to load the file from the theme folder.
+    if(!file_exists($file)){
+      $file = get_template_path($this->xmlData['definition']['template']);
+    }
+
     // Load template
-    return ("<input type='hidden' name='FILTER_PID' value='".$this->pid."'>".$smarty->fetch(get_template_path($this->xmlData['definition']['template'], true)));
+    return ("<input type='hidden' name='FILTER_PID' value='".$this->pid."'>".$smarty->fetch($file));
   }
 
 
@@ -383,9 +391,6 @@ class filter {
       $filter= $query['filter'];
       $attributes= $query['attribute'];
 
-      $method = "";
-      if(isset($query['method'])) $method = $query['method'];
-
       // Generate final filter
       foreach ($this->elements as $tag => $element) {
         if (!isset($element['set']) || !isset($element['unset'])) {
@@ -403,16 +408,17 @@ class filter {
         }
 
         if ($this->elementValues[$tag] == "") {
-          $e_unset= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_unset);
+          $e_unset= preg_replace('/[^\\\\]\$/', normalizeLdap($this->elementValues[$tag]), $e_unset);
+          $e_unset= preg_replace('/\\\\\$/','$', $e_unset);
           $filter= preg_replace("/\\$$tag/", $e_unset, $filter);
         } else {
-          $e_set= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_set);
+          $e_set= preg_replace('/[^\\\\]\$/', normalizeLdap($this->elementValues[$tag]), $e_set);
+          $e_set= preg_replace('/\\\\\$/','$', $e_set);
           $filter= preg_replace("/\\$$tag/", $e_set, $filter);
         }
       }
 
-      $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, $this->category,$method, $this->objectStorage));
-      $result = call_user_func(array($backend, 'unifyResults'), $result);
+      $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, $this->category, $this->objectStorage));
     }
     
     return ($result);