summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-10-16 17:55:55 +0200
committerAleksander Machniak <alec@alec.pl>2012-10-16 17:55:55 +0200
commit639a825b2ebdb16fe6e9725bde00f7baa31ae434 (patch)
treea80998979f0b4a3a97a7e357a10ce8a433525339
parent9bfaf5f070bd62355d9d0b87e87e57c835549ac0 (diff)
Fix post-filtering vlv results, fixes warning "mb_strtolower() expects parameter 1 to be a string, array given"
Conflicts: program/include/rcube_ldap.php
-rw-r--r--program/include/rcube_ldap.php36
1 files changed, 19 insertions, 17 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index fef940d8a..999f56cfb 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -772,24 +772,26 @@ class rcube_ldap extends rcube_addressbook
for ($i = 0; $i < $entries['count']; $i++) {
$rec = $this->_ldap2result($entries[$i]);
- foreach (array('email', 'name') as $f) {
- $val = mb_strtolower($rec[$f]);
- switch ($mode) {
- case 1:
- $got = ($val == $search);
- break;
- case 2:
- $got = ($search == substr($val, 0, strlen($search)));
- break;
- default:
- $got = (strpos($val, $search) !== false);
- break;
- }
+ foreach ($fields as $f) {
+ foreach ((array)$rec[$f] as $val) {
+ $val = mb_strtolower($val);
+ switch ($mode) {
+ case 1:
+ $got = ($val == $search);
+ break;
+ case 2:
+ $got = ($search == substr($val, 0, strlen($search)));
+ break;
+ default:
+ $got = (strpos($val, $search) !== false);
+ break;
+ }
- if ($got) {
- $this->result->add($rec);
- $this->result->count++;
- break;
+ if ($got) {
+ $this->result->add($rec);
+ $this->result->count++;
+ break 2;
+ }
}
}
}