From fc52af24f1418d6590a2d37a0d8cc31b123e38f6 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Tue, 19 Aug 2014 12:08:35 -0400 Subject: [PATCH] Fix merge error that disabled contact drag'n'drop --- program/lib/Roundcube/rcube_imap_cache.php | 34 +++++++++++++++++++++------------- 1 files changed, 21 insertions(+), 13 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php index 89e3ceb..5170e9e 100644 --- a/program/lib/Roundcube/rcube_imap_cache.php +++ b/program/lib/Roundcube/rcube_imap_cache.php @@ -419,7 +419,7 @@ } unset($msg->flags); - $msg = serialize($this->db->encode($msg)); + $msg = $this->db->encode($msg, true); // update cache record (even if it exists, the update // here will work as select, assume row exist if affected_rows=0) @@ -641,7 +641,7 @@ if ($sql_arr = $this->db->fetch_assoc($sql_result)) { $data = explode('@', $sql_arr['data']); - $index = @unserialize($data[0]); + $index = $this->db->decode($data[0], true); unset($data[0]); if (empty($index)) { @@ -678,7 +678,7 @@ if ($sql_arr = $this->db->fetch_assoc($sql_result)) { $data = explode('@', $sql_arr['data']); - $thread = @unserialize($data[0]); + $thread = $this->db->decode($data[0], true); unset($data[0]); if (empty($thread)) { @@ -704,7 +704,7 @@ $data, $mbox_data = array(), $exists = false, $modseq = null) { $data = array( - serialize($data), + $this->db->encode($data, true), $sort_field, (int) $this->skip_deleted, (int) $mbox_data['UIDVALIDITY'], @@ -737,7 +737,7 @@ private function add_thread_row($mailbox, $data, $mbox_data = array(), $exists = false) { $data = array( - serialize($data), + $this->db->encode($data, true), (int) $this->skip_deleted, (int) $mbox_data['UIDVALIDITY'], (int) $mbox_data['UIDNEXT'], @@ -1069,7 +1069,7 @@ */ private function build_message($sql_arr) { - $message = $this->db->decode(unserialize($sql_arr['data'])); + $message = $this->db->decode($sql_arr['data'], true); if ($message) { $message->flags = array(); @@ -1092,13 +1092,13 @@ // Save current message from internal cache if ($message = $this->icache['__message']) { // clean up some object's data - $object = $this->message_object_prepare($message['object']); + $this->message_object_prepare($message['object']); // calculate current md5 sum - $md5sum = md5(serialize($object)); + $md5sum = md5(serialize($message['object'])); if ($message['md5sum'] != $md5sum) { - $this->add_message($message['mailbox'], $object, !$message['exists']); + $this->add_message($message['mailbox'], $message['object'], !$message['exists']); } $this->icache['__message']['md5sum'] = $md5sum; @@ -1108,8 +1108,10 @@ /** * Prepares message object to be stored in database. + * + * @param rcube_message_header|rcube_message_part */ - private function message_object_prepare($msg) + private function message_object_prepare(&$msg) { // Remove body too big (>25kB) if ($msg->body && strlen($msg->body) > 25 * 1024) { @@ -1123,13 +1125,19 @@ list($msg->ctype_primary, $msg->ctype_secondary) = explode('/', $msg->mimetype); } + unset($msg->replaces); + if (is_array($msg->structure->parts)) { - foreach ($msg->structure->parts as $idx => $part) { - $msg->structure->parts[$idx] = $this->message_object_prepare($part); + foreach ($msg->structure->parts as $part) { + $this->message_object_prepare($part); } } - return $msg; + if (is_array($msg->parts)) { + foreach ($msg->parts as $part) { + $this->message_object_prepare($part); + } + } } -- Gitblit v1.9.1