Fix XML export so it actually can export table structure

More escaping fixes
This commit is contained in:
Piotr Przybylski
2011-07-14 00:05:58 +02:00
parent 65d962d397
commit 70083ad583

View File

@@ -86,7 +86,9 @@ function PMA_exportHeader() {
global $table; global $table;
global $tables; global $tables;
$export_struct = isset($GLOBALS['xml_export_struc']) ? true : false; $export_struct = isset($GLOBALS['xml_export_functions']) || isset($GLOBALS['xml_export_procedures'])
|| isset($GLOBALS['xml_export_tables']) || isset($GLOBALS['xml_export_triggers'])
|| isset($GLOBALS['xml_export_views']);
$export_data = isset($GLOBALS['xml_export_contents']) ? true : false; $export_data = isset($GLOBALS['xml_export_contents']) ? true : false;
if ($GLOBALS['output_charset_conversion']) { if ($GLOBALS['output_charset_conversion']) {
@@ -151,7 +153,7 @@ function PMA_exportHeader() {
$head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf; $head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
$tbl = " " . $tbl; $tbl = " " . htmlspecialchars($tbl);
$tbl = str_replace("\n", "\n ", $tbl); $tbl = str_replace("\n", "\n ", $tbl);
$head .= $tbl . ';' . $crlf; $head .= $tbl . ';' . $crlf;
@@ -167,7 +169,7 @@ function PMA_exportHeader() {
// Do some formatting // Do some formatting
$code = substr(rtrim($code), 0, -3); $code = substr(rtrim($code), 0, -3);
$code = " " . $code; $code = " " . htmlspecialchars($code);
$code = str_replace("\n", "\n ", $code); $code = str_replace("\n", "\n ", $code);
$head .= $code . $crlf; $head .= $code . $crlf;
@@ -190,7 +192,7 @@ function PMA_exportHeader() {
// Do some formatting // Do some formatting
$sql = PMA_DBI_get_definition($db, 'FUNCTION', $function); $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
$sql = rtrim($sql); $sql = rtrim($sql);
$sql = " " . $sql; $sql = " " . htmlspecialchars($sql);
$sql = str_replace("\n", "\n ", $sql); $sql = str_replace("\n", "\n ", $sql);
$head .= $sql . $crlf; $head .= $sql . $crlf;
@@ -213,7 +215,7 @@ function PMA_exportHeader() {
// Do some formatting // Do some formatting
$sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure); $sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
$sql = rtrim($sql); $sql = rtrim($sql);
$sql = " " . $sql; $sql = " " . htmlspecialchars($sql);
$sql = str_replace("\n", "\n ", $sql); $sql = str_replace("\n", "\n ", $sql);
$head .= $sql . $crlf; $head .= $sql . $crlf;
@@ -255,7 +257,7 @@ function PMA_exportDBHeader($db) {
$head = ' <!--' . $crlf $head = ' <!--' . $crlf
. ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf . ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
. ' -->' . $crlf . ' -->' . $crlf
. ' <database name="' . $db . '">' . $crlf; . ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
return PMA_exportOutputHandler($head); return PMA_exportOutputHandler($head);
} }