From 9b4aaa79d3cc1cded4e8a3bd11063994152fccc7 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 03 Feb 2009 02:40:26 -0500
Subject: [PATCH] - Fix displaying of alternative-inside-alternative messages (#1485713)

---
 program/include/rcube_contacts.php |   27 ++++++---------------------
 1 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index a9d1614..65d89ca 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -5,7 +5,7 @@
  | program/include/rcube_contacts.php                                    |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland                 |
+ | Copyright (C) 2006-2009, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -34,7 +34,7 @@
   var $result = null;
   var $search_fields;
   var $search_string;
-  var $table_cols = array('name', 'email', 'firstname', 'surname');
+  var $table_cols = array('name', 'email', 'firstname', 'surname', 'vcard');
   
   /** public properties */
   var $primary_key = 'contact_id';
@@ -56,16 +56,6 @@
     $this->db_name = get_table_name('contacts');
     $this->user_id = $user;
     $this->ready = $this->db && !$this->db->is_error();
-  }
-
-  /**
-   * PHP 4 object constructor
-   *
-   * @see rcube_contacts::__construct()
-   */
-  function rcube_contacts($dbconn, $user)
-  {
-    $this->__construct($dbconn, $user);
   }
 
 
@@ -196,12 +186,12 @@
       if ($col == 'ID' || $col == $this->primary_key)
       {
         $ids = !is_array($value) ? split(',', $value) : $value;
-        $add_where[] = $this->primary_key." IN (".join(',', $ids).")";
+        $add_where[] = $this->primary_key.' IN ('.join(',', $ids).')';
       }
       else if ($strict)
-        $add_where[] = $this->db->quoteIdentifier($col)."=".$this->db->quote($value);
+        $add_where[] = $this->db->quoteIdentifier($col).'='.$this->db->quote($value);
       else
-        $add_where[] = $this->db->quoteIdentifier($col)." LIKE ".$this->db->quote(strlen($value)>2 ? "%$value%" : "$value%");
+        $add_where[] = $this->db->ilike($col, '%'.$value.'%');
     }
     
     if (!empty($add_where))
@@ -393,13 +383,8 @@
    */
   function delete_all()
   {
-    if (is_array($ids))
-      $ids = join(',', $ids);
-
-    $this->db->query("DELETE FROM {$this->db_name} WHERE  user_id=?", $this->user_id);
+    $this->db->query("DELETE FROM {$this->db_name} WHERE user_id=?", $this->user_id);
     return $this->db->affected_rows();
   }
 
 }
-
-

--
Gitblit v1.9.1