From 83fe90ba39c1bfcb7946947200221e33689f011e Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 18 Feb 2009 23:34:07 -0700 Subject: [PATCH] Use abiword for msword display --- framework/Mime/lib/Horde/Mime/Viewer/msword.php | 36 ++++++++----------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/framework/Mime/lib/Horde/Mime/Viewer/msword.php b/framework/Mime/lib/Horde/Mime/Viewer/msword.php index ce205e509..945ee9b62 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/msword.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/msword.php @@ -1,7 +1,7 @@ _conf['location']) . "\\wvHtml.xml -d $tmp_dir -1 $tmp_word > $tmp_output"; - } else { - $version = exec($this->_conf['location'] . ' --version'); - $args = (version_compare($version, '0.7.0') >= 0) - ? " --charset=$charset --targetdir=$tmp_dir $tmp_word $tmp_file" - : " $tmp_word $tmp_output"; - } - - $fh = fopen($tmp_word, 'w'); - fwrite($fh, $this->_mimepart->getContents()); - fclose($fh); + file_put_contents($tmp_word, $this->_mimepart->getContents()); + $args = ' --to=html --to-name=' . $tmp_output . ' ' . $tmp_word; exec($this->_conf['location'] . $args); if (file_exists($tmp_output)) { - return array( - $this->_mimepart->getMimeId() => array( - 'data' => file_get_contents($tmp_output), - 'status' => array(), - 'type' => 'text/html; charset=' . $charset - ) - ); + $data = file_get_contents($tmp_output); + $type = 'text/html'; + } else { + $data = _("Unable to translate this Word document"); + $type = 'text/plain'; } return array( $this->_mimepart->getMimeId() => array( - 'data' => _("Unable to translate this Word document"), + 'data' => $data, 'status' => array(), - 'type' => 'text/plain; charset=' . $charset + 'type' => $type . '; charset=' . NLS::getCharset() ) ); } -- 2.11.0