<?php
/**
 * $Id: mime_drivers.php,v 1.3 2003/04/30 16:10:33 k-fish Exp $
 *
 * Decide which output drivers you want to activate. Below
 * are the core ones:
 *
 * php:          The internal PHP4 syntax highlighting engine
 * text:         plain text and css files
 * enscript:     GNU enscript
 * images:       Image files
 *
 * Right now, the additional choices are:
 *
 * tgz:          Tarballs, including gzipped ones.
 * rar:          RAR archives
 * msword:       Microsoft Word files via wvHtml
 * msexcel:      Microsoft Excel files via xlhtml
 * mspowerpoint: Microsoft Powerpoint files via ppthtml
 * zip:          Zip files
 * rpm:          RPM packages
 * deb:          Debian packages
 *
 * Not yet arrived:
 *
 * vcard:        vCards
 * enriched:     Enriched text format
 * ...
 */
$mime_drivers_map['registered'][] = 'php';
$mime_drivers_map['registered'][] = 'images';
$mime_drivers_map['registered'][] = 'text';

reset($_SESSION['MGW']->settings);
while(list($k, $v) = each($_SESSION['MGW']->settings)){
    if((substr($k,0,5) == 'mime_') && (substr($k,strrpos($k,'_')) == '_enable'))
	if($v) $mime_drivers_map['registered'][] = substr($k,5,-7);
}

/**
 * If you want to specifically override any MIME type to be
 * handled by a specific driver, then enter it here.  Normally,
 * this is safe to leave, but it's useful when multiple drivers
 * handle the same MIME type, and you want to specify exactly
 * which one should handle it.
 */
$mime_drivers_map['overrides'] = array(
       'application/pdf' => 'default',
       'application/postscript' => 'default'
);

/**
 * Driver specific settings.  Here, you have to configure each
 * driver which you chose to activate above.  Default settings have
 * been filled in for them, and if you haven't activated it, then
 * just leave it as it is - it won't get loaded.
 *
 * The 'handles' setting below shouldn't be changed in most
 * circumstances.  It registers a set of MIME type that the driver
 * can handle.  The 'x-extension' MIME type is a special one to
 * Horde that maps a file extension to a MIME type.  It's useful
 * when you know that all files ending in '.c' are C files, for
 * example. You can set the MIME subtype to '*' to match all possible
 * subtypes (i.e. 'image/*').
 *
 * The 'icons' entry is for the driver to register various icons
 * for the MIME types it handles. The array consists of a
 * 'default' icon for that driver, and can also include specific
 * MIME-types which can have their own icons. You can set the MIME
 * subtype to '*' to match all possible subtypes (i.e. 'image/*').
 *
 */

/**
 * Default driver settings
 */
$mime_drivers['default']['icons'] = array(
        'default'                       => 'default.png',
        'application/pdf'               => 'pdf.gif',
        'application/postscript'        => 'ps.gif',
	'audio/basic'                   => 'audio.gif',
        'audio/x-sun'                   => 'audio.gif',
        'message/delivery-status'       => 'mail.gif',
        'message/rfc822'                => 'mail.gif',
        'unknown/octet-stream'          => 'binary.gif',
        'video/avi'                     => 'video.gif',
        'video/mpeg'                    => 'video.gif',
        'video/mpg'                     => 'video.gif');

/**
 * text driver settings
 */
$mime_drivers['text']['handles'] = array(
    'text/plain', 'text/css');

/**
 * PHP driver settings
 */
$mime_drivers['php']['handles'] = array(
    'x-extension/php', 'x-extension/php3', 'x-extension/phps',
    'x-extension/php3s', 'application/x-httpd-php',
    'application/x-httpd-php3', 'application/x-httpd-phps');
$mime_drivers['php']['icons'] = array(
    'default' => 'php.gif');

/**
 * GNU Enscript driver settings
 */
$mime_drivers['enscript']['location'] = $_SESSION['MGW']->settings['mime_enscript_binary'];
$mime_drivers['enscript']['handles'] = array(
    'text/html', 'x-extension/pl', 'x-extension/c',
    'text/xml', 'application/x-sh', 'application/x-javascript',
    'x-extension/java', 'x-extension/h', 'x-extension/cpp',
    'x-extension/vhd', 'x-extension/vhdl', 'x-extension/sql',
    'x-extension/vb', 'x-extension/vba', 'x-extension/el');
