|
|
|
@ -771,8 +771,9 @@ class rcube_ldap extends rcube_addressbook
|
|
|
|
|
|
|
|
|
|
// 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,24 +801,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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|