".$this->renderFilterMenu()." | ";
+ $content= "".$this->renderFilterMenu()." | ";
$content.= " ".$this->getTextfield('search_filter', $this->value, $this->searches[$this->search])." ".
" | ";
@@ -252,10 +242,9 @@ class filter {
$this->initial= true;
return $result;
}
-
// Go thru all queries and merge results
foreach ($this->query as $query) {
- if (!isset($query['backend']) || !isset($query['filter']) || !isset($query['attribute'])) {
+ if (!isset($query['backend']) || !isset($query['filter'])) {
die("No backend specified in search config.");
}
@@ -267,12 +256,15 @@ class filter {
// Load filter and attributes
$filter= $query['filter'];
- $attributes= $query['attribute'];
// Handle converters if present
if ($this->converter) {
preg_match('/([^:]+)::(.*)$/', $this->converter, $m);
- $filter= call_user_func(array($m[1], $m[2]), preg_replace('/\$/', $this->value, $filter));
+ if ($this->value == "") {
+ $filter= call_user_func(array($m[1], $m[2]), preg_replace('/\$/', "*", $filter));
+ } else {
+ $filter= call_user_func(array($m[1], $m[2]), preg_replace('/\$/', $this->value, $filter));
+ }
}
// Do not replace escaped \$ - This is required to be able to search for e.g. windows machines.
@@ -282,7 +274,7 @@ class filter {
$filter= preg_replace("/\\$/", "*".normalizeLdap($this->value)."*", $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, $this->attributes, $this->category, $this->objectStorage));
}
return ($result);
@@ -292,7 +284,6 @@ class filter {
function update()
{
if (isset($_POST['FILTER_PID']) && $_POST['FILTER_PID'] == $this->pid) {
-
// Save input field
if (isset($_POST['search_filter'])) {
$this->value= validate($_POST['search_filter']);
@@ -304,14 +295,8 @@ class filter {
}
// Switch filter?
- if (is_array($this->category)) {
- $categories= $this->category;
- } else {
- $categories= array($this->category);
- }
-
if (isset($_POST['act'])) {
- foreach (array_merge($this->searches, userFilter::getFilter($categories)) as $tag => $cfg) {
+ foreach ($this->searches as $tag => $cfg) {
if ($_POST['act'] == "filter-$tag") {
$this->setSearch($tag);
break;
@@ -338,6 +323,7 @@ class filter {
$result= array();
// Is backend available?
+ # FIXME
$queries= $config['query'];
if (!isset($queries[0])){
$queries= array($queries);
@@ -425,34 +411,29 @@ class filter {
function renderFilterMenu()
{
// Load shortcut
- $result= "".
- " |