From: Michael M Slusarz Date: Wed, 12 Nov 2008 18:47:50 +0000 (-0700) Subject: Update debian Viewer. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=41f963a3c4b95286b982363af5a642f7ad9ee6e3;p=horde.git Update debian Viewer. --- diff --git a/framework/Mime/lib/Horde/Mime/Viewer/deb.php b/framework/Mime/lib/Horde/Mime/Viewer/deb.php index d848f06e2..233f48a2e 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/deb.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/deb.php @@ -14,41 +14,57 @@ class Horde_Mime_Viewer_deb extends Horde_Mime_Viewer_Driver { /** - * Render the data. + * Can this driver render various views? * - * @param array $params Any parameters the viewer may need. + * @var boolean + */ + protected $_capability = array( + 'embedded' => false, + 'full' => true, + 'info' => false, + 'inline' => true + ); + + /** + * 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)) { + $ret['data'] = '' . $ret['data'] . ''; + } + return $ret; + } + + /** + * Return the rendered inline version of the Horde_Mime_Part object. * - * @return string The rendered data. + * @return array See Horde_Mime_Viewer_Driver::render(). */ - public function render($params = array()) + protected function _renderInline() { - /* Check to make sure the program actually exists. */ - if (!file_exists($GLOBALS['mime_drivers']['horde']['deb']['location'])) { - return '
' . sprintf(_("The program used to view this data type (%s) was not found on the system."), $GLOBALS['mime_drivers']['horde']['deb']['location']) . '
'; + /* Check to make sure the viewer program exists. */ + if (!isset($this->_conf['location']) || + !file_exists($this->_conf['location'])) { + return array(); } $tmp_deb = Horde::getTempFile('horde_deb'); - $fh = fopen($tmp_deb, 'w'); - fwrite($fh, $this->mime_part->getContents()); - fclose($fh); + file_put_contents($tmp_deb, $this->_mimepart->getContents()); - $fh = popen($GLOBALS['mime_drivers']['horde']['deb']['location'] . " -f $tmp_deb 2>&1", 'r'); + $fh = popen($this->_conf['location'] . " -f $tmp_deb 2>&1", 'r'); while (($rc = fgets($fh, 8192))) { $data .= $rc; } pclose($fh); - return '
' . htmlspecialchars($data) . '
'; - } - - /** - * Return the MIME content type of the rendered content. - * - * @return string The content type of the output. - */ - public function getType() - { - return 'text/html; charset=' . NLS::getCharset(); + return array( + 'data' => '
' . htmlspecialchars($data) . '
', + 'type' => 'text/html; charset=' . NLS::getCharset() + ); } }