Fix rendering of multipart/alternative when it is a subpart
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Fri, 19 Oct 2007 09:30:29 +0000 (09:30 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:49 +0000 (00:35 +0100)
of another multipart

 mimepart.inc.php |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@276 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/mimepart.inc.php

index 0446640..ed7080f 100644 (file)
@@ -433,7 +433,7 @@ class BananaMimePart
         $signed =& $this->getSignedPart(); 
         if ($signed !== $this) { 
             return $signed->getText(); 
-        } 
+        }
         $this->decodeContent();
         return $this->body;
     }
@@ -452,6 +452,15 @@ class BananaMimePart
                                                                     'artid' => Banana::$artid,
                                                                     'part'  => $part)))
                  . '" alt="' . banana_htmlentities($this->filename) . '" />';
+        } else if ($type == 'multipart' && $subtype == 'alternative') {
+            $types =& Banana::$msgshow_mimeparts;
+            foreach ($types as $type) {
+                @list($type, $subtype) = explode('/', $type);
+                $part = $this->getParts($type, $subtype);
+                if (count($part) > 0) {
+                    return $part[0]->toHtml();
+                }
+            }
         } elseif ((!in_array($type, Banana::$msgshow_mimeparts)
                   && !in_array($this->content_type, Banana::$msgshow_mimeparts))
                   || $this->disposition == 'attachment') {