summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_contacts.php13
-rw-r--r--program/include/rcube_ldap.php15
2 files changed, 14 insertions, 14 deletions
diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index 687b4b111..7c142f545 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -192,7 +192,7 @@ class rcube_contacts extends rcube_addressbook
// determine whether we have to parse the vcard or if only db cols are requested
$read_vcard = !$cols || count(array_intersect($cols, $this->table_cols)) < count($cols);
-
+
while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
$sql_arr['ID'] = $sql_arr[$this->primary_key];
@@ -255,17 +255,18 @@ class rcube_contacts extends rcube_addressbook
$ids = $this->db->array2list($ids, 'integer');
$where[] = 'c.' . $this->primary_key.' IN ('.$ids.')';
}
- else if ($strict) {
- $where[] = $this->db->quoteIdentifier($col).' = '.$this->db->quote($value);
- }
else if ($col == '*') {
$words = array();
foreach(explode(" ", self::normalize_string($value)) as $word)
$words[] = $this->db->ilike('words', '%'.$word.'%');
$where[] = '(' . join(' AND ', $words) . ')';
- }
- else
+ }
+ else if ($strict) {
+ $where[] = $this->db->quoteIdentifier($col).' = '.$this->db->quote($value);
+ }
+ else if (in_array($col, $this->table_cols)) {
$where[] = $this->db->ilike($col, '%'.$value.'%');
+ }
}
foreach ($required as $col) {
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index f166fd23a..7f0ea84fa 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -479,21 +479,20 @@ class rcube_ldap extends rcube_addressbook
$filter = '(|';
$wc = !$strict && $this->prop['fuzzy_search'] ? '*' : '';
- if ($fields != '*')
+ if ($fields == '*')
{
// search_fields are required for fulltext search
- if (!$this->prop['search_fields'])
+ if (empty($this->prop['search_fields']))
{
$this->set_error(self::ERROR_SEARCH, 'nofulltextsearch');
$this->result = new rcube_result_set();
return $this->result;
}
- }
-
- if (is_array($this->prop['search_fields']))
- {
- foreach ($this->prop['search_fields'] as $k => $field)
- $filter .= "($field=$wc" . $this->_quote_string($value) . "$wc)";
+ if (is_array($this->prop['search_fields']))
+ {
+ foreach ($this->prop['search_fields'] as $k => $field)
+ $filter .= "($field=$wc" . $this->_quote_string($value) . "$wc)";
+ }
}
else
{