3
* The MIME_Viewer_security class is a wrapper used to load the appropriate
4
* MIME_Viewer for secure multipart messages (defined by RFC 1847). This
5
* class handles multipart/signed and multipart/encrypted data.
7
* $Horde: framework/MIME/MIME/Viewer/security.php,v 1.6.10.1 2005/01/03 12:19:06 jan Exp $
9
* Copyright 2002-2005 Michael Slusarz <slusarz@bigworm.colorado.edu>
11
* See the enclosed file COPYING for license information (LGPL). If you
12
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
14
* @author Michael Slusarz <slusarz@bigworm.colorado.edu>
15
* @version $Revision: 1.6.10.1 $
17
* @package Horde_MIME_Viewer
19
class MIME_Viewer_security extends MIME_Viewer {
22
* Stores the MIME_Viewer of the specified security protocol.
24
* @var object MIME_Viewer $_viewer
30
* The $mime_part class variable has the information to render
31
* out, encapsulated in a MIME_Part object.
35
* @param $params mixed The parameters (if any) to pass to the underlying
38
* @return string Rendering of the content.
40
function render($params = array())
42
/* Get the appropriate MIME_Viewer for the protocol specified. */
43
if (!($this->_resolveViewer())) {
47
/* Render using the loaded MIME_Viewer object. */
48
return $this->_viewer->render($params);
52
* Returns the content-type of the Viewer used to view the part.
56
* @return string A content-type string.
60
/* Get the appropriate MIME_Viewer for the protocol specified. */
61
if (!($this->_resolveViewer())) {
62
return 'application/octet-stream';
64
return $this->_viewer->getType();
69
* Load a MIME_Viewer according to the protocol parameter stored
70
* in the MIME_Part to render. If unsuccessful, try to load a generic
71
* multipart MIME_Viewer.
75
* @return boolean True on success, false on failure.
77
function _resolveViewer()
81
if (empty($this->_viewer)) {
82
$protocol = $this->mime_part->getContentTypeParameter('protocol');
83
if (empty($protocol)) {
86
$viewer = &MIME_Viewer::factory($this->mime_part, $protocol);
88
(String::lower(get_class($viewer)) == 'mime_viewer_default')) {
89
$viewer = &MIME_Viewer::factory($this->mime_part, $this->mime_part->getPrimaryType() . '/*');
94
$this->_viewer = $viewer;