summaryrefslogtreecommitdiff
path: root/program/include/rcube_contacts.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-06-03 12:09:10 +0000
committeralecpl <alec@alec.pl>2011-06-03 12:09:10 +0000
commita5be870d6c7ca8913e0e3accaf6d4cf188a3c3cd (patch)
treecfc800882d311d0432272e553617070d5f52a54c /program/include/rcube_contacts.php
parente9a9f2f6c52e41f3e85fc3ab0ee93afecd080892 (diff)
- Performance improvement, fix case-sensitivness in advanced search
Diffstat (limited to 'program/include/rcube_contacts.php')
-rw-r--r--program/include/rcube_contacts.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index 5e7165edd..84b3fd7e8 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -284,7 +284,7 @@ class rcube_contacts extends rcube_addressbook
$where[] = '(' . join(' AND ', $words) . ')';
}
if (is_array($value))
- $post_search[$col] = $strict ? $val : mb_strtolower($val);
+ $post_search[$col] = mb_strtolower($val);
}
}
}
@@ -331,9 +331,8 @@ class rcube_contacts extends rcube_addressbook
if (is_array($value)) {
$value = implode($value);
}
- if (($strict && $value == $search)
- || (!$strict && strpos(mb_strtolower($value), $search) !== false)
- ) {
+ $value = mb_strtolower($value);
+ if (($strict && $value == $search) || (!$strict && strpos($value, $search) !== false)) {
$found++;
break;
}
@@ -349,7 +348,14 @@ class rcube_contacts extends rcube_addressbook
// build WHERE clause
$ids = $this->db->array2list($ids, 'integer');
$where = 'c.' . $this->primary_key.' IN ('.$ids.')';
+ // reset counter
unset($this->cache['count']);
+
+ // when we know we have an empty result
+ if ($ids == '0') {
+ $this->set_search_set($where);
+ return ($this->result = new rcube_result_set(0, 0));
+ }
}
if (!empty($where)) {