Code

Enabled sorting
[gosa.git] / gosa-core / include / class_filter.inc
index 9b2fed5458381bcf79bba4e76752ac552e2b6042..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));
   }
 
 
@@ -400,10 +408,12 @@ 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);
         }
       }