diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-10-16 17:54:57 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-10-16 17:54:57 +0200 |
commit | 07239b65d64f3a98bee9b29cc1553530e4be9187 (patch) | |
tree | 2250c30b990ec52786fa8e9e8aac0a16d7b77bb1 /program/include | |
parent | dec798e3aece05d7ffcd43e6a19a7678dea37e23 (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
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_ldap.php | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php index babd34b60..17ef20aab 100644 --- a/program/include/rcube_ldap.php +++ b/program/include/rcube_ldap.php @@ -803,24 +803,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; + } } } } |