XHTML in Mantis 1.3 development trunk

I just wanted to upgrade my current installation of Mantis to the current 1.3.0 trunk. But this wasn’t as easy as in previous development releases of mantis. Obviously the content-encoding switched to more strict xhtml+xml. In previous versions the HTTP content-type was still text/html, which worked just fine. Using Firefox is no problem, but Internet Explorer doesn’t like the content-type application/xhtml+xml and always tries to download the page instead of displaying the page.

To resolve this problem I added a test prior to sending the content type, to which content type is actually supported by the client. The content-type is set in thehttp_api.php, so the modified function http_content_headers() looks like this:

 * Set content-type headers.
function http_content_headers() {
    if ( !headers_sent() ) {
        if (stristr($_SERVER[HTTP_ACCEPT], "application/xhtml+xml")) {
            header( 'Content-Type: application/xhtml+xml; charset=UTF-8' );
        } else {
            header( 'Content-Type: text/html; charset=UTF-8' );
        // Disallow Internet Explorer from attempting to second guess the Content-Type
        // header as per http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-pro
        header( 'X-Content-Type-Options: nosniff' );

On another quick side-note: I had some custom HTML to include my own header to mantis, which caused an XML parse error – this was because I didn’t close the img tag for an embedded image.

Printer mapping in script

On a side note, a quick way to add printer mappings in a logon script. Even though logon-scripts seem a little out-dated with the power of group policies … non the less.

OK, to map a printer to a local machine you can leverage the rundll32.

rundll32 printui.dll,PrintUIEntry /in /n \\[server]\[printer_share]

Manually restore timer settings

I just updated the image of my dreambox to the latest offical DMM release.

To get a clean start I did a manual backup of my settings located in /etc/enigma2. Actually the most valueable settings are the bouquets and the timer settings. So I just copied all files from /etc/enigma2 via FTP to my computer.

Restoring the bouquets is actually quite easy, just copy the bouquet files back to /etc/enigma2 and restart enigma. Voila!

But the timers.xml is totally different story. The timers.xml is being loaded into memory when enigma starts and is written back to disk when the box shutdowns. So just copying the timers.xml from the backup back to disk doesn’t do anything, since the file is being overwritten when enigma stops.

The solution is actually quite easy as well. Turn off enigma will flush the timers.xml to disk. To shutdown only enigma without turning off the dreambox you have to switch the runlevel. switching to init 4 will cause just this. Now you can copy the timers.xml from the backup to disk and then restart enigma with either init 3 or by starting enigma2.