handling headers issue in schema export

This commit is contained in:
Adnan
2010-08-17 20:41:15 +05:00
parent 03d37b45f1
commit 1cdf881f42
6 changed files with 69 additions and 23 deletions

View 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();");

View File

@@ -335,9 +335,9 @@ class PMA_EPS
*/
function showOutput($fileName)
{
if(ob_get_clean()){
ob_end_clean();
}
// if(ob_get_clean()){
//ob_end_clean();
//}
//header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="'.$fileName.'.eps"');
$output = $this->stringCommands;

View File

@@ -172,7 +172,7 @@ class PMA_SVG extends XMLWriter
*/
function showOutput($fileName)
{
ob_get_clean();
//ob_get_clean();
header('Content-type: image/svg+xml');
header('Content-Disposition: attachment; filename="'.$fileName.'.svg"');
$output = $this->flush();
@@ -349,7 +349,7 @@ class Table_Stats
* @global array The relations settings
* @global string The current db name
* @access private
* @see PMA_PDF, Table_Stats::Table_Stats_setWidth,
* @see PMA_SVG, Table_Stats::Table_Stats_setWidth,
Table_Stats::Table_Stats_setHeight
*/
function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)

View File

@@ -65,7 +65,7 @@ class PMA_User_Schema
case 'edcoord':
$this->choosenPage = $_POST['chpage'];
$this->c_table_rows = $_POST['c_table_rows'];
$this->_editCoordinates($db, $cfgRelation);
$this->_editCoordinates($db, $cfgRelation,$query_default_option);
break;
case 'deleteCrap':
$this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage);
@@ -341,7 +341,7 @@ class PMA_User_Schema
{
global $cfg,$pmaThemeImage,$db,$test_rs,$chpage;
?>
<form method="post" action="export_relation_schema.php">
<form method="post" action="handle_relation_schema.php">
<fieldset>
<legend>
<?php
@@ -775,7 +775,7 @@ class PMA_User_Schema
* @return void
* @access private
*/
private function _editCoordinates($db, $cfgRelation)
private function _editCoordinates($db, $cfgRelation,$query_default_option)
{
for ($i = 0; $i < $this->c_table_rows; $i++) {
$arrvalue = 'c_table_' . $i;

View File

@@ -157,9 +157,9 @@ class PMA_VISIO extends XMLWriter
*/
function showOutput($fileName)
{
if(ob_get_clean()){
ob_end_clean();
}
//if(ob_get_clean()){
//ob_end_clean();
//}
//header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="'.$fileName.'.vdx"');
$output = $this->flush();
@@ -535,7 +535,6 @@ class PMA_Visio_Relation_Schema extends PMA_Export_Relation_Schema
if ($seen_a_relation) {
$this->_drawRelations($this->showColor);
}
$visio->endVisioDoc();
$visio->showOutput($db.'-'.$this->pageNumber);
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($this));
print '</pre>';
}
/**

View File

@@ -2977,11 +2977,11 @@ if(!class_exists('TCPDF', false)) {
switch($dest) {
case 'I': {
//Send to standard output
//if(ob_get_contents()) {
// $this->Error('Some data has already been output, can\'t send PDF file');
//}
ob_end_clean();
ob_start();
if(ob_get_contents()) {
$this->Error('Some data has already been output, can\'t send PDF file');
}
//ob_end_clean();
//ob_start();
if(php_sapi_name()!='cli') {
//We send to a browser
header('Content-Type: application/pdf');
@@ -2996,11 +2996,11 @@ if(!class_exists('TCPDF', false)) {
}
case 'D': {
//Download file
// if(ob_get_contents()) {
// $this->Error(ob_get_contents().'Some data has already been output, can\'t send PDF file');
//}
ob_end_clean();
ob_start();
if(ob_get_contents()) {
$this->Error(ob_get_contents().'Some data has already been output, can\'t send PDF file');
}
//ob_end_clean();
//ob_start();
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) {
header('Content-Type: application/force-download');
} else {