function doExport($table, $mode)
{
    global $REX, $REX_USER, $XLS_TABLES, $XLS_MODES;
    $Basedir = dirname(__FILE__);
    require_once $Basedir . '/../libs/Spreadsheet_Excel_Writer-0.8/Writer.php';
    if (array_key_exists($table, $XLS_TABLES) && array_key_exists($mode, $XLS_MODES)) {
        $createstamp = time();
        $oTable = new ExportTable($table);
        if ($mode == 'all') {
            $result = $oTable->getAll();
        } else {
            if ($mode == 'new') {
                $result = $oTable->getNew();
            }
        }
        if (mysql_error() == '') {
            rs2xls(xlsLocation($table, $createstamp), xlsFilename($tables[$table], $createstamp), $result);
            $values = array(0, $table, mysql_num_rows($result), $REX_USER->getValue('login'), $createstamp);
            $set = '';
            $first = true;
            foreach ($values as $value) {
                if ($first) {
                    $first = false;
                } else {
                    $set .= ', ';
                }
                if (is_string($value)) {
                    $set .= '"' . mysql_escape_string($value) . '"';
                } else {
                    $set .= $value;
                }
            }
            $sql = new CompatSql();
            $qry = 'INSERT INTO ' . TBL_EXCEL_EXPORT . ' VALUES (' . $set . ')';
            $sql->setQuery($qry);
        } else {
            echo 'Fehler beim ausführen der Abfrage!';
        }
    }
}
<?php

/*
    excel_export Addon by <a href="mailto:staab@public-4u.de">Markus Staab</a>
    <a href="http://www.public-4u.de">www.public-4u.de</a>
    20.06.2005
    Version RC1
*/
error_reporting(E_ALL ^ E_NOTICE);
$Basedir = dirname(__FILE__);
require_once $Basedir . '/functions/function_compat.inc.php';
// CREATE/UPDATE DATABASE AND CREATE/UPDATE MODULES
$sql = new CompatSql();
$error = '';
foreach (readSqlDump(dirname(__FILE__) . '/install.sql') as $query) {
    $sql->query($query);
    $error .= $sql->getError();
}
unset($sql);
// CREATE/UPDATE PAGES
// CREATE/UPDATE FILES
// REGENERATE SITE
if ($error != '') {
    $REX['ADDON']['installmsg']['excel_export'] = $error;
} else {
    $REX['ADDON']['install']['excel_export'] = 1;
}
// ERRMSG IN CASE: $REX[ADDON][installmsg]["guestbook"] = "Leider konnte nichts installiert werden da.";