[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <?php 2 /** 3 * The IMP_MIME_Viewer_partial class allows multipart/partial messages to be 4 * displayed (RFC 2046 [5.2.2]). 5 * 6 * $Horde: imp/lib/MIME/Viewer/partial.php,v 1.17.10.11 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_partial 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 global $imp; 32 33 $base_ob = &$contents->getBaseObjectPtr(); 34 $curr_index = $base_ob->getMessageIndex(); 35 $id = $this->mime_part->getContentTypeParameter('id'); 36 $parts = array(); 37 38 require_once IMP_BASE . '/lib/IMAP/Search.php'; 39 require_once 'Horde/MIME/Contents.php'; 40 require_once 'Horde/MIME/Structure.php'; 41 42 /* Perform the search to find the other parts of the message. */ 43 $imap_search = &IMP_IMAP_Search::singleton(array('pop3' => ($imp['base_protocol'] == 'pop3'))); 44 $query = &new IMP_IMAP_Search_Query(); 45 $query->header('Content-Type', $id); 46 $indices = $imap_search->searchMailbox($query, $imp['stream'], IMP::serverString($imp['mailbox'])); 47 48 /* If not able to find the other parts of the message, print error. */ 49 if (count($indices) != $this->mime_part->getContentTypeParameter('total')) { 50 return $contents->formatStatusMsg(sprintf(_("Cannot display - found only %s of %s parts of this message in the current mailbox."), count($indices), $this->mime_part->getContentTypeParameter('total'))); 51 } 52 53 /* Get the contents of each of the parts. */ 54 foreach ($indices as $val) { 55 /* No need to fetch the current part again. */ 56 if ($val == $curr_index) { 57 $parts[$this->mime_part->getContentTypeParameter('number')] = $this->mime_part->getContents(); 58 } else { 59 require_once IMP_BASE . '/lib/MIME/Contents.php'; 60 require_once IMP_BASE . '/lib/MIME/Headers.php'; 61 $imp_contents = &IMP_Contents::singleton($val . IMP_IDX_SEP . $_SESSION['imp']['thismailbox']); 62 $part = &$imp_contents->getMIMEPart(0); 63 $parts[$part->getContentTypeParameter('number')] = $imp_contents->getBody(); 64 } 65 } 66 67 /* Sort the parts in numerical order. */ 68 ksort($parts, SORT_NUMERIC); 69 70 /* Combine the parts and render the underlying data. */ 71 $mime_message = &MIME_Structure::parseTextMIMEMessage(implode('', $parts)); 72 $mc = &new MIME_Contents($mime_message, array('download' => 'download_attach', 'view' => 'view_attach'), array(&$contents)); 73 $mc->buildMessage(); 74 75 return '<table>' . $mc->getMessage(true) . '</table>'; 76 } 77 78 /** 79 * Return the content-type of the rendered output. 80 * 81 * @return string The content-type of the output. 82 */ 83 function getType() 84 { 85 return 'text/html; charset=' . NLS::getCharset(); 86 } 87 88 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:30:07 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |