$restore['records_inserted_table'] = array();
    $restore['extended_inserts'] = 0;
    $restore['extended_insert_flag'] = -1;
    $restore['last_parser_status'] = 0;
    $restore['EOB'] = false;
    $restore['fileEOF'] = false;
    $restore['file_progress_percent'] = 0;
    $restore['tables_to_restore'] = false;
    // restore complete file
    // Should we restore the complete file or are only some tables selected ?
    if (isset($_POST['sel_tbl'])) {
        $restore['tables_to_restore'] = $_POST['sel_tbl'];
        //correct the nr of tables and total records to restore
        $restore['tables_total'] = 0;
        $restore['records_total'] = 0;
        $tabledata = getTableHeaderInfoFromBackup($restore['filename']);
        foreach ($tabledata as $key => $val) {
            if (in_array($val['name'], $restore['tables_to_restore'])) {
                $restore['tables_total']++;
                $restore['records_total'] += $val['records'];
            }
        }
    }
    $_SESSION['config'] = $config;
    $_SESSION['databases'] = $databases;
    $_SESSION['restore'] = $restore;
    $logMsg = sprintf($lang['L_START_RESTORE_DB_FILE'], $config['db_actual'], $restore['filename']);
    $log->write(Log::PHP, $logMsg);
} else {
    $config = $_SESSION['config'];
    $databases = $_SESSION['databases'];
 * http://www.mysqldumper.net
 *
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
$fileName = isset($_GET['filename']) ? urldecode($_GET['filename']) : '';
if (isset($_POST['file'][0])) {
    $fileName = $_POST['file'][0];
}
$tplRestoreSelectTables = new MSDTemplate();
$tplRestoreSelectTables->set_filenames(array('tplRestoreSelectTables' => 'tpl/restore/selectTables.tpl'));
//Get Header-Infos from file
$sline = readStatusline($fileName);
if ($sline['records'] == -1) {
    // not a backup of MySQLDumper
    $tplRestoreSelectTables->assign_block_vars('NO_MSD_BACKUP', array());
} else {
    // Get Tableinfo from file header
    $tabledata = getTableHeaderInfoFromBackup($fileName);
    for ($i = 0; $i < sizeof($tabledata); $i++) {
        $klasse = $i % 2 ? 1 : '';
        $tplRestoreSelectTables->assign_block_vars('ROW', array('CLASS' => 'dbrow' . $klasse, 'ID' => $i, 'NR' => $i + 1, 'TABLENAME' => $tabledata[$i]['name'], 'RECORDS' => String::formatNumber($tabledata[$i]['records']), 'SIZE' => byteOutput($tabledata[$i]['size']), 'LAST_UPDATE' => $tabledata[$i]['update'], 'TABLETYPE' => $tabledata[$i]['engine']));
    }
}
$confirmRestore = $lang['L_FM_ALERTRESTORE1'] . ' `' . $config['db_actual'] . '`  ' . $lang['L_FM_ALERTRESTORE2'] . ' ' . $fileName . ' ' . $lang['L_FM_ALERTRESTORE3'];
$tplRestoreSelectTables->assign_vars(array('PAGETITLE' => $lang['L_RESTORE'] . ' - ' . $lang['L_TABLESELECTION'], 'DATABASE' => $config['db_actual'], 'FILENAME' => $fileName, 'ICON_OK' => $icon['ok'], 'ICON_DELETE' => $icon['delete'], 'ICON_RESTORE' => $icon['restore'], 'L_NO_MSD_BACKUP' => $lang['L_NOT_SUPPORTED'], 'CONFIRM_RESTORE' => $confirmRestore));