本文整理汇总了PHP中PMA_downloadHeader函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_downloadHeader函数的具体用法?PHP PMA_downloadHeader怎么用?PHP PMA_downloadHeader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_downloadHeader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_exportAsFileDownload
/**
* Function to export as entries
*
* @param array $entries entries
*
* @return void
*/
function PMA_exportAsFileDownload($entries)
{
@ini_set('url_rewriter.tags', '');
$dump = "# " . sprintf(__('Tracking report for table `%s`'), htmlspecialchars($_REQUEST['table'])) . "\n" . "# " . date('Y-m-d H:i:s') . "\n";
foreach ($entries as $entry) {
$dump .= $entry['statement'];
}
$filename = 'log_' . htmlspecialchars($_REQUEST['table']) . '.sql';
PMA_Response::getInstance()->disable();
PMA_downloadHeader($filename, 'text/x-sql', mb_strlen($dump));
echo $dump;
exit;
}
示例2: PMA_sanitizeFilename
}
exit;
}
}
/**
* Send headers depending on whether the user chose to download a dump file
* or not
*/
if (!$save_on_server) {
if ($asfile) {
// Download
// (avoid rewriting data containing HTML with anchors and forms;
// this was reported to happen under Plesk)
@ini_set('url_rewriter.tags', '');
$filename = PMA_sanitizeFilename($filename);
PMA_downloadHeader($filename, $mime_type);
} else {
// HTML
if ($export_type == 'database') {
$num_tables = count($tables);
if ($num_tables == 0) {
$message = PMA_Message::error(__('No tables found in database.'));
$active_page = 'db_export.php';
include 'db_export.php';
exit;
}
}
list($html, $back_button) = PMA_getHtmlForDisplayedExportHeader($export_type, $db, $table);
echo $html;
unset($html);
}
示例3: showOutput
/**
* Output EPS Document for download
*
* @param string $fileName name of the eps document
*
* @return void
*
* @access public
*/
function showOutput($fileName)
{
// if(ob_get_clean()){
//ob_end_clean();
//}
$output = $this->stringCommands;
PMA_Response::getInstance()->disable();
PMA_downloadHeader($fileName, 'image/x-eps', mb_strlen($output));
print $output;
}
示例4: showOutput
/**
* output Svg Document
*
* svg document prompted to the user for download
* Svg document saved in .svg extension and can be
* easily changeable by using any svg IDE
*
* @param string $fileName file name
*
* @return void
* @access public
* @see XMLWriter::startElement(),XMLWriter::writeAttribute()
*/
function showOutput($fileName)
{
//ob_get_clean();
$output = $this->flush();
PMA_Response::getInstance()->disable();
PMA_downloadHeader($fileName . '.svg', 'image/svg+xml', $GLOBALS['PMA_String']->strlen($output));
print $output;
}
示例5: showOutput
/**
* output Svg Document
*
* svg document prompted to the user for download
* Svg document saved in .svg extension and can be
* easily changeable by using any svg IDE
*
* @param string $fileName file name
*
* @return void
* @see XMLWriter::startElement(),XMLWriter::writeAttribute()
*/
public function showOutput($fileName)
{
//ob_get_clean();
$output = $this->flush();
PMA_Response::getInstance()->disable();
PMA_downloadHeader($fileName, 'image/svg+xml', mb_strlen($output));
print $output;
}
示例6: define
* @package PhpMyAdmin
*/
/**
* Common functions.
*/
// we don't want the usual PMA\libraries\Response-generated HTML above the column's
// data
define('PMA_BYPASS_GET_INSTANCE', 1);
require_once 'libraries/common.inc.php';
require_once 'libraries/mime.lib.php';
/* Check parameters */
PMA\libraries\Util::checkParameters(array('db', 'table'));
/* Select database */
if (!$GLOBALS['dbi']->selectDb($db)) {
PMA\libraries\Util::mysqlDie(sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)), '', false);
}
/* Check if table exists */
if (!$GLOBALS['dbi']->getColumns($db, $table)) {
PMA\libraries\Util::mysqlDie(__('Invalid table name'));
}
/* Grab data */
$sql = 'SELECT ' . PMA\libraries\Util::backquote($_GET['transform_key']) . ' FROM ' . PMA\libraries\Util::backquote($table) . ' WHERE ' . $_GET['where_clause'] . ';';
$result = $GLOBALS['dbi']->fetchValue($sql);
/* Check return code */
if ($result === false) {
PMA\libraries\Util::mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql);
}
/* Avoid corrupting data */
@ini_set('url_rewriter.tags', '');
PMA_downloadHeader($table . '-' . $_GET['transform_key'] . '.bin', PMA_detectMIME($result), mb_strlen($result, '8bit'));
echo $result;
示例7: _toFile
/**
* Handles common tasks of writing the visualization to file for various formats.
*
* @param string $file_name file name
* @param string $type mime type
* @param string $ext extension of the file
*
* @return void
* @access private
*/
private function _toFile($file_name, $type, $ext)
{
$file_name = $this->_sanitizeName($file_name, $ext);
PMA_downloadHeader($file_name, $type);
}
示例8: ConfigFile
$cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings);
PMA_userprefsPageInit($cf);
$error = '';
if (isset($_POST['submit_export']) && isset($_POST['export_type']) && $_POST['export_type'] == 'text_file') {
// export to JSON file
PMA\libraries\Response::getInstance()->disable();
$filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
PMA_downloadHeader($filename, 'application/json');
$settings = PMA_loadUserprefs();
echo json_encode($settings['config_data'], JSON_PRETTY_PRINT);
exit;
} elseif (isset($_POST['submit_export']) && isset($_POST['export_type']) && $_POST['export_type'] == 'php_file') {
// export to JSON file
PMA\libraries\Response::getInstance()->disable();
$filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.php';
PMA_downloadHeader($filename, 'application/php');
$settings = PMA_loadUserprefs();
echo '/* ' . _('phpMyAdmin configuration snippet') . " */\n\n";
echo '/* ' . _('Paste it to your config.inc.php') . " */\n\n";
foreach ($settings['config_data'] as $key => $val) {
echo '$cfg[\'' . str_replace('/', '\'][\'', $key) . '\'] = ';
echo var_export($val, true) . ";\n";
}
exit;
} else {
if (isset($_POST['submit_get_json'])) {
$settings = PMA_loadUserprefs();
$response = PMA\libraries\Response::getInstance();
$response->addJSON('prefs', json_encode($settings['config_data']));
$response->addJSON('mtime', $settings['mtime']);
exit;
示例9: Download
/**
* Sends file as a download to user.
*
* @param string $filename file name
*
* @return void
*/
function Download($filename)
{
$pdfData = $this->getPDFData();
PMA_Response::getInstance()->disable();
PMA_downloadHeader($filename, 'application/pdf', strlen($pdfData));
echo $pdfData;
}
示例10: mb_substr
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
/* Decode data */
if ($extension != 'svg') {
$data = mb_substr($_REQUEST['image'], mb_strpos($_REQUEST['image'], ',') + 1);
$data = base64_decode($data);
} else {
$data = $_REQUEST['image'];
}
/* Send download header */
PMA_downloadHeader($filename, $_REQUEST['type'], mb_strlen($data));
/* Send data */
echo $data;
} else {
if (isset($_REQUEST['monitorconfig'])) {
/* For monitor chart config export */
PMA_downloadHeader('monitor.cfg', 'application/json; charset=UTF-8');
header('X-Content-Type-Options: nosniff');
echo urldecode($_REQUEST['monitorconfig']);
} else {
if (isset($_REQUEST['import'])) {
/* For monitor chart config import */
header('Content-Type: application/json; charset=UTF-8');
header('X-Content-Type-Options: nosniff');
if (!file_exists($_FILES['file']['tmp_name'])) {
exit;
}
echo file_get_contents($_FILES['file']['tmp_name']);
}
}
}
示例11: array
require_once 'libraries/mime.lib.php';
/**
* Sets globals from $_GET
*/
$get_params = array('where_clause', 'transform_key');
foreach ($get_params as $one_get_param) {
if (isset($_GET[$one_get_param])) {
$GLOBALS[$one_get_param] = $_GET[$one_get_param];
}
}
/* Check parameters */
PMA_Util::checkParameters(array('db', 'table', 'where_clause', 'transform_key'));
/* Select database */
if (!PMA_DBI_select_db($db)) {
PMA_Util::mysqlDie(sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)), '', '');
}
/* Check if table exists */
if (!PMA_DBI_get_columns($db, $table)) {
PMA_Util::mysqlDie(__('Invalid table name'));
}
/* Grab data */
$sql = 'SELECT ' . PMA_Util::backquote($transform_key) . ' FROM ' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';';
$result = PMA_DBI_fetch_value($sql);
/* Check return code */
if ($result === false) {
PMA_Util::mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql);
}
/* Avoid corrupting data */
@ini_set('url_rewriter.tags', '');
PMA_downloadHeader($table . '-' . $transform_key . '.bin', PMA_detectMIME($result), strlen($result));
echo $result;
示例12: showOutput
/**
* Output Dia Document for download
*
* @param string $fileName name of the dia document
*
* @return void
* @access public
* @see XMLWriter::flush()
*/
function showOutput($fileName)
{
if (ob_get_clean()) {
ob_end_clean();
}
$output = $this->flush();
PMA_Response::getInstance()->disable();
PMA_downloadHeader($fileName . '.dia', 'application/x-dia-diagram', $GLOBALS['PMA_String']->strlen($output));
print $output;
}
示例13: showOutput
/**
* Output Visio XML .VDX Document for download
*
* @param string $fileName name of the Visio XML document
*
* @return void
* @access public
* @see XMLWriter::flush()
*/
function showOutput($fileName)
{
//if(ob_get_clean()){
//ob_end_clean();
//}
$output = $this->flush();
PMA_Response::getInstance()->disable();
PMA_downloadHeader($fileName . '.vdx', 'application/visio', strlen($output));
print $output;
}
示例14: PMA_exportAsFileDownload
/**
* Function to export as entries
*
* @param array $entries entries
*
* @return void
*/
function PMA_exportAsFileDownload($entries)
{
@ini_set('url_rewriter.tags', '');
// Replace all multiple whitespaces by a single space
$table = htmlspecialchars(preg_replace('/\\s+/', ' ', $_REQUEST['table']));
$dump = "# " . sprintf(__('Tracking report for table `%s`'), $table) . "\n" . "# " . date('Y-m-d H:i:s') . "\n";
foreach ($entries as $entry) {
$dump .= $entry['statement'];
}
$filename = 'log_' . $table . '.sql';
PMA\libraries\Response::getInstance()->disable();
PMA_downloadHeader($filename, 'text/x-sql', strlen($dump));
echo $dump;
exit;
}
示例15: mb_substr
$filename = $_REQUEST['filename'];
}
/** @var String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
/* Decode data */
if ($extension != 'svg') {
$data = mb_substr($_REQUEST['image'], mb_strpos($_REQUEST['image'], ',') + 1);
$data = base64_decode($data);
} else {
$data = $_REQUEST['image'];
}
/* Send download header */
PMA_downloadHeader($filename, $_REQUEST['type'], mb_strlen($data));
/* Send data */
echo $data;
} else {
if (isset($_REQUEST['monitorconfig'])) {
/* For monitor chart config export */
PMA_downloadHeader('monitor.cfg', 'application/force-download');
echo urldecode($_REQUEST['monitorconfig']);
} else {
if (isset($_REQUEST['import'])) {
/* For monitor chart config import */
header('Content-type: text/plain');
if (!file_exists($_FILES['file']['tmp_name'])) {
exit;
}
echo file_get_contents($_FILES['file']['tmp_name']);
}
}
}