| | |
| | | " AND c.user_id=?" . |
| | | ($this->group_id ? " AND m.contactgroup_id=?" : ""). |
| | | ($this->filter ? " AND (".$this->filter.")" : "") . |
| | | " ORDER BY c.name, c.email", |
| | | " ORDER BY ". $this->db->concat('c.name', 'c.email'), |
| | | $start_row, |
| | | $length, |
| | | $this->user_id, |
| | |
| | | |
| | | // 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]; |
| | | |
| | |
| | | $sql_arr = $this->convert_db_data($sql_arr); |
| | | else |
| | | $sql_arr['email'] = preg_split('/,\s*/', $sql_arr['email']); |
| | | |
| | | |
| | | // make sure we have a name to display |
| | | if (empty($sql_arr['name'])) |
| | | if (empty($sql_arr['name'])) { |
| | | if (empty($sql_arr['email'])) |
| | | $sql_arr['email'] = $this->get_col_values('email', $sql_arr, true); |
| | | $sql_arr['name'] = $sql_arr['email'][0]; |
| | | } |
| | | |
| | | $this->result->add($sql_arr); |
| | | } |
| | |
| | | $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) { |