[Svn] r4491 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Fri Feb 4 09:23:45 CET 2011


Author: alec
Date: 2011-02-04 02:23:45 -0600 (Fri, 04 Feb 2011)
New Revision: 4491

Modified:
   trunk/roundcubemail/program/include/rcube_message.php
Log:
- Small code improvements related to r4487


Modified: trunk/roundcubemail/program/include/rcube_message.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_message.php	2011-02-03 22:08:03 UTC (rev 4490)
+++ trunk/roundcubemail/program/include/rcube_message.php	2011-02-04 08:23:45 UTC (rev 4491)
@@ -490,6 +490,7 @@
             // if this was a related part try to resolve references
             if ($mimetype == 'multipart/related' && sizeof($this->inline_parts)) {
                 $a_replaces = array();
+                $img_regexp = '/^image\/(gif|jpe?g|png|tiff|bmp|svg)/';
 
                 foreach ($this->inline_parts as $inline_object) {
                     $part_url = $this->get_part_url($inline_object->mime_id);
@@ -498,24 +499,24 @@
                     if ($inline_object->content_location) {
                         $a_replaces[$inline_object->content_location] = $part_url;
                     }
-                    // MS Outlook sends sometimes non-related attachments as related
-                    // In this case multipart/related message has only one text part
-                    // We'll add all such attachments to the attachments list
-                    if (!isset($got_html_part) && empty($inline_object->content_id)
-                        && !empty($inline_object->filename)
-                    ) {
-                        $this->attachments[] = $inline_object;
+
+                    if (!empty($inline_object->filename)) {
+                        // MS Outlook sends sometimes non-related attachments as related
+                        // In this case multipart/related message has only one text part
+                        // We'll add all such attachments to the attachments list
+                        if (!isset($got_html_part) && empty($inline_object->content_id)) {
+                            $this->attachments[] = $inline_object;
+                        }
+                        // MS Outlook sometimes also adds non-image attachments as related
+                        // We'll add all such attachments to the attachments list
+                        // Warning: some browsers support pdf in <img/>
+                        else if (!preg_match($img_regexp, $inline_object->mimetype)) {
+                            $this->attachments[] = $inline_object;
+                        }
+                        // @TODO: we should fetch HTML body and find attachment's content-id
+                        // to handle also image attachments without reference in the body
+                        // @TODO: should we list all image attachments in text mode?
                     }
-                    // MS Outlook sometimes also adds non-image attachments as related
-                    // We'll add all such attachments to the attachments list
-                    // Warning: some browsers support pdf in <img/>
-                    // @TODO: we should fetch HTML body and find attachment's content-id
-                    // to handle also image attachments without reference in the body
-                    if (!empty($inline_object->filename)
-                        && !preg_match('/^image\/(gif|jpe?g|png|tiff|bmp|svg)/', $inline_object->mimetype)
-                    ) {
-                        $this->attachments[] = $inline_object;
-                    }
                 }
 
                 // add replace array to each content part

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list