From cb2bc809ef29f349d38c89e202d821e67bb4c947 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 21 Sep 2010 14:47:55 -0400
Subject: [PATCH] Fix db_mode check in insert_id()

---
 program/include/rcube_imap.php |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index c5b10e6..2151f5c 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -138,9 +138,10 @@
         // write error log
         else if ($this->conn->error) {
             $this->error_code = $this->conn->errornum;
-            raise_error(array('code' => 403, 'type' => 'imap',
-                'file' => __FILE__, 'line' => __LINE__,
-                'message' => $this->conn->error), true, false);
+            if ($pass && $user)
+                raise_error(array('code' => 403, 'type' => 'imap',
+                    'file' => __FILE__, 'line' => __LINE__,
+                    'message' => $this->conn->error), true, false);
         }
 
         return false;
@@ -155,8 +156,7 @@
      */
     function close()
     {
-        if ($this->conn && $this->conn->connected())
-            $this->conn->close();
+        $this->conn->close();
         $this->write_cache();
     }
 
@@ -3426,7 +3426,7 @@
             $name = trim($val['name']);
 
             if (preg_match('/^[\'"]/', $name) && preg_match('/[\'"]$/', $name))
-                $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', $name);
+                $name = trim($name, '\'"');
 
             if ($name && $address && $name != $address)
                 $string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address);
@@ -3458,7 +3458,7 @@
     function decode_header($input, $remove_quotes=false)
     {
         $str = rcube_imap::decode_mime_string((string)$input, $this->default_charset);
-        if ($str{0}=='"' && $remove_quotes)
+        if ($str[0] == '"' && $remove_quotes)
             $str = str_replace('"', '', $str);
 
         return $str;

--
Gitblit v1.9.1