| | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | |
| | | */ |
| | | |
| | | |
| | |
| | | /** |
| | | * Store database connection. |
| | | * |
| | | * @var rcube_mdb2 |
| | | * @var rcube_db |
| | | */ |
| | | private $db = null; |
| | | private $user_id = 0; |
| | |
| | | // fulltext search in all fields |
| | | else if ($col == '*') { |
| | | $words = array(); |
| | | foreach (explode($WS, self::normalize_string($value)) as $word) { |
| | | foreach (explode($WS, rcube_utils::normalize_string($value)) as $word) { |
| | | switch ($mode) { |
| | | case 1: // strict |
| | | $words[] = '(' . $this->db->ilike('words', $word . '%') |
| | |
| | | // vCard field |
| | | else { |
| | | if (in_array($col, $this->fulltext_cols)) { |
| | | foreach (explode(" ", self::normalize_string($val)) as $word) { |
| | | foreach (rcube_utils::normalize_string($val, true) as $word) { |
| | | switch ($mode) { |
| | | case 1: // strict |
| | | $words[] = '(' . $this->db->ilike('words', $word . $WS . '%') |
| | |
| | | if (isset($value)) |
| | | $vcard->set($field, $value, $section); |
| | | if ($fulltext && is_array($value)) |
| | | $words .= ' ' . self::normalize_string(join(" ", $value)); |
| | | $words .= ' ' . rcube_utils::normalize_string(join(" ", $value)); |
| | | else if ($fulltext && strlen($value) >= 3) |
| | | $words .= ' ' . self::normalize_string($value); |
| | | $words .= ' ' . rcube_utils::normalize_string($value); |
| | | } |
| | | } |
| | | $out['vcard'] = $vcard->export(false); |
| | |
| | | $contact_id |
| | | ); |
| | | |
| | | if (!$this->db->db_error) |
| | | if ($error = $this->db->is_error()) |
| | | $this->set_error(self::ERROR_SAVING, $error); |
| | | else |
| | | $added++; |
| | | } |
| | | |
| | |
| | | $checkname); |
| | | |
| | | // append number to make name unique |
| | | if ($hit = $this->db->num_rows($sql_result)) |
| | | if ($hit = $this->db->fetch_array($sql_result)) { |
| | | $checkname = $name . ' ' . $num++; |
| | | } while ($hit > 0); |
| | | } |
| | | } while ($hit); |
| | | |
| | | return $checkname; |
| | | } |