[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/MIME/Viewer/ -> rfc822.php (source)

   1  <?php
   2  /**
   3   * The MIME_Viewer_rfc822 class renders out messages from the
   4   * message/rfc822 content type.
   5   *
   6   * $Horde: framework/MIME/MIME/Viewer/rfc822.php,v 1.8.10.8 2006/01/01 21:28:25 jan Exp $
   7   *
   8   * Copyright 2002-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>
   9   *
  10   * See the enclosed file COPYING for license information (GPL). If you
  11   * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  12   *
  13   * @author  Michael Slusarz <slusarz@bigworm.colorado.edu>
  14   * @since   Horde 3.0
  15   * @package Horde_MIME_Viewer
  16   */
  17  class MIME_Viewer_rfc822 extends MIME_Viewer {
  18  
  19      /**
  20       * Render out the currently set contents.
  21       *
  22       * @param array $params  An array with any parameters needed.
  23       *
  24       * @return string  The rendered text.
  25       */
  26      function render($params = array())
  27      {
  28          $part = $this->mime_part;
  29          $part->transferDecodeContents();
  30  
  31          $text = $part->getContents();
  32          if (!$text) {
  33              require_once 'Horde/MIME/Contents.php';
  34              $contents = &new MIME_Contents(new MIME_Part());
  35              return $contents->formatStatusMsg(_("There was an error displaying this message part"));
  36          } else {
  37              return $text;
  38          }
  39      }
  40  
  41      /**
  42       * Render out attachment information.
  43       *
  44       * @param array $params  An array with any parameters needed.
  45       *
  46       * @return string  The rendered text in HTML.
  47       */
  48      function renderAttachmentInfo($params = array())
  49      {
  50          $msg = '';
  51  
  52          /* Get the text of the part.  Since we need to look for the end of
  53           * the headers by searching for the CRLFCRLF sequence, use
  54           * getCanonicalContents() to make sure we are getting the text with
  55           * CRLF's. */
  56          $text = $this->mime_part->getCanonicalContents();
  57  
  58          /* Search for the end of the header text (CRLFCRLF). */
  59          $text = substr($text, 0, strpos($text, "\r\n\r\n"));
  60  
  61          /* Get the list of headers now. */
  62          require_once 'Horde/MIME/Structure.php';
  63          $headers = MIME_Structure::parseMIMEHeaders($text, true, true);
  64  
  65          require_once 'Horde/MIME/Contents.php';
  66          $contents = &new MIME_Contents(new MIME_Part());
  67          $msg = $contents->formatStatusMsg(_("The following are the headers for this message/rfc822 message."), Horde::img('info_icon.png', _("Info"), 'height="16" width="16"', $GLOBALS['registry']->getImageDir('horde')), false);
  68  
  69          $msg .= '<span class="fixed">';
  70  
  71          $header_array = array(
  72              'date' => _("Date"),
  73              'subject' => _("Subject"),
  74              'from' => _("From"),
  75              'to' => _("To")
  76          );
  77          $header_output = array();
  78  
  79          foreach ($header_array as $key => $val) {
  80              if (isset($headers[$key])) {
  81                  if (is_array($headers[$key])) {
  82                      $headers[$key] = $headers[$key][0];
  83                  }
  84                  $header_output[] = '<strong>' . $val . ':</strong> ' . $headers[$key];
  85              }
  86          }
  87  
  88          require_once 'Horde/Text/Filter.php';
  89          $msg .= implode("<br />\n", Text_Filter::filter($header_output, 'emails')) . '</span>';
  90  
  91          return $msg;
  92      }
  93  
  94      /**
  95       * Return the MIME content type for the rendered data.
  96       *
  97       * @return string  The content type of the data.
  98       */
  99      function getType()
 100      {
 101          return 'text/plain; charset=' . NLS::getCharset();
 102      }
 103  
 104  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7