From 107bde9cfd9a0392d18544b5a433552ce6f2f0a6 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 30 Aug 2006 13:41:21 -0400
Subject: [PATCH] Added MSSQL support

---
 program/steps/mail/addcontact.inc |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 6ead678..b040581 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -21,9 +21,9 @@
 
 $REMOTE_REQUEST = TRUE;
 
-if ($_GET['_address'])
+if (!empty($_GET['_address']))
   {
-  $contact_arr = $IMAP->decode_address_list($_GET['_address']);
+  $contact_arr = $IMAP->decode_address_list(get_input_value('_address', RCUBE_INPUT_GET, TRUE));
   if (sizeof($contact_arr))
     {
     $contact = $contact_arr[1];
@@ -32,7 +32,7 @@
       $sql_result = $DB->query("SELECT 1 FROM ".get_table_name('contacts')."
                                 WHERE  user_id=?
                                 AND    email=?
-                                AND    del<>'1'",
+                                AND    del<>1",
                                 $_SESSION['user_id'],$contact['mailto']);
 
     // contact entry with this mail address exists
@@ -42,13 +42,13 @@
     else if ($contact['mailto'])
       {
       $DB->query("INSERT INTO ".get_table_name('contacts')."
-                  (user_id, name, email)
-                  VALUES (?, ?, ?)",
+                  (user_id, changed, del, name, email)
+                  VALUES (?, ".$DB->now().", 0, ?, ?)",
                   $_SESSION['user_id'],
                   $contact['name'],
                   $contact['mailto']);
 
-      $added = $DB->insert_id();
+      $added = $DB->insert_id(get_sequence_name('contacts'));
       }
     }
 

--
Gitblit v1.9.1