6.0.0-git
2024-03-19
Last Modified 2011-11-29 by Guest

Note: this is Apache-centric but read on at the end for a a potential IIS solution
Note: works only with horde 3
For Apache:
The wvHtml component of wvWare 1 can be used to generate HTML renderings of Microsoft Word documents. If wvHtml is installed, and Horde is configured to use it to view Word Documents, the msword MIME Viewer class will be invoked to generate the converted HTML document. Any embedded contents of the Word Document, specifically graphics, will be placed in the upload_tmp_dir location, as configured in your php.ini, OR, if you have defined tmpdir in horde/conf.php, that value will be used.

However, the MIME viewer class for msword returns a web page that includes image links that point to the Horde webroot. A solution some people have used is to modify the Horde or IMP code to actually write the graphics files to those locations, but this has security implications.

A more secure solution, which requires no modification to Horde, or IMP, is to leverage the Apache mod_rewrite module to rewrite wvHtml graphics links on the fly and redirect them to your temporary directory.

To do this, you must obviously have Apache installed, and the mod_rewrite module installed and enabled for your Horde installation (see the Apache mod_rewrite documentation for configuration information2)

  1. Figure out your upload_tmp_dir value (referred to as $tmpdir from here on out)
    • If using the default PHP value, this is usually /tmp.
    • If you have set 'tmpdir' in horde/conf.php, use this value instead.
    • Regardless, this directory should NOT be located underneath your Apache DocumentRoot
  2. Make sure you have horde/mime_drivers.php configured to use wvHtml for msword documents
  3. Add a RewriteRule to your Apache configuration
    • RewriteRule ^$webroot/imp/msword(.+) $tmpdir/msword$1 [L]
  4. Restart Apache
  5. View Word documents with graphics, in all their glory :)

As an example:

If:
Horde configurations:

  • $conf['tmpdir']=/var/www/tmp ($tmpdir=/var/www/tmp)
  • $registry['webroot']['horde']= /horde ($webroot=/horde)

Apache configuration:

  • DocumentRoot "/var/www/virtualdomains/yourdomain/horde"

Then your RewriteRule for Apache becomes:
RewriteRule ^/horde/imp/msword(.+) /var/www/tmp/msword$1 [L]

[# IIS ]
For IIS:
Rewriting functionality in a default configuration of IIS is limited. However, similar functionality should be attainable by using ISAPI_rewrite3. A lite version is available for free and the above syntax should work, although this author has not tested a configuration with IIS.

KMM