From 7a05909da8d5218e15295f9074a2b3207ab062aa Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 11 Dec 2009 16:39:43 -0500
Subject: [PATCH] - fix warning on PHP5.3 (#1486284)

---
 program/include/rcube_imap.php |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 31156e4..5e5a6e0 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1281,13 +1281,15 @@
       // build parts list for headers pre-fetching
       for ($i=0, $count=0; $i<count($part); $i++)
         if (is_array($part[$i]) && count($part[$i]) > 3)
-	  // fetch message headers if message/rfc822 or named part (could contain Content-Location header)
-	  if (strtolower($part[$i][0]) == 'message' ||
-	    (in_array('name', (array)$part[$i][2]) && (empty($part[$i][3]) || $part[$i][3]=='NIL'))) {
+          // fetch message headers if message/rfc822 or named part (could contain Content-Location header)
+	  if (!is_array($part[$i][0]) && (strtolower($part[$i][0]) == 'message' ||
+	    (in_array('name', (array)$part[$i][2]) && (empty($part[$i][3]) || $part[$i][3]=='NIL')))) {
 	    $part_headers[] = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1;
 	    }
 
       // pre-fetch headers of all parts (in one command for better performance)
+      // @TODO: we could do this before _structure_part() call, to fetch
+      // headers for parts on all levels
       if ($part_headers)
         $part_headers = iil_C_FetchMIMEHeaders($this->conn, $this->mailbox, $this->_msg_id, $part_headers);
 
@@ -1300,8 +1302,8 @@
 
       return $struct;
       }
-    
-    
+
+
     // regular part
     $struct->ctype_primary = strtolower($part[0]);
     $struct->ctype_secondary = strtolower($part[1]);
@@ -1368,7 +1370,7 @@
     }
 
     if ($struct->ctype_primary=='message') {
-      if (is_array($part[8]) && empty($struct->parts))
+      if (is_array($part[8]) && $di != 8 && empty($struct->parts))
         $struct->parts[] = $this->_structure_part($part[8], ++$count, $struct->mime_id);
     }
 
@@ -1711,8 +1713,8 @@
     // make sure mailbox exists
     if ($to_mbox != 'INBOX' && !in_array($to_mbox, $this->_list_mailboxes()))
       {
-      if (in_array($to_mbox_in, $this->default_folders))
-        $this->create_mailbox($to_mbox_in, TRUE);
+      if (in_array($tbox, $this->default_folders))
+        $this->create_mailbox($tbox, TRUE);
       else
         return FALSE;
       }

--
Gitblit v1.9.1