File: rfc822.php

package info (click to toggle)
imp4 4.2-4lenny3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 18,252 kB
  • ctags: 5,316
  • sloc: php: 21,340; xml: 19,302; makefile: 68; sql: 14
file content (68 lines) | stat: -rw-r--r-- 1,999 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

require_once 'Horde/MIME/Viewer/rfc822.php';

/**
 * The IMP_MIME_Viewer_rfc822 class renders out messages from
 * message/rfc822 content types.
 *
 * $Horde: imp/lib/MIME/Viewer/rfc822.php,v 1.26.10.13 2008/01/02 11:31:51 jan Exp $
 *
 * Copyright 2002-2008 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author  Michael Slusarz <slusarz@horde.org>
 * @package Horde_MIME_Viewer
 */
class IMP_MIME_Viewer_rfc822 extends MIME_Viewer_rfc822 {

    /**
     * Render out the currently set contents.
     *
     * @param array $params  An array with a reference to a MIME_Contents
     *                       object.
     *
     * @return string  The rendered text in HTML.
     */
    function render($params)
    {
        $contents = &$params[0];

        /* Get the entire body part of the message/rfc822 contents. */
        if (!$this->mime_part->getInformation('imp_contents_set') &&
            is_a($contents, 'IMP_Contents') &&
            $this->mime_part->getMIMEId()) {
            $this->mime_part = &$contents->getDecodedMIMEPart($this->mime_part->getMIMEId(), true);
        }

        return parent::render();
    }

    /**
     * Render out attachment information.
     *
     * @param array $params  An array with a reference to a MIME_Contents
     *                       object.
     *
     * @return string  The rendered text in HTML.
     */
    function renderAttachmentInfo($params)
    {
        $contents = &$params[0];

        if (is_a($contents, 'IMP_Contents') &&
            !$this->mime_part->getContents()) {
            $id = $this->mime_part->getMIMEId();
            $hdr_id = substr($id, -2);
            if ($hdr_id != '.0') {
                $id .= '.0';
            }
            $this->mime_part = &$contents->getDecodedMIMEPart($id);
        }

        return parent::renderAttachmentInfo();
    }

}