/** * Sends header indicating file download. * * @param string $filename Filename to include in headers if empty, * none Content-Disposition header will be sent. * @param string $mimetype MIME type to include in headers. * @param int $length Length of content (optional) * @param bool $no_cache Whether to include no-caching headers. * * @return nothing */ function PMA_download_header($filename, $mimetype, $length = 0, $no_cache = true) { if ($no_cache) { PMA_no_cache_header(); } /* Replace all possibly dangerous chars in filename */ $filename = str_replace(array(';', '"', "\n", "\r"), '-', $filename); if (!empty($filename)) { header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename="' . $filename . '"'); } header('Content-Type: ' . $mimetype); header('Content-Transfer-Encoding: binary'); if ($length > 0) { header('Content-Length: ' . $length); } }
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Simple wrapper just to enable error reporting and include config * * @package PhpMyAdmin */ // we need the common loader for the PMA_no_cache_header function define('PMA_MINIMUM_COMMON', 1); require './libraries/common.inc.php'; $GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT'; PMA_no_cache_header(); header('Content-Type: text/html; charset=utf-8'); require './libraries/vendor_config.php'; error_reporting(E_ALL); /** * Read config file. */ if (is_readable(CONFIG_FILE)) { require CONFIG_FILE; }