1: <?php
2: /**
3: * This class handles message/external-body (RFC 2046 [5.2.3]) parts.
4: *
5: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (GPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/gpl.
9: *
10: * @author Michael Slusarz <slusarz@horde.org>
11: * @category Horde
12: * @license http://www.horde.org/licenses/gpl GPL
13: * @package IMP
14: */
15: class IMP_Mime_Viewer_Externalbody extends Horde_Mime_Viewer_Base
16: {
17: /**
18: */
19: protected $_metadata = array(
20: 'compressed' => false,
21: 'embedded' => true,
22: 'forceinline' => true
23: );
24:
25: /**
26: */
27: protected function _getEmbeddedMimeParts()
28: {
29: switch ($this->_mimepart->getContentTypeParameter('access-type')) {
30: case 'anon-ftp':
31: case 'ftp':
32: case 'local-file':
33: case 'mail-server':
34: case 'tftp':
35: // RFC 2046 [5.2.3.1]: Unsupported.
36: break;
37:
38: case 'content-id':
39: // RFC 1873
40: $imp_contents = $this->getConfigParam('imp_contents');
41: $base_part = $imp_contents->getMIMEMessage();
42: $cid = $this->_mimepart->getContentId();
43:
44: foreach (array_keys($base_part->contentTypeMap(true)) as $key) {
45: if (($part = $base_part->getPart($key)) &&
46: ($part->getContentId() == $cid) &&
47: ($part->getType() != 'message/external-body')) {
48: $full_part = clone $imp_contents->getMIMEPart($key);
49: $full_part->setMimeId($this->_mimepart->getMimeId());
50: // TODO: Add headers from referring body part.
51: return $full_part;
52: }
53: }
54: break;
55: }
56:
57: return null;
58: }
59:
60: }
61: