From: Michael M Slusarz Date: Wed, 19 Nov 2008 05:26:50 +0000 (-0700) Subject: Currently, can't do anything with gzip only data. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=832835327561e883af21b2c6b1b3ae91145e4104;p=horde.git Currently, can't do anything with gzip only data. TODO: implement IMP zip-like driver to allow browsing/downloading of both gzip files and tar files. --- diff --git a/framework/Mime/lib/Horde/Mime/Viewer/tgz.php b/framework/Mime/lib/Horde/Mime/Viewer/tgz.php index 1bb108872..a042b773e 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/tgz.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/tgz.php @@ -19,8 +19,8 @@ class Horde_Mime_Viewer_tgz extends Horde_Mime_Viewer_Driver */ protected $_capability = array( 'embedded' => false, - 'full' => true, - 'info' => false, + 'full' => false, + 'info' => true, 'inline' => true ); @@ -35,36 +35,25 @@ class Horde_Mime_Viewer_tgz extends Horde_Mime_Viewer_Driver ); /** - * Return the full rendered version of the Horde_Mime_Part object. - * - * @return array See Horde_Mime_Viewer_Driver::render(). - */ - protected function _render() - { - $ret = $this->_renderInline(); - if (!empty($ret)) { - reset($ret); - $ret[key($ret)]['data'] = '' . $ret[key($ret)]['data'] . ''; - } - return $ret; - } - - /** * Return the rendered inline version of the Horde_Mime_Part object. * * @return array See Horde_Mime_Viewer_Driver::render(). */ protected function _renderInline() { + /* Currently, can't do anything without tar file. */ + $subtype = $this->_mimepart->getSubType(); + if (in_array($subtype, array('gzip', 'x-gzip', 'x-gzip-compressed'))) { + return array(); + } + $contents = $this->_mimepart->getContents(); - /* Only decompress gzipped files. */ - $subtype = $this->_mimepart->getSubType(); + /* Decompress gzipped files. */ if (in_array($subtype, $this->_gzipSubtypes)) { $gzip = &Horde_Compress::singleton('gzip'); $contents = $gzip->decompress($contents); - if (is_a($contents, 'PEAR_Error') || - empty($contents)) { + if (is_a($contents, 'PEAR_Error') || empty($contents)) { return array(); } } @@ -115,4 +104,14 @@ class Horde_Mime_Viewer_tgz extends Horde_Mime_Viewer_Driver ) ); } + + /** + * Return the rendered information about the Horde_Mime_Part object. + * + * @return array See Horde_Mime_Viewer_Driver::render(). + */ + protected function _renderInfo() + { + return $this->_renderInline(); + } }