예제 #1
0
if ($restore['kind'] == 0) {
    $fpath = $config['paths']['backup'];
} else {
    $fpath = $config['paths']['structure'];
}
$fmp = $restore['part'];
$restore['compressed'] = substr(strtolower($restore['filename']), -2) == 'gz' ? 1 : 0;
// Datei oeffnen
$restore['filehandle'] = $restore['compressed'] == 1 ? gzopen($fpath . $restore['filename'], 'r') : fopen($fpath . $restore['filename'], 'r');
if ($restore['filehandle']) {
    //nur am Anfang Logeintrag
    if ($restore['offset'] == 0 && $restore['anzahl_tabellen'] == 0) {
        // Statuszeile auslesen
        $restore['part'] = 0;
        $statusline = $restore['compressed'] == 1 ? gzgets($restore['filehandle']) : fgets($restore['filehandle']);
        $sline = ReadStatusline($statusline);
        $restore['anzahl_tabellen'] = $sline['tables'];
        $restore['anzahl_eintraege'] = $sline['records'];
        if ($sline['part'] != 'MP_0') {
            $restore['part'] = 1;
        }
        //substr($sline['part'],3);
        if ($config['empty_db_before_restore'] == 1) {
            EmptyDB($databases['db_actual']);
        }
        $restore['tablelock'] = 0;
        $restore['erweiterte_inserts'] = 0;
        if ($sline['tables'] == "-1") {
            $restore['compressed'] ? gzseek($restore['filehandle'], 0) : fseek($restore['filehandle'], 0);
        }
        if ($restore['part'] > 0) {
예제 #2
0
function AutoDelete()
{
    global $del_files, $config, $lang, $out;
    $out = '';
    if ($config['max_backup_files'] > 0) {
        //Files einlesen
        $dh = opendir($config['paths']['backup']);
        $dbbackups = array();
        $files = array();
        // Build assoc Array $db=>$timestamp=>$filenames
        while (false !== ($filename = readdir($dh))) {
            if ($filename != '.' && $filename != '..' && !is_dir($config['paths']['backup'] . $filename)) {
                //statuszeile auslesen
                if (substr($filename, -2) == 'gz') {
                    $fp = gzopen($config['paths']['backup'] . $filename, 'r');
                    $sline = gzgets($fp, 40960);
                    gzclose($fp);
                } else {
                    $fp = fopen($config['paths']['backup'] . $filename, 'r');
                    $sline = fgets($fp, 500);
                    fclose($fp);
                }
                $statusline = ReadStatusline($sline);
                if ($statusline['dbname'] != 'unknown') {
                    $tabellenanzahl = $statusline['tables'] == -1 ? '' : $statusline['tables'];
                    $eintraege = $statusline['records'] == -1 ? '' : $statusline['records'];
                    $part = $statusline['part'] == 'MP_0' || ($statusline['part'] = '') ? 0 : substr($statusline['part'], 3);
                    $db_name = $statusline['dbname'];
                    $datum = substr($filename, strlen($db_name) + 1);
                    $timestamp = substr($datum, 0, 16);
                    if (!isset($files[$db_name])) {
                        $files[$db_name] = array();
                    }
                    if (!isset($files[$db_name][$timestamp])) {
                        $files[$db_name][$timestamp] = array();
                    }
                    $files[$db_name][$timestamp][] = $filename;
                }
            }
        }
        $out = '';
        // stores output messages
        // Backups pro DB und Timestamp ermitteln
        foreach ($files as $db => $val) {
            //echo "<br>DB ".$db." hat ".sizeof($val)." Backups.";
            if (sizeof($val) > $config['max_backup_files']) {
                $db_files = $val;
                krsort($db_files, SORT_STRING);
                //now latest backupfiles are on top -> delete all files with greater index
                $i = 0;
                foreach ($db_files as $timestamp => $filenames) {
                    if ($i >= $config['max_backup_files']) {
                        // Backup too old -> delete files
                        foreach ($filenames as $f) {
                            if ($out == '') {
                                $out .= $lang['L_FM_AUTODEL1'] . '<br>';
                            }
                            if (@unlink('./' . $config['paths']['backup'] . $f)) {
                                $out .= '<span class="nomargin">' . sprintf($lang['L_DELETE_FILE_SUCCESS'], $f) . '</span><br>';
                            } else {
                                $out .= $lang['L_ERROR'] . ': <span class="error nomargin">' . sprintf($lang['L_DELETE_FILE_ERROR'], $f) . '</span><br>';
                            }
                        }
                    }
                    $i++;
                }
            }
        }
    }
    return $out;
}
예제 #3
0
$config['files']['iconpath'] = './css/' . $config['theme'] . '/icons/';
$aus = array();
$pageheader = MSDheader() . headline($lang['L_RESTORE']);
$aus1 = $page_parameter = '';
$RestoreFertig = $eingetragen = $dauer = $filegroesse = 0;
MSD_mysql_connect($restore['dump_encoding'], true, $restore['actual_table']);
@mysql_select_db($databases['db_actual']) or die($lang['L_DB_SELECT_ERROR'] . $databases['db_actual'] . $lang['L_DB_SELECT_ERROR2']);
// open backup file
$restore['filehandle'] = $restore['compressed'] == 1 ? gzopen($config['paths']['backup'] . $restore['filename'], 'r') : fopen($config['paths']['backup'] . $restore['filename'], 'r');
if ($restore['filehandle']) {
    //nur am Anfang Logeintrag
    if ($restore['offset'] == 0 && $restore['anzahl_tabellen'] == 0) {
        // Statuszeile auslesen
        $restore['part'] = 0;
        $statusline = $restore['compressed'] == 1 ? gzgets($restore['filehandle']) : fgets($restore['filehandle']);
        $sline = ReadStatusline($statusline, true);
        $restore['anzahl_tabellen'] = $sline['tables'];
        $restore['anzahl_eintraege'] = $sline['records'];
        if ($sline['part'] != 'MP_0') {
            $restore['part'] = 1;
        }
        //substr($sline['part'],3);
        if ($config['empty_db_before_restore'] == 1) {
            EmptyDB($databases['db_actual']);
        }
        $restore['tablelock'] = 0;
        $restore['erweiterte_inserts'] = 0;
        if ($sline['tables'] == '-1') {
            $restore['compressed'] ? gzseek($restore['filehandle'], 0) : fseek($restore['filehandle'], 0);
        }
        if ($restore['part'] > 0) {
예제 #4
0
function AutoDelete()
{
    global $del_files, $config, $lang, $out;
    //Files einlesen
    $dh = opendir($config['paths']['backup']);
    $dbbackups = array();
    while (false !== ($filename = readdir($dh))) {
        if ($filename != "." && $filename != ".." && !is_dir($config['paths']['backup'] . $filename)) {
            //statuszeile auslesen
            if (substr($filename, -2) == "gz") {
                $fp = gzopen($config['paths']['backup'] . $filename, "r");
                $sline = gzgets($fp, 40960);
                gzclose($fp);
            } else {
                $fp = fopen($config['paths']['backup'] . $filename, "r");
                $sline = fgets($fp, 500);
                fclose($fp);
            }
            $statusline = ReadStatusline($sline);
            $tabellenanzahl = $statusline["tables"] == -1 ? "" : $statusline["tables"];
            $eintraege = $statusline["records"] == -1 ? "" : $statusline["records"];
            $part = $statusline["part"] == "MP_0" ? 0 : substr($statusline["part"], 3);
            $databases['db_actual'] = $statusline["dbname"];
            $datum = substr($filename, strlen($databases['db_actual']) + 1);
            $datum = substr($datum, 0, 16);
            if (isset($dbbackups[$databases['db_actual']])) {
                $dbbackups[$databases['db_actual']]++;
            } else {
                $dbbackups[$databases['db_actual']] = 1;
            }
            $files[] = "{$datum}|" . $databases['db_actual'] . "|{$part}|{$filename}";
        }
    }
    @rsort($files);
    // Mehr Dateien vorhanden, als es laut config.php sein d�rften? Dann weg damit :-)
    if ($config['del_files_after_days'] > 0) {
        $nowtime = strtotime("-" . ($config['del_files_after_days'] + 1) . " day");
        for ($i = 0; $i < sizeof($files); $i++) {
            $delfile = explode("|", $files[$i]);
            $ts = substr($delfile[0], 0, 4) . "-" . substr($delfile[0], 5, 2) . "-" . substr($delfile[0], 8, 2);
            if (strtotime($ts) < $nowtime) {
                $out .= DeleteFile($files[$i], "days");
                unset($files[$i]);
            }
        }
    }
    @rsort($files);
    if ($config['max_backup_files'] > 0) {
        if (sizeof($files) > $config['max_backup_files']) {
            if ($config['max_backup_files_each'] == 1) {
                //gilt es nur f�r jede Datenbank
                for ($i = sizeof($files) - 1; $i >= 0; $i--) {
                    $delfile = explode("|", $files[$i]);
                    if ($dbbackups[$delfile[1]] > $config['max_backup_files']) {
                        $out .= DeleteFile($files[$i], "max");
                        unset($files[$i]);
                        $dbbackups[$delfile[1]]--;
                    }
                }
            } else {
                //oder gilt es f�r alle Backups
                for ($i = sizeof($files) - 1; $i >= $config['max_backup_files']; $i--) {
                    $delfile = implode("|", $files);
                    $out .= DeleteFile($files[$i], "max");
                    unset($files[$i]);
                }
            }
        }
    }
    return $out;
}
/**
 * Send e-mail and attach file
 *
 * @param string $file
 * @return boolean
 */
function doEmail($file)
{
    global $config, $dump, $lang, $log;
    include 'lib/phpmailer/php5/class.phpmailer.php';
    include 'inc/classes/helper/Html.php';
    // get some status info from actual file
    $rootpath = $config['paths']['root'] . $config['paths']['backup'];
    $fileInfo = ReadStatusline($file);
    $fileInfo['size'] = @filesize($rootpath . $file);
    $database = $fileInfo['dbname'];
    $tablesSaved = $fileInfo['tables'];
    $recordsSaved = $fileInfo['tables'];
    if (sizeof($_SESSION['email']['filelist']) == 0) {
        // first call after backup -> create file list of all files for each database
        $_SESSION['email']['filelist'] = array();
        foreach ($_SESSION['log']['email'] as $filename) {
            $statusInfo = ReadStatusline($filename);
            if (!isset($_SESSION['email']['filelist'][$statusInfo['dbname']])) {
                $_SESSION['email']['filelist'][$statusInfo['dbname']] = array();
            }
            $_SESSION['email']['filelist'][$statusInfo['dbname']][] = $filename;
        }
    }
    // create file list for specific database
    $filelist = '';
    foreach ($_SESSION['email']['filelist'][$database] as $filename) {
        $phpSelf = $_SERVER['PHP_SELF'];
        $linkToFile = '<a href="' . getServerProtocol() . $_SERVER['HTTP_HOST'] . substr($phpSelf, 0, strrpos($phpSelf, '/')) . '/' . $config['paths']['backup'] . $filename . '">' . $filename . '</a>';
        $filelist .= $linkToFile;
        if ($file == $filename && $config['email']['attach_backup']) {
            $filelist .= ' (' . $lang['L_ATTACHED_AS_FILE'] . ')';
        }
        $filelist .= '<br />' . "\n";
    }
    $mail = new PHPMailer();
    $mail->CharSet = 'utf-8';
    $mail->PlugInDir = 'lib/phpmailer/php5/';
    $mail->From = $config['email']['sender_address'];
    $mail->FromName = $config['email']['sender_name'];
    $mail->AddAddress($config['email']['recipient_address'], $config['email']['recipient_name']);
    // add cc-recipients
    foreach ($config['email']['recipient_cc'] as $recipient) {
        if ($recipient['address'] > '') {
            $mail->AddCC($recipient['address'], $recipient['name']);
        }
    }
    //build subject
    $subject = $lang['L_DUMP_FILENAME'] . ': ' . $file;
    if ($fileInfo['comment'] > '') {
        $subject = $fileInfo['comment'] . ', ' . $subject;
    }
    $mail->Subject = $subject;
    $mail->Timeout = 60;
    // set used mail-method
    $mail->IsMail();
    //defaults to php-mail-function
    if ($config['use_mailer'] == 1) {
        $mail->IsSendmail();
        $mail->Sendmail = $config['sendmail_call'];
    } elseif ($config['use_mailer'] == 2) {
        $mail->IsSMTP();
        //debug
        //$mail->SMTPDebug = PHP_INT_MAX;
        $mail->Host = $config['smtp_server'];
        $mail->Port = $config['smtp_port'];
        // auth?
        if ($config['smtp_useauth']) {
            $mail->SMTPAuth = true;
            $mail->Username = $config['smtp_user'];
            $mail->Password = $config['smtp_pass'];
        }
        //use ssl?
        if ($config['smtp_usessl']) {
            $mail->SMTPSecure = 'tls';
        }
    }
    //build mail body
    $body = '';
    //add attachement?
    if ($config['email']['attach_backup']) {
        //check if file is bigger than allowed max size
        if ($config['email_maxsize'] > 0 && $fileInfo['size'] > $config['email_maxsize']) {
            // attachement too big -> don't attach and paste message to body
            $body .= sprintf($lang['L_EMAILBODY_TOOBIG'], byteOutput($config['email_maxsize']), $database, $file . ' (' . byte_output(filesize($config['paths']['backup'] . $file)) . ')<br />');
        } else {
            // add file as attachement
            $mail->AddAttachment($rootpath . $file);
            $body .= sprintf($lang['L_EMAILBODY_ATTACH'], $database, $filelist);
        }
    } else {
        // don't attach backup file according to configuration
        $body .= sprintf($lang['L_EMAILBODY_TOOBIG'], byteOutput($config['email_maxsize']), $database, "{$file} (" . byteOutput(filesize($config['paths']['backup'] . $file)) . ")<br />");
    }
    //set body
    $mail->MsgHTML($body);
    //build alternative-body without tags for mail-clients blocking HTML
    $altBody = strip_tags(Html::br2nl($body));
    $mail->AltBody = $altBody;
    $mail->Timeout = 30;
    $ret = $mail->Send();
    if (!$ret) {
        writeToErrorLog('', '', $lang['L_MAILERROR'] . ' -> ' . $mail->ErrorInfo, 0);
        $log->write(Log::PHP, $lang['L_MAILERROR']);
    } else {
        $msg = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email']['recipient_address'];
        $log->write(Log::PHP, $msg);
    }
    return $ret;
}
예제 #6
0
function read_statusline_from_file($filename)
{
    global $config;
    if (strtolower(substr($filename, -2)) == 'gz') {
        $fp = gzopen($config['paths']['backup'] . $filename, "r");
        if ($fp === false) {
            die('Can\'t open file ' . $filename);
        }
        $sline = gzgets($fp, 40960);
        gzclose($fp);
    } else {
        $fp = fopen($config['paths']['backup'] . $filename, "r");
        if ($fp === false) {
            die('Can\'t open file ' . $filename);
        }
        $sline = fgets($fp, 5000);
        fclose($fp);
    }
    $statusline = ReadStatusline($sline);
    return $statusline;
}
/**
 * Read information from all backup files in folder work/backup and return multidimensional array
 * containing all info.
 *
 * @return array
 */
function getBackupfileInfo()
{
    global $config;
    clearstatcache();
    $files = array();
    $dh = opendir($config['paths']['backup']);
    while (false !== ($filename = readdir($dh))) {
        if ($filename != '.' && $filename != '..' && !is_dir($config['paths']['backup'] . $filename)) {
            $files[]['name'] = $filename;
        }
    }
    $arrayindex = 0;
    $total_filesize = 0;
    $db_backups = array();
    $db_summary_anzahl = array();
    $db_summary_last = array();
    if (count($files) > 0) {
        for ($i = 0; $i < sizeof($files); $i++) {
            // filesize
            $size = filesize($config['paths']['backup'] . $files[$i]['name']);
            $file_datum = date("d\\.m\\.Y H:i", filemtime($config['paths']['backup'] . $files[$i]['name']));
            $statusline = ReadStatusline($files[$i]['name']);
            $backup_timestamp = GetTimestampFromFilename($files[$i]['name']);
            $pathinfo = pathinfo($files[$i]['name']);
            $file_extension = $pathinfo['extension'];
            if ($backup_timestamp == '') {
                $backup_timestamp = $file_datum;
            }
            $database_name = $statusline['dbname'];
            // check for some special cases
            if ($database_name == 'unknown') {
                $database_name = '~unknown';
            }
            // needed for sorting - place unknown files at the end
            if ($statusline['comment'] == 'converted') {
                $database_name = '~converted';
            }
            // converted fiels
            //jetzt alle in ein Array packen
            if ($statusline['part'] == 'MP_0' || $statusline['part'] == '') {
                $db_backups[$arrayindex]['name'] = $files[$i]['name'];
                $db_backups[$arrayindex]['db'] = $database_name;
                $db_backups[$arrayindex]['extension'] = $file_extension;
                $db_backups[$arrayindex]['size'] = $size;
                $db_backups[$arrayindex]['date'] = $backup_timestamp;
                $db_backups[$arrayindex]['sort'] = getSortableDate($backup_timestamp);
                $db_backups[$arrayindex]['tables'] = $statusline['tables'];
                $db_backups[$arrayindex]['records'] = $statusline['records'];
                $db_backups[$arrayindex]['multipart'] = 0;
                $db_backups[$arrayindex]['comment'] = $statusline['comment'];
                $db_backups[$arrayindex]['script'] = $statusline['script'] != '' ? $statusline['script'] . '(' . $statusline['scriptversion'] . ')' : '';
                $db_backups[$arrayindex]['charset'] = $statusline['charset'];
                $db_backups[$arrayindex]['mysqlversion'] = $statusline['mysqlversion'];
                if (!isset($db_summary_last[$database_name])) {
                    $db_summary_last[$database_name] = $backup_timestamp;
                }
                $db_summary_anzahl[$database_name] = isset($db_summary_anzahl[$database_name]) ? $db_summary_anzahl[$database_name] + 1 : 1;
                $db_summary_size[$database_name] = isset($db_summary_size[$database_name]) ? $db_summary_size[$database_name] + $size : $size;
                if (getSortableDate($backup_timestamp) > getSortableDate($db_summary_last[$database_name])) {
                    $db_summary_last[$database_name] = $backup_timestamp;
                }
            } else {
                //v($statusline);
                //list multipart files only once but keep info how many files belong to this backup
                $done = 0;
                if (!isset($db_summary_size[$database_name])) {
                    $db_summary_size[$database_name] = 0;
                }
                for ($j = 0; $j < $arrayindex; $j++) {
                    if (isset($db_backups[$j])) {
                        if ($db_backups[$j]['date'] == $backup_timestamp && $db_backups[$j]['db'] == $database_name && $db_backups[$j]['extension'] == $file_extension) {
                            $db_backups[$j]['mysqlversion'] = $statusline['mysqlversion'];
                            $db_backups[$j]['multipart']++;
                            $db_backups[$j]['size'] += $size;
                            // calculate size for this multipart backup
                            $db_summary_size[$database_name] += $size;
                            // calculate total size for this database
                            $done = 1;
                            break;
                        }
                    }
                }
                if ($done == 1) {
                    $arrayindex--;
                }
                if ($done == 0) {
                    //new entry for this backup with this timestamp
                    $db_backups[$arrayindex]['name'] = $files[$i]['name'];
                    $db_backups[$arrayindex]['db'] = $database_name;
                    $db_backups[$arrayindex]['extension'] = $file_extension;
                    $db_backups[$arrayindex]['size'] = $size;
                    $db_backups[$arrayindex]['date'] = $backup_timestamp;
                    $db_backups[$arrayindex]['sort'] = getSortableDate($backup_timestamp);
                    $db_backups[$arrayindex]['tables'] = $statusline['tables'];
                    $db_backups[$arrayindex]['records'] = $statusline['records'];
                    $db_backups[$arrayindex]['multipart'] = 1;
                    $db_backups[$arrayindex]['comment'] = $statusline['comment'];
                    $db_backups[$arrayindex]['script'] = $statusline['script'] != "" ? $statusline['script'] . "(" . $statusline['scriptversion'] . ")" : "";
                    $db_backups[$arrayindex]['charset'] = $statusline['charset'];
                    if (!isset($db_summary_last[$database_name])) {
                        $db_summary_last[$database_name] = $backup_timestamp;
                    }
                    $db_summary_anzahl[$database_name] = isset($db_summary_anzahl[$database_name]) ? $db_summary_anzahl[$database_name] + 1 : 1;
                    $db_summary_size[$database_name] = isset($db_summary_size[$database_name]) ? $db_summary_size[$database_name] + $size : $size;
                    if (getSortableDate($backup_timestamp) > getSortableDate($db_summary_last[$database_name])) {
                        $db_summary_last[$database_name] = $backup_timestamp;
                    }
                }
            }
            $arrayindex++;
            $total_filesize += $size;
            // calculate overall file size
        }
    }
    if (isset($db_backups) && is_array($db_backups)) {
        $db_backups = arfsort($db_backups, get_orderarray('sort,d|name,A'));
    }
    // merge infos into one array
    $info = array();
    $info['filesize_total'] = $total_filesize;
    // total size of all files
    $info['files'] = $db_backups;
    // info per file
    unset($db_backups);
    $info['databases'] = array();
    foreach ($db_summary_anzahl as $db => $count) {
        $info['databases'][$db]['backup_count'] = $count;
        $info['databases'][$db]['backup_size_total'] = $db_summary_size[$db];
        $info['databases'][$db]['latest_backup_timestamp'] = $db_summary_last[$db];
    }
    return $info;
}
예제 #8
0
function FileList($multi = 0)
{
    global $config, $kind, $fpath, $lang, $databases, $href, $dbactiv, $action, $expand;
    $files = array();
    if ($kind == 0) {
        //Backup-Dateien
        $Theader = $lang['fm_files1'] . ' ' . $lang['of'] . ' "' . $dbactiv . '"';
        $Wheader = $lang['fm_files2'];
        $akind = 1;
    } else {
        //Struktur-Dateien
        $Theader = $lang['fm_files2'];
        $Wheader = $lang['fm_files1'];
        $akind = 0;
    }
    $Sum_Files = 0;
    $dh = opendir($fpath);
    $fl = "";
    $i = 0;
    while (false !== ($filename = readdir($dh))) {
        if ($filename != "." && $filename != ".." && !is_dir($fpath . $filename)) {
            $files[$i]['name'] = $filename;
            $Sum_Files++;
            $i++;
        }
    }
    $fl .= '<div align="center">' . br() . $lang['fm_choose_file'] . br();
    $fl .= '<span id="gd">&nbsp;</span>' . br() . '<br><br>';
    $fl .= '<table class="border">' . br();
    $fl .= '<tr>' . br() . '<td colspan="8" align="left"><strong>' . $Theader . '</strong></td>' . br() . '<td colspan="3" align="right"><a href="filemanagement.php?action=' . $action . '&amp;kind=' . $akind . '" class="small">' . $Wheader . '</a></td>' . br() . '</tr>' . br();
    //Tableheader
    $fl .= '<tr class="thead">' . br() . '<th colspan="2">' . $lang['db'] . '</th>' . br() . '
	<th>gz</th>' . br() . '
	<th>Script</th>' . br() . '
	<th colspan="2">' . $lang['comment'] . '</th>' . br() . '

	<th>' . $lang['fm_filedate'] . '</th>' . br() . '
	<th>Multipart</th>' . br() . '
	<th>' . $lang['fm_tables'] . ' / ' . $lang['fm_records'] . '</th>' . br() . '
	<th align="right" colspan="2">' . $lang['fm_filesize'] . '</th>' . br() . '</tr>' . br();
    $checkindex = $arrayindex = $gesamt = 0;
    $db_summary_anzahl = array();
    if (count($files) > 0) {
        for ($i = 0; $i < sizeof($files); $i++) {
            // Dateigr&ouml;&szlig;e
            $size = filesize($fpath . $files[$i]['name']);
            $file_datum = date("d\\.m\\.Y H:i", filemtime($fpath . $files[$i]['name']));
            //statuszeile auslesen
            $sline = '';
            if (substr($files[$i]['name'], -2) == "gz") {
                if ($config['zlib']) {
                    $fp = gzopen($fpath . $files[$i]['name'], "r");
                    $sline = gzgets($fp, 40960);
                    gzclose($fp);
                }
            } else {
                $fp = fopen($fpath . $files[$i]['name'], "r");
                $sline = fgets($fp, 5000);
                fclose($fp);
            }
            $statusline = ReadStatusline($sline);
            $but = ExtractBUT($files[$i]['name']);
            if ($but == "") {
                $but = $file_datum;
            }
            $dbn = $statusline['dbname'];
            //jetzt alle in ein Array packen
            if ($statusline['part'] == "MP_0" || $statusline['part'] == "") {
                $db_backups[$arrayindex]['name'] = $files[$i]['name'];
                $db_backups[$arrayindex]['db'] = $dbn;
                $db_backups[$arrayindex]['size'] = $size;
                $db_backups[$arrayindex]['date'] = $but;
                $db_backups[$arrayindex]['sort'] = sortierdatum($but);
                $db_backups[$arrayindex]['tabellen'] = $statusline['tables'];
                $db_backups[$arrayindex]['eintraege'] = $statusline['records'];
                $db_backups[$arrayindex]['multipart'] = 0;
                $db_backups[$arrayindex]['kommentar'] = $statusline['comment'];
                $db_backups[$arrayindex]['script'] = $statusline['script'] != "" ? $statusline['script'] . "(" . $statusline['scriptversion'] . ")" : "";
                if (!isset($db_summary_last[$dbn])) {
                    $db_summary_last[$dbn] = $but;
                }
                $db_summary_anzahl[$dbn] = isset($db_summary_anzahl[$dbn]) ? $db_summary_anzahl[$dbn] + 1 : 1;
                $db_summary_size[$dbn] = isset($db_summary_size[$dbn]) ? $db_summary_size[$dbn] + $size : $size;
                if ($but > $db_summary_last[$dbn]) {
                    $db_summary_last[$dbn] = $but;
                }
            } else {
                //multipart nur einmal
                $done = 0;
                if (!isset($db_summary_size[$dbn])) {
                    $db_summary_size[$dbn] = 0;
                }
                for ($j = 0; $j < $arrayindex; $j++) {
                    if (isset($db_backups[$j])) {
                        if ($db_backups[$j]['date'] == $but && $db_backups[$j]['db'] == $dbn) {
                            $db_backups[$j]['multipart']++;
                            $db_backups[$j]['size'] += $size;
                            $db_summary_size[$dbn] += $size;
                            $done = 1;
                            break;
                        }
                    }
                }
                if ($done == 1) {
                    $arrayindex--;
                }
                if ($done == 0) {
                    //Eintrag war noch nicht vorhanden
                    $db_backups[$arrayindex]['name'] = $files[$i]['name'];
                    $db_backups[$arrayindex]['db'] = $dbn;
                    $db_backups[$arrayindex]['size'] = $size;
                    $db_backups[$arrayindex]['date'] = $but;
                    $db_backups[$arrayindex]['sort'] = sortierdatum($but);
                    $db_backups[$arrayindex]['tabellen'] = $statusline['tables'];
                    $db_backups[$arrayindex]['eintraege'] = $statusline['records'];
                    $db_backups[$arrayindex]['multipart'] = 1;
                    $db_backups[$arrayindex]['kommentar'] = $statusline['comment'];
                    $db_backups[$arrayindex]['script'] = $statusline['script'] != "" ? $statusline['script'] . "(" . $statusline['scriptversion'] . ")" : "";
                    if (!isset($db_summary_last[$dbn])) {
                        $db_summary_last[$dbn] = $but;
                    }
                    $db_summary_anzahl[$dbn] = isset($db_summary_anzahl[$dbn]) ? $db_summary_anzahl[$dbn] + 1 : 1;
                    $db_summary_size[$dbn] = isset($db_summary_size[$dbn]) ? $db_summary_size[$dbn] + $size : $size;
                    if ($but > $db_summary_last[$dbn]) {
                        $db_summary_last[$dbn] = $but;
                    }
                }
            }
            // Gesamtgr&ouml;&szlig;e aller Backupfiles
            $arrayindex++;
            $gesamt = $gesamt + $size;
        }
    }
    //Schleife fertig - jetzt Ausgabe
    if (isset($db_backups) && is_array($db_backups)) {
        $db_backups = mu_sort($db_backups, 'sort,name');
    }
    // Hier werden die Dateinamen ausgegeben
    if ($arrayindex > 0) {
        for ($i = $arrayindex; $i >= 0; $i--) {
            $cl = $i % 2 ? "dbrow" : "dbrow1";
            if (isset($db_backups[$i]['db']) && $db_backups[$i]['db'] == $dbactiv) {
                $multi = $db_summary_anzahl[$dbactiv] > 1 && $action == "files" ? 1 : 0;
                $fl .= '<input type="hidden" name="multi" value="' . $multi . '">';
                if ($db_backups[$i]['multipart'] > 0) {
                    $dbn = NextPart($db_backups[$i]['name'], 1);
                } else {
                    $dbn = $db_backups[$i]['name'];
                }
                $fl .= '<tr ' . ($dbactiv == $databases['db_actual'] ? 'class="dbrowsel"' : 'class="' . $cl . '"') . '>' . br();
                $fl .= '<td align="left" colspan="2" nowrap>' . br();
                if ($multi == 0) {
                    $fl .= '<input type="hidden" name="multipart[]" value="' . $db_backups[$i]['multipart'] . '"><input name="file[]" type="radio" class="radio" value="' . $dbn . '" onClick="Check(' . $checkindex++ . ',0);">';
                } else {
                    $fl .= '<input type="hidden" name="multipart[]" value="' . $db_backups[$i]['multipart'] . '"><input name="file[]" type="checkbox" class="checkbox" value="' . $dbn . '" onClick="Check(' . $checkindex++ . ',1);">';
                }
                $fl .= $db_backups[$i]['multipart'] == 0 ? '&nbsp;<a href="' . $fpath . $dbn . '" title="Backupfile: ' . $dbn . '" style="font-size:8pt;" target="_blank">' . ($db_backups[$i]['db'] == 'unknown' ? $dbn : $db_backups[$i]['db']) . '</a></td>' . br() : '&nbsp;<span style="font-size:8pt;">' . $db_backups[$i]['db'] . '</span></td>' . br();
                $fl .= '<td class="sm" nowrap align="center">' . (substr($dbn, -3) == ".gz" ? '<img src="' . $config['files']['iconpath'] . 'gz.gif" alt="' . $lang['compressed'] . '" width="16" height="16" border="0">' : "&nbsp;") . '</td>';
                $fl .= '<td class="sm" nowrap align="center">' . $db_backups[$i]['script'] . '</td>';
                $fl .= '<td class="sm" nowrap align="right">' . ($db_backups[$i]['kommentar'] != "" ? '<img src="' . $config['files']['iconpath'] . 'rename.gif" alt="' . $db_backups[$i]['kommentar'] . '" title="' . $db_backups[$i]['kommentar'] . '" width="16" height="16" border="0">' : "&nbsp;") . '</td>';
                $fl .= '<td class="sm" nowrap align="left">' . ($db_backups[$i]['kommentar'] != "" ? nl2br(wordwrap($db_backups[$i]['kommentar'], 50)) : "&nbsp;") . '</td>';
                $fl .= '<td class="sm" nowrap>' . $db_backups[$i]['date'] . '</td>' . br();
                $fl .= '<td style="text-align:center">';
                $fl .= $db_backups[$i]['multipart'] == 0 ? $lang['no'] : '<a style="font-size:11px;" href="filemanagement.php?action=files&kind=0&dbactiv=' . $dbactiv . '&expand=' . $i . '">' . $db_backups[$i]['multipart'] . ' Files</a>';
                //
                $fl .= '</td>' . br() . '<td  style="text-align:right;padding-right:12px;" nowrap>';
                $fl .= $db_backups[$i]['eintraege'] != -1 ? $db_backups[$i]['tabellen'] . ' / ' . number_format($db_backups[$i]['eintraege'], 0, ",", ".") : $lang['fm_oldbackup'];
                $fl .= '</td>' . br();
                $fl .= '<td align="right" colspan="2" style="font-size:8pt;">' . byte_output($db_backups[$i]['size']) . '</td>' . br();
                $fl .= '</tr>' . br();
                if ($expand == $i) {
                    $fl .= '<tr ' . ($dbactiv == $databases['db_actual'] ? 'class="dbrowsel"' : 'class="' . $cl . '"') . '>' . br();
                    $fl .= '<td class="sm" valign="top">All Parts:</td><td  class="sm" colspan="11" align="left">' . PartListe($db_backups[$i]['name'], $db_backups[$i]['multipart']) . '</td>';
                }
            }
        }
    }
    $fl .= '<tr>' . br() . '<td colspan="11" align="left"><br><strong>' . $lang['fm_all_bu'] . '</strong></td>' . br() . '</tr>' . br();
    //Tableheader
    $fl .= '<tr class="thead">' . br() . '<th colspan="5" align="left">' . $lang['fm_dbname'] . '</th>' . br() . '
	<th align="left">' . $lang['fm_anz_bu'] . '</th>' . br() . '
	<th>' . $lang['fm_last_bu'] . '</th>' . br() . '
	<th colspan="4" style="text-align:right;">' . $lang['fm_totalsize'] . '</th></tr>' . br();
    //die anderen Backups
    if (count($db_summary_anzahl) > 0) {
        $i = 0;
        while (list($key, $val) = each($db_summary_anzahl)) {
            $cl = $i++ % 2 ? "dbrow" : "dbrow1";
            $keyaus = $key == "unknown" ? '<em>' . $lang['no_msd_backupfile'] . '</em>' : $key;
            $fl .= '<tr class="' . $cl . '">' . br() . '<td colspan="5" align="left"><a href="' . $href . '&dbactiv=' . $key . '">' . $keyaus . '</a></td>' . br();
            $fl .= '<td style="text-align:right">' . $val . '&nbsp;&nbsp;</td>' . br();
            $fl .= '<td class="sm" nowrap>' . (isset($db_summary_last[$key]) ? $db_summary_last[$key] : "") . '</td>' . br();
            $fl .= '<td style="text-align:right;font-size:8pt;" colspan="4">' . byte_output($db_summary_size[$key]) . '&nbsp;</td>' . br();
            $fl .= '</tr>' . br(3);
        }
    }
    if (!is_array($files)) {
        $fl .= '<tr><td colspan="11">' . $lang['fm_nofilesfound'] . '</td></tr>' . br();
    }
    //--------------------------------------------------------
    //*** Ausgabe der Gesamtgr&ouml;&szlig;e aller Backupfiles ***
    //--------------------------------------------------------
    $space = MD_FreeDiskSpace();
    $fl .= '<tr>' . br();
    $fl .= '<td align="left" colspan="8"><b>' . $lang['fm_totalsize'] . ' (' . $Sum_Files . ' files): </b> </td>' . br();
    $fl .= '<td style="text-align:right" colspan="3"><b>' . byte_output($gesamt) . '</b></td>' . br();
    $fl .= '</tr>' . br();
    //--------------------------------------------------------
    //*** Ausgabe des freien Speicher auf dem Rechner ***
    //--------------------------------------------------------
    $fl .= '<tr>' . br();
    $fl .= '<td colspan="8" align="left">' . $lang['fm_freespace'] . ': </td>' . br();
    $fl .= '<td colspan="3"  style="text-align:right"><b>' . $space . '</b></td>' . br();
    $fl .= '</tr>' . br();
    $fl .= '</table></div>' . br();
    return $fl;
}