From 5f31429de5732617ad18fd2b67d6e2424a7185a7 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Thu, 28 Nov 2013 09:20:58 -0500 Subject: [PATCH] Fix preparation of message object before saving into the cache. The bug cased e.g. displaying HTML content as plain text for messages with Content-Type: text/html. --- program/lib/Roundcube/rcube_imap_cache.php | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php index 445d463..0c3edea 100644 --- a/program/lib/Roundcube/rcube_imap_cache.php +++ b/program/lib/Roundcube/rcube_imap_cache.php @@ -327,7 +327,6 @@ return array(); } - $msgs = array_flip($msgs); $result = array(); if ($this->mode & self::MODE_MESSAGE) { @@ -340,6 +339,8 @@ ." AND uid IN (".$this->db->array2list($msgs, 'integer').")", $this->userid, $mailbox); + $msgs = array_flip($msgs); + while ($sql_arr = $this->db->fetch_assoc($sql_result)) { $uid = intval($sql_arr['uid']); $result[$uid] = $this->build_message($sql_arr); @@ -351,11 +352,13 @@ unset($msgs[$uid]); } } + + $msgs = array_flip($msgs); } // Fetch not found messages from IMAP server if (!empty($msgs)) { - $messages = $this->imap->fetch_headers($mailbox, array_keys($msgs), false, true); + $messages = $this->imap->fetch_headers($mailbox, $msgs, false, true); // Insert to DB and add to result list if (!empty($messages)) { @@ -1247,10 +1250,8 @@ unset($msg->replaces); - if (is_array($msg->structure->parts)) { - foreach ($msg->structure->parts as $part) { - $this->message_object_prepare($part, $size); - } + if (is_object($msg->structure)) { + $this->message_object_prepare($msg->structure, $size); } if (is_array($msg->parts)) { -- Gitblit v1.9.1