Changeset c505e59 in github


Ignore:
Timestamp:
Sep 5, 2008 5:29:06 AM (5 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
a6d7a9f
Parents:
c8a21d6
Message:

Respect Content-Location headers in multipart/related messages (#1484946)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r0dbac32 rc505e59  
    22--------------------------- 
    33 
    4 2008/09/04 (thomasb) 
     42008/09/05 (thomasb) 
    55---------- 
    66- Enable export of address book contacts as vCard 
     7- Respect Content-Location headers in multipart/related messages according to RFC2110 (#1484946) 
    78 
    892008/09/04 (alec) 
  • program/include/rcube_imap.php

    r97e9d16 rc505e59  
    11501150        $struct->disposition = 'inline'; 
    11511151      } 
    1152  
    1153     // fetch message headers if message/rfc822 
    1154     if ($struct->ctype_primary=='message') 
    1155       { 
    1156       $headers = iil_C_FetchPartBody($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id.'.HEADER'); 
    1157       $struct->headers = $this->_parse_headers($headers); 
    1158        
     1152     
     1153    // fetch message headers if message/rfc822 or named part (could contain Content-Location header) 
     1154    if ($struct->ctype_primary == 'message' || ($struct->ctype_parameters['name'] && !$struct->content_id)) { 
     1155      $part_headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id); 
     1156      $struct->headers = $this->_parse_headers($part_headers) + $struct->headers; 
     1157    } 
     1158 
     1159    if ($struct->ctype_primary=='message') { 
    11591160      if (is_array($part[8]) && empty($struct->parts)) 
    11601161        $struct->parts[] = $this->_structure_part($part[8], ++$count, $struct->mime_id); 
    1161       } 
     1162    } 
    11621163 
    11631164    // normalize filename property 
  • program/include/rcube_message.php

    r82bac87 rc505e59  
    357357            $this->inline_parts[] = $mail_part; 
    358358          } 
     359          else if ($message_ctype_secondary == 'related' && $mail_part->headers['content-location']) { 
     360            $mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location']; 
     361            $this->inline_parts[] = $mail_part; 
     362          } 
    359363          // is regular attachment 
    360364          else { 
     
    371375 
    372376        foreach ($this->inline_parts as $inline_object) { 
    373           $a_replaces['cid:'.$inline_object->content_id] = $this->get_part_url($inline_object->mime_id); 
     377          $part_url = $this->get_part_url($inline_object->mime_id); 
     378          if ($inline_object->content_id) 
     379            $a_replaces['cid:'.$inline_object->content_id] = $part_url; 
     380          if ($inline_object->content_location) 
     381            $a_replaces[$inline_object->content_location] = $part_url; 
    374382        } 
    375383 
  • program/lib/washtml.php

    rd368a68 rc505e59  
    133133                 ')\s*/i', $str, $match)) { 
    134134          if($match[2]) { 
    135             if(preg_match('/^(http|https|ftp):.*$/i', $match[2], $url)) { 
     135            if($src = $this->config['cid_map'][$match[2]]) 
     136              $value .= ' url(\''.htmlspecialchars($src, ENT_QUOTES) . '\')'; 
     137            else if(preg_match('/^(http|https|ftp):.*$/i', $match[2], $url)) { 
    136138              if($this->config['allow_remote']) 
    137139                $value .= ' url(\''.htmlspecialchars($url[0], ENT_QUOTES).'\')'; 
    138140              else 
    139141                $this->extlinks = true; 
    140             } else if(preg_match('/^cid:(.*)$/i', $match[2], $cid)) 
    141               $value .= ' url(\''.htmlspecialchars($this->config['cid_map']['cid:'.$cid[1]], ENT_QUOTES) . '\')'; 
     142            } 
    142143          } else if($match[0] != 'url' && $match[0] != 'rbg')//whitelist ? 
    143144            $value .= ' ' . $match[0]; 
     
    165166        $t .= ' style="' . $style . '"'; 
    166167      else if($key == 'src' && strtolower($node->tagName) == 'img') { //check tagName anyway 
    167         if(preg_match('/^(http|https|ftp):.*/i', $value)) { 
     168        if($src = $this->config['cid_map'][$value]) { 
     169          $t .= ' ' . $key . '="' . htmlspecialchars($src, ENT_QUOTES) . '"'; 
     170        } 
     171        else if(preg_match('/^(http|https|ftp):.*/i', $value)) { 
    168172          if($this->config['allow_remote']) 
    169173            $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; 
     
    173177              $t .= ' src="' . htmlspecialchars($this->config['blocked_src'], ENT_QUOTES) . '"'; 
    174178          } 
    175         } else if(preg_match('/^cid:(.*)$/i', $value, $cid)) 
    176           $t .= ' ' . $key . '="' . htmlspecialchars($this->config['cid_map']['cid:'.$cid[1]], ENT_QUOTES) . '"'; 
     179        } 
    177180      } else 
    178181        $washed .= ($washed?' ':'') . $key; 
Note: See TracChangeset for help on using the changeset viewer.