Overview

Packages

  • Mime
    • Viewer

Classes

  • Horde_Mime_Viewer
  • Horde_Mime_Viewer_Audio
  • Horde_Mime_Viewer_Base
  • Horde_Mime_Viewer_Deb
  • Horde_Mime_Viewer_Default
  • Horde_Mime_Viewer_Enriched
  • Horde_Mime_Viewer_Exception
  • Horde_Mime_Viewer_Html
  • Horde_Mime_Viewer_Images
  • Horde_Mime_Viewer_Msexcel
  • Horde_Mime_Viewer_Mspowerpoint
  • Horde_Mime_Viewer_Msword
  • Horde_Mime_Viewer_Ooo
  • Horde_Mime_Viewer_Pdf
  • Horde_Mime_Viewer_Plain
  • Horde_Mime_Viewer_Rar
  • Horde_Mime_Viewer_Report
  • Horde_Mime_Viewer_Rfc822
  • Horde_Mime_Viewer_Richtext
  • Horde_Mime_Viewer_Rpm
  • Horde_Mime_Viewer_Rtf
  • Horde_Mime_Viewer_Security
  • Horde_Mime_Viewer_Simple
  • Horde_Mime_Viewer_Smil
  • Horde_Mime_Viewer_Syntaxhighlighter
  • Horde_Mime_Viewer_Tgz
  • Horde_Mime_Viewer_Tnef
  • Horde_Mime_Viewer_Translation
  • Horde_Mime_Viewer_Wordperfect
  • Horde_Mime_Viewer_Zip
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Horde_Mime_Viewer_Rfc822 class renders out messages from the
 4:  * message/rfc822 content type.
 5:  *
 6:  * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * See the enclosed file COPYING for license information (GPL). If you
 9:  * did not receive this file, see http://www.horde.org/licenses/gpl.
10:  *
11:  * @author   Michael Slusarz <slusarz@horde.org>
12:  * @category Horde
13:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
14:  * @package  Mime_Viewer
15:  */
16: class Horde_Mime_Viewer_Rfc822 extends Horde_Mime_Viewer_Base
17: {
18:     /**
19:      * This driver's display capabilities.
20:      *
21:      * @var array
22:      */
23:     protected $_capability = array(
24:         'full' => true,
25:         'info' => true,
26:         'inline' => false,
27:         'raw' => false
28:     );
29: 
30:     /**
31:      * Return the full rendered version of the Horde_Mime_Part object.
32:      *
33:      * @return array  See parent::render().
34:      */
35:     protected function _render()
36:     {
37:         return $this->_renderReturn(
38:             null,
39:             'text/plain; charset=' . $this->getConfigParam('charset')
40:         );
41:     }
42: 
43:     /**
44:      * Return the rendered information about the Horde_Mime_Part object.
45:      *
46:      * @return array  See parent::render().
47:      */
48:     protected function _renderInfo()
49:     {
50:         /* Get the text of the part.  Since we need to look for the end of
51:          * the headers by searching for the CRLFCRLF sequence, use
52:          * getCanonicalContents() to make sure we are getting the text with
53:          * CRLF's. */
54:         $text = $this->_mimepart->getContents(array('canonical' => true));
55:         if (empty($text)) {
56:             return array();
57:         }
58: 
59:         /* Search for the end of the header text (CRLFCRLF). */
60:         $text = substr($text, 0, strpos($text, "\r\n\r\n"));
61: 
62:         /* Get the list of headers now. */
63:         $headers = Horde_Mime_Headers::parseHeaders($text);
64: 
65:         $header_array = array(
66:             'date' => Horde_Mime_Viewer_Translation::t("Date"),
67:             'from' => Horde_Mime_Viewer_Translation::t("From"),
68:             'to' => Horde_Mime_Viewer_Translation::t("To"),
69:             'cc' => Horde_Mime_Viewer_Translation::t("Cc"),
70:             'bcc' => Horde_Mime_Viewer_Translation::t("Bcc"),
71:             'reply-to' => Horde_Mime_Viewer_Translation::t("Reply-To"),
72:             'subject' => Horde_Mime_Viewer_Translation::t("Subject")
73:         );
74:         $header_output = array();
75: 
76:         foreach ($header_array as $key => $val) {
77:             $hdr = $headers->getValue($key);
78:             if (!empty($hdr)) {
79:                 $header_output[] = '<strong>' . $val . ':</strong> ' . htmlspecialchars($hdr);
80:             }
81:         }
82: 
83:         return $this->_renderReturn(
84:             (empty($header_output) ? '' : ('<div class="fixed mimeHeaders">' . $this->_textFilter(implode("<br />\n", $header_output), 'emails') . '</div>')),
85:             'text/html; charset=UTF-8'
86:         );
87:     }
88: 
89: }
90: 
API documentation generated by ApiGen