Code

Some pliglist iconmenu updates
[gosa.git] / gosa-core / include / class_filter.inc
index 6a6a4216efff52f5c61a9a59d8c889acb8339bca..f44e39dcb5ec03c9cead94245d24390b19123e8b 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));
   }
 
 
@@ -399,12 +407,13 @@ class filter {
           $e_unset= is_array($element['unset'])?"":$element['unset'];
         }
 
+        // Do not replace escaped \$ - This is required to be able to search for e.g. windows machines.
         if ($this->elementValues[$tag] == "") {
-          $e_unset= preg_replace('/[^\\\\]\$/', normalizeLdap($this->elementValues[$tag]), $e_unset);
+          $e_unset= preg_replace('/([^\\\\])\$/', '${1}'.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('/([^\\\\])\$/', '${1}'.normalizeLdap($this->elementValues[$tag]), $e_set);
           $e_set= preg_replace('/\\\\\$/','$', $e_set);
           $filter= preg_replace("/\\$$tag/", $e_set, $filter);
         }
@@ -522,7 +531,7 @@ class filter {
 
         echo '<ul>';
         foreach ($result as $entry) {
-          echo '<li>'.$entry.'</li>';
+          echo '<li>'.mark($_POST[$tag], $entry).'</li>';
           if ($max-- == 0) {
             break;
           }