[ Index ]
 

Code source de IMP H3 (4.1.5)

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/lib/MIME/Viewer/ -> notification.php (source)

   1  <?php
   2  /**
   3   * The IMP_MIME_Viewer_notification class handles multipart/report messages
   4   * that refer to mail notification messages (RFC 2298).
   5   *
   6   * $Horde: imp/lib/MIME/Viewer/notification.php,v 1.14.10.8 2007/01/02 13:55:00 jan Exp $
   7   *
   8   * Copyright 2003-2007 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   IMP 4.0
  15   * @package Horde_MIME_Viewer
  16   */
  17  class IMP_MIME_Viewer_notification extends MIME_Viewer {
  18  
  19      /**
  20       * Render out the currently set contents.
  21       *
  22       * @param array $params  An array with a reference to a MIME_Contents
  23       *                       object.
  24       *
  25       * @return string  The rendered text in HTML.
  26       */
  27      function render($params)
  28      {
  29          $contents = &$params[0];
  30  
  31          /* If this is a straight message/disposition-notification part, just
  32             output the text. */
  33          if ($this->mime_part->getType() == 'message/disposition-notification') {
  34              $part = &new MIME_Part('text/plain');
  35              $part->setContents($this->mime_part->getContents());
  36              return '<pre>' . htmlentities($contents->renderMIMEPart($part)) . '</pre>';
  37          }
  38  
  39          global $registry;
  40  
  41          /* RFC 2298 [3]: There are three parts to a delivery status
  42             multipart/report message:
  43               (1) Human readable message
  44               (2) Machine parsable body part (message/disposition-notification)
  45               (3) Original message (optional) */
  46  
  47          /* Print the human readable message. */
  48          $part = $contents->getDecodedMIMEPart($this->mime_part->getRelativeMIMEId(1));
  49          $status = array(
  50              _("A message you have sent has resulted in a return notification from the recipient."),
  51              _("The mail server generated the following informational message:")
  52          );
  53          $statusimg = Horde::img('alerts/message.png', _("Attention"), 'height="16" width="16"', $registry->getImageDir('horde'));
  54          $text = $contents->formatStatusMsg($status, $statusimg) .
  55              '<blockquote>' . $contents->renderMIMEPart($part) . '</blockquote>' . "\n";
  56  
  57          /* Display a link to more detailed message. */
  58          $part = $contents->getDecodedMIMEPart($this->mime_part->getRelativeMIMEId(2));
  59  
  60          $status = array();
  61          $statusimg = Horde::img('info_icon.png', _("Info"), 'height="16" width="16"', $registry->getImageDir('horde'));
  62          $status[] = sprintf(_("Additional information can be viewed %s."), $contents->linkViewJS($part, 'view_attach', _("HERE"), _("Additional information details")));
  63  
  64          /* Display a link to the sent message. Try to download the text of
  65             the message/rfc822 part first, if it exists. */
  66          if (($part = $contents->getDecodedMIMEPart($this->mime_part->getRelativeMIMEId('3.0'))) ||
  67              ($part = $contents->getDecodedMIMEPart($this->mime_part->getRelativeMIMEId(3)))) {
  68              $status[] = sprintf(_("The text of the sent message can be viewed %s."), $contents->linkViewJS($part, 'view_attach', _("HERE"), _("The text of the sent message")));
  69          }
  70  
  71          $text .= $contents->formatStatusMsg($status, $statusimg, false);
  72  
  73          return $text;
  74      }
  75  
  76  
  77      /**
  78       * Return the content-type.
  79       *
  80       * @return string  The content-type of the message.
  81       */
  82      function getType()
  83      {
  84          return 'text/html; charset=' . NLS::getCharset();
  85      }
  86  
  87  }


Généré le : Thu Nov 29 12:30:07 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics