diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-02-04 08:23:45 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-02-04 08:23:45 +0000 |
| commit | 55714c4a5fb709c2dd08e8684c1a9336f3f0b20e (patch) | |
| tree | e8399e59be9d37103b5f4f695bc7df644aacde16 /roundcubemail/program/include | |
| parent | 6cf335e8f6ce162642c5e565f43c0c161ace1dd2 (diff) | |
- Small code improvements related to r4487
git-svn-id: https://svn.roundcube.net/trunk@4491 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_message.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/roundcubemail/program/include/rcube_message.php b/roundcubemail/program/include/rcube_message.php index ec034db69..3a96a0b7b 100644 --- a/roundcubemail/program/include/rcube_message.php +++ b/roundcubemail/program/include/rcube_message.php @@ -490,6 +490,7 @@ class rcube_message // 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,23 +499,23 @@ class rcube_message 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; - } - // 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; + + 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? } } |
