示例#1
0
            flash('error', gt("Error opening eql file for writing") . " " . $path);
        } else {
            $eqlfile = expFile::dumpDatabase($db, array_keys($_POST['tables']));
            if (fwrite($eql, $eqlfile) === FALSE) {
                flash('error', gt("Error writing to eql file") . " " . $path);
            }
            fclose($eql);
            flash('message', gt("Sample database (eql file) saved to") . " '" . DISPLAY_THEME . "' " . gt("theme"));
            expHistory::back();
        }
    } else {
        // This code was lifted from phpMyAdmin, but this is Open Source, right?
        // 'application/octet-stream' is the registered IANA type but
        //        MSIE and Opera seems to prefer 'application/octetstream'
        $mime_type = EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA' ? 'application/octetstream' : 'application/octet-stream';
        header('Content-Type: ' . $mime_type);
        header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        // IE need specific headers
        if (EXPONENT_USER_BROWSER == 'IE') {
            header('Content-Disposition: inline; filename="' . $filename . '"');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
        } else {
            header('Content-Disposition: attachment; filename="' . $filename . '"');
            header('Pragma: no-cache');
        }
        echo expFile::dumpDatabase($db, array_keys($_POST['tables']));
        exit('');
        // Exit, since we are exporting
    }
}