Changeset 4491 in subversion


Ignore:
Timestamp:
Feb 4, 2011 3:23:45 AM (2 years ago)
Author:
alec
Message:
  • Small code improvements related to r4487
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_message.php

    r4487 r4491  
    491491            if ($mimetype == 'multipart/related' && sizeof($this->inline_parts)) { 
    492492                $a_replaces = array(); 
     493                $img_regexp = '/^image\/(gif|jpe?g|png|tiff|bmp|svg)/'; 
    493494 
    494495                foreach ($this->inline_parts as $inline_object) { 
     
    499500                        $a_replaces[$inline_object->content_location] = $part_url; 
    500501                    } 
    501                     // MS Outlook sends sometimes non-related attachments as related 
    502                     // In this case multipart/related message has only one text part 
    503                     // We'll add all such attachments to the attachments list 
    504                     if (!isset($got_html_part) && empty($inline_object->content_id) 
    505                         && !empty($inline_object->filename) 
    506                     ) { 
    507                         $this->attachments[] = $inline_object; 
    508                     } 
    509                     // MS Outlook sometimes also adds non-image attachments as related 
    510                     // We'll add all such attachments to the attachments list 
    511                     // Warning: some browsers support pdf in <img/> 
    512                     // @TODO: we should fetch HTML body and find attachment's content-id 
    513                     // to handle also image attachments without reference in the body 
    514                     if (!empty($inline_object->filename) 
    515                         && !preg_match('/^image\/(gif|jpe?g|png|tiff|bmp|svg)/', $inline_object->mimetype) 
    516                     ) { 
    517                         $this->attachments[] = $inline_object; 
     502 
     503                    if (!empty($inline_object->filename)) { 
     504                        // MS Outlook sends sometimes non-related attachments as related 
     505                        // In this case multipart/related message has only one text part 
     506                        // We'll add all such attachments to the attachments list 
     507                        if (!isset($got_html_part) && empty($inline_object->content_id)) { 
     508                            $this->attachments[] = $inline_object; 
     509                        } 
     510                        // MS Outlook sometimes also adds non-image attachments as related 
     511                        // We'll add all such attachments to the attachments list 
     512                        // Warning: some browsers support pdf in <img/> 
     513                        else if (!preg_match($img_regexp, $inline_object->mimetype)) { 
     514                            $this->attachments[] = $inline_object; 
     515                        } 
     516                        // @TODO: we should fetch HTML body and find attachment's content-id 
     517                        // to handle also image attachments without reference in the body 
     518                        // @TODO: should we list all image attachments in text mode? 
    518519                    } 
    519520                } 
Note: See TracChangeset for help on using the changeset viewer.