Aleksander Machniak
2012-10-16 699cb1fda3594705918c987714e7277572afb8b0
Fix post-filtering vlv results, fixes warning "mb_strtolower() expects parameter 1 to be a string, array given"
1 files modified
11 ■■■■■ changed files
program/include/rcube_ldap.php 11 ●●●●● patch | view | raw | blame | history
program/include/rcube_ldap.php
@@ -771,8 +771,9 @@
        // use VLV pseudo-search for autocompletion
        $rcube = rcube::get_instance();
        $list_fields = $rcube->config->get('contactlist_fields');
        if ($this->prop['vlv_search'] && $this->conn && join(',', (array)$fields) == join(',', $rcube->config->get('contactlist_fields')))
        if ($this->prop['vlv_search'] && $this->conn && join(',', (array)$fields) == join(',', $list_fields))
        {
            // add general filter to query
            if (!empty($this->prop['filter']) && empty($this->filter))
@@ -800,8 +801,9 @@
            for ($i = 0; $i < $entries['count']; $i++) {
                $rec = $this->_ldap2result($entries[$i]);
                foreach (array('email', 'name') as $f) {
                    $val = mb_strtolower($rec[$f]);
                foreach ($fields as $f) {
                    foreach ((array)$rec[$f] as $val) {
                        $val = mb_strtolower($val);
                    switch ($mode) {
                    case 1:
                        $got = ($val == $search);
@@ -817,7 +819,8 @@
                    if ($got) {
                        $this->result->add($rec);
                        $this->result->count++;
                        break;
                            break 2;
                        }
                    }
                }
            }