From 92cd7f34b07e86062f2c024039e3309768b48ce6 Mon Sep 17 00:00:00 2001
From: Andy Wermke <andy@dev.next-step-software.com>
Date: Thu, 04 Apr 2013 10:10:23 -0400
Subject: [PATCH] Merge branch 'master' of https://github.com/roundcube/roundcubemail

---
 program/lib/Roundcube/rcube_contacts.php |   28 +++++-----------------------
 1 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php
index 5b4292a..c66e986 100644
--- a/program/lib/Roundcube/rcube_contacts.php
+++ b/program/lib/Roundcube/rcube_contacts.php
@@ -2,8 +2,6 @@
 
 /*
  +-----------------------------------------------------------------------+
- | program/include/rcube_contacts.php                                    |
- |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
  | Copyright (C) 2006-2012, The Roundcube Dev Team                       |
  |                                                                       |
@@ -13,7 +11,6 @@
  |                                                                       |
  | PURPOSE:                                                              |
  |   Interface to the local address book database                        |
- |                                                                       |
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
@@ -63,6 +60,7 @@
       'jobtitle', 'organization', 'department', 'assistant', 'manager',
       'gender', 'maidenname', 'spouse', 'email', 'phone', 'address',
       'birthday', 'anniversary', 'website', 'im', 'notes', 'photo');
+    public $date_cols = array('birthday', 'anniversary');
 
     const SEPARATOR = ',';
 
@@ -404,32 +402,16 @@
             for ($i=0; $i<$pages; $i++) {
                 $this->list_records(null, $i, true);
                 while ($row = $this->result->next()) {
-                    $id = $row[$this->primary_key];
+                    $id    = $row[$this->primary_key];
                     $found = array();
                     foreach (preg_grep($regexp, array_keys($row)) as $col) {
                         $pos     = strpos($col, ':');
                         $colname = $pos ? substr($col, 0, $pos) : $col;
                         $search  = $post_search[$colname];
                         foreach ((array)$row[$col] as $value) {
-                            // composite field, e.g. address
-                            foreach ((array)$value 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) {
-                                    $found[$colname] = true;
-                                    break 2;
-                                }
+                            if ($this->compare_search_value($colname, $value, $search, $mode)) {
+                                $found[$colname] = true;
+                                break 2;
                             }
                         }
                     }

--
Gitblit v1.9.1