/usr/share/php/Horde/Mime/Viewer/Rfc822.php is in php-horde-mime-viewer 2.1.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | <?php
/**
* The Horde_Mime_Viewer_Rfc822 class renders out messages from the
* message/rfc822 content type.
*
* Copyright 2002-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Mime_Viewer
*/
class Horde_Mime_Viewer_Rfc822 extends Horde_Mime_Viewer_Base
{
/**
* This driver's display capabilities.
*
* @var array
*/
protected $_capability = array(
'full' => true,
'info' => true,
'inline' => false,
'raw' => false
);
/**
* Return the full rendered version of the Horde_Mime_Part object.
*
* @return array See parent::render().
*/
protected function _render()
{
return $this->_renderReturn(
null,
'text/plain; charset=' . $this->getConfigParam('charset')
);
}
/**
* Return the rendered information about the Horde_Mime_Part object.
*
* @return array See parent::render().
*/
protected function _renderInfo()
{
/* Get the text of the part. Since we need to look for the end of
* the headers by searching for the CRLFCRLF sequence, use
* getCanonicalContents() to make sure we are getting the text with
* CRLF's. */
$text = $this->_mimepart->getContents(array('canonical' => true));
if (empty($text)) {
return array();
}
/* Search for the end of the header text (CRLFCRLF). */
$text = substr($text, 0, strpos($text, "\r\n\r\n"));
/* Get the list of headers now. */
$headers = Horde_Mime_Headers::parseHeaders($text);
$header_array = array(
'date' => Horde_Mime_Viewer_Translation::t("Date"),
'from' => Horde_Mime_Viewer_Translation::t("From"),
'to' => Horde_Mime_Viewer_Translation::t("To"),
'cc' => Horde_Mime_Viewer_Translation::t("Cc"),
'bcc' => Horde_Mime_Viewer_Translation::t("Bcc"),
'reply-to' => Horde_Mime_Viewer_Translation::t("Reply-To"),
'subject' => Horde_Mime_Viewer_Translation::t("Subject")
);
$header_output = array();
foreach ($header_array as $key => $val) {
$hdr = $this->_getHeaderValue($headers, $key);
if (!empty($hdr)) {
$header_output[] = '<strong>' . $val . ':</strong> ' . htmlspecialchars($hdr);
}
}
return $this->_renderReturn(
(empty($header_output) ? '' : ('<div class="fixed mimeHeaders">' . $this->_textFilter(implode("<br />\n", $header_output), 'emails') . '</div>')),
'text/html; charset=UTF-8'
);
}
/**
* Get the value for a given header.
*
* @param Horde_Mime_Headers $ob The headers object.
* @param string $header The header.
*
* @return string The header value.
*/
protected function _getHeaderValue($ob, $header)
{
return $ob->getValue($header);
}
}
|