$mime_drivers['enscript']['icons'] = array(
    'default'                  => 'text.gif',
    'text/html'                => 'html.gif',
    'text/xml'                 => 'xml.gif',
    'x-extension/c'            => 'source-c.gif',
    'x-extension/h'            => 'source-h.gif',
    'x-extension/java'         => 'source-java.gif',
    'application/x-javascript' => 'script-js.gif');

/**
 * Tar driver settings
 */
$mime_drivers['tgz']['location'] = $_SESSION['MGW']->settings['mime_tgz_binary'];
$mime_drivers['tgz']['handles'] = array(
    'x-extension/tgz',
    'x-extension/tar',
    'application/x-gzip-compressed',
    'application/x-gtar',
    'application/x-tar');
$mime_drivers['tgz']['icons'] = array(
    'default' => 'compressed.gif');

/**
 * Zip file driver settings
 */
$mime_drivers['zip']['location'] = $_SESSION['MGW']->settings['mime_zip_binary'];
$mime_drivers['zip']['handles'] = array(
    'x-extension/zip',
    'application/zip',
    'application/x-compressed',
    'application/x-zip-compressed');
$mime_drivers['zip']['icons'] = array(
    'default' => 'compressed.gif');

/**
 * MP3 file driver settings
 */
$mime_drivers['mp3']['location'] = $_SESSION['MGW']->settings['mime_mp3_binary'];
$mime_drivers['mp3']['handles'] = array(
    'x-extension/mp3',
    'audio/mpeg');
$mime_drivers['mp3']['icons'] = array(
    'default' => 'audio.gif');

/**
 * RAR archive driver settings
 */
$mime_drivers['rar']['location'] = $_SESSION['MGW']->settings['mime_rar_binary'];
$mime_drivers['rar']['handles'] = array(
    'x-extension/rar',
    'application/x-rar-compressed');
$mime_drivers['rar']['icons'] = array(
    'default' => 'compressed.gif');

/**
 * MS Word driver settings
 * This driver requires wvWare (www.wvware.com) to be installed.
 */
$mime_drivers['msword']['location'] = $_SESSION['MGW']->settings['mime_msword_binary'];
$mime_drivers['msword']['handles'] = array(
    'application/msword',
    'text/rtf',
    'x-extension/doc',
    'x-extension/rtf');
$mime_drivers['msword']['icons'] = array(
    'default' => 'msword.gif');

/**
 * MS Excel driver settings
 * This driver requires xlhtml (www.xlhtml.org) to be installed.
 */
$mime_drivers['msexcel']['location'] = $_SESSION['MGW']->settings['mime_msexcel_binary'];
$mime_drivers['msexcel']['handles'] = array(
    'application/vnd.ms-excel',
    'application/msexcel',
    'x-extension/xls');
$mime_drivers['msexcel']['icons'] = array(
    'default' => 'msexcel.gif');

/**
 * MS Powerpoint driver settings
 * This driver requires ppthtml, included with xlhtml (www.xlhtml.org),
 * to be installed.
 */
$mime_drivers['mspowerpoint']['location'] = $_SESSION['MGW']->settings['mime_mspowerpoint_binary'];
$mime_drivers['mspowerpoint']['handles'] = array(
    'application/vnd.ms-powerpoint',
    'application/mspowerpoint',
    'x-extension/ppt');
$mime_drivers['mspowerpoint']['icons'] = array(
    'default' => 'mspowerpoint.gif');

/**
 * RPM driver settings
 */
$mime_drivers['rpm']['location'] = $_SESSION['MGW']->settings['mime_rpm_binary'];
$mime_drivers['rpm']['handles'] = array(
    'application/x-rpm',
    'application/x-redhat-package-manager',
    'x-extension/rpm');
$mime_drivers['rpm']['icons'] = array(
    'default' => 'rpm.gif');

/**
 * Debian package driver settings
 */
$mime_drivers['deb']['location'] = $_SESSION['MGW']->settings['mime_deb_binary'];
$mime_drivers['deb']['handles'] = array(
    'application/x-debian-package',
    'x-extension/deb');
$mime_drivers['deb']['icons'] = array(
    'default' => 'deb.gif');

/**
 * Image settings
 */
$mime_drivers['images']['icons'] = array(
    'default' => 'image.gif');
$mime_drivers['images']['handles'] = array(
    'image/bmp', 'image/gif', 'image/jpeg', 'image/pjpeg', 'image/pbm',
    'image/pgm', 'image/png', 'image/tiff', 'image/x-png');
