1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: class Horde_Mime_Viewer_Rfc822 extends Horde_Mime_Viewer_Base
17: {
18: 19: 20: 21: 22:
23: protected $_capability = array(
24: 'full' => true,
25: 'info' => true,
26: 'inline' => false,
27: 'raw' => false
28: );
29:
30: 31: 32: 33: 34:
35: protected function _render()
36: {
37: return $this->_renderReturn(
38: null,
39: 'text/plain; charset=' . $this->getConfigParam('charset')
40: );
41: }
42:
43: 44: 45: 46: 47:
48: protected function _renderInfo()
49: {
50: 51: 52: 53:
54: $text = $this->_mimepart->getContents(array('canonical' => true));
55: if (empty($text)) {
56: return array();
57: }
58:
59:
60: $text = substr($text, 0, strpos($text, "\r\n\r\n"));
61:
62:
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: