handling headers issue in schema export
This commit is contained in:
48
handle_relation_schema.php
Normal file
48
handle_relation_schema.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
|
* @package phpMyAdmin
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets some core libraries
|
||||||
|
*/
|
||||||
|
require_once './libraries/common.inc.php';
|
||||||
|
require './libraries/StorageEngine.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Includ settings for relation stuff
|
||||||
|
* get all variables needed for exporting relational schema
|
||||||
|
* in $cfgRelation
|
||||||
|
*/
|
||||||
|
require_once './libraries/relation.lib.php';
|
||||||
|
$cfgRelation = PMA_getRelationsParam();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings for relation stuff
|
||||||
|
*/
|
||||||
|
require_once './libraries/transformations.lib.php';
|
||||||
|
require_once './libraries/Index.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is to avoid "Command out of sync" errors. Before switching this to
|
||||||
|
* a value of 0 (for MYSQLI_USE_RESULT), please check the logic
|
||||||
|
* to free results wherever needed.
|
||||||
|
*/
|
||||||
|
$query_default_option = PMA_DBI_QUERY_STORE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get all the export options and verify
|
||||||
|
* call and include the appropriate Schema Class depending on $export_type
|
||||||
|
*
|
||||||
|
/**
|
||||||
|
* default is PDF
|
||||||
|
*/
|
||||||
|
global $db,$export_type;
|
||||||
|
$export_type = isset($export_type) ? $export_type : 'pdf';
|
||||||
|
PMA_DBI_select_db($db);
|
||||||
|
|
||||||
|
include("./libraries/schema/".ucfirst($export_type)."_Relation_Schema.class.php");
|
||||||
|
$obj_schema = eval("new PMA_".ucfirst($export_type)."_Relation_Schema();");
|
@@ -335,9 +335,9 @@ class PMA_EPS
|
|||||||
*/
|
*/
|
||||||
function showOutput($fileName)
|
function showOutput($fileName)
|
||||||
{
|
{
|
||||||
if(ob_get_clean()){
|
// if(ob_get_clean()){
|
||||||
ob_end_clean();
|
//ob_end_clean();
|
||||||
}
|
//}
|
||||||
//header('Content-type: text/xml');
|
//header('Content-type: text/xml');
|
||||||
header('Content-Disposition: attachment; filename="'.$fileName.'.eps"');
|
header('Content-Disposition: attachment; filename="'.$fileName.'.eps"');
|
||||||
$output = $this->stringCommands;
|
$output = $this->stringCommands;
|
||||||
|
@@ -172,7 +172,7 @@ class PMA_SVG extends XMLWriter
|
|||||||
*/
|
*/
|
||||||
function showOutput($fileName)
|
function showOutput($fileName)
|
||||||
{
|
{
|
||||||
ob_get_clean();
|
//ob_get_clean();
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
header('Content-Disposition: attachment; filename="'.$fileName.'.svg"');
|
header('Content-Disposition: attachment; filename="'.$fileName.'.svg"');
|
||||||
$output = $this->flush();
|
$output = $this->flush();
|
||||||
@@ -349,7 +349,7 @@ class Table_Stats
|
|||||||
* @global array The relations settings
|
* @global array The relations settings
|
||||||
* @global string The current db name
|
* @global string The current db name
|
||||||
* @access private
|
* @access private
|
||||||
* @see PMA_PDF, Table_Stats::Table_Stats_setWidth,
|
* @see PMA_SVG, Table_Stats::Table_Stats_setWidth,
|
||||||
Table_Stats::Table_Stats_setHeight
|
Table_Stats::Table_Stats_setHeight
|
||||||
*/
|
*/
|
||||||
function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
|
function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
|
||||||
|
@@ -65,7 +65,7 @@ class PMA_User_Schema
|
|||||||
case 'edcoord':
|
case 'edcoord':
|
||||||
$this->choosenPage = $_POST['chpage'];
|
$this->choosenPage = $_POST['chpage'];
|
||||||
$this->c_table_rows = $_POST['c_table_rows'];
|
$this->c_table_rows = $_POST['c_table_rows'];
|
||||||
$this->_editCoordinates($db, $cfgRelation);
|
$this->_editCoordinates($db, $cfgRelation,$query_default_option);
|
||||||
break;
|
break;
|
||||||
case 'deleteCrap':
|
case 'deleteCrap':
|
||||||
$this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage);
|
$this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage);
|
||||||
@@ -341,7 +341,7 @@ class PMA_User_Schema
|
|||||||
{
|
{
|
||||||
global $cfg,$pmaThemeImage,$db,$test_rs,$chpage;
|
global $cfg,$pmaThemeImage,$db,$test_rs,$chpage;
|
||||||
?>
|
?>
|
||||||
<form method="post" action="export_relation_schema.php">
|
<form method="post" action="handle_relation_schema.php">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
<?php
|
<?php
|
||||||
@@ -775,7 +775,7 @@ class PMA_User_Schema
|
|||||||
* @return void
|
* @return void
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _editCoordinates($db, $cfgRelation)
|
private function _editCoordinates($db, $cfgRelation,$query_default_option)
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < $this->c_table_rows; $i++) {
|
for ($i = 0; $i < $this->c_table_rows; $i++) {
|
||||||
$arrvalue = 'c_table_' . $i;
|
$arrvalue = 'c_table_' . $i;
|
||||||
|
@@ -157,9 +157,9 @@ class PMA_VISIO extends XMLWriter
|
|||||||
*/
|
*/
|
||||||
function showOutput($fileName)
|
function showOutput($fileName)
|
||||||
{
|
{
|
||||||
if(ob_get_clean()){
|
//if(ob_get_clean()){
|
||||||
ob_end_clean();
|
//ob_end_clean();
|
||||||
}
|
//}
|
||||||
//header('Content-type: text/xml');
|
//header('Content-type: text/xml');
|
||||||
header('Content-Disposition: attachment; filename="'.$fileName.'.vdx"');
|
header('Content-Disposition: attachment; filename="'.$fileName.'.vdx"');
|
||||||
$output = $this->flush();
|
$output = $this->flush();
|
||||||
@@ -535,7 +535,6 @@ class PMA_Visio_Relation_Schema extends PMA_Export_Relation_Schema
|
|||||||
if ($seen_a_relation) {
|
if ($seen_a_relation) {
|
||||||
$this->_drawRelations($this->showColor);
|
$this->_drawRelations($this->showColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
$visio->endVisioDoc();
|
$visio->endVisioDoc();
|
||||||
$visio->showOutput($db.'-'.$this->pageNumber);
|
$visio->showOutput($db.'-'.$this->pageNumber);
|
||||||
exit();
|
exit();
|
||||||
@@ -543,7 +542,6 @@ class PMA_Visio_Relation_Schema extends PMA_Export_Relation_Schema
|
|||||||
print_r(get_object_vars($visio));
|
print_r(get_object_vars($visio));
|
||||||
print_r(get_object_vars($this));
|
print_r(get_object_vars($this));
|
||||||
print '</pre>';
|
print '</pre>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2977,11 +2977,11 @@ if(!class_exists('TCPDF', false)) {
|
|||||||
switch($dest) {
|
switch($dest) {
|
||||||
case 'I': {
|
case 'I': {
|
||||||
//Send to standard output
|
//Send to standard output
|
||||||
//if(ob_get_contents()) {
|
if(ob_get_contents()) {
|
||||||
// $this->Error('Some data has already been output, can\'t send PDF file');
|
$this->Error('Some data has already been output, can\'t send PDF file');
|
||||||
//}
|
}
|
||||||
ob_end_clean();
|
//ob_end_clean();
|
||||||
ob_start();
|
//ob_start();
|
||||||
if(php_sapi_name()!='cli') {
|
if(php_sapi_name()!='cli') {
|
||||||
//We send to a browser
|
//We send to a browser
|
||||||
header('Content-Type: application/pdf');
|
header('Content-Type: application/pdf');
|
||||||
@@ -2996,11 +2996,11 @@ if(!class_exists('TCPDF', false)) {
|
|||||||
}
|
}
|
||||||
case 'D': {
|
case 'D': {
|
||||||
//Download file
|
//Download file
|
||||||
// if(ob_get_contents()) {
|
if(ob_get_contents()) {
|
||||||
// $this->Error(ob_get_contents().'Some data has already been output, can\'t send PDF file');
|
$this->Error(ob_get_contents().'Some data has already been output, can\'t send PDF file');
|
||||||
//}
|
}
|
||||||
ob_end_clean();
|
//ob_end_clean();
|
||||||
ob_start();
|
//ob_start();
|
||||||
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) {
|
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) {
|
||||||
header('Content-Type: application/force-download');
|
header('Content-Type: application/force-download');
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user