[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 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. 6 * 7 * $Horde: framework/MIME/MIME/Viewer/security.php,v 1.6.10.5 2006/01/01 21:28:25 jan Exp $ 8 * 9 * Copyright 2002-2006 Michael Slusarz <slusarz@bigworm.colorado.edu> 10 * 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. 13 * 14 * @author Michael Slusarz <slusarz@bigworm.colorado.edu> 15 * @since Horde 3.0 16 * @package Horde_MIME_Viewer 17 */ 18 class MIME_Viewer_security extends MIME_Viewer { 19 20 /** 21 * Stores the MIME_Viewer of the specified security protocol. 22 * 23 * @var MIME_Viewer 24 */ 25 var $_viewer; 26 27 /** 28 * The $mime_part class variable has the information to render 29 * out, encapsulated in a MIME_Part object. 30 * 31 * @param $params mixed The parameters (if any) to pass to the underlying 32 * MIME_Viewer. 33 * 34 * @return string Rendering of the content. 35 */ 36 function render($params = array()) 37 { 38 /* Get the appropriate MIME_Viewer for the protocol specified. */ 39 if (!($this->_resolveViewer())) { 40 return; 41 } 42 43 /* Render using the loaded MIME_Viewer object. */ 44 return $this->_viewer->render($params); 45 } 46 47 /** 48 * Returns the content-type of the Viewer used to view the part. 49 * 50 * @return string A content-type string. 51 */ 52 function getType() 53 { 54 /* Get the appropriate MIME_Viewer for the protocol specified. */ 55 if (!($this->_resolveViewer())) { 56 return 'application/octet-stream'; 57 } else { 58 return $this->_viewer->getType(); 59 } 60 } 61 62 /** 63 * Load a MIME_Viewer according to the protocol parameter stored 64 * in the MIME_Part to render. If unsuccessful, try to load a generic 65 * multipart MIME_Viewer. 66 * 67 * @access private 68 * 69 * @return boolean True on success, false on failure. 70 */ 71 function _resolveViewer() 72 { 73 $viewer = null; 74 75 if (empty($this->_viewer)) { 76 $protocol = $this->mime_part->getContentTypeParameter('protocol'); 77 if (empty($protocol)) { 78 return false; 79 } 80 $viewer = &MIME_Viewer::factory($this->mime_part, $protocol); 81 if (empty($viewer) || 82 (String::lower(get_class($viewer)) == 'mime_viewer_default')) { 83 $viewer = &MIME_Viewer::factory($this->mime_part, $this->mime_part->getPrimaryType() . '/*'); 84 if (empty($viewer)) { 85 return false; 86 } 87 } 88 $this->_viewer = $viewer; 89 } 90 91 return true; 92 } 93 94 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |