Extension:MHTML

What can this extension do?
If MHTML text is pasted into a Wiki document between and tags, it will render the MHTML in an IFRAME.

Usage
Do not use this on public sites. When editing a page, use the clipboard to copy MHTML files into the Wiki edit page. Surround the MHTML with and. Page will render in an IFRAME. This facilitates placing documents, particularly from MS-OFFICE, into Wiki pages.

The extension will attempt to guess which HTML file should be considered the main page. To tell it, set the page attribute, for example

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
This extension requires the optional "mailparse" PECL module for php. Install according to the normal PECL procedures. However, mailparse must load AFTER mbstring. On many distributions, this is most easily ensured by changing the ini file for mailparse to "z-mailparse.ini" so it loads after "mbstring.ini".

To install this extension, add the following to LocalSettings.php:

Configuration parameters
None

User rights
None

Warnings, Bugs, and TODO

 * Do not use on any site where use of raw html would be unsafe
 * The unpacked contents of each mhtml file are placed in the images/cached directory in directories hashed with the MD5 of the original mhtml file. There is not yet any cleanup. If you delete them, you must make sure that the cached version of the module's output is also flushed.
 * Cutting and pasting MHTML files into the edit box is silly.  There should be a file upload dialog.
 * If you take the MHTML file back out of the page and try to open it with IE, it is not pristine enough. This seems to be a whitespace sensitivity.  This needs to be fixed so that MHTML files can be round-tripped properly.
 * Some MHTML files, particularly from Powerpoint, do not display correctly in Firefox.