Git
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2011
- 8 participants
- 476 discussions

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12840-g3769b84
by Michal Čihař 02 Aug '11
by Michal Čihař 02 Aug '11
02 Aug '11
The branch, master has been updated
via 3769b849aa6a72f8816cf6bc2cacbff506a2fe85 (commit)
from 7e7be00f8466bb380e0c1d4370aa43ece0b1780f (commit)
- Log -----------------------------------------------------------------
commit 3769b849aa6a72f8816cf6bc2cacbff506a2fe85
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Tue Aug 2 15:53:19 2011 +0200
Forgot to reindent some files
-----------------------------------------------------------------------
Summary of changes:
libraries/export/php_array.php | 226 +++++++++---------
libraries/export/texytext.php | 516 ++++++++++++++++++++--------------------
libraries/export/xls.php | 258 ++++++++++----------
libraries/export/xlsx.php | 256 ++++++++++----------
libraries/export/xml.php | 502 +++++++++++++++++++-------------------
libraries/export/yaml.php | 234 +++++++++---------
6 files changed, 996 insertions(+), 996 deletions(-)
diff --git a/libraries/export/php_array.php b/libraries/export/php_array.php
index 783afe0..6424759 100644
--- a/libraries/export/php_array.php
+++ b/libraries/export/php_array.php
@@ -30,134 +30,134 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Set of functions used to build exports of tables
- */
+ /**
+ * Set of functions used to build exports of tables
+ */
+
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter()
+ {
+ return true;
+ }
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter()
-{
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader()
+ {
+ PMA_exportOutputHandler(
+ '<?php' . $GLOBALS['crlf']
+ . '/**' . $GLOBALS['crlf']
+ . ' * Export to PHP Array plugin for PHPMyAdmin' . $GLOBALS['crlf']
+ . ' * @version 0.2b' . $GLOBALS['crlf']
+ . ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
+ );
+ return true;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader()
-{
- PMA_exportOutputHandler(
- '<?php' . $GLOBALS['crlf']
- . '/**' . $GLOBALS['crlf']
- . ' * Export to PHP Array plugin for PHPMyAdmin' . $GLOBALS['crlf']
- . ' * @version 0.2b' . $GLOBALS['crlf']
- . ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
- );
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db)
+ {
+ PMA_exportOutputHandler('//' . $GLOBALS['crlf'] . '// Database "' . $db . '"' . $GLOBALS['crlf'] . '//' . $GLOBALS['crlf']);
+ return true;
+ }
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db)
-{
- PMA_exportOutputHandler('//' . $GLOBALS['crlf'] . '// Database "' . $db . '"' . $GLOBALS['crlf'] . '//' . $GLOBALS['crlf']);
- return true;
-}
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db)
+ {
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db)
-{
- return true;
-}
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db)
+ {
+ return true;
+ }
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db)
-{
- return true;
-}
+ /**
+ * Outputs the content of a table as a fragment of PHP code
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+
+ $columns_cnt = PMA_DBI_num_fields($result);
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
+ }
+ unset($i);
-/**
- * Outputs the content of a table as a fragment of PHP code
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $buffer = '';
+ $record_cnt = 0;
+ while ($record = PMA_DBI_fetch_row($result)) {
- $columns_cnt = PMA_DBI_num_fields($result);
- for ($i = 0; $i < $columns_cnt; $i++) {
- $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
- }
- unset($i);
+ $record_cnt++;
- $buffer = '';
- $record_cnt = 0;
- while ($record = PMA_DBI_fetch_row($result)) {
+ // Output table name as comment if this is the first record of the table
+ if ($record_cnt == 1) {
+ $buffer .= $crlf . '// ' . $db . '.' . $table . $crlf;
+ $buffer .= '$' . $table . ' = array(' . $crlf;
+ $buffer .= ' array(';
+ } else {
+ $buffer .= ',' . $crlf . ' array(';
+ }
- $record_cnt++;
- // Output table name as comment if this is the first record of the table
- if ($record_cnt == 1) {
- $buffer .= $crlf . '// ' . $db . '.' . $table . $crlf;
- $buffer .= '$' . $table . ' = array(' . $crlf;
- $buffer .= ' array(';
- } else {
- $buffer .= ',' . $crlf . ' array(';
- }
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ $buffer .= "'" . $columns[$i]. "'=>" . var_export($record[$i], true) . (($i + 1 >= $columns_cnt) ? '' : ',');
+ }
+ $buffer .= ')';
+ }
- for ($i = 0; $i < $columns_cnt; $i++) {
- $buffer .= "'" . $columns[$i]. "'=>" . var_export($record[$i], true) . (($i + 1 >= $columns_cnt) ? '' : ',');
+ $buffer .= $crlf . ');' . $crlf;
+ if (! PMA_exportOutputHandler($buffer)) {
+ return false;
}
- $buffer .= ')';
- }
+ PMA_DBI_free_result($result);
- $buffer .= $crlf . ');' . $crlf;
- if (! PMA_exportOutputHandler($buffer)) {
- return false;
+ return true;
}
- PMA_DBI_free_result($result);
-
- return true;
-}
-
}
diff --git a/libraries/export/texytext.php b/libraries/export/texytext.php
index 06de740..d248c1b 100644
--- a/libraries/export/texytext.php
+++ b/libraries/export/texytext.php
@@ -32,302 +32,302 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- return true;
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- return true;
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- return PMA_exportOutputHandler('===' . __('Database') . ' ' . $db . "\n\n");
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
-
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
-
-/**
- * Outputs the content of a table in Texy format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- global $what;
-
- if (! PMA_exportOutputHandler('== ' . __('Dumping data for table') . ' ' . $table . "\n\n")) {
- return false;
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ return true;
}
- // Gets the data from the database
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- $fields_cnt = PMA_DBI_num_fields($result);
-
- // If required, get fields name at the first line
- if (isset($GLOBALS[$what . '_columns'])) {
- $text_output = "|------\n";
- for ($i = 0; $i < $fields_cnt; $i++) {
- $text_output .= '|' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i)));
- } // end for
- $text_output .= "\n|------\n";
- if (! PMA_exportOutputHandler($text_output)) {
- return false;
- }
- } // end if
-
- // Format the data
- while ($row = PMA_DBI_fetch_row($result)) {
- $text_output = '';
- for ($j = 0; $j < $fields_cnt; $j++) {
- if (! isset($row[$j]) || is_null($row[$j])) {
- $value = $GLOBALS[$what . '_null'];
- } elseif ($row[$j] == '0' || $row[$j] != '') {
- $value = $row[$j];
- } else {
- $value = ' ';
- }
- $text_output .= '|' . htmlspecialchars($value);
- } // end for
- $text_output .= "\n";
- if (! PMA_exportOutputHandler($text_output)) {
- return false;
- }
- } // end while
- PMA_DBI_free_result($result);
-
- return true;
-}
-
-/**
- * Outputs table's structure
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param bool $do_relation whether to include relation comments
- * @param bool $do_comments whether to include the pmadb-style column comments
- * as comments in the structure; this is deprecated
- * but the parameter is left here because export.php
- * calls PMA_exportStructure() also for other export
- * types which use this parameter
- * @param bool $do_mime whether to include mime comments
- * @param bool $dates whether to include creation/update/check dates
- * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
- * @param string $export_type 'server', 'database', 'table'
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
-{
- global $cfgRelation;
-
- if (! PMA_exportOutputHandler('== ' . __('Table structure for table') . ' ' .$table . "\n\n")) {
- return false;
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ return true;
}
/**
- * Get the unique keys in the table
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
- $keys_result = PMA_DBI_query($keys_query);
- $unique_keys = array();
- while ($key = PMA_DBI_fetch_assoc($keys_result)) {
- if ($key['Non_unique'] == 0) {
- $unique_keys[] = $key['Column_name'];
- }
+ function PMA_exportDBHeader($db) {
+ return PMA_exportOutputHandler('===' . __('Database') . ' ' . $db . "\n\n");
}
- PMA_DBI_free_result($keys_result);
/**
- * Gets fields properties
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- PMA_DBI_select_db($db);
-
- // Check if we can use Relations
- if ($do_relation && ! empty($cfgRelation['relation'])) {
- // Find which tables are related with the current one and write it in
- // an array
- $res_rel = PMA_getForeigners($db, $table);
+ function PMA_exportDBFooter($db) {
+ return true;
+ }
- if ($res_rel && count($res_rel) > 0) {
- $have_rel = true;
- } else {
- $have_rel = false;
- }
- } else {
- $have_rel = false;
- } // end if
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
/**
- * Displays the table structure
+ * Outputs the content of a table in Texy format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ global $what;
- $columns_cnt = 4;
- if ($do_relation && $have_rel) {
- $columns_cnt++;
- }
- if ($do_comments && $cfgRelation['commwork']) {
- $columns_cnt++;
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $columns_cnt++;
- }
+ if (! PMA_exportOutputHandler('== ' . __('Dumping data for table') . ' ' . $table . "\n\n")) {
+ return false;
+ }
- $text_output = "|------\n";
- $text_output .= '|' . htmlspecialchars(__('Column'));
- $text_output .= '|' . htmlspecialchars(__('Type'));
- $text_output .= '|' . htmlspecialchars(__('Null'));
- $text_output .= '|' . htmlspecialchars(__('Default'));
- if ($do_relation && $have_rel) {
- $text_output .= '|' . htmlspecialchars(__('Links to'));
- }
- if ($do_comments) {
- $text_output .= '|' . htmlspecialchars(__('Comments'));
- $comments = PMA_getComments($db, $table);
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $text_output .= '|' . htmlspecialchars('MIME');
- $mime_map = PMA_getMIME($db, $table, true);
- }
- $text_output .= "\n|------\n";
+ // Gets the data from the database
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $fields_cnt = PMA_DBI_num_fields($result);
+
+ // If required, get fields name at the first line
+ if (isset($GLOBALS[$what . '_columns'])) {
+ $text_output = "|------\n";
+ for ($i = 0; $i < $fields_cnt; $i++) {
+ $text_output .= '|' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i)));
+ } // end for
+ $text_output .= "\n|------\n";
+ if (! PMA_exportOutputHandler($text_output)) {
+ return false;
+ }
+ } // end if
+
+ // Format the data
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $text_output = '';
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ if (! isset($row[$j]) || is_null($row[$j])) {
+ $value = $GLOBALS[$what . '_null'];
+ } elseif ($row[$j] == '0' || $row[$j] != '') {
+ $value = $row[$j];
+ } else {
+ $value = ' ';
+ }
+ $text_output .= '|' . htmlspecialchars($value);
+ } // end for
+ $text_output .= "\n";
+ if (! PMA_exportOutputHandler($text_output)) {
+ return false;
+ }
+ } // end while
+ PMA_DBI_free_result($result);
- if (! PMA_exportOutputHandler($text_output)) {
- return false;
+ return true;
}
- $columns = PMA_DBI_get_columns($db, $table);
- foreach ($columns as $column) {
-
- $text_output = '';
- $type = $column['Type'];
- // reformat mysql query output
- // set or enum types: slashes single quotes inside options
- if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
- $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
- $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
- $type_nowrap = '';
-
- $binary = 0;
- $unsigned = 0;
- $zerofill = 0;
- } else {
- $type_nowrap = ' nowrap="nowrap"';
- $type = preg_replace('/BINARY/i', '', $type);
- $type = preg_replace('/ZEROFILL/i', '', $type);
- $type = preg_replace('/UNSIGNED/i', '', $type);
- if (empty($type)) {
- $type = ' ';
- }
+ /**
+ * Outputs table's structure
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param bool $do_relation whether to include relation comments
+ * @param bool $do_comments whether to include the pmadb-style column comments
+ * as comments in the structure; this is deprecated
+ * but the parameter is left here because export.php
+ * calls PMA_exportStructure() also for other export
+ * types which use this parameter
+ * @param bool $do_mime whether to include mime comments
+ * @param bool $dates whether to include creation/update/check dates
+ * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
+ * @param string $export_type 'server', 'database', 'table'
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
+ {
+ global $cfgRelation;
- $binary = preg_match('/BINARY/i', $column['Type']);
- $unsigned = preg_match('/UNSIGNED/i', $column['Type']);
- $zerofill = preg_match('/ZEROFILL/i', $column['Type']);
- }
- $attribute = ' ';
- if ($binary) {
- $attribute = 'BINARY';
- }
- if ($unsigned) {
- $attribute = 'UNSIGNED';
- }
- if ($zerofill) {
- $attribute = 'UNSIGNED ZEROFILL';
+ if (! PMA_exportOutputHandler('== ' . __('Table structure for table') . ' ' .$table . "\n\n")) {
+ return false;
}
- if (! isset($column['Default'])) {
- if ($column['Null'] != 'NO') {
- $column['Default'] = 'NULL';
+
+ /**
+ * Get the unique keys in the table
+ */
+ $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
+ $keys_result = PMA_DBI_query($keys_query);
+ $unique_keys = array();
+ while ($key = PMA_DBI_fetch_assoc($keys_result)) {
+ if ($key['Non_unique'] == 0) {
+ $unique_keys[] = $key['Column_name'];
}
}
+ PMA_DBI_free_result($keys_result);
- $fmt_pre = '';
- $fmt_post = '';
- if (in_array($column['Field'], $unique_keys)) {
- $fmt_pre = '**' . $fmt_pre;
- $fmt_post = $fmt_post . '**';
- }
- if ($column['Key']=='PRI') {
- $fmt_pre = '//' . $fmt_pre;
- $fmt_post = $fmt_post . '//';
- }
- $text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
- $text_output .= '|' . htmlspecialchars($type);
- $text_output .= '|' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
- $text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
+ /**
+ * Gets fields properties
+ */
+ PMA_DBI_select_db($db);
- $field_name = $column['Field'];
+ // Check if we can use Relations
+ if ($do_relation && ! empty($cfgRelation['relation'])) {
+ // Find which tables are related with the current one and write it in
+ // an array
+ $res_rel = PMA_getForeigners($db, $table);
+ if ($res_rel && count($res_rel) > 0) {
+ $have_rel = true;
+ } else {
+ $have_rel = false;
+ }
+ } else {
+ $have_rel = false;
+ } // end if
+
+ /**
+ * Displays the table structure
+ */
+
+ $columns_cnt = 4;
if ($do_relation && $have_rel) {
- $text_output .= '|' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '');
+ $columns_cnt++;
}
if ($do_comments && $cfgRelation['commwork']) {
- $text_output .= '|' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '');
+ $columns_cnt++;
}
if ($do_mime && $cfgRelation['mimework']) {
- $text_output .= '|' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '');
+ $columns_cnt++;
}
- $text_output .= "\n";
+ $text_output = "|------\n";
+ $text_output .= '|' . htmlspecialchars(__('Column'));
+ $text_output .= '|' . htmlspecialchars(__('Type'));
+ $text_output .= '|' . htmlspecialchars(__('Null'));
+ $text_output .= '|' . htmlspecialchars(__('Default'));
+ if ($do_relation && $have_rel) {
+ $text_output .= '|' . htmlspecialchars(__('Links to'));
+ }
+ if ($do_comments) {
+ $text_output .= '|' . htmlspecialchars(__('Comments'));
+ $comments = PMA_getComments($db, $table);
+ }
+ if ($do_mime && $cfgRelation['mimework']) {
+ $text_output .= '|' . htmlspecialchars('MIME');
+ $mime_map = PMA_getMIME($db, $table, true);
+ }
+ $text_output .= "\n|------\n";
if (! PMA_exportOutputHandler($text_output)) {
return false;
}
- } // end while
- return true;
-}
+ $columns = PMA_DBI_get_columns($db, $table);
+ foreach ($columns as $column) {
+
+ $text_output = '';
+ $type = $column['Type'];
+ // reformat mysql query output
+ // set or enum types: slashes single quotes inside options
+ if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
+ $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
+ $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
+ $type_nowrap = '';
+
+ $binary = 0;
+ $unsigned = 0;
+ $zerofill = 0;
+ } else {
+ $type_nowrap = ' nowrap="nowrap"';
+ $type = preg_replace('/BINARY/i', '', $type);
+ $type = preg_replace('/ZEROFILL/i', '', $type);
+ $type = preg_replace('/UNSIGNED/i', '', $type);
+ if (empty($type)) {
+ $type = ' ';
+ }
+
+ $binary = preg_match('/BINARY/i', $column['Type']);
+ $unsigned = preg_match('/UNSIGNED/i', $column['Type']);
+ $zerofill = preg_match('/ZEROFILL/i', $column['Type']);
+ }
+ $attribute = ' ';
+ if ($binary) {
+ $attribute = 'BINARY';
+ }
+ if ($unsigned) {
+ $attribute = 'UNSIGNED';
+ }
+ if ($zerofill) {
+ $attribute = 'UNSIGNED ZEROFILL';
+ }
+ if (! isset($column['Default'])) {
+ if ($column['Null'] != 'NO') {
+ $column['Default'] = 'NULL';
+ }
+ }
+
+ $fmt_pre = '';
+ $fmt_post = '';
+ if (in_array($column['Field'], $unique_keys)) {
+ $fmt_pre = '**' . $fmt_pre;
+ $fmt_post = $fmt_post . '**';
+ }
+ if ($column['Key']=='PRI') {
+ $fmt_pre = '//' . $fmt_pre;
+ $fmt_post = $fmt_post . '//';
+ }
+ $text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
+ $text_output .= '|' . htmlspecialchars($type);
+ $text_output .= '|' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
+ $text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
+
+ $field_name = $column['Field'];
+
+ if ($do_relation && $have_rel) {
+ $text_output .= '|' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '');
+ }
+ if ($do_comments && $cfgRelation['commwork']) {
+ $text_output .= '|' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '');
+ }
+ if ($do_mime && $cfgRelation['mimework']) {
+ $text_output .= '|' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '');
+ }
+
+ $text_output .= "\n";
+
+ if (! PMA_exportOutputHandler($text_output)) {
+ return false;
+ }
+ } // end while
+
+ return true;
+ }
}
?>
diff --git a/libraries/export/xls.php b/libraries/export/xls.php
index 5747f08..3ff6f6a 100644
--- a/libraries/export/xls.php
+++ b/libraries/export/xls.php
@@ -30,164 +30,164 @@ if (isset($plugin_list)) {
);
} else {
-/* Append the PHPExcel directory to the include path variable */
-set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
+ /* Append the PHPExcel directory to the include path variable */
+ set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
-require_once './libraries/PHPExcel/PHPExcel.php';
-require_once './libraries/PHPExcel/PHPExcel/Writer/Excel5.php';
+ require_once './libraries/PHPExcel/PHPExcel.php';
+ require_once './libraries/PHPExcel/PHPExcel/Writer/Excel5.php';
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- global $workbook;
- global $tmp_filename;
-
- $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
-
- $workbookWriter = new PHPExcel_Writer_Excel5($workbook);
- $workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
- $workbookWriter->save($tmp_filename);
-
- if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
- return false;
- }
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ global $workbook;
+ global $tmp_filename;
- unlink($tmp_filename);
+ $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
- unset($GLOBALS['workbook']);
- unset($GLOBALS['sheet_index']);
+ $workbookWriter = new PHPExcel_Writer_Excel5($workbook);
+ $workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
+ $workbookWriter->save($tmp_filename);
- return true;
-}
+ if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
+ return false;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- global $db;
+ unlink($tmp_filename);
- /* Initialize the workbook */
- $GLOBALS['workbook'] = new PHPExcel();
- $GLOBALS['sheet_index'] = 0;
- global $workbook;
+ unset($GLOBALS['workbook']);
+ unset($GLOBALS['sheet_index']);
- $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
- $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
- $workbook->getProperties()->setTitle($db);
- $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLS Dump');
+ return true;
+ }
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ global $db;
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
+ /* Initialize the workbook */
+ $GLOBALS['workbook'] = new PHPExcel();
+ $GLOBALS['sheet_index'] = 0;
+ global $workbook;
+ $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
+ $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
+ $workbook->getProperties()->setTitle($db);
+ $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLS Dump');
- return true;
-}
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
-/**
- * Outputs the content of a table in XLS format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- global $workbook;
- global $sheet_index;
+ return true;
+ }
/**
- * Get the data from the database using the original query
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- $result = PMA_DBI_fetch_result($sql_query);
- $row_cnt = count($result);
+ function PMA_exportDBFooter($db) {
+ return true;
+ }
- if ($row_cnt > 0) {
- $col_names = array_keys($result[0]);
- $fields_cnt = count($result[0]);
- $row_offset = 1;
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
- /* Only one sheet is created on workbook initialization */
- if ($sheet_index > 0) {
- $workbook->createSheet();
- }
+ /**
+ * Outputs the content of a table in XLS format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ global $workbook;
+ global $sheet_index;
+
+ /**
+ * Get the data from the database using the original query
+ */
+ $result = PMA_DBI_fetch_result($sql_query);
+ $row_cnt = count($result);
+
+ if ($row_cnt > 0) {
+ $col_names = array_keys($result[0]);
+ $fields_cnt = count($result[0]);
+ $row_offset = 1;
+
+ /* Only one sheet is created on workbook initialization */
+ if ($sheet_index > 0) {
+ $workbook->createSheet();
+ }
- $workbook->setActiveSheetIndex($sheet_index);
- $workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
+ $workbook->setActiveSheetIndex($sheet_index);
+ $workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
- if (isset($GLOBALS['xls_columns']) && $GLOBALS['xls_columns']) {
- for ($i = 0; $i < $fields_cnt; ++$i) {
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
+ if (isset($GLOBALS['xls_columns']) && $GLOBALS['xls_columns']) {
+ for ($i = 0; $i < $fields_cnt; ++$i) {
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
+ }
+ $row_offset++;
}
- $row_offset++;
- }
- for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
- for ($c = 0; $c < $fields_cnt; ++$c) {
- if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xls_null']);
- } elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
- /**
- * @todo we should somehow handle character set here!
- */
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
- } else {
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
+ for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
+ for ($c = 0; $c < $fields_cnt; ++$c) {
+ if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xls_null']);
+ } elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
+ /**
+ * @todo we should somehow handle character set here!
+ */
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
+ } else {
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
+ }
}
}
+
+ $sheet_index++;
}
- $sheet_index++;
+ return true;
}
- return true;
-}
-
}
?>
diff --git a/libraries/export/xlsx.php b/libraries/export/xlsx.php
index 8f5cb19..b06a615 100644
--- a/libraries/export/xlsx.php
+++ b/libraries/export/xlsx.php
@@ -30,163 +30,163 @@ if (isset($plugin_list)) {
);
} else {
-/* Append the PHPExcel directory to the include path variable */
-set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
+ /* Append the PHPExcel directory to the include path variable */
+ set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
-require_once './libraries/PHPExcel/PHPExcel.php';
-require_once './libraries/PHPExcel/PHPExcel/Writer/Excel2007.php';
+ require_once './libraries/PHPExcel/PHPExcel.php';
+ require_once './libraries/PHPExcel/PHPExcel/Writer/Excel2007.php';
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- global $workbook;
- global $tmp_filename;
-
- $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_');
-
- $workbookWriter = new PHPExcel_Writer_Excel2007($workbook);
- $workbookWriter->save($tmp_filename);
-
- if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
- return false;
- }
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ global $workbook;
+ global $tmp_filename;
- unlink($tmp_filename);
+ $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_');
- unset($GLOBALS['workbook']);
- unset($GLOBALS['sheet_index']);
+ $workbookWriter = new PHPExcel_Writer_Excel2007($workbook);
+ $workbookWriter->save($tmp_filename);
- return true;
-}
+ if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
+ return false;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- global $db;
+ unlink($tmp_filename);
- /* Initialize the workbook */
- $GLOBALS['workbook'] = new PHPExcel();
- $GLOBALS['sheet_index'] = 0;
- global $workbook;
+ unset($GLOBALS['workbook']);
+ unset($GLOBALS['sheet_index']);
- $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
- $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
- $workbook->getProperties()->setTitle($db);
- $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLSX Dump');
+ return true;
+ }
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ global $db;
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
+ /* Initialize the workbook */
+ $GLOBALS['workbook'] = new PHPExcel();
+ $GLOBALS['sheet_index'] = 0;
+ global $workbook;
+ $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
+ $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
+ $workbook->getProperties()->setTitle($db);
+ $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLSX Dump');
- return true;
-}
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
-/**
- * Outputs the content of a table in XLSX format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- global $workbook;
- global $sheet_index;
+ return true;
+ }
/**
- * Get the data from the database using the original query
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- $result = PMA_DBI_fetch_result($sql_query);
- $row_cnt = count($result);
+ function PMA_exportDBFooter($db) {
+ return true;
+ }
- if ($row_cnt > 0) {
- $col_names = array_keys($result[0]);
- $fields_cnt = count($result[0]);
- $row_offset = 1;
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
- /* Only one sheet is created on workbook initialization */
- if ($sheet_index > 0) {
- $workbook->createSheet();
- }
+ /**
+ * Outputs the content of a table in XLSX format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ global $workbook;
+ global $sheet_index;
+
+ /**
+ * Get the data from the database using the original query
+ */
+ $result = PMA_DBI_fetch_result($sql_query);
+ $row_cnt = count($result);
+
+ if ($row_cnt > 0) {
+ $col_names = array_keys($result[0]);
+ $fields_cnt = count($result[0]);
+ $row_offset = 1;
+
+ /* Only one sheet is created on workbook initialization */
+ if ($sheet_index > 0) {
+ $workbook->createSheet();
+ }
- $workbook->setActiveSheetIndex($sheet_index);
- $workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
+ $workbook->setActiveSheetIndex($sheet_index);
+ $workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
- if (isset($GLOBALS['xlsx_columns']) && $GLOBALS['xlsx_columns']) {
- for ($i = 0; $i < $fields_cnt; ++$i) {
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
+ if (isset($GLOBALS['xlsx_columns']) && $GLOBALS['xlsx_columns']) {
+ for ($i = 0; $i < $fields_cnt; ++$i) {
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
+ }
+ $row_offset++;
}
- $row_offset++;
- }
- for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
- for ($c = 0; $c < $fields_cnt; ++$c) {
- if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xlsx_null']);
- } elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
- /**
- * @todo we should somehow handle character set here!
- */
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
- } else {
- $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
+ for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
+ for ($c = 0; $c < $fields_cnt; ++$c) {
+ if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xlsx_null']);
+ } elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
+ /**
+ * @todo we should somehow handle character set here!
+ */
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
+ } else {
+ $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
+ }
}
}
+
+ $sheet_index++;
}
- $sheet_index++;
+ return true;
}
- return true;
-}
-
}
?>
diff --git a/libraries/export/xml.php b/libraries/export/xml.php
index 26953af..b55d1e9 100644
--- a/libraries/export/xml.php
+++ b/libraries/export/xml.php
@@ -48,295 +48,295 @@ if (isset($plugin_list)) {
$plugin_list['xml']['options'][] = array('type' => 'end_group');
} else {
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- $foot = '</pma_xml_export>';
-
- return PMA_exportOutputHandler($foot);
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- global $crlf;
- global $cfg;
- global $db;
- global $table;
- global $tables;
-
- $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;
-
- if ($GLOBALS['output_charset_conversion']) {
- $charset = $GLOBALS['charset_of_file'];
- } else {
- $charset = 'utf-8';
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ $foot = '</pma_xml_export>';
+
+ return PMA_exportOutputHandler($foot);
}
- $head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf
- . '<!--' . $crlf
- . '- phpMyAdmin XML Dump' . $crlf
- . '- version ' . PMA_VERSION . $crlf
- . '- http://www.phpmyadmin.net' . $crlf
- . '-' . $crlf
- . '- ' . __('Host') . ': ' . $cfg['Server']['host'];
- if (!empty($cfg['Server']['port'])) {
- $head .= ':' . $cfg['Server']['port'];
- }
- $head .= $crlf
- . '- ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
- . '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
- . '- ' . __('PHP Version') . ': ' . phpversion() . $crlf
- . '-->' . $crlf . $crlf;
-
- $head .= '<pma_xml_export version="1.0"' . (($export_struct) ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
-
- if ($export_struct) {
- $result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.PMA_sqlAddSlashes($db).'\' LIMIT 1');
- $db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
- $db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
-
- $head .= ' <!--' . $crlf;
- $head .= ' - Structure schemas' . $crlf;
- $head .= ' -->' . $crlf;
- $head .= ' <pma:structure_schemas>' . $crlf;
- $head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
-
- if (count($tables) == 0) {
- $tables[] = $table;
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ global $crlf;
+ global $cfg;
+ global $db;
+ global $table;
+ global $tables;
+
+ $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;
+
+ if ($GLOBALS['output_charset_conversion']) {
+ $charset = $GLOBALS['charset_of_file'];
+ } else {
+ $charset = 'utf-8';
}
- foreach ($tables as $table) {
- // Export tables and views
- $result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0);
- $tbl = $result[$table][1];
+ $head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf
+ . '<!--' . $crlf
+ . '- phpMyAdmin XML Dump' . $crlf
+ . '- version ' . PMA_VERSION . $crlf
+ . '- http://www.phpmyadmin.net' . $crlf
+ . '-' . $crlf
+ . '- ' . __('Host') . ': ' . $cfg['Server']['host'];
+ if (!empty($cfg['Server']['port'])) {
+ $head .= ':' . $cfg['Server']['port'];
+ }
+ $head .= $crlf
+ . '- ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
+ . '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
+ . '- ' . __('PHP Version') . ': ' . phpversion() . $crlf
+ . '-->' . $crlf . $crlf;
+
+ $head .= '<pma_xml_export version="1.0"' . (($export_struct) ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
+
+ if ($export_struct) {
+ $result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.PMA_sqlAddSlashes($db).'\' LIMIT 1');
+ $db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
+ $db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
+
+ $head .= ' <!--' . $crlf;
+ $head .= ' - Structure schemas' . $crlf;
+ $head .= ' -->' . $crlf;
+ $head .= ' <pma:structure_schemas>' . $crlf;
+ $head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
+
+ if (count($tables) == 0) {
+ $tables[] = $table;
+ }
- $is_view = PMA_isView($db, $table);
+ foreach ($tables as $table) {
+ // Export tables and views
+ $result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0);
+ $tbl = $result[$table][1];
- if ($is_view) {
- $type = 'view';
- } else {
- $type = 'table';
- }
-
- if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
- continue;
- }
-
- if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
- continue;
+ $is_view = PMA_isView($db, $table);
+
+ if ($is_view) {
+ $type = 'view';
+ } else {
+ $type = 'table';
+ }
+
+ if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
+ continue;
+ }
+
+ if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
+ continue;
+ }
+
+ $head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
+
+ $tbl = " " . htmlspecialchars($tbl);
+ $tbl = str_replace("\n", "\n ", $tbl);
+
+ $head .= $tbl . ';' . $crlf;
+ $head .= ' </pma:' . $type . '>' . $crlf;
+
+ if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
+ // Export triggers
+ $triggers = PMA_DBI_get_triggers($db, $table);
+ if ($triggers) {
+ foreach ($triggers as $trigger) {
+ $code = $trigger['create'];
+ $head .= ' <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
+
+ // Do some formatting
+ $code = substr(rtrim($code), 0, -3);
+ $code = " " . htmlspecialchars($code);
+ $code = str_replace("\n", "\n ", $code);
+
+ $head .= $code . $crlf;
+ $head .= ' </pma:trigger>' . $crlf;
+ }
+
+ unset($trigger);
+ unset($triggers);
+ }
+ }
}
- $head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
-
- $tbl = " " . htmlspecialchars($tbl);
- $tbl = str_replace("\n", "\n ", $tbl);
-
- $head .= $tbl . ';' . $crlf;
- $head .= ' </pma:' . $type . '>' . $crlf;
-
- if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
- // Export triggers
- $triggers = PMA_DBI_get_triggers($db, $table);
- if ($triggers) {
- foreach ($triggers as $trigger) {
- $code = $trigger['create'];
- $head .= ' <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
+ if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
+ // Export functions
+ $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
+ if ($functions) {
+ foreach ($functions as $function) {
+ $head .= ' <pma:function name="' . $function . '">' . $crlf;
// Do some formatting
- $code = substr(rtrim($code), 0, -3);
- $code = " " . htmlspecialchars($code);
- $code = str_replace("\n", "\n ", $code);
+ $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
+ $sql = rtrim($sql);
+ $sql = " " . htmlspecialchars($sql);
+ $sql = str_replace("\n", "\n ", $sql);
- $head .= $code . $crlf;
- $head .= ' </pma:trigger>' . $crlf;
+ $head .= $sql . $crlf;
+ $head .= ' </pma:function>' . $crlf;
}
- unset($trigger);
- unset($triggers);
+ unset($create_func);
+ unset($function);
+ unset($functions);
}
}
- }
-
- if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
- // Export functions
- $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
- if ($functions) {
- foreach ($functions as $function) {
- $head .= ' <pma:function name="' . $function . '">' . $crlf;
-
- // Do some formatting
- $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
- $sql = rtrim($sql);
- $sql = " " . htmlspecialchars($sql);
- $sql = str_replace("\n", "\n ", $sql);
-
- $head .= $sql . $crlf;
- $head .= ' </pma:function>' . $crlf;
- }
- unset($create_func);
- unset($function);
- unset($functions);
- }
- }
-
- if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
- // Export procedures
- $procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
- if ($procedures) {
- foreach ($procedures as $procedure) {
- $head .= ' <pma:procedure name="' . $procedure . '">' . $crlf;
-
- // Do some formatting
- $sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
- $sql = rtrim($sql);
- $sql = " " . htmlspecialchars($sql);
- $sql = str_replace("\n", "\n ", $sql);
-
- $head .= $sql . $crlf;
- $head .= ' </pma:procedure>' . $crlf;
- }
+ if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
+ // Export procedures
+ $procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
+ if ($procedures) {
+ foreach ($procedures as $procedure) {
+ $head .= ' <pma:procedure name="' . $procedure . '">' . $crlf;
+
+ // Do some formatting
+ $sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
+ $sql = rtrim($sql);
+ $sql = " " . htmlspecialchars($sql);
+ $sql = str_replace("\n", "\n ", $sql);
+
+ $head .= $sql . $crlf;
+ $head .= ' </pma:procedure>' . $crlf;
+ }
- unset($create_proc);
- unset($procedure);
- unset($procedures);
+ unset($create_proc);
+ unset($procedure);
+ unset($procedures);
+ }
}
- }
- unset($result);
+ unset($result);
- $head .= ' </pma:database>' . $crlf;
- $head .= ' </pma:structure_schemas>' . $crlf;
+ $head .= ' </pma:database>' . $crlf;
+ $head .= ' </pma:structure_schemas>' . $crlf;
- if ($export_data) {
- $head .= $crlf;
+ if ($export_data) {
+ $head .= $crlf;
+ }
}
- }
-
- return PMA_exportOutputHandler($head);
-}
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- global $crlf;
-
- if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
- $head = ' <!--' . $crlf
- . ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
- . ' -->' . $crlf
- . ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
-
return PMA_exportOutputHandler($head);
}
- else
- {
- return true;
- }
-}
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- global $crlf;
-
- if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
- return PMA_exportOutputHandler(' </database>' . $crlf);
- }
- else
- {
- return true;
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ global $crlf;
+
+ if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
+ $head = ' <!--' . $crlf
+ . ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
+ . ' -->' . $crlf
+ . ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
+
+ return PMA_exportOutputHandler($head);
+ }
+ else
+ {
+ return true;
+ }
}
-}
-
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
-/**
- * Outputs the content of a table in XML format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
-
- if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
-
- $columns_cnt = PMA_DBI_num_fields($result);
- $columns = array();
- for ($i = 0; $i < $columns_cnt; $i++) {
- $columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i)));
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ global $crlf;
+
+ if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
+ return PMA_exportOutputHandler(' </database>' . $crlf);
}
- unset($i);
-
- $buffer = ' <!-- ' . __('Table') . ' ' . $table . ' -->' . $crlf;
- if (!PMA_exportOutputHandler($buffer)) {
- return false;
+ else
+ {
+ return true;
}
+ }
+
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
- while ($record = PMA_DBI_fetch_row($result)) {
- $buffer = ' <table name="' . htmlspecialchars($table) . '">' . $crlf;
+ /**
+ * Outputs the content of a table in XML format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+
+ if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+
+ $columns_cnt = PMA_DBI_num_fields($result);
+ $columns = array();
for ($i = 0; $i < $columns_cnt; $i++) {
- // If a cell is NULL, still export it to preserve the XML structure
- if (!isset($record[$i]) || is_null($record[$i])) {
- $record[$i] = 'NULL';
- }
- $buffer .= ' <column name="' . htmlspecialchars($columns[$i]) . '">' . htmlspecialchars((string)$record[$i])
- . '</column>' . $crlf;
+ $columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i)));
}
- $buffer .= ' </table>' . $crlf;
+ unset($i);
+ $buffer = ' <!-- ' . __('Table') . ' ' . $table . ' -->' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
+
+ while ($record = PMA_DBI_fetch_row($result)) {
+ $buffer = ' <table name="' . htmlspecialchars($table) . '">' . $crlf;
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ // If a cell is NULL, still export it to preserve the XML structure
+ if (!isset($record[$i]) || is_null($record[$i])) {
+ $record[$i] = 'NULL';
+ }
+ $buffer .= ' <column name="' . htmlspecialchars($columns[$i]) . '">' . htmlspecialchars((string)$record[$i])
+ . '</column>' . $crlf;
+ }
+ $buffer .= ' </table>' . $crlf;
+
+ if (!PMA_exportOutputHandler($buffer)) {
+ return false;
+ }
+ }
+ PMA_DBI_free_result($result);
}
- PMA_DBI_free_result($result);
- }
- return true;
-} // end of the 'PMA_getTableXML()' function
-}
+ return true;
+ } // end of the 'PMA_getTableXML()' function
+ }
}
?>
diff --git a/libraries/export/yaml.php b/libraries/export/yaml.php
index 26b19a9..0ec1551 100644
--- a/libraries/export/yaml.php
+++ b/libraries/export/yaml.php
@@ -31,139 +31,139 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Set of functions used to build exports of tables
- */
-
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter()
-{
- PMA_exportOutputHandler('...' . $GLOBALS['crlf']);
- return true;
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader()
-{
- PMA_exportOutputHandler('%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']);
- return true;
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db)
-{
- return true;
-}
+ /**
+ * Set of functions used to build exports of tables
+ */
+
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter()
+ {
+ PMA_exportOutputHandler('...' . $GLOBALS['crlf']);
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db)
-{
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader()
+ {
+ PMA_exportOutputHandler('%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']);
+ return true;
+ }
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db)
-{
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db)
+ {
+ return true;
+ }
-/**
- * Outputs the content of a table in YAML format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db)
+ {
+ return true;
+ }
- $columns_cnt = PMA_DBI_num_fields($result);
- for ($i = 0; $i < $columns_cnt; $i++) {
- $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db)
+ {
+ return true;
}
- unset($i);
-
- $buffer = '';
- $record_cnt = 0;
- while ($record = PMA_DBI_fetch_row($result)) {
- $record_cnt++;
-
- // Output table name as comment if this is the first record of the table
- if ($record_cnt == 1) {
- $buffer = '# ' . $db . '.' . $table . $crlf;
- $buffer .= '-' . $crlf;
- } else {
- $buffer = '-' . $crlf;
- }
+ /**
+ * Outputs the content of a table in YAML format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+
+ $columns_cnt = PMA_DBI_num_fields($result);
for ($i = 0; $i < $columns_cnt; $i++) {
- if (! isset($record[$i])) {
- continue;
+ $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
+ }
+ unset($i);
+
+ $buffer = '';
+ $record_cnt = 0;
+ while ($record = PMA_DBI_fetch_row($result)) {
+ $record_cnt++;
+
+ // Output table name as comment if this is the first record of the table
+ if ($record_cnt == 1) {
+ $buffer = '# ' . $db . '.' . $table . $crlf;
+ $buffer .= '-' . $crlf;
+ } else {
+ $buffer = '-' . $crlf;
}
- $column = $columns[$i];
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ if (! isset($record[$i])) {
+ continue;
+ }
- if (is_null($record[$i])) {
- $buffer .= ' ' . $column . ': null' . $crlf;
- continue;
- }
+ $column = $columns[$i];
+
+ if (is_null($record[$i])) {
+ $buffer .= ' ' . $column . ': null' . $crlf;
+ continue;
+ }
- if (is_numeric($record[$i])) {
- $buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
- continue;
+ if (is_numeric($record[$i])) {
+ $buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
+ continue;
+ }
+
+ $record[$i] = str_replace(array('\\', '"', "\n", "\r"), array('\\\\', '\"', '\n', '\r'), $record[$i]);
+ $buffer .= ' ' . $column . ': "' . $record[$i] . '"' . $crlf;
}
- $record[$i] = str_replace(array('\\', '"', "\n", "\r"), array('\\\\', '\"', '\n', '\r'), $record[$i]);
- $buffer .= ' ' . $column . ': "' . $record[$i] . '"' . $crlf;
+ if (! PMA_exportOutputHandler($buffer)) {
+ return false;
+ }
}
+ PMA_DBI_free_result($result);
- if (! PMA_exportOutputHandler($buffer)) {
- return false;
- }
+ return true;
}
- PMA_DBI_free_result($result);
-
- return true;
-}
}
?>
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12839-g7e7be00
by Michal Čihař 02 Aug '11
by Michal Čihař 02 Aug '11
02 Aug '11
The branch, master has been updated
via 7e7be00f8466bb380e0c1d4370aa43ece0b1780f (commit)
from 8cb1f3a1cc1a089e53a89c1a4f59cd63a1ddecf8 (commit)
- Log -----------------------------------------------------------------
commit 7e7be00f8466bb380e0c1d4370aa43ece0b1780f
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Tue Aug 2 15:50:44 2011 +0200
Forgot to reindent this one
-----------------------------------------------------------------------
Summary of changes:
libraries/export/sql.php | 1632 +++++++++++++++++++++++-----------------------
1 files changed, 816 insertions(+), 816 deletions(-)
diff --git a/libraries/export/sql.php b/libraries/export/sql.php
index 0781db4..f0f6f15 100644
--- a/libraries/export/sql.php
+++ b/libraries/export/sql.php
@@ -294,956 +294,956 @@ if (isset($plugin_list)) {
}
} else {
-/**
- * Avoids undefined variables, use NULL so isset() returns false
- */
-if (! isset($sql_backquotes)) {
- $sql_backquotes = null;
-}
+ /**
+ * Avoids undefined variables, use NULL so isset() returns false
+ */
+ if (! isset($sql_backquotes)) {
+ $sql_backquotes = null;
+ }
-/**
- * Exports routines (procedures and functions)
- *
- * @param string $db
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportRoutines($db) {
- global $crlf;
+ /**
+ * Exports routines (procedures and functions)
+ *
+ * @param string $db
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportRoutines($db) {
+ global $crlf;
+
+ $text = '';
+ $delimiter = '$$';
- $text = '';
- $delimiter = '$$';
+ $procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
+ $function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
- $procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
- $function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
+ if ($procedure_names || $function_names) {
+ $text .= $crlf
+ . 'DELIMITER ' . $delimiter . $crlf;
+ }
- if ($procedure_names || $function_names) {
- $text .= $crlf
- . 'DELIMITER ' . $delimiter . $crlf;
- }
+ if ($procedure_names) {
+ $text .=
+ PMA_exportComment()
+ . PMA_exportComment(__('Procedures'))
+ . PMA_exportComment();
- if ($procedure_names) {
- $text .=
- PMA_exportComment()
- . PMA_exportComment(__('Procedures'))
- . PMA_exportComment();
-
- foreach ($procedure_names as $procedure_name) {
- if (! empty($GLOBALS['sql_drop_table'])) {
- $text .= 'DROP PROCEDURE IF EXISTS '
- . PMA_backquote($procedure_name)
- . $delimiter . $crlf;
+ foreach ($procedure_names as $procedure_name) {
+ if (! empty($GLOBALS['sql_drop_table'])) {
+ $text .= 'DROP PROCEDURE IF EXISTS '
+ . PMA_backquote($procedure_name)
+ . $delimiter . $crlf;
+ }
+ $text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name)
+ . $delimiter . $crlf . $crlf;
}
- $text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name)
- . $delimiter . $crlf . $crlf;
}
- }
- if ($function_names) {
- $text .=
- PMA_exportComment()
- . PMA_exportComment(__('Functions'))
- . PMA_exportComment();
-
- foreach ($function_names as $function_name) {
- if (! empty($GLOBALS['sql_drop_table'])) {
- $text .= 'DROP FUNCTION IF EXISTS '
- . PMA_backquote($function_name)
- . $delimiter . $crlf;
+ if ($function_names) {
+ $text .=
+ PMA_exportComment()
+ . PMA_exportComment(__('Functions'))
+ . PMA_exportComment();
+
+ foreach ($function_names as $function_name) {
+ if (! empty($GLOBALS['sql_drop_table'])) {
+ $text .= 'DROP FUNCTION IF EXISTS '
+ . PMA_backquote($function_name)
+ . $delimiter . $crlf;
+ }
+ $text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name)
+ . $delimiter . $crlf . $crlf;
}
- $text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name)
- . $delimiter . $crlf . $crlf;
}
- }
- if ($procedure_names || $function_names) {
- $text .= 'DELIMITER ;' . $crlf;
- }
+ if ($procedure_names || $function_names) {
+ $text .= 'DELIMITER ;' . $crlf;
+ }
- if (! empty($text)) {
- return PMA_exportOutputHandler($text);
- } else {
- return false;
+ if (! empty($text)) {
+ return PMA_exportOutputHandler($text);
+ } else {
+ return false;
+ }
}
-}
-/**
- * Possibly outputs comment
- *
- * @param string $text Text of comment
- * @return string The formatted comment
- *
- * @access private
- */
-function PMA_exportComment($text = '')
-{
- if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) {
- // see http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html
- return '--' . (empty($text) ? '' : ' ') . $text . $GLOBALS['crlf'];
- } else {
- return '';
+ /**
+ * Possibly outputs comment
+ *
+ * @param string $text Text of comment
+ * @return string The formatted comment
+ *
+ * @access private
+ */
+ function PMA_exportComment($text = '')
+ {
+ if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) {
+ // see http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html
+ return '--' . (empty($text) ? '' : ' ') . $text . $GLOBALS['crlf'];
+ } else {
+ return '';
+ }
}
-}
-/**
- * Possibly outputs CRLF
- *
- * @return string $crlf or nothing
- *
- * @access private
- */
-function PMA_possibleCRLF()
-{
- if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) {
- return $GLOBALS['crlf'];
- } else {
- return '';
+ /**
+ * Possibly outputs CRLF
+ *
+ * @return string $crlf or nothing
+ *
+ * @access private
+ */
+ function PMA_possibleCRLF()
+ {
+ if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) {
+ return $GLOBALS['crlf'];
+ } else {
+ return '';
+ }
}
-}
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter()
-{
- global $crlf;
- global $mysql_charset_map;
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter()
+ {
+ global $crlf;
+ global $mysql_charset_map;
+
+ $foot = '';
+
+ if (isset($GLOBALS['sql_disable_fk'])) {
+ $foot .= 'SET FOREIGN_KEY_CHECKS=1;' . $crlf;
+ }
- $foot = '';
+ if (isset($GLOBALS['sql_use_transaction'])) {
+ $foot .= 'COMMIT;' . $crlf;
+ }
- if (isset($GLOBALS['sql_disable_fk'])) {
- $foot .= 'SET FOREIGN_KEY_CHECKS=1;' . $crlf;
- }
+ // restore connection settings
+ $charset_of_file = isset($GLOBALS['charset_of_file']) ? $GLOBALS['charset_of_file'] : '';
+ if (!empty($GLOBALS['asfile']) && isset($mysql_charset_map[$charset_of_file])) {
+ $foot .= $crlf
+ . '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . $crlf
+ . '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . $crlf
+ . '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . $crlf;
+ }
- if (isset($GLOBALS['sql_use_transaction'])) {
- $foot .= 'COMMIT;' . $crlf;
- }
+ /* Restore timezone */
+ if ($GLOBALS['sql_utc_time']) {
+ PMA_DBI_query('SET time_zone = "' . $GLOBALS['old_tz'] . '"');
+ }
- // restore connection settings
- $charset_of_file = isset($GLOBALS['charset_of_file']) ? $GLOBALS['charset_of_file'] : '';
- if (!empty($GLOBALS['asfile']) && isset($mysql_charset_map[$charset_of_file])) {
- $foot .= $crlf
- . '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . $crlf
- . '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . $crlf
- . '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . $crlf;
+ return PMA_exportOutputHandler($foot);
}
- /* Restore timezone */
- if ($GLOBALS['sql_utc_time']) {
- PMA_DBI_query('SET time_zone = "' . $GLOBALS['old_tz'] . '"');
- }
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader()
+ {
+ global $crlf;
+ global $cfg;
+ global $mysql_charset_map;
+
+ if (isset($GLOBALS['sql_compatibility'])) {
+ $tmp_compat = $GLOBALS['sql_compatibility'];
+ if ($tmp_compat == 'NONE') {
+ $tmp_compat = '';
+ }
+ PMA_DBI_try_query('SET SQL_MODE="' . $tmp_compat . '"');
+ unset($tmp_compat);
+ }
+ $head = PMA_exportComment('phpMyAdmin SQL Dump')
+ . PMA_exportComment('version ' . PMA_VERSION)
+ . PMA_exportComment('http://www.phpmyadmin.net')
+ . PMA_exportComment();
+ $host_string = __('Host') . ': ' . $cfg['Server']['host'];
+ if (!empty($cfg['Server']['port'])) {
+ $host_string .= ':' . $cfg['Server']['port'];
+ }
+ $head .= PMA_exportComment($host_string);
+ $head .= PMA_exportComment(__('Generation Time')
+ . ': ' . PMA_localisedDate())
+ . PMA_exportComment(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION)
+ . PMA_exportComment(__('PHP Version') . ': ' . phpversion())
+ . PMA_possibleCRLF();
+
+ if (isset($GLOBALS['sql_header_comment']) && !empty($GLOBALS['sql_header_comment'])) {
+ // '\n' is not a newline (like "\n" would be), it's the characters
+ // backslash and n, as explained on the export interface
+ $lines = explode('\n', $GLOBALS['sql_header_comment']);
+ $head .= PMA_exportComment();
+ foreach ($lines as $one_line) {
+ $head .= PMA_exportComment($one_line);
+ }
+ $head .= PMA_exportComment();
+ }
- return PMA_exportOutputHandler($foot);
-}
+ if (isset($GLOBALS['sql_disable_fk'])) {
+ $head .= 'SET FOREIGN_KEY_CHECKS=0;' . $crlf;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader()
-{
- global $crlf;
- global $cfg;
- global $mysql_charset_map;
-
- if (isset($GLOBALS['sql_compatibility'])) {
- $tmp_compat = $GLOBALS['sql_compatibility'];
- if ($tmp_compat == 'NONE') {
- $tmp_compat = '';
+ /* We want exported AUTO_INCREMENT fields to have still same value, do this only for recent MySQL exports */
+ if (!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') {
+ $head .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf;
}
- PMA_DBI_try_query('SET SQL_MODE="' . $tmp_compat . '"');
- unset($tmp_compat);
- }
- $head = PMA_exportComment('phpMyAdmin SQL Dump')
- . PMA_exportComment('version ' . PMA_VERSION)
- . PMA_exportComment('http://www.phpmyadmin.net')
- . PMA_exportComment();
- $host_string = __('Host') . ': ' . $cfg['Server']['host'];
- if (!empty($cfg['Server']['port'])) {
- $host_string .= ':' . $cfg['Server']['port'];
- }
- $head .= PMA_exportComment($host_string);
- $head .= PMA_exportComment(__('Generation Time')
- . ': ' . PMA_localisedDate())
- . PMA_exportComment(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION)
- . PMA_exportComment(__('PHP Version') . ': ' . phpversion())
- . PMA_possibleCRLF();
-
- if (isset($GLOBALS['sql_header_comment']) && !empty($GLOBALS['sql_header_comment'])) {
- // '\n' is not a newline (like "\n" would be), it's the characters
- // backslash and n, as explained on the export interface
- $lines = explode('\n', $GLOBALS['sql_header_comment']);
- $head .= PMA_exportComment();
- foreach ($lines as $one_line) {
- $head .= PMA_exportComment($one_line);
+
+ if (isset($GLOBALS['sql_use_transaction'])) {
+ $head .= 'SET AUTOCOMMIT=0;' . $crlf
+ . 'START TRANSACTION;' . $crlf;
}
- $head .= PMA_exportComment();
- }
- if (isset($GLOBALS['sql_disable_fk'])) {
- $head .= 'SET FOREIGN_KEY_CHECKS=0;' . $crlf;
- }
- /* We want exported AUTO_INCREMENT fields to have still same value, do this only for recent MySQL exports */
- if (!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') {
- $head .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf;
- }
+ /* Change timezone if we should export timestamps in UTC */
+ if ($GLOBALS['sql_utc_time']) {
+ $head .= 'SET time_zone = "+00:00";' . $crlf;
+ $GLOBALS['old_tz'] = PMA_DBI_fetch_value('SELECT @@session.time_zone');
+ PMA_DBI_query('SET time_zone = "+00:00"');
+ }
- if (isset($GLOBALS['sql_use_transaction'])) {
- $head .= 'SET AUTOCOMMIT=0;' . $crlf
- . 'START TRANSACTION;' . $crlf;
- }
+ $head .= PMA_possibleCRLF();
+ if (! empty($GLOBALS['asfile'])) {
+ // we are saving as file, therefore we provide charset information
+ // so that a utility like the mysql client can interpret
+ // the file correctly
+ if (isset($GLOBALS['charset_of_file']) && isset($mysql_charset_map[$GLOBALS['charset_of_file']])) {
+ // we got a charset from the export dialog
+ $set_names = $mysql_charset_map[$GLOBALS['charset_of_file']];
+ } else {
+ // by default we use the connection charset
+ $set_names = $mysql_charset_map['utf-8'];
+ }
+ $head .= $crlf
+ . '/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;' . $crlf
+ . '/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;' . $crlf
+ . '/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;' . $crlf
+ . '/*!40101 SET NAMES ' . $set_names . ' */;' . $crlf . $crlf;
+ }
- /* Change timezone if we should export timestamps in UTC */
- if ($GLOBALS['sql_utc_time']) {
- $head .= 'SET time_zone = "+00:00";' . $crlf;
- $GLOBALS['old_tz'] = PMA_DBI_fetch_value('SELECT @@session.time_zone');
- PMA_DBI_query('SET time_zone = "+00:00"');
+ return PMA_exportOutputHandler($head);
}
- $head .= PMA_possibleCRLF();
-
- if (! empty($GLOBALS['asfile'])) {
- // we are saving as file, therefore we provide charset information
- // so that a utility like the mysql client can interpret
- // the file correctly
- if (isset($GLOBALS['charset_of_file']) && isset($mysql_charset_map[$GLOBALS['charset_of_file']])) {
- // we got a charset from the export dialog
- $set_names = $mysql_charset_map[$GLOBALS['charset_of_file']];
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db)
+ {
+ global $crlf;
+ if (isset($GLOBALS['sql_drop_database'])) {
+ if (!PMA_exportOutputHandler('DROP DATABASE ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) {
+ return false;
+ }
+ }
+ $create_query = 'CREATE DATABASE ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : $db);
+ $collation = PMA_getDbCollation($db);
+ if (strpos($collation, '_')) {
+ $create_query .= ' DEFAULT CHARACTER SET ' . substr($collation, 0, strpos($collation, '_')) . ' COLLATE ' . $collation;
} else {
- // by default we use the connection charset
- $set_names = $mysql_charset_map['utf-8'];
+ $create_query .= ' DEFAULT CHARACTER SET ' . $collation;
}
- $head .= $crlf
- . '/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;' . $crlf
- . '/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;' . $crlf
- . '/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;' . $crlf
- . '/*!40101 SET NAMES ' . $set_names . ' */;' . $crlf . $crlf;
- }
-
- return PMA_exportOutputHandler($head);
-}
-
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db)
-{
- global $crlf;
- if (isset($GLOBALS['sql_drop_database'])) {
- if (!PMA_exportOutputHandler('DROP DATABASE ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) {
+ $create_query .= ';' . $crlf;
+ if (!PMA_exportOutputHandler($create_query)) {
return false;
}
- }
- $create_query = 'CREATE DATABASE ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : $db);
- $collation = PMA_getDbCollation($db);
- if (strpos($collation, '_')) {
- $create_query .= ' DEFAULT CHARACTER SET ' . substr($collation, 0, strpos($collation, '_')) . ' COLLATE ' . $collation;
- } else {
- $create_query .= ' DEFAULT CHARACTER SET ' . $collation;
- }
- $create_query .= ';' . $crlf;
- if (!PMA_exportOutputHandler($create_query)) {
- return false;
- }
- if (isset($GLOBALS['sql_backquotes']) && isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] == 'NONE') {
- $result = PMA_exportOutputHandler('USE ' . PMA_backquote($db) . ';' . $crlf);
- } else {
- $result = PMA_exportOutputHandler('USE ' . $db . ';' . $crlf);
- }
-
- return $result;
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db)
-{
- $head = PMA_exportComment()
- . PMA_exportComment(__('Database') . ': ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''))
- . PMA_exportComment();
- return PMA_exportOutputHandler($head);
-}
+ if (isset($GLOBALS['sql_backquotes']) && isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] == 'NONE') {
+ $result = PMA_exportOutputHandler('USE ' . PMA_backquote($db) . ';' . $crlf);
+ } else {
+ $result = PMA_exportOutputHandler('USE ' . $db . ';' . $crlf);
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db)
-{
- global $crlf;
-
- $result = true;
- if (isset($GLOBALS['sql_constraints'])) {
- $result = PMA_exportOutputHandler($GLOBALS['sql_constraints']);
- unset($GLOBALS['sql_constraints']);
+ return $result;
}
- if (($GLOBALS['sql_structure_or_data'] == 'structure' || $GLOBALS['sql_structure_or_data'] == 'structure_and_data') && isset($GLOBALS['sql_procedure_function'])) {
- $text = '';
- $delimiter = '$$';
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db)
+ {
+ $head = PMA_exportComment()
+ . PMA_exportComment(__('Database') . ': ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''))
+ . PMA_exportComment();
+ return PMA_exportOutputHandler($head);
+ }
- if (PMA_MYSQL_INT_VERSION > 50100) {
- $event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddSlashes($db,true) . '\';');
- } else {
- $event_names = array();
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db)
+ {
+ global $crlf;
+
+ $result = true;
+ if (isset($GLOBALS['sql_constraints'])) {
+ $result = PMA_exportOutputHandler($GLOBALS['sql_constraints']);
+ unset($GLOBALS['sql_constraints']);
}
- if ($event_names) {
- $text .= $crlf
- . 'DELIMITER ' . $delimiter . $crlf;
+ if (($GLOBALS['sql_structure_or_data'] == 'structure' || $GLOBALS['sql_structure_or_data'] == 'structure_and_data') && isset($GLOBALS['sql_procedure_function'])) {
+ $text = '';
+ $delimiter = '$$';
- $text .=
- PMA_exportComment()
- . PMA_exportComment(__('Events'))
- . PMA_exportComment();
+ if (PMA_MYSQL_INT_VERSION > 50100) {
+ $event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddSlashes($db,true) . '\';');
+ } else {
+ $event_names = array();
+ }
- foreach ($event_names as $event_name) {
- if (! empty($GLOBALS['sql_drop_table'])) {
- $text .= 'DROP EVENT ' . PMA_backquote($event_name) . $delimiter . $crlf;
+ if ($event_names) {
+ $text .= $crlf
+ . 'DELIMITER ' . $delimiter . $crlf;
+
+ $text .=
+ PMA_exportComment()
+ . PMA_exportComment(__('Events'))
+ . PMA_exportComment();
+
+ foreach ($event_names as $event_name) {
+ if (! empty($GLOBALS['sql_drop_table'])) {
+ $text .= 'DROP EVENT ' . PMA_backquote($event_name) . $delimiter . $crlf;
+ }
+ $text .= PMA_DBI_get_definition($db, 'EVENT', $event_name) . $delimiter . $crlf . $crlf;
}
- $text .= PMA_DBI_get_definition($db, 'EVENT', $event_name) . $delimiter . $crlf . $crlf;
- }
- $text .= 'DELIMITER ;' . $crlf;
- }
+ $text .= 'DELIMITER ;' . $crlf;
+ }
- if (! empty($text)) {
- $result = PMA_exportOutputHandler($text);
+ if (! empty($text)) {
+ $result = PMA_exportOutputHandler($text);
+ }
}
+ return $result;
}
- return $result;
-}
-/**
- * Returns a stand-in CREATE definition to resolve view dependencies
- *
- * @param string $db the database name
- * @param string $view the view name
- * @param string $crlf the end of line sequence
- * @return string resulting definition
- *
- * @access public
- */
-function PMA_getTableDefStandIn($db, $view, $crlf) {
- $create_query = '';
- if (! empty($GLOBALS['sql_drop_table'])) {
- $create_query .= 'DROP VIEW IF EXISTS ' . PMA_backquote($view) . ';' . $crlf;
- }
+ /**
+ * Returns a stand-in CREATE definition to resolve view dependencies
+ *
+ * @param string $db the database name
+ * @param string $view the view name
+ * @param string $crlf the end of line sequence
+ * @return string resulting definition
+ *
+ * @access public
+ */
+ function PMA_getTableDefStandIn($db, $view, $crlf) {
+ $create_query = '';
+ if (! empty($GLOBALS['sql_drop_table'])) {
+ $create_query .= 'DROP VIEW IF EXISTS ' . PMA_backquote($view) . ';' . $crlf;
+ }
- $create_query .= 'CREATE TABLE ';
+ $create_query .= 'CREATE TABLE ';
- if (isset($GLOBALS['sql_if_not_exists']) && $GLOBALS['sql_if_not_exists']) {
- $create_query .= 'IF NOT EXISTS ';
- }
- $create_query .= PMA_backquote($view) . ' (' . $crlf;
- $tmp = array();
- $columns = PMA_DBI_get_columns_full($db, $view);
- foreach ($columns as $column_name => $definition) {
- $tmp[] = PMA_backquote($column_name) . ' ' . $definition['Type'] . $crlf;
+ if (isset($GLOBALS['sql_if_not_exists']) && $GLOBALS['sql_if_not_exists']) {
+ $create_query .= 'IF NOT EXISTS ';
+ }
+ $create_query .= PMA_backquote($view) . ' (' . $crlf;
+ $tmp = array();
+ $columns = PMA_DBI_get_columns_full($db, $view);
+ foreach ($columns as $column_name => $definition) {
+ $tmp[] = PMA_backquote($column_name) . ' ' . $definition['Type'] . $crlf;
+ }
+ $create_query .= implode(',', $tmp) . ');';
+ return($create_query);
}
- $create_query .= implode(',', $tmp) . ');';
- return($create_query);
-}
-/**
- * Returns $table's CREATE definition
- *
- * @param string $db the database name
- * @param string $table the table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param bool $show_dates whether to include creation/update/check dates
- * @param bool $add_semicolon whether to add semicolon and end-of-line at the end
- * @param bool $view whether we're handling a view
- * @return string resulting schema
- *
- * @access public
- */
-function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $add_semicolon = true, $view = false)
-{
- global $sql_drop_table;
- global $sql_backquotes;
- global $sql_constraints_query; // just the text of the query
- global $sql_drop_foreign_keys;
-
- $schema_create = '';
- $auto_increment = '';
- $new_crlf = $crlf;
-
- // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
- $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($table, true) . '\'', null, PMA_DBI_QUERY_STORE);
- if ($result != false) {
- if (PMA_DBI_num_rows($result) > 0) {
- $tmpres = PMA_DBI_fetch_assoc($result);
- // Here we optionally add the AUTO_INCREMENT next value,
- // but starting with MySQL 5.0.24, the clause is already included
- // in SHOW CREATE TABLE so we'll remove it below
- if (isset($GLOBALS['sql_auto_increment']) && !empty($tmpres['Auto_increment'])) {
- $auto_increment .= ' AUTO_INCREMENT=' . $tmpres['Auto_increment'] . ' ';
- }
+ /**
+ * Returns $table's CREATE definition
+ *
+ * @param string $db the database name
+ * @param string $table the table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param bool $show_dates whether to include creation/update/check dates
+ * @param bool $add_semicolon whether to add semicolon and end-of-line at the end
+ * @param bool $view whether we're handling a view
+ * @return string resulting schema
+ *
+ * @access public
+ */
+ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $add_semicolon = true, $view = false)
+ {
+ global $sql_drop_table;
+ global $sql_backquotes;
+ global $sql_constraints_query; // just the text of the query
+ global $sql_drop_foreign_keys;
+
+ $schema_create = '';
+ $auto_increment = '';
+ $new_crlf = $crlf;
+
+ // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
+ $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($table, true) . '\'', null, PMA_DBI_QUERY_STORE);
+ if ($result != false) {
+ if (PMA_DBI_num_rows($result) > 0) {
+ $tmpres = PMA_DBI_fetch_assoc($result);
+ // Here we optionally add the AUTO_INCREMENT next value,
+ // but starting with MySQL 5.0.24, the clause is already included
+ // in SHOW CREATE TABLE so we'll remove it below
+ if (isset($GLOBALS['sql_auto_increment']) && !empty($tmpres['Auto_increment'])) {
+ $auto_increment .= ' AUTO_INCREMENT=' . $tmpres['Auto_increment'] . ' ';
+ }
- if ($show_dates && isset($tmpres['Create_time']) && !empty($tmpres['Create_time'])) {
- $schema_create .= PMA_exportComment(__('Creation') . ': ' . PMA_localisedDate(strtotime($tmpres['Create_time'])));
- $new_crlf = PMA_exportComment() . $crlf;
- }
+ if ($show_dates && isset($tmpres['Create_time']) && !empty($tmpres['Create_time'])) {
+ $schema_create .= PMA_exportComment(__('Creation') . ': ' . PMA_localisedDate(strtotime($tmpres['Create_time'])));
+ $new_crlf = PMA_exportComment() . $crlf;
+ }
- if ($show_dates && isset($tmpres['Update_time']) && !empty($tmpres['Update_time'])) {
- $schema_create .= PMA_exportComment(__('Last update') . ': ' . PMA_localisedDate(strtotime($tmpres['Update_time'])));
- $new_crlf = PMA_exportComment() . $crlf;
- }
+ if ($show_dates && isset($tmpres['Update_time']) && !empty($tmpres['Update_time'])) {
+ $schema_create .= PMA_exportComment(__('Last update') . ': ' . PMA_localisedDate(strtotime($tmpres['Update_time'])));
+ $new_crlf = PMA_exportComment() . $crlf;
+ }
- if ($show_dates && isset($tmpres['Check_time']) && !empty($tmpres['Check_time'])) {
- $schema_create .= PMA_exportComment(__('Last check') . ': ' . PMA_localisedDate(strtotime($tmpres['Check_time'])));
- $new_crlf = PMA_exportComment() . $crlf;
+ if ($show_dates && isset($tmpres['Check_time']) && !empty($tmpres['Check_time'])) {
+ $schema_create .= PMA_exportComment(__('Last check') . ': ' . PMA_localisedDate(strtotime($tmpres['Check_time'])));
+ $new_crlf = PMA_exportComment() . $crlf;
+ }
}
+ PMA_DBI_free_result($result);
}
- PMA_DBI_free_result($result);
- }
-
- $schema_create .= $new_crlf;
-
- // no need to generate a DROP VIEW here, it was done earlier
- if (! empty($sql_drop_table) && ! PMA_Table::isView($db,$table)) {
- $schema_create .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table, $sql_backquotes) . ';' . $crlf;
- }
- // Complete table dump,
- // Whether to quote table and fields names or not
- if ($sql_backquotes) {
- PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 1');
- } else {
- PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 0');
- }
+ $schema_create .= $new_crlf;
- // I don't see the reason why this unbuffered query could cause problems,
- // because SHOW CREATE TABLE returns only one row, and we free the
- // results below. Nonetheless, we got 2 user reports about this
- // (see bug 1562533) so I remove the unbuffered mode.
- //$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), null, PMA_DBI_QUERY_UNBUFFERED);
- //
- // Note: SHOW CREATE TABLE, at least in MySQL 5.1.23, does not
- // produce a displayable result for the default value of a BIT
- // field, nor does the mysqldump command. See MySQL bug 35796
- $result = PMA_DBI_try_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table));
- // an error can happen, for example the table is crashed
- $tmp_error = PMA_DBI_getError();
- if ($tmp_error) {
- return PMA_exportComment(__('in use') . '(' . $tmp_error . ')');
- }
-
- if ($result != false && ($row = PMA_DBI_fetch_row($result))) {
- $create_query = $row[1];
- unset($row);
-
- // Convert end of line chars to one that we want (note that MySQL doesn't return query it will accept in all cases)
- if (strpos($create_query, "(\r\n ")) {
- $create_query = str_replace("\r\n", $crlf, $create_query);
- } elseif (strpos($create_query, "(\n ")) {
- $create_query = str_replace("\n", $crlf, $create_query);
- } elseif (strpos($create_query, "(\r ")) {
- $create_query = str_replace("\r", $crlf, $create_query);
+ // no need to generate a DROP VIEW here, it was done earlier
+ if (! empty($sql_drop_table) && ! PMA_Table::isView($db,$table)) {
+ $schema_create .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table, $sql_backquotes) . ';' . $crlf;
}
- /*
- * Drop database name from VIEW creation.
- *
- * This is a bit tricky, but we need to issue SHOW CREATE TABLE with
- * database name, but we don't want name to show up in CREATE VIEW
- * statement.
- */
- if ($view) {
- $create_query = preg_replace('/' . PMA_backquote($db) . '\./', '', $create_query);
+ // Complete table dump,
+ // Whether to quote table and fields names or not
+ if ($sql_backquotes) {
+ PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 1');
+ } else {
+ PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
- // Should we use IF NOT EXISTS?
- if (isset($GLOBALS['sql_if_not_exists'])) {
- $create_query = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $create_query);
+ // I don't see the reason why this unbuffered query could cause problems,
+ // because SHOW CREATE TABLE returns only one row, and we free the
+ // results below. Nonetheless, we got 2 user reports about this
+ // (see bug 1562533) so I remove the unbuffered mode.
+ //$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), null, PMA_DBI_QUERY_UNBUFFERED);
+ //
+ // Note: SHOW CREATE TABLE, at least in MySQL 5.1.23, does not
+ // produce a displayable result for the default value of a BIT
+ // field, nor does the mysqldump command. See MySQL bug 35796
+ $result = PMA_DBI_try_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table));
+ // an error can happen, for example the table is crashed
+ $tmp_error = PMA_DBI_getError();
+ if ($tmp_error) {
+ return PMA_exportComment(__('in use') . '(' . $tmp_error . ')');
}
- // are there any constraints to cut out?
- if (preg_match('@CONSTRAINT|FOREIGN[\s]+KEY@', $create_query)) {
+ if ($result != false && ($row = PMA_DBI_fetch_row($result))) {
+ $create_query = $row[1];
+ unset($row);
+
+ // Convert end of line chars to one that we want (note that MySQL doesn't return query it will accept in all cases)
+ if (strpos($create_query, "(\r\n ")) {
+ $create_query = str_replace("\r\n", $crlf, $create_query);
+ } elseif (strpos($create_query, "(\n ")) {
+ $create_query = str_replace("\n", $crlf, $create_query);
+ } elseif (strpos($create_query, "(\r ")) {
+ $create_query = str_replace("\r", $crlf, $create_query);
+ }
- // Split the query into lines, so we can easily handle it. We know lines are separated by $crlf (done few lines above).
- $sql_lines = explode($crlf, $create_query);
- $sql_count = count($sql_lines);
+ /*
+ * Drop database name from VIEW creation.
+ *
+ * This is a bit tricky, but we need to issue SHOW CREATE TABLE with
+ * database name, but we don't want name to show up in CREATE VIEW
+ * statement.
+ */
+ if ($view) {
+ $create_query = preg_replace('/' . PMA_backquote($db) . '\./', '', $create_query);
+ }
- // lets find first line with constraints
- for ($i = 0; $i < $sql_count; $i++) {
- if (preg_match('@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@', $sql_lines[$i])) {
- break;
- }
+ // Should we use IF NOT EXISTS?
+ if (isset($GLOBALS['sql_if_not_exists'])) {
+ $create_query = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $create_query);
}
- // If we really found a constraint
- if ($i != $sql_count) {
+ // are there any constraints to cut out?
+ if (preg_match('@CONSTRAINT|FOREIGN[\s]+KEY@', $create_query)) {
- // remove , from the end of create statement
- $sql_lines[$i - 1] = preg_replace('@,$@', '', $sql_lines[$i - 1]);
+ // Split the query into lines, so we can easily handle it. We know lines are separated by $crlf (done few lines above).
+ $sql_lines = explode($crlf, $create_query);
+ $sql_count = count($sql_lines);
- // prepare variable for constraints
- if (!isset($sql_constraints)) {
- if (isset($GLOBALS['no_constraints_comments'])) {
- $sql_constraints = '';
- } else {
- $sql_constraints = $crlf
- . PMA_exportComment()
- . PMA_exportComment(__('Constraints for dumped tables'))
- . PMA_exportComment();
+ // lets find first line with constraints
+ for ($i = 0; $i < $sql_count; $i++) {
+ if (preg_match('@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@', $sql_lines[$i])) {
+ break;
}
}
- // comments for current table
- if (!isset($GLOBALS['no_constraints_comments'])) {
- $sql_constraints .= $crlf
- . PMA_exportComment()
- . PMA_exportComment(__('Constraints for table') . ' ' . PMA_backquote($table))
- . PMA_exportComment();
- }
+ // If we really found a constraint
+ if ($i != $sql_count) {
- // let's do the work
- $sql_constraints_query .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
- $sql_constraints .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
- $sql_drop_foreign_keys .= 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $crlf;
+ // remove , from the end of create statement
+ $sql_lines[$i - 1] = preg_replace('@,$@', '', $sql_lines[$i - 1]);
- $first = true;
- for ($j = $i; $j < $sql_count; $j++) {
- if (preg_match('@CONSTRAINT|FOREIGN[\s]+KEY@', $sql_lines[$j])) {
- if (!$first) {
- $sql_constraints .= $crlf;
- }
- if (strpos($sql_lines[$j], 'CONSTRAINT') === false) {
- $tmp_str = preg_replace('/(FOREIGN[\s]+KEY)/', 'ADD \1', $sql_lines[$j]);
- $sql_constraints_query .= $tmp_str;
- $sql_constraints .= $tmp_str;
+ // prepare variable for constraints
+ if (!isset($sql_constraints)) {
+ if (isset($GLOBALS['no_constraints_comments'])) {
+ $sql_constraints = '';
} else {
- $tmp_str = preg_replace('/(CONSTRAINT)/', 'ADD \1', $sql_lines[$j]);
- $sql_constraints_query .= $tmp_str;
- $sql_constraints .= $tmp_str;
- preg_match('/(CONSTRAINT)([\s])([\S]*)([\s])/', $sql_lines[$j], $matches);
- if (! $first) {
- $sql_drop_foreign_keys .= ', ';
+ $sql_constraints = $crlf
+ . PMA_exportComment()
+ . PMA_exportComment(__('Constraints for dumped tables'))
+ . PMA_exportComment();
+ }
+ }
+
+ // comments for current table
+ if (!isset($GLOBALS['no_constraints_comments'])) {
+ $sql_constraints .= $crlf
+ . PMA_exportComment()
+ . PMA_exportComment(__('Constraints for table') . ' ' . PMA_backquote($table))
+ . PMA_exportComment();
+ }
+
+ // let's do the work
+ $sql_constraints_query .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
+ $sql_constraints .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
+ $sql_drop_foreign_keys .= 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $crlf;
+
+ $first = true;
+ for ($j = $i; $j < $sql_count; $j++) {
+ if (preg_match('@CONSTRAINT|FOREIGN[\s]+KEY@', $sql_lines[$j])) {
+ if (!$first) {
+ $sql_constraints .= $crlf;
}
- $sql_drop_foreign_keys .= 'DROP FOREIGN KEY ' . $matches[3];
+ if (strpos($sql_lines[$j], 'CONSTRAINT') === false) {
+ $tmp_str = preg_replace('/(FOREIGN[\s]+KEY)/', 'ADD \1', $sql_lines[$j]);
+ $sql_constraints_query .= $tmp_str;
+ $sql_constraints .= $tmp_str;
+ } else {
+ $tmp_str = preg_replace('/(CONSTRAINT)/', 'ADD \1', $sql_lines[$j]);
+ $sql_constraints_query .= $tmp_str;
+ $sql_constraints .= $tmp_str;
+ preg_match('/(CONSTRAINT)([\s])([\S]*)([\s])/', $sql_lines[$j], $matches);
+ if (! $first) {
+ $sql_drop_foreign_keys .= ', ';
+ }
+ $sql_drop_foreign_keys .= 'DROP FOREIGN KEY ' . $matches[3];
+ }
+ $first = false;
+ } else {
+ break;
}
- $first = false;
- } else {
- break;
}
- }
- $sql_constraints .= ';' . $crlf;
- $sql_constraints_query .= ';';
+ $sql_constraints .= ';' . $crlf;
+ $sql_constraints_query .= ';';
- $create_query = implode($crlf, array_slice($sql_lines, 0, $i)) . $crlf . implode($crlf, array_slice($sql_lines, $j, $sql_count - 1));
- unset($sql_lines);
+ $create_query = implode($crlf, array_slice($sql_lines, 0, $i)) . $crlf . implode($crlf, array_slice($sql_lines, $j, $sql_count - 1));
+ unset($sql_lines);
+ }
}
+ $schema_create .= $create_query;
}
- $schema_create .= $create_query;
- }
- // remove a possible "AUTO_INCREMENT = value" clause
- // that could be there starting with MySQL 5.0.24
- $schema_create = preg_replace('/AUTO_INCREMENT\s*=\s*([0-9])+/', '', $schema_create);
+ // remove a possible "AUTO_INCREMENT = value" clause
+ // that could be there starting with MySQL 5.0.24
+ $schema_create = preg_replace('/AUTO_INCREMENT\s*=\s*([0-9])+/', '', $schema_create);
- $schema_create .= $auto_increment;
+ $schema_create .= $auto_increment;
- PMA_DBI_free_result($result);
- return $schema_create . ($add_semicolon ? ';' . $crlf : '');
-} // end of the 'PMA_getTableDef()' function
-
-/**
- * Returns $table's comments, relations etc.
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf end of line sequence
- * @param bool $do_relation whether to include relation comments
- * @param bool $do_mime whether to include mime comments
- * @return string resulting comments
- *
- * @access private
- */
-function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mime = false)
-{
- global $cfgRelation;
- global $sql_backquotes;
- global $sql_constraints;
-
- $schema_create = '';
-
- // Check if we can use Relations
- if ($do_relation && !empty($cfgRelation['relation'])) {
- // Find which tables are related with the current one and write it in
- // an array
- $res_rel = PMA_getForeigners($db, $table);
-
- if ($res_rel && count($res_rel) > 0) {
- $have_rel = true;
+ PMA_DBI_free_result($result);
+ return $schema_create . ($add_semicolon ? ';' . $crlf : '');
+ } // end of the 'PMA_getTableDef()' function
+
+ /**
+ * Returns $table's comments, relations etc.
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf end of line sequence
+ * @param bool $do_relation whether to include relation comments
+ * @param bool $do_mime whether to include mime comments
+ * @return string resulting comments
+ *
+ * @access private
+ */
+ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mime = false)
+ {
+ global $cfgRelation;
+ global $sql_backquotes;
+ global $sql_constraints;
+
+ $schema_create = '';
+
+ // Check if we can use Relations
+ if ($do_relation && !empty($cfgRelation['relation'])) {
+ // Find which tables are related with the current one and write it in
+ // an array
+ $res_rel = PMA_getForeigners($db, $table);
+
+ if ($res_rel && count($res_rel) > 0) {
+ $have_rel = true;
+ } else {
+ $have_rel = false;
+ }
} else {
- $have_rel = false;
- }
- } else {
- $have_rel = false;
- } // end if
+ $have_rel = false;
+ } // end if
- if ($do_mime && $cfgRelation['mimework']) {
- if (!($mime_map = PMA_getMIME($db, $table, true))) {
- unset($mime_map);
+ if ($do_mime && $cfgRelation['mimework']) {
+ if (!($mime_map = PMA_getMIME($db, $table, true))) {
+ unset($mime_map);
+ }
}
- }
- if (isset($mime_map) && count($mime_map) > 0) {
- $schema_create .= PMA_possibleCRLF()
- . PMA_exportComment()
- . PMA_exportComment(__('MIME TYPES FOR TABLE'). ' ' . PMA_backquote($table, $sql_backquotes) . ':');
- @reset($mime_map);
- foreach ($mime_map AS $mime_field => $mime) {
- $schema_create .= PMA_exportComment(' ' . PMA_backquote($mime_field, $sql_backquotes))
- . PMA_exportComment(' ' . PMA_backquote($mime['mimetype'], $sql_backquotes));
+ if (isset($mime_map) && count($mime_map) > 0) {
+ $schema_create .= PMA_possibleCRLF()
+ . PMA_exportComment()
+ . PMA_exportComment(__('MIME TYPES FOR TABLE'). ' ' . PMA_backquote($table, $sql_backquotes) . ':');
+ @reset($mime_map);
+ foreach ($mime_map AS $mime_field => $mime) {
+ $schema_create .= PMA_exportComment(' ' . PMA_backquote($mime_field, $sql_backquotes))
+ . PMA_exportComment(' ' . PMA_backquote($mime['mimetype'], $sql_backquotes));
+ }
+ $schema_create .= PMA_exportComment();
}
- $schema_create .= PMA_exportComment();
- }
- if ($have_rel) {
- $schema_create .= PMA_possibleCRLF()
- . PMA_exportComment()
- . PMA_exportComment(__('RELATIONS FOR TABLE'). ' ' . PMA_backquote($table, $sql_backquotes) . ':');
- foreach ($res_rel AS $rel_field => $rel) {
- $schema_create .= PMA_exportComment(' ' . PMA_backquote($rel_field, $sql_backquotes))
- . PMA_exportComment(' ' . PMA_backquote($rel['foreign_table'], $sql_backquotes)
- . ' -> ' . PMA_backquote($rel['foreign_field'], $sql_backquotes));
+ if ($have_rel) {
+ $schema_create .= PMA_possibleCRLF()
+ . PMA_exportComment()
+ . PMA_exportComment(__('RELATIONS FOR TABLE'). ' ' . PMA_backquote($table, $sql_backquotes) . ':');
+ foreach ($res_rel AS $rel_field => $rel) {
+ $schema_create .= PMA_exportComment(' ' . PMA_backquote($rel_field, $sql_backquotes))
+ . PMA_exportComment(' ' . PMA_backquote($rel['foreign_table'], $sql_backquotes)
+ . ' -> ' . PMA_backquote($rel['foreign_field'], $sql_backquotes));
+ }
+ $schema_create .= PMA_exportComment();
}
- $schema_create .= PMA_exportComment();
- }
-
- return $schema_create;
-} // end of the 'PMA_getTableComments()' function
+ return $schema_create;
+
+ } // end of the 'PMA_getTableComments()' function
+
+ /**
+ * Outputs table's structure
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param bool $relation whether to include relation comments
+ * @param bool $comments whether to include the pmadb-style column comments
+ * as comments in the structure; this is deprecated
+ * but the parameter is left here because export.php
+ * calls PMA_exportStructure() also for other export
+ * types which use this parameter
+ * @param bool $mime whether to include mime comments
+ * @param bool $dates whether to include creation/update/check dates
+ * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
+ * @param string $export_type 'server', 'database', 'table'
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false, $comments = false, $mime = false, $dates = false, $export_mode, $export_type)
+ {
+ $formatted_table_name = (isset($GLOBALS['sql_backquotes']))
+ ? PMA_backquote($table)
+ : '\'' . $table . '\'';
+ $dump = PMA_possibleCRLF()
+ . PMA_exportComment(str_repeat('-', 56))
+ . PMA_possibleCRLF()
+ . PMA_exportComment();
-/**
- * Outputs table's structure
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param bool $relation whether to include relation comments
- * @param bool $comments whether to include the pmadb-style column comments
- * as comments in the structure; this is deprecated
- * but the parameter is left here because export.php
- * calls PMA_exportStructure() also for other export
- * types which use this parameter
- * @param bool $mime whether to include mime comments
- * @param bool $dates whether to include creation/update/check dates
- * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
- * @param string $export_type 'server', 'database', 'table'
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false, $comments = false, $mime = false, $dates = false, $export_mode, $export_type)
-{
- $formatted_table_name = (isset($GLOBALS['sql_backquotes']))
- ? PMA_backquote($table)
- : '\'' . $table . '\'';
- $dump = PMA_possibleCRLF()
- . PMA_exportComment(str_repeat('-', 56))
- . PMA_possibleCRLF()
- . PMA_exportComment();
-
- switch($export_mode) {
- case 'create_table':
- $dump .= PMA_exportComment(__('Table structure for table') . ' ' . $formatted_table_name);
- $dump .= PMA_exportComment();
- $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates);
- $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $mime);
- break;
- case 'triggers':
- $dump = '';
- $triggers = PMA_DBI_get_triggers($db, $table);
- if ($triggers) {
- $dump .= PMA_possibleCRLF()
- . PMA_exportComment()
- . PMA_exportComment(__('Triggers') . ' ' . $formatted_table_name)
- . PMA_exportComment();
- $delimiter = '//';
- foreach ($triggers as $trigger) {
- $dump .= $trigger['drop'] . ';' . $crlf;
- $dump .= 'DELIMITER ' . $delimiter . $crlf;
- $dump .= $trigger['create'];
- $dump .= 'DELIMITER ;' . $crlf;
+ switch($export_mode) {
+ case 'create_table':
+ $dump .= PMA_exportComment(__('Table structure for table') . ' ' . $formatted_table_name);
+ $dump .= PMA_exportComment();
+ $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates);
+ $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $mime);
+ break;
+ case 'triggers':
+ $dump = '';
+ $triggers = PMA_DBI_get_triggers($db, $table);
+ if ($triggers) {
+ $dump .= PMA_possibleCRLF()
+ . PMA_exportComment()
+ . PMA_exportComment(__('Triggers') . ' ' . $formatted_table_name)
+ . PMA_exportComment();
+ $delimiter = '//';
+ foreach ($triggers as $trigger) {
+ $dump .= $trigger['drop'] . ';' . $crlf;
+ $dump .= 'DELIMITER ' . $delimiter . $crlf;
+ $dump .= $trigger['create'];
+ $dump .= 'DELIMITER ;' . $crlf;
+ }
}
- }
- break;
- case 'create_view':
- $dump .= PMA_exportComment(__('Structure for view') . ' ' . $formatted_table_name)
- . PMA_exportComment();
- // delete the stand-in table previously created (if any)
- if ($export_type != 'table') {
- $dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
- }
- $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates, true, true);
- break;
- case 'stand_in':
- $dump .= PMA_exportComment(__('Stand-in structure for view') . ' ' . $formatted_table_name)
- . PMA_exportComment();
- // export a stand-in definition to resolve view dependencies
- $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
- } // end switch
-
- // this one is built by PMA_getTableDef() to use in table copy/move
- // but not in the case of export
- unset($GLOBALS['sql_constraints_query']);
-
- return PMA_exportOutputHandler($dump);
-}
-
-/**
- * Outputs the content of a table in SQL format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- global $sql_backquotes;
- global $current_row;
-
- $formatted_table_name = (isset($GLOBALS['sql_backquotes']))
- ? PMA_backquote($table)
- : '\'' . $table . '\'';
-
- // Do not export data for a VIEW
- // (For a VIEW, this is called only when exporting a single VIEW)
- if (PMA_Table::isView($db, $table)) {
- $head = PMA_possibleCRLF()
- . PMA_exportComment()
- . PMA_exportComment('VIEW ' . ' ' . $formatted_table_name)
- . PMA_exportComment(__('Data') . ': ' . __('None'))
- . PMA_exportComment()
- . PMA_possibleCRLF();
-
- if (! PMA_exportOutputHandler($head)) {
- return false;
- }
- return true;
- }
+ break;
+ case 'create_view':
+ $dump .= PMA_exportComment(__('Structure for view') . ' ' . $formatted_table_name)
+ . PMA_exportComment();
+ // delete the stand-in table previously created (if any)
+ if ($export_type != 'table') {
+ $dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
+ }
+ $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates, true, true);
+ break;
+ case 'stand_in':
+ $dump .= PMA_exportComment(__('Stand-in structure for view') . ' ' . $formatted_table_name)
+ . PMA_exportComment();
+ // export a stand-in definition to resolve view dependencies
+ $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
+ } // end switch
- // analyze the query to get the true column names, not the aliases
- // (this fixes an undefined index, also if Complete inserts
- // are used, we did not get the true column name in case of aliases)
- $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($sql_query));
+ // this one is built by PMA_getTableDef() to use in table copy/move
+ // but not in the case of export
+ unset($GLOBALS['sql_constraints_query']);
- $result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- // a possible error: the table has crashed
- $tmp_error = PMA_DBI_getError();
- if ($tmp_error) {
- return PMA_exportOutputHandler(PMA_exportComment(__('in use') . ' (' . $tmp_error . ')'));
+ return PMA_exportOutputHandler($dump);
}
- if ($result != false) {
- $fields_cnt = PMA_DBI_num_fields($result);
-
- // Get field information
- $fields_meta = PMA_DBI_get_fields_meta($result);
- $field_flags = array();
- for ($j = 0; $j < $fields_cnt; $j++) {
- $field_flags[$j] = PMA_DBI_field_flags($result, $j);
+ /**
+ * Outputs the content of a table in SQL format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ global $sql_backquotes;
+ global $current_row;
+
+ $formatted_table_name = (isset($GLOBALS['sql_backquotes']))
+ ? PMA_backquote($table)
+ : '\'' . $table . '\'';
+
+ // Do not export data for a VIEW
+ // (For a VIEW, this is called only when exporting a single VIEW)
+ if (PMA_Table::isView($db, $table)) {
+ $head = PMA_possibleCRLF()
+ . PMA_exportComment()
+ . PMA_exportComment('VIEW ' . ' ' . $formatted_table_name)
+ . PMA_exportComment(__('Data') . ': ' . __('None'))
+ . PMA_exportComment()
+ . PMA_possibleCRLF();
+
+ if (! PMA_exportOutputHandler($head)) {
+ return false;
+ }
+ return true;
}
- for ($j = 0; $j < $fields_cnt; $j++) {
- if (isset($analyzed_sql[0]['select_expr'][$j]['column'])) {
- $field_set[$j] = PMA_backquote($analyzed_sql[0]['select_expr'][$j]['column'], $sql_backquotes);
- } else {
- $field_set[$j] = PMA_backquote($fields_meta[$j]->name, $sql_backquotes);
- }
+ // analyze the query to get the true column names, not the aliases
+ // (this fixes an undefined index, also if Complete inserts
+ // are used, we did not get the true column name in case of aliases)
+ $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($sql_query));
+
+ $result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ // a possible error: the table has crashed
+ $tmp_error = PMA_DBI_getError();
+ if ($tmp_error) {
+ return PMA_exportOutputHandler(PMA_exportComment(__('in use') . ' (' . $tmp_error . ')'));
}
- if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'UPDATE') {
- // update
- $schema_insert = 'UPDATE ';
- if (isset($GLOBALS['sql_ignore'])) {
- $schema_insert .= 'IGNORE ';
+ if ($result != false) {
+ $fields_cnt = PMA_DBI_num_fields($result);
+
+ // Get field information
+ $fields_meta = PMA_DBI_get_fields_meta($result);
+ $field_flags = array();
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ $field_flags[$j] = PMA_DBI_field_flags($result, $j);
}
- // avoid EOL blank
- $schema_insert .= PMA_backquote($table, $sql_backquotes) . ' SET';
- } else {
- // insert or replace
- if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'REPLACE') {
- $sql_command = 'REPLACE';
- } else {
- $sql_command = 'INSERT';
+
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ if (isset($analyzed_sql[0]['select_expr'][$j]['column'])) {
+ $field_set[$j] = PMA_backquote($analyzed_sql[0]['select_expr'][$j]['column'], $sql_backquotes);
+ } else {
+ $field_set[$j] = PMA_backquote($fields_meta[$j]->name, $sql_backquotes);
+ }
}
- // delayed inserts?
- if (isset($GLOBALS['sql_delayed'])) {
- $insert_delayed = ' DELAYED';
+ if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'UPDATE') {
+ // update
+ $schema_insert = 'UPDATE ';
+ if (isset($GLOBALS['sql_ignore'])) {
+ $schema_insert .= 'IGNORE ';
+ }
+ // avoid EOL blank
+ $schema_insert .= PMA_backquote($table, $sql_backquotes) . ' SET';
} else {
- $insert_delayed = '';
- }
+ // insert or replace
+ if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'REPLACE') {
+ $sql_command = 'REPLACE';
+ } else {
+ $sql_command = 'INSERT';
+ }
+
+ // delayed inserts?
+ if (isset($GLOBALS['sql_delayed'])) {
+ $insert_delayed = ' DELAYED';
+ } else {
+ $insert_delayed = '';
+ }
- // insert ignore?
- if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'INSERT' && isset($GLOBALS['sql_ignore'])) {
- $insert_delayed .= ' IGNORE';
+ // insert ignore?
+ if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'INSERT' && isset($GLOBALS['sql_ignore'])) {
+ $insert_delayed .= ' IGNORE';
+ }
+
+ // scheme for inserting fields
+ if ($GLOBALS['sql_insert_syntax'] == 'complete' || $GLOBALS['sql_insert_syntax'] == 'both') {
+ $fields = implode(', ', $field_set);
+ $schema_insert = $sql_command . $insert_delayed .' INTO ' . PMA_backquote($table, $sql_backquotes)
+ // avoid EOL blank
+ . ' (' . $fields . ') VALUES';
+ } else {
+ $schema_insert = $sql_command . $insert_delayed .' INTO ' . PMA_backquote($table, $sql_backquotes)
+ . ' VALUES';
+ }
}
- // scheme for inserting fields
- if ($GLOBALS['sql_insert_syntax'] == 'complete' || $GLOBALS['sql_insert_syntax'] == 'both') {
- $fields = implode(', ', $field_set);
- $schema_insert = $sql_command . $insert_delayed .' INTO ' . PMA_backquote($table, $sql_backquotes)
- // avoid EOL blank
- . ' (' . $fields . ') VALUES';
+ $search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
+ $replace = array('\0', '\n', '\r', '\Z');
+ $current_row = 0;
+ $query_size = 0;
+ if (($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') && (!isset($GLOBALS['sql_type']) || $GLOBALS['sql_type'] != 'UPDATE')) {
+ $separator = ',';
+ $schema_insert .= $crlf;
} else {
- $schema_insert = $sql_command . $insert_delayed .' INTO ' . PMA_backquote($table, $sql_backquotes)
- . ' VALUES';
+ $separator = ';';
}
- }
- $search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
- $replace = array('\0', '\n', '\r', '\Z');
- $current_row = 0;
- $query_size = 0;
- if (($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') && (!isset($GLOBALS['sql_type']) || $GLOBALS['sql_type'] != 'UPDATE')) {
- $separator = ',';
- $schema_insert .= $crlf;
- } else {
- $separator = ';';
- }
-
- while ($row = PMA_DBI_fetch_row($result)) {
- if ($current_row == 0) {
- $head = PMA_possibleCRLF()
- . PMA_exportComment()
- . PMA_exportComment(__('Dumping data for table') . ' ' . $formatted_table_name)
- . PMA_exportComment()
- . $crlf;
- if (! PMA_exportOutputHandler($head)) {
- return false;
+ while ($row = PMA_DBI_fetch_row($result)) {
+ if ($current_row == 0) {
+ $head = PMA_possibleCRLF()
+ . PMA_exportComment()
+ . PMA_exportComment(__('Dumping data for table') . ' ' . $formatted_table_name)
+ . PMA_exportComment()
+ . $crlf;
+ if (! PMA_exportOutputHandler($head)) {
+ return false;
+ }
}
- }
- $current_row++;
- for ($j = 0; $j < $fields_cnt; $j++) {
- // NULL
- if (!isset($row[$j]) || is_null($row[$j])) {
- $values[] = 'NULL';
- // a number
- // timestamp is numeric on some MySQL 4.1, BLOBs are sometimes numeric
- } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp'
- && ! $fields_meta[$j]->blob) {
- $values[] = $row[$j];
- // a true BLOB
- // - mysqldump only generates hex data when the --hex-blob
- // option is used, for fields having the binary attribute
- // no hex is generated
- // - a TEXT field returns type blob but a real blob
- // returns also the 'binary' flag
- } elseif (stristr($field_flags[$j], 'BINARY')
- && $fields_meta[$j]->blob
- && isset($GLOBALS['sql_hex_for_blob'])) {
- // empty blobs need to be different, but '0' is also empty :-(
- if (empty($row[$j]) && $row[$j] != '0') {
- $values[] = '\'\'';
+ $current_row++;
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ // NULL
+ if (!isset($row[$j]) || is_null($row[$j])) {
+ $values[] = 'NULL';
+ // a number
+ // timestamp is numeric on some MySQL 4.1, BLOBs are sometimes numeric
+ } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp'
+ && ! $fields_meta[$j]->blob) {
+ $values[] = $row[$j];
+ // a true BLOB
+ // - mysqldump only generates hex data when the --hex-blob
+ // option is used, for fields having the binary attribute
+ // no hex is generated
+ // - a TEXT field returns type blob but a real blob
+ // returns also the 'binary' flag
+ } elseif (stristr($field_flags[$j], 'BINARY')
+ && $fields_meta[$j]->blob
+ && isset($GLOBALS['sql_hex_for_blob'])) {
+ // empty blobs need to be different, but '0' is also empty :-(
+ if (empty($row[$j]) && $row[$j] != '0') {
+ $values[] = '\'\'';
+ } else {
+ $values[] = '0x' . bin2hex($row[$j]);
+ }
+ // detection of 'bit' works only on mysqli extension
+ } elseif ($fields_meta[$j]->type == 'bit') {
+ $values[] = "b'" . PMA_sqlAddSlashes(PMA_printable_bit_value($row[$j], $fields_meta[$j]->length)) . "'";
+ // something else -> treat as a string
} else {
- $values[] = '0x' . bin2hex($row[$j]);
- }
- // detection of 'bit' works only on mysqli extension
- } elseif ($fields_meta[$j]->type == 'bit') {
- $values[] = "b'" . PMA_sqlAddSlashes(PMA_printable_bit_value($row[$j], $fields_meta[$j]->length)) . "'";
- // something else -> treat as a string
- } else {
- $values[] = '\'' . str_replace($search, $replace, PMA_sqlAddSlashes($row[$j])) . '\'';
- } // end if
- } // end for
+ $values[] = '\'' . str_replace($search, $replace, PMA_sqlAddSlashes($row[$j])) . '\'';
+ } // end if
+ } // end for
- // should we make update?
- if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'UPDATE') {
+ // should we make update?
+ if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'UPDATE') {
- $insert_line = $schema_insert;
- for ($i = 0; $i < $fields_cnt; $i++) {
- if (0 == $i) {
- $insert_line .= ' ';
- }
- if ($i > 0) {
- // avoid EOL blank
- $insert_line .= ',';
+ $insert_line = $schema_insert;
+ for ($i = 0; $i < $fields_cnt; $i++) {
+ if (0 == $i) {
+ $insert_line .= ' ';
+ }
+ if ($i > 0) {
+ // avoid EOL blank
+ $insert_line .= ',';
+ }
+ $insert_line .= $field_set[$i] . ' = ' . $values[$i];
}
- $insert_line .= $field_set[$i] . ' = ' . $values[$i];
- }
- list($tmp_unique_condition, $tmp_clause_is_unique) = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $row);
- $insert_line .= ' WHERE ' . $tmp_unique_condition;
- unset($tmp_unique_condition, $tmp_clause_is_unique);
+ list($tmp_unique_condition, $tmp_clause_is_unique) = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $row);
+ $insert_line .= ' WHERE ' . $tmp_unique_condition;
+ unset($tmp_unique_condition, $tmp_clause_is_unique);
- } else {
+ } else {
- // Extended inserts case
- if ($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') {
- if ($current_row == 1) {
- $insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
- } else {
- $insert_line = '(' . implode(', ', $values) . ')';
- if (isset($GLOBALS['sql_max_query_size']) && $GLOBALS['sql_max_query_size'] > 0 && $query_size + strlen($insert_line) > $GLOBALS['sql_max_query_size']) {
- if (!PMA_exportOutputHandler(';' . $crlf)) {
- return false;
+ // Extended inserts case
+ if ($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') {
+ if ($current_row == 1) {
+ $insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
+ } else {
+ $insert_line = '(' . implode(', ', $values) . ')';
+ if (isset($GLOBALS['sql_max_query_size']) && $GLOBALS['sql_max_query_size'] > 0 && $query_size + strlen($insert_line) > $GLOBALS['sql_max_query_size']) {
+ if (!PMA_exportOutputHandler(';' . $crlf)) {
+ return false;
+ }
+ $query_size = 0;
+ $current_row = 1;
+ $insert_line = $schema_insert . $insert_line;
}
- $query_size = 0;
- $current_row = 1;
- $insert_line = $schema_insert . $insert_line;
}
+ $query_size += strlen($insert_line);
+ }
+ // Other inserts case
+ else {
+ $insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
}
- $query_size += strlen($insert_line);
- }
- // Other inserts case
- else {
- $insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
}
- }
- unset($values);
+ unset($values);
- if (!PMA_exportOutputHandler(($current_row == 1 ? '' : $separator . $crlf) . $insert_line)) {
- return false;
- }
+ if (!PMA_exportOutputHandler(($current_row == 1 ? '' : $separator . $crlf) . $insert_line)) {
+ return false;
+ }
- } // end while
- if ($current_row > 0) {
- if (!PMA_exportOutputHandler(';' . $crlf)) {
- return false;
+ } // end while
+ if ($current_row > 0) {
+ if (!PMA_exportOutputHandler(';' . $crlf)) {
+ return false;
+ }
}
- }
- } // end if ($result != false)
- PMA_DBI_free_result($result);
+ } // end if ($result != false)
+ PMA_DBI_free_result($result);
- return true;
-} // end of the 'PMA_exportData()' function
+ return true;
+ } // end of the 'PMA_exportData()' function
}
?>
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12838-g8cb1f3a
by Michal Čihař 02 Aug '11
by Michal Čihař 02 Aug '11
02 Aug '11
The branch, master has been updated
via 8cb1f3a1cc1a089e53a89c1a4f59cd63a1ddecf8 (commit)
from 8cb8a3d4c75dc6bf9665d4a3e80a2fea1a1b31eb (commit)
- Log -----------------------------------------------------------------
commit 8cb1f3a1cc1a089e53a89c1a4f59cd63a1ddecf8
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Tue Aug 2 15:25:27 2011 +0200
Fix indentation
-----------------------------------------------------------------------
Summary of changes:
libraries/export/codegen.php | 334 +++++++++---------
libraries/export/csv.php | 330 +++++++++---------
libraries/export/htmlword.php | 546 ++++++++++++++--------------
libraries/export/json.php | 242 +++++++-------
libraries/export/latex.php | 658 +++++++++++++++++-----------------
libraries/export/mediawiki.php | 228 ++++++------
libraries/export/ods.php | 344 +++++++++---------
libraries/export/odt.php | 594 ++++++++++++++++----------------
libraries/export/pdf.php | 764 ++++++++++++++++++++--------------------
9 files changed, 2020 insertions(+), 2020 deletions(-)
diff --git a/libraries/export/codegen.php b/libraries/export/codegen.php
index 357eac0..b8b35d5 100644
--- a/libraries/export/codegen.php
+++ b/libraries/export/codegen.php
@@ -42,188 +42,188 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Set of functions used to build exports of tables
- */
-
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter()
-{
- return true;
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader()
-{
- return true;
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db)
-{
- return true;
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db)
-{
- return true;
-}
-
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db)
-{
- return true;
-}
+ /**
+ * Set of functions used to build exports of tables
+ */
-/**
- * Outputs the content of a table in NHibernate format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- global $CG_FORMATS, $CG_HANDLERS, $what;
- $format = $GLOBALS[$what . '_format'];
- if (isset($CG_FORMATS[$format])) {
- return PMA_exportOutputHandler($CG_HANDLERS[$format]($db, $table, $crlf));
- }
- return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
-}
-
-/**
- *
- * @package phpMyAdmin-Export
- * @subpackage Codegen
- */
-class TableProperty
-{
- public $name;
- public $type;
- public $nullable;
- public $key;
- public $defaultValue;
- public $ext;
- function __construct($row)
- {
- $this->name = trim($row[0]);
- $this->type = trim($row[1]);
- $this->nullable = trim($row[2]);
- $this->key = trim($row[3]);
- $this->defaultValue = trim($row[4]);
- $this->ext = trim($row[5]);
- }
- function getPureType()
- {
- $pos=strpos($this->type, "(");
- if ($pos > 0)
- return substr($this->type, 0, $pos);
- return $this->type;
- }
- function isNotNull()
- {
- return $this->nullable == "NO" ? "true" : "false";
- }
- function isUnique()
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter()
{
- return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
+ return true;
}
- function getDotNetPrimitiveType()
- {
- if (strpos($this->type, "int") === 0) return "int";
- if (strpos($this->type, "long") === 0) return "long";
- if (strpos($this->type, "char") === 0) return "string";
- if (strpos($this->type, "varchar") === 0) return "string";
- if (strpos($this->type, "text") === 0) return "string";
- if (strpos($this->type, "longtext") === 0) return "string";
- if (strpos($this->type, "tinyint") === 0) return "bool";
- if (strpos($this->type, "datetime") === 0) return "DateTime";
- return "unknown";
- }
- function getDotNetObjectType()
+
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader()
{
- if (strpos($this->type, "int") === 0) return "Int32";
- if (strpos($this->type, "long") === 0) return "Long";
- if (strpos($this->type, "char") === 0) return "String";
- if (strpos($this->type, "varchar") === 0) return "String";
- if (strpos($this->type, "text") === 0) return "String";
- if (strpos($this->type, "longtext") === 0) return "String";
- if (strpos($this->type, "tinyint") === 0) return "Boolean";
- if (strpos($this->type, "datetime") === 0) return "DateTime";
- return "Unknown";
+ return true;
}
- function getIndexName()
+
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db)
{
- if (strlen($this->key)>0)
- return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
- return "";
+ return true;
}
- function isPK()
+
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db)
{
- return $this->key=="PRI";
+ return true;
}
- function formatCs($text)
+
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db)
{
- $text=str_replace("#name#", cgMakeIdentifier($this->name, false), $text);
- return $this->format($text);
+ return true;
}
- function formatXml($text)
+
+ /**
+ * Outputs the content of a table in NHibernate format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
- $text=str_replace("#name#", htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), $text);
- $text=str_replace("#indexName#", $this->getIndexName(), $text);
- return $this->format($text);
+ global $CG_FORMATS, $CG_HANDLERS, $what;
+ $format = $GLOBALS[$what . '_format'];
+ if (isset($CG_FORMATS[$format])) {
+ return PMA_exportOutputHandler($CG_HANDLERS[$format]($db, $table, $crlf));
+ }
+ return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
}
- function format($text)
+
+ /**
+ *
+ * @package phpMyAdmin-Export
+ * @subpackage Codegen
+ */
+ class TableProperty
{
- $text=str_replace("#ucfirstName#", cgMakeIdentifier($this->name), $text);
- $text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
- $text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
- $text=str_replace("#type#", $this->getPureType(), $text);
- $text=str_replace("#notNull#", $this->isNotNull(), $text);
- $text=str_replace("#unique#", $this->isUnique(), $text);
- return $text;
+ public $name;
+ public $type;
+ public $nullable;
+ public $key;
+ public $defaultValue;
+ public $ext;
+ function __construct($row)
+ {
+ $this->name = trim($row[0]);
+ $this->type = trim($row[1]);
+ $this->nullable = trim($row[2]);
+ $this->key = trim($row[3]);
+ $this->defaultValue = trim($row[4]);
+ $this->ext = trim($row[5]);
+ }
+ function getPureType()
+ {
+ $pos=strpos($this->type, "(");
+ if ($pos > 0)
+ return substr($this->type, 0, $pos);
+ return $this->type;
+ }
+ function isNotNull()
+ {
+ return $this->nullable == "NO" ? "true" : "false";
+ }
+ function isUnique()
+ {
+ return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
+ }
+ function getDotNetPrimitiveType()
+ {
+ if (strpos($this->type, "int") === 0) return "int";
+ if (strpos($this->type, "long") === 0) return "long";
+ if (strpos($this->type, "char") === 0) return "string";
+ if (strpos($this->type, "varchar") === 0) return "string";
+ if (strpos($this->type, "text") === 0) return "string";
+ if (strpos($this->type, "longtext") === 0) return "string";
+ if (strpos($this->type, "tinyint") === 0) return "bool";
+ if (strpos($this->type, "datetime") === 0) return "DateTime";
+ return "unknown";
+ }
+ function getDotNetObjectType()
+ {
+ if (strpos($this->type, "int") === 0) return "Int32";
+ if (strpos($this->type, "long") === 0) return "Long";
+ if (strpos($this->type, "char") === 0) return "String";
+ if (strpos($this->type, "varchar") === 0) return "String";
+ if (strpos($this->type, "text") === 0) return "String";
+ if (strpos($this->type, "longtext") === 0) return "String";
+ if (strpos($this->type, "tinyint") === 0) return "Boolean";
+ if (strpos($this->type, "datetime") === 0) return "DateTime";
+ return "Unknown";
+ }
+ function getIndexName()
+ {
+ if (strlen($this->key)>0)
+ return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
+ return "";
+ }
+ function isPK()
+ {
+ return $this->key=="PRI";
+ }
+ function formatCs($text)
+ {
+ $text=str_replace("#name#", cgMakeIdentifier($this->name, false), $text);
+ return $this->format($text);
+ }
+ function formatXml($text)
+ {
+ $text=str_replace("#name#", htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), $text);
+ $text=str_replace("#indexName#", $this->getIndexName(), $text);
+ return $this->format($text);
+ }
+ function format($text)
+ {
+ $text=str_replace("#ucfirstName#", cgMakeIdentifier($this->name), $text);
+ $text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
+ $text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
+ $text=str_replace("#type#", $this->getPureType(), $text);
+ $text=str_replace("#notNull#", $this->isNotNull(), $text);
+ $text=str_replace("#unique#", $this->isUnique(), $text);
+ return $text;
+ }
}
-}
function cgMakeIdentifier($str, $ucfirst = true)
{
diff --git a/libraries/export/csv.php b/libraries/export/csv.php
index 19ca573..8b04841 100644
--- a/libraries/export/csv.php
+++ b/libraries/export/csv.php
@@ -35,189 +35,189 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- return true;
-}
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ return true;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- global $what;
- global $csv_terminated;
- global $csv_separator;
- global $csv_enclosed;
- global $csv_escaped;
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ global $what;
+ global $csv_terminated;
+ global $csv_separator;
+ global $csv_enclosed;
+ global $csv_escaped;
- // Here we just prepare some values for export
- if ($what == 'excel') {
- $csv_terminated = "\015\012";
- switch($GLOBALS['excel_edition']) {
- case 'win':
- // as tested on Windows with Excel 2002 and Excel 2007
- $csv_separator = ';';
- break;
- case 'mac_excel2003':
- $csv_separator = ';';
- break;
- case 'mac_excel2008':
- $csv_separator = ',';
- break;
- }
- $csv_enclosed = '"';
- $csv_escaped = '"';
- if (isset($GLOBALS['excel_columns'])) {
- $GLOBALS['csv_columns'] = 'yes';
- }
- } else {
- if (empty($csv_terminated) || strtolower($csv_terminated) == 'auto') {
- $csv_terminated = $GLOBALS['crlf'];
+ // Here we just prepare some values for export
+ if ($what == 'excel') {
+ $csv_terminated = "\015\012";
+ switch($GLOBALS['excel_edition']) {
+ case 'win':
+ // as tested on Windows with Excel 2002 and Excel 2007
+ $csv_separator = ';';
+ break;
+ case 'mac_excel2003':
+ $csv_separator = ';';
+ break;
+ case 'mac_excel2008':
+ $csv_separator = ',';
+ break;
+ }
+ $csv_enclosed = '"';
+ $csv_escaped = '"';
+ if (isset($GLOBALS['excel_columns'])) {
+ $GLOBALS['csv_columns'] = 'yes';
+ }
} else {
- $csv_terminated = str_replace('\\r', "\015", $csv_terminated);
- $csv_terminated = str_replace('\\n', "\012", $csv_terminated);
- $csv_terminated = str_replace('\\t', "\011", $csv_terminated);
- } // end if
- $csv_separator = str_replace('\\t', "\011", $csv_separator);
+ if (empty($csv_terminated) || strtolower($csv_terminated) == 'auto') {
+ $csv_terminated = $GLOBALS['crlf'];
+ } else {
+ $csv_terminated = str_replace('\\r', "\015", $csv_terminated);
+ $csv_terminated = str_replace('\\n', "\012", $csv_terminated);
+ $csv_terminated = str_replace('\\t', "\011", $csv_terminated);
+ } // end if
+ $csv_separator = str_replace('\\t', "\011", $csv_separator);
+ }
+ return true;
}
- return true;
-}
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- return true;
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ return true;
+ }
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ return true;
+ }
-/**
- * Outputs the content of a table in CSV format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- global $what;
- global $csv_terminated;
- global $csv_separator;
- global $csv_enclosed;
- global $csv_escaped;
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
- // Gets the data from the database
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- $fields_cnt = PMA_DBI_num_fields($result);
+ /**
+ * Outputs the content of a table in CSV format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ global $what;
+ global $csv_terminated;
+ global $csv_separator;
+ global $csv_enclosed;
+ global $csv_escaped;
- // If required, get fields name at the first line
- if (isset($GLOBALS['csv_columns'])) {
- $schema_insert = '';
- for ($i = 0; $i < $fields_cnt; $i++) {
- if ($csv_enclosed == '') {
- $schema_insert .= stripslashes(PMA_DBI_field_name($result, $i));
- } else {
- $schema_insert .= $csv_enclosed
- . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, stripslashes(PMA_DBI_field_name($result, $i)))
- . $csv_enclosed;
- }
- $schema_insert .= $csv_separator;
- } // end for
- $schema_insert =trim(substr($schema_insert, 0, -1));
- if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
- return false;
- }
- } // end if
+ // Gets the data from the database
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $fields_cnt = PMA_DBI_num_fields($result);
- // Format the data
- while ($row = PMA_DBI_fetch_row($result)) {
- $schema_insert = '';
- for ($j = 0; $j < $fields_cnt; $j++) {
- if (!isset($row[$j]) || is_null($row[$j])) {
- $schema_insert .= $GLOBALS[$what . '_null'];
- } elseif ($row[$j] == '0' || $row[$j] != '') {
- // always enclose fields
- if ($what == 'excel') {
- $row[$j] = preg_replace("/\015(\012)?/", "\012", $row[$j]);
- }
- // remove CRLF characters within field
- if (isset($GLOBALS[$what . '_removeCRLF']) && $GLOBALS[$what . '_removeCRLF']) {
- $row[$j] = str_replace("\n", "", str_replace("\r", "", $row[$j]));
- }
+ // If required, get fields name at the first line
+ if (isset($GLOBALS['csv_columns'])) {
+ $schema_insert = '';
+ for ($i = 0; $i < $fields_cnt; $i++) {
if ($csv_enclosed == '') {
- $schema_insert .= $row[$j];
+ $schema_insert .= stripslashes(PMA_DBI_field_name($result, $i));
} else {
- // also double the escape string if found in the data
- if ('csv' == $what) {
- $schema_insert .= $csv_enclosed
- . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, str_replace($csv_escaped, $csv_escaped . $csv_escaped, $row[$j]))
+ $schema_insert .= $csv_enclosed
+ . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, stripslashes(PMA_DBI_field_name($result, $i)))
. $csv_enclosed;
+ }
+ $schema_insert .= $csv_separator;
+ } // end for
+ $schema_insert =trim(substr($schema_insert, 0, -1));
+ if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
+ return false;
+ }
+ } // end if
+
+ // Format the data
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $schema_insert = '';
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ if (!isset($row[$j]) || is_null($row[$j])) {
+ $schema_insert .= $GLOBALS[$what . '_null'];
+ } elseif ($row[$j] == '0' || $row[$j] != '') {
+ // always enclose fields
+ if ($what == 'excel') {
+ $row[$j] = preg_replace("/\015(\012)?/", "\012", $row[$j]);
+ }
+ // remove CRLF characters within field
+ if (isset($GLOBALS[$what . '_removeCRLF']) && $GLOBALS[$what . '_removeCRLF']) {
+ $row[$j] = str_replace("\n", "", str_replace("\r", "", $row[$j]));
+ }
+ if ($csv_enclosed == '') {
+ $schema_insert .= $row[$j];
} else {
- // for excel, avoid a problem when a field contains
- // double quotes
- $schema_insert .= $csv_enclosed
- . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $row[$j])
- . $csv_enclosed;
+ // also double the escape string if found in the data
+ if ('csv' == $what) {
+ $schema_insert .= $csv_enclosed
+ . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, str_replace($csv_escaped, $csv_escaped . $csv_escaped, $row[$j]))
+ . $csv_enclosed;
+ } else {
+ // for excel, avoid a problem when a field contains
+ // double quotes
+ $schema_insert .= $csv_enclosed
+ . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $row[$j])
+ . $csv_enclosed;
+ }
}
+ } else {
+ $schema_insert .= '';
}
- } else {
- $schema_insert .= '';
- }
- if ($j < $fields_cnt-1) {
- $schema_insert .= $csv_separator;
- }
- } // end for
+ if ($j < $fields_cnt-1) {
+ $schema_insert .= $csv_separator;
+ }
+ } // end for
- if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
- return false;
- }
- } // end while
- PMA_DBI_free_result($result);
+ if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
+ return false;
+ }
+ } // end while
+ PMA_DBI_free_result($result);
- return true;
-} // end of the 'PMA_getTableCsv()' function
+ return true;
+ } // end of the 'PMA_getTableCsv()' function
}
?>
diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php
index 6604ac6..707bc77 100644
--- a/libraries/export/htmlword.php
+++ b/libraries/export/htmlword.php
@@ -34,321 +34,321 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- return PMA_exportOutputHandler('</body></html>');
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- global $charset_of_file;
- return PMA_exportOutputHandler('<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:x="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<head>
- <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
-</head>
-<body>');
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
-
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
-
-/**
- * Outputs the content of a table in HTML (Microsoft Word) format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- global $what;
-
- if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
- return false;
- }
- if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
- return false;
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ return PMA_exportOutputHandler('</body></html>');
}
- // Gets the data from the database
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- $fields_cnt = PMA_DBI_num_fields($result);
-
- // If required, get fields name at the first line
- if (isset($GLOBALS['htmlword_columns'])) {
- $schema_insert = '<tr class="print-category">';
- for ($i = 0; $i < $fields_cnt; $i++) {
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
- } // end for
- $schema_insert .= '</tr>';
- if (! PMA_exportOutputHandler($schema_insert)) {
- return false;
- }
- } // end if
-
- // Format the data
- while ($row = PMA_DBI_fetch_row($result)) {
- $schema_insert = '<tr class="print-category">';
- for ($j = 0; $j < $fields_cnt; $j++) {
- if (! isset($row[$j]) || is_null($row[$j])) {
- $value = $GLOBALS[$what . '_null'];
- } elseif ($row[$j] == '0' || $row[$j] != '') {
- $value = $row[$j];
- } else {
- $value = '';
- }
- $schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
- } // end for
- $schema_insert .= '</tr>';
- if (! PMA_exportOutputHandler($schema_insert)) {
- return false;
- }
- } // end while
- PMA_DBI_free_result($result);
- if (! PMA_exportOutputHandler('</table>')) {
- return false;
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ global $charset_of_file;
+ return PMA_exportOutputHandler('<html xmlns:o="urn:schemas-microsoft-com:office:office"
+ xmlns:x="urn:schemas-microsoft-com:office:word"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html>
+ <head>
+ <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
+ </head>
+ <body>');
}
- return true;
-}
-
-/**
- * Outputs table's structure
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param bool $do_relation whether to include relation comments
- * @param bool $do_comments whether to include the pmadb-style column comments
- * as comments in the structure; this is deprecated
- * but the parameter is left here because export.php
- * calls PMA_exportStructure() also for other export
- * types which use this parameter
- * @param bool $do_mime whether to include mime comments
- * @param bool $dates whether to include creation/update/check dates
- * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
- * @param string $export_type 'server', 'database', 'table'
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
-{
- global $cfgRelation;
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
+ }
- if (! PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
- return false;
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ return true;
}
/**
- * Get the unique keys in the table
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
- $keys_result = PMA_DBI_query($keys_query);
- $unique_keys = array();
- while ($key = PMA_DBI_fetch_assoc($keys_result)) {
- if ($key['Non_unique'] == 0) {
- $unique_keys[] = $key['Column_name'];
- }
+ function PMA_exportDBCreate($db) {
+ return true;
}
- PMA_DBI_free_result($keys_result);
/**
- * Gets fields properties
+ * Outputs the content of a table in HTML (Microsoft Word) format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- PMA_DBI_select_db($db);
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ global $what;
- // Check if we can use Relations
- if ($do_relation && ! empty($cfgRelation['relation'])) {
- // Find which tables are related with the current one and write it in
- // an array
- $res_rel = PMA_getForeigners($db, $table);
+ if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
+ return false;
+ }
+ if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
+ return false;
+ }
- if ($res_rel && count($res_rel) > 0) {
- $have_rel = true;
- } else {
- $have_rel = false;
+ // Gets the data from the database
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $fields_cnt = PMA_DBI_num_fields($result);
+
+ // If required, get fields name at the first line
+ if (isset($GLOBALS['htmlword_columns'])) {
+ $schema_insert = '<tr class="print-category">';
+ for ($i = 0; $i < $fields_cnt; $i++) {
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
+ } // end for
+ $schema_insert .= '</tr>';
+ if (! PMA_exportOutputHandler($schema_insert)) {
+ return false;
+ }
+ } // end if
+
+ // Format the data
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $schema_insert = '<tr class="print-category">';
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ if (! isset($row[$j]) || is_null($row[$j])) {
+ $value = $GLOBALS[$what . '_null'];
+ } elseif ($row[$j] == '0' || $row[$j] != '') {
+ $value = $row[$j];
+ } else {
+ $value = '';
+ }
+ $schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
+ } // end for
+ $schema_insert .= '</tr>';
+ if (! PMA_exportOutputHandler($schema_insert)) {
+ return false;
+ }
+ } // end while
+ PMA_DBI_free_result($result);
+ if (! PMA_exportOutputHandler('</table>')) {
+ return false;
}
- } else {
- $have_rel = false;
- } // end if
+
+ return true;
+ }
/**
- * Displays the table structure
+ * Outputs table's structure
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param bool $do_relation whether to include relation comments
+ * @param bool $do_comments whether to include the pmadb-style column comments
+ * as comments in the structure; this is deprecated
+ * but the parameter is left here because export.php
+ * calls PMA_exportStructure() also for other export
+ * types which use this parameter
+ * @param bool $do_mime whether to include mime comments
+ * @param bool $dates whether to include creation/update/check dates
+ * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
+ * @param string $export_type 'server', 'database', 'table'
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
- return false;
- }
+ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
+ {
+ global $cfgRelation;
- $columns_cnt = 4;
- if ($do_relation && $have_rel) {
- $columns_cnt++;
- }
- if ($do_comments && $cfgRelation['commwork']) {
- $columns_cnt++;
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $columns_cnt++;
- }
+ if (! PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
+ return false;
+ }
- $schema_insert = '<tr class="print-category">';
- $schema_insert .= '<th class="print">' . htmlspecialchars(__('Column')) . '</th>';
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Type')) . '</b></td>';
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Null')) . '</b></td>';
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Default')) . '</b></td>';
- if ($do_relation && $have_rel) {
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Links to')) . '</b></td>';
- }
- if ($do_comments) {
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Comments')) . '</b></td>';
- $comments = PMA_getComments($db, $table);
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $schema_insert .= '<td class="print"><b>' . htmlspecialchars('MIME') . '</b></td>';
- $mime_map = PMA_getMIME($db, $table, true);
- }
- $schema_insert .= '</tr>';
+ /**
+ * Get the unique keys in the table
+ */
+ $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
+ $keys_result = PMA_DBI_query($keys_query);
+ $unique_keys = array();
+ while ($key = PMA_DBI_fetch_assoc($keys_result)) {
+ if ($key['Non_unique'] == 0) {
+ $unique_keys[] = $key['Column_name'];
+ }
+ }
+ PMA_DBI_free_result($keys_result);
- if (! PMA_exportOutputHandler($schema_insert)) {
- return false;
- }
+ /**
+ * Gets fields properties
+ */
+ PMA_DBI_select_db($db);
- $columns = PMA_DBI_get_columns($db, $table);
- foreach ($columns as $column) {
+ // Check if we can use Relations
+ if ($do_relation && ! empty($cfgRelation['relation'])) {
+ // Find which tables are related with the current one and write it in
+ // an array
+ $res_rel = PMA_getForeigners($db, $table);
- $schema_insert = '<tr class="print-category">';
- $type = $column['Type'];
- // reformat mysql query output
- // set or enum types: slashes single quotes inside options
- if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
- $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
- $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
- $type_nowrap = '';
-
- $binary = 0;
- $unsigned = 0;
- $zerofill = 0;
- } else {
- $type_nowrap = ' nowrap="nowrap"';
- $type = preg_replace('/BINARY/i', '', $type);
- $type = preg_replace('/ZEROFILL/i', '', $type);
- $type = preg_replace('/UNSIGNED/i', '', $type);
- if (empty($type)) {
- $type = ' ';
+ if ($res_rel && count($res_rel) > 0) {
+ $have_rel = true;
+ } else {
+ $have_rel = false;
}
+ } else {
+ $have_rel = false;
+ } // end if
- $binary = preg_match('/BINARY/i', $column['Type']);
- $unsigned = preg_match('/UNSIGNED/i', $column['Type']);
- $zerofill = preg_match('/ZEROFILL/i', $column['Type']);
- }
- $attribute = ' ';
- if ($binary) {
- $attribute = 'BINARY';
- }
- if ($unsigned) {
- $attribute = 'UNSIGNED';
- }
- if ($zerofill) {
- $attribute = 'UNSIGNED ZEROFILL';
- }
- if (! isset($column['Default'])) {
- if ($column['Null'] != 'NO') {
- $column['Default'] = 'NULL';
- }
+ /**
+ * Displays the table structure
+ */
+ if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
+ return false;
}
- $fmt_pre = '';
- $fmt_post = '';
- if (in_array($column['Field'], $unique_keys)) {
- $fmt_pre = '<b>' . $fmt_pre;
- $fmt_post = $fmt_post . '</b>';
+ $columns_cnt = 4;
+ if ($do_relation && $have_rel) {
+ $columns_cnt++;
}
- if ($column['Key'] == 'PRI') {
- $fmt_pre = '<i>' . $fmt_pre;
- $fmt_post = $fmt_post . '</i>';
+ if ($do_comments && $cfgRelation['commwork']) {
+ $columns_cnt++;
+ }
+ if ($do_mime && $cfgRelation['mimework']) {
+ $columns_cnt++;
}
- $schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . '</td>';
- $schema_insert .= '<td class="print">' . htmlspecialchars($type) . '</td>';
- $schema_insert .= '<td class="print">' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
- $schema_insert .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
-
- $field_name = $column['Field'];
+ $schema_insert = '<tr class="print-category">';
+ $schema_insert .= '<th class="print">' . htmlspecialchars(__('Column')) . '</th>';
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Type')) . '</b></td>';
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Null')) . '</b></td>';
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Default')) . '</b></td>';
if ($do_relation && $have_rel) {
- $schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Links to')) . '</b></td>';
}
- if ($do_comments && $cfgRelation['commwork']) {
- $schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
+ if ($do_comments) {
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Comments')) . '</b></td>';
+ $comments = PMA_getComments($db, $table);
}
if ($do_mime && $cfgRelation['mimework']) {
- $schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
+ $schema_insert .= '<td class="print"><b>' . htmlspecialchars('MIME') . '</b></td>';
+ $mime_map = PMA_getMIME($db, $table, true);
}
-
$schema_insert .= '</tr>';
if (! PMA_exportOutputHandler($schema_insert)) {
return false;
}
- } // end while
- return PMA_exportOutputHandler('</table>');
-}
+ $columns = PMA_DBI_get_columns($db, $table);
+ foreach ($columns as $column) {
+
+ $schema_insert = '<tr class="print-category">';
+ $type = $column['Type'];
+ // reformat mysql query output
+ // set or enum types: slashes single quotes inside options
+ if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
+ $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
+ $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
+ $type_nowrap = '';
+
+ $binary = 0;
+ $unsigned = 0;
+ $zerofill = 0;
+ } else {
+ $type_nowrap = ' nowrap="nowrap"';
+ $type = preg_replace('/BINARY/i', '', $type);
+ $type = preg_replace('/ZEROFILL/i', '', $type);
+ $type = preg_replace('/UNSIGNED/i', '', $type);
+ if (empty($type)) {
+ $type = ' ';
+ }
+
+ $binary = preg_match('/BINARY/i', $column['Type']);
+ $unsigned = preg_match('/UNSIGNED/i', $column['Type']);
+ $zerofill = preg_match('/ZEROFILL/i', $column['Type']);
+ }
+ $attribute = ' ';
+ if ($binary) {
+ $attribute = 'BINARY';
+ }
+ if ($unsigned) {
+ $attribute = 'UNSIGNED';
+ }
+ if ($zerofill) {
+ $attribute = 'UNSIGNED ZEROFILL';
+ }
+ if (! isset($column['Default'])) {
+ if ($column['Null'] != 'NO') {
+ $column['Default'] = 'NULL';
+ }
+ }
+
+ $fmt_pre = '';
+ $fmt_post = '';
+ if (in_array($column['Field'], $unique_keys)) {
+ $fmt_pre = '<b>' . $fmt_pre;
+ $fmt_post = $fmt_post . '</b>';
+ }
+ if ($column['Key'] == 'PRI') {
+ $fmt_pre = '<i>' . $fmt_pre;
+ $fmt_post = $fmt_post . '</i>';
+ }
+ $schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . '</td>';
+ $schema_insert .= '<td class="print">' . htmlspecialchars($type) . '</td>';
+ $schema_insert .= '<td class="print">' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
+ $schema_insert .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
+
+ $field_name = $column['Field'];
+
+ if ($do_relation && $have_rel) {
+ $schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
+ }
+ if ($do_comments && $cfgRelation['commwork']) {
+ $schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
+ }
+ if ($do_mime && $cfgRelation['mimework']) {
+ $schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
+ }
+
+ $schema_insert .= '</tr>';
+
+ if (! PMA_exportOutputHandler($schema_insert)) {
+ return false;
+ }
+ } // end while
+
+ return PMA_exportOutputHandler('</table>');
+ }
}
?>
diff --git a/libraries/export/json.php b/libraries/export/json.php
index e008f0c..860d640 100644
--- a/libraries/export/json.php
+++ b/libraries/export/json.php
@@ -30,144 +30,144 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Set of functions used to build exports of tables
- */
+ /**
+ * Set of functions used to build exports of tables
+ */
+
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter()
+ {
+ return true;
+ }
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter()
-{
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader()
+ {
+ PMA_exportOutputHandler(
+ '/**' . $GLOBALS['crlf']
+ . ' Export to JSON plugin for PHPMyAdmin' . $GLOBALS['crlf']
+ . ' @version 0.1' . $GLOBALS['crlf']
+ . ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
+ );
+ return true;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader()
-{
- PMA_exportOutputHandler(
- '/**' . $GLOBALS['crlf']
- . ' Export to JSON plugin for PHPMyAdmin' . $GLOBALS['crlf']
- . ' @version 0.1' . $GLOBALS['crlf']
- . ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
- );
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db)
+ {
+ PMA_exportOutputHandler('// Database \'' . $db . '\'' . $GLOBALS['crlf'] );
+ return true;
+ }
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db)
-{
- PMA_exportOutputHandler('// Database \'' . $db . '\'' . $GLOBALS['crlf'] );
- return true;
-}
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db)
+ {
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db)
-{
- return true;
-}
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db)
+ {
+ return true;
+ }
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db)
-{
- return true;
-}
+ /**
+ * Outputs the content of a table in JSON format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+
+ $columns_cnt = PMA_DBI_num_fields($result);
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
+ }
+ unset($i);
-/**
- * Outputs the content of a table in JSON format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $buffer = '';
+ $record_cnt = 0;
+ while ($record = PMA_DBI_fetch_row($result)) {
- $columns_cnt = PMA_DBI_num_fields($result);
- for ($i = 0; $i < $columns_cnt; $i++) {
- $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
- }
- unset($i);
+ $record_cnt++;
- $buffer = '';
- $record_cnt = 0;
- while ($record = PMA_DBI_fetch_row($result)) {
+ // Output table name as comment if this is the first record of the table
+ if ($record_cnt == 1) {
+ $buffer .= '// ' . $db . '.' . $table . $crlf . $crlf;
+ $buffer .= '[{';
+ } else {
+ $buffer .= ', {';
+ }
- $record_cnt++;
+ for ($i = 0; $i < $columns_cnt; $i++) {
- // Output table name as comment if this is the first record of the table
- if ($record_cnt == 1) {
- $buffer .= '// ' . $db . '.' . $table . $crlf . $crlf;
- $buffer .= '[{';
- } else {
- $buffer .= ', {';
- }
+ $isLastLine = ($i + 1 >= $columns_cnt);
- for ($i = 0; $i < $columns_cnt; $i++) {
+ $column = $columns[$i];
- $isLastLine = ($i + 1 >= $columns_cnt);
+ if (is_null($record[$i])) {
+ $buffer .= '"' . addslashes($column) . '": null' . (! $isLastLine ? ',' : '');
+ } elseif (is_numeric($record[$i])) {
+ $buffer .= '"' . addslashes($column) . '": ' . $record[$i] . (! $isLastLine ? ',' : '');
+ } else {
+ $buffer .= '"' . addslashes($column) . '": "' . addslashes($record[$i]) . '"' . (! $isLastLine ? ',' : '');
+ }
+ }
- $column = $columns[$i];
+ $buffer .= '}';
+ }
- if (is_null($record[$i])) {
- $buffer .= '"' . addslashes($column) . '": null' . (! $isLastLine ? ',' : '');
- } elseif (is_numeric($record[$i])) {
- $buffer .= '"' . addslashes($column) . '": ' . $record[$i] . (! $isLastLine ? ',' : '');
- } else {
- $buffer .= '"' . addslashes($column) . '": "' . addslashes($record[$i]) . '"' . (! $isLastLine ? ',' : '');
- }
+ if ($record_cnt) {
+ $buffer .= ']';
+ }
+ if (! PMA_exportOutputHandler($buffer)) {
+ return false;
}
- $buffer .= '}';
- }
+ PMA_DBI_free_result($result);
- if ($record_cnt) {
- $buffer .= ']';
- }
- if (! PMA_exportOutputHandler($buffer)) {
- return false;
+ return true;
}
- PMA_DBI_free_result($result);
-
- return true;
-}
-
}
diff --git a/libraries/export/latex.php b/libraries/export/latex.php
index 080d0ac..1c6064a 100644
--- a/libraries/export/latex.php
+++ b/libraries/export/latex.php
@@ -82,389 +82,389 @@ if (isset($plugin_list)) {
array('type' => 'end_group');
} else {
-/**
- * Escapes some special characters for use in TeX/LaTeX
- *
- * @param string the string to convert
- *
- * @return string the converted string with escape codes
- *
- * @access private
- */
-function PMA_texEscape($string) {
- $escape = array('$', '%', '{', '}', '&', '#', '_', '^');
- $cnt_escape = count($escape);
- for ($k=0; $k < $cnt_escape; $k++) {
- $string = str_replace($escape[$k], '\\' . $escape[$k], $string);
+ /**
+ * Escapes some special characters for use in TeX/LaTeX
+ *
+ * @param string the string to convert
+ *
+ * @return string the converted string with escape codes
+ *
+ * @access private
+ */
+ function PMA_texEscape($string) {
+ $escape = array('$', '%', '{', '}', '&', '#', '_', '^');
+ $cnt_escape = count($escape);
+ for ($k=0; $k < $cnt_escape; $k++) {
+ $string = str_replace($escape[$k], '\\' . $escape[$k], $string);
+ }
+ return $string;
}
- return $string;
-}
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- return true;
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- global $crlf;
- global $cfg;
-
- $head = '% phpMyAdmin LaTeX Dump' . $crlf
- . '% version ' . PMA_VERSION . $crlf
- . '% http://www.phpmyadmin.net' . $crlf
- . '%' . $crlf
- . '% ' . __('Host') . ': ' . $cfg['Server']['host'];
- if (!empty($cfg['Server']['port'])) {
- $head .= ':' . $cfg['Server']['port'];
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ return true;
}
- $head .= $crlf
- . '% ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
- . '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
- . '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
- return PMA_exportOutputHandler($head);
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- global $crlf;
- $head = '% ' . $crlf
- . '% ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
- . '% ' . $crlf;
- return PMA_exportOutputHandler($head);
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
-
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
-
-/**
- * Outputs the content of a table in LaTeX table/sideways table environment
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- $result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- $columns_cnt = PMA_DBI_num_fields($result);
- for ($i = 0; $i < $columns_cnt; $i++) {
- $columns[$i] = PMA_DBI_field_name($result, $i);
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ global $crlf;
+ global $cfg;
+
+ $head = '% phpMyAdmin LaTeX Dump' . $crlf
+ . '% version ' . PMA_VERSION . $crlf
+ . '% http://www.phpmyadmin.net' . $crlf
+ . '%' . $crlf
+ . '% ' . __('Host') . ': ' . $cfg['Server']['host'];
+ if (!empty($cfg['Server']['port'])) {
+ $head .= ':' . $cfg['Server']['port'];
+ }
+ $head .= $crlf
+ . '% ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
+ . '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
+ . '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
+ return PMA_exportOutputHandler($head);
}
- unset($i);
-
- $buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table . $crlf . '%' . $crlf
- . ' \\begin{longtable}{|';
- for ($index=0;$index<$columns_cnt;$index++) {
- $buffer .= 'l|';
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ global $crlf;
+ $head = '% ' . $crlf
+ . '% ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
+ . '% ' . $crlf;
+ return PMA_exportOutputHandler($head);
}
- $buffer .= '} ' . $crlf ;
- $buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf;
- if (isset($GLOBALS['latex_caption'])) {
- $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_data_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
- . '} \\label{' . PMA_expandUserString($GLOBALS['latex_data_label'], NULL, array('table' => $table, 'database' => $db)) . '} \\\\';
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ return true;
}
- if (!PMA_exportOutputHandler($buffer)) {
- return false;
+
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
}
- // show column names
- if (isset($GLOBALS['latex_columns'])) {
- $buffer = '\\hline ';
+ /**
+ * Outputs the content of a table in LaTeX table/sideways table environment
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ $result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+
+ $columns_cnt = PMA_DBI_num_fields($result);
for ($i = 0; $i < $columns_cnt; $i++) {
- $buffer .= '\\multicolumn{1}{|c|}{\\textbf{' . PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
- }
+ $columns[$i] = PMA_DBI_field_name($result, $i);
+ }
+ unset($i);
- $buffer = substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
- if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
- return false;
+ $buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table . $crlf . '%' . $crlf
+ . ' \\begin{longtable}{|';
+
+ for ($index=0;$index<$columns_cnt;$index++) {
+ $buffer .= 'l|';
}
+ $buffer .= '} ' . $crlf ;
+
+ $buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf;
if (isset($GLOBALS['latex_caption'])) {
- if (!PMA_exportOutputHandler('\\caption{' . PMA_expandUserString($GLOBALS['latex_data_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ')) return false;
- }
- if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
- return false;
+ $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_data_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
+ . '} \\label{' . PMA_expandUserString($GLOBALS['latex_data_label'], NULL, array('table' => $table, 'database' => $db)) . '} \\\\';
}
- } else {
- if (!PMA_exportOutputHandler('\\\\ \hline')) {
+ if (!PMA_exportOutputHandler($buffer)) {
return false;
}
- }
- // print the whole table
- while ($record = PMA_DBI_fetch_assoc($result)) {
+ // show column names
+ if (isset($GLOBALS['latex_columns'])) {
+ $buffer = '\\hline ';
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ $buffer .= '\\multicolumn{1}{|c|}{\\textbf{' . PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
+ }
- $buffer = '';
- // print each row
- for ($i = 0; $i < $columns_cnt; $i++) {
- if (isset($record[$columns[$i]])
- && (! function_exists('is_null') || !is_null($record[$columns[$i]]))) {
- $column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
- } else {
- $column_value = $GLOBALS['latex_null'];
+ $buffer = substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
+ if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
+ return false;
+ }
+ if (isset($GLOBALS['latex_caption'])) {
+ if (!PMA_exportOutputHandler('\\caption{' . PMA_expandUserString($GLOBALS['latex_data_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ')) return false;
}
+ if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
+ return false;
+ }
+ } else {
+ if (!PMA_exportOutputHandler('\\\\ \hline')) {
+ return false;
+ }
+ }
- // last column ... no need for & character
- if ($i == ($columns_cnt - 1)) {
- $buffer .= $column_value;
- } else {
- $buffer .= $column_value . " & ";
+ // print the whole table
+ while ($record = PMA_DBI_fetch_assoc($result)) {
+
+ $buffer = '';
+ // print each row
+ for ($i = 0; $i < $columns_cnt; $i++) {
+ if (isset($record[$columns[$i]])
+ && (! function_exists('is_null') || !is_null($record[$columns[$i]]))) {
+ $column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
+ } else {
+ $column_value = $GLOBALS['latex_null'];
+ }
+
+ // last column ... no need for & character
+ if ($i == ($columns_cnt - 1)) {
+ $buffer .= $column_value;
+ } else {
+ $buffer .= $column_value . " & ";
+ }
+ }
+ $buffer .= ' \\\\ \\hline ' . $crlf;
+ if (!PMA_exportOutputHandler($buffer)) {
+ return false;
}
}
- $buffer .= ' \\\\ \\hline ' . $crlf;
+
+ $buffer = ' \\end{longtable}' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
- }
-
- $buffer = ' \\end{longtable}' . $crlf;
- if (!PMA_exportOutputHandler($buffer)) {
- return false;
- }
- PMA_DBI_free_result($result);
- return true;
+ PMA_DBI_free_result($result);
+ return true;
-} // end getTableLaTeX
-
-/**
- * Outputs table's structure
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param bool $do_relation whether to include relation comments
- * @param bool $do_comments whether to include the pmadb-style column comments
- * as comments in the structure; this is deprecated
- * but the parameter is left here because export.php
- * calls PMA_exportStructure() also for other export
- * types which use this parameter
- * @param bool $do_mime whether to include mime comments
- * @param bool $dates whether to include creation/update/check dates
- * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
- * @param string $export_type 'server', 'database', 'table'
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
-{
- global $cfgRelation;
+ } // end getTableLaTeX
/**
- * Get the unique keys in the table
+ * Outputs table's structure
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param bool $do_relation whether to include relation comments
+ * @param bool $do_comments whether to include the pmadb-style column comments
+ * as comments in the structure; this is deprecated
+ * but the parameter is left here because export.php
+ * calls PMA_exportStructure() also for other export
+ * types which use this parameter
+ * @param bool $do_mime whether to include mime comments
+ * @param bool $dates whether to include creation/update/check dates
+ * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
+ * @param string $export_type 'server', 'database', 'table'
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
- $keys_result = PMA_DBI_query($keys_query);
- $unique_keys = array();
- while ($key = PMA_DBI_fetch_assoc($keys_result)) {
- if ($key['Non_unique'] == 0) {
- $unique_keys[] = $key['Column_name'];
+ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
+ {
+ global $cfgRelation;
+
+ /**
+ * Get the unique keys in the table
+ */
+ $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
+ $keys_result = PMA_DBI_query($keys_query);
+ $unique_keys = array();
+ while ($key = PMA_DBI_fetch_assoc($keys_result)) {
+ if ($key['Non_unique'] == 0) {
+ $unique_keys[] = $key['Column_name'];
+ }
}
- }
- PMA_DBI_free_result($keys_result);
+ PMA_DBI_free_result($keys_result);
- /**
- * Gets fields properties
- */
- PMA_DBI_select_db($db);
+ /**
+ * Gets fields properties
+ */
+ PMA_DBI_select_db($db);
- // Check if we can use Relations
- if ($do_relation && !empty($cfgRelation['relation'])) {
- // Find which tables are related with the current one and write it in
- // an array
- $res_rel = PMA_getForeigners($db, $table);
+ // Check if we can use Relations
+ if ($do_relation && !empty($cfgRelation['relation'])) {
+ // Find which tables are related with the current one and write it in
+ // an array
+ $res_rel = PMA_getForeigners($db, $table);
- if ($res_rel && count($res_rel) > 0) {
- $have_rel = true;
+ if ($res_rel && count($res_rel) > 0) {
+ $have_rel = true;
+ } else {
+ $have_rel = false;
+ }
} else {
- $have_rel = false;
+ $have_rel = false;
+ } // end if
+
+ /**
+ * Displays the table structure
+ */
+ $buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf
+ . ' \\begin{longtable}{';
+ if (!PMA_exportOutputHandler($buffer)) {
+ return false;
}
- } else {
- $have_rel = false;
- } // end if
-
- /**
- * Displays the table structure
- */
- $buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf
- . ' \\begin{longtable}{';
- if (!PMA_exportOutputHandler($buffer)) {
- return false;
- }
-
- $columns_cnt = 4;
- $alignment = '|l|c|c|c|';
- if ($do_relation && $have_rel) {
- $columns_cnt++;
- $alignment .= 'l|';
- }
- if ($do_comments) {
- $columns_cnt++;
- $alignment .= 'l|';
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $columns_cnt++;
- $alignment .='l|';
- }
- $buffer = $alignment . '} ' . $crlf ;
-
- $header = ' \\hline ';
- $header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
- if ($do_relation && $have_rel) {
- $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
- }
- if ($do_comments) {
- $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
- $comments = PMA_getComments($db, $table);
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
- $mime_map = PMA_getMIME($db, $table, true);
- }
- // Table caption for first page and label
- if (isset($GLOBALS['latex_caption'])) {
- $buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
- . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], NULL, array('table' => $table, 'database' => $db))
- . '} \\\\' . $crlf;
- }
- $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
- // Table caption on next pages
- if (isset($GLOBALS['latex_caption'])) {
- $buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
- . '} \\\\ ' . $crlf;
- }
- $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
-
- if (!PMA_exportOutputHandler($buffer)) {
- return false;
- }
-
- $fields = PMA_DBI_get_columns($db, $table);
- foreach ($fields as $row) {
- $type = $row['Type'];
- // reformat mysql query output
- // set or enum types: slashes single quotes inside options
- if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
- $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
- $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
- $type_nowrap = '';
-
- $binary = 0;
- $unsigned = 0;
- $zerofill = 0;
- } else {
- $type_nowrap = ' nowrap="nowrap"';
- $type = preg_replace('/BINARY/i', '', $type);
- $type = preg_replace('/ZEROFILL/i', '', $type);
- $type = preg_replace('/UNSIGNED/i', '', $type);
- if (empty($type)) {
- $type = ' ';
- }
-
- $binary = preg_match('/BINARY/i', $row['Type']);
- $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
- $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
+ $columns_cnt = 4;
+ $alignment = '|l|c|c|c|';
+ if ($do_relation && $have_rel) {
+ $columns_cnt++;
+ $alignment .= 'l|';
}
- if (!isset($row['Default'])) {
- if ($row['Null'] != 'NO') {
- $row['Default'] = 'NULL';
- }
+ if ($do_comments) {
+ $columns_cnt++;
+ $alignment .= 'l|';
}
+ if ($do_mime && $cfgRelation['mimework']) {
+ $columns_cnt++;
+ $alignment .='l|';
+ }
+ $buffer = $alignment . '} ' . $crlf ;
- $field_name = $row['Field'];
-
- $local_buffer = $field_name . "\000" . $type . "\000"
- . (($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'))
- . "\000" . (isset($row['Default']) ? $row['Default'] : '');
-
+ $header = ' \\hline ';
+ $header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
if ($do_relation && $have_rel) {
- $local_buffer .= "\000";
- if (isset($res_rel[$field_name])) {
- $local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
- }
+ $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
}
- if ($do_comments && $cfgRelation['commwork']) {
- $local_buffer .= "\000";
- if (isset($comments[$field_name])) {
- $local_buffer .= $comments[$field_name];
- }
+ if ($do_comments) {
+ $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
+ $comments = PMA_getComments($db, $table);
}
if ($do_mime && $cfgRelation['mimework']) {
- $local_buffer .= "\000";
- if (isset($mime_map[$field_name])) {
- $local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']);
- }
+ $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
+ $mime_map = PMA_getMIME($db, $table, true);
}
- $local_buffer = PMA_texEscape($local_buffer);
- if ($row['Key']=='PRI') {
- $pos=strpos($local_buffer, "\000");
- $local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
+
+ // Table caption for first page and label
+ if (isset($GLOBALS['latex_caption'])) {
+ $buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
+ . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], NULL, array('table' => $table, 'database' => $db))
+ . '} \\\\' . $crlf;
}
- if (in_array($field_name, $unique_keys)) {
- $pos=strpos($local_buffer, "\000");
- $local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
+ $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
+ // Table caption on next pages
+ if (isset($GLOBALS['latex_caption'])) {
+ $buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
+ . '} \\\\ ' . $crlf;
}
- $buffer = str_replace("\000", ' & ', $local_buffer);
- $buffer .= ' \\\\ \\hline ' . $crlf;
+ $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
- } // end while
- $buffer = ' \\end{longtable}' . $crlf;
- return PMA_exportOutputHandler($buffer);
-} // end of the 'PMA_exportStructure' function
+ $fields = PMA_DBI_get_columns($db, $table);
+ foreach ($fields as $row) {
+ $type = $row['Type'];
+ // reformat mysql query output
+ // set or enum types: slashes single quotes inside options
+ if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
+ $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
+ $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
+ $type_nowrap = '';
+
+ $binary = 0;
+ $unsigned = 0;
+ $zerofill = 0;
+ } else {
+ $type_nowrap = ' nowrap="nowrap"';
+ $type = preg_replace('/BINARY/i', '', $type);
+ $type = preg_replace('/ZEROFILL/i', '', $type);
+ $type = preg_replace('/UNSIGNED/i', '', $type);
+ if (empty($type)) {
+ $type = ' ';
+ }
+
+ $binary = preg_match('/BINARY/i', $row['Type']);
+ $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
+ $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
+ }
+ if (!isset($row['Default'])) {
+ if ($row['Null'] != 'NO') {
+ $row['Default'] = 'NULL';
+ }
+ }
+
+ $field_name = $row['Field'];
+
+ $local_buffer = $field_name . "\000" . $type . "\000"
+ . (($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'))
+ . "\000" . (isset($row['Default']) ? $row['Default'] : '');
+
+ if ($do_relation && $have_rel) {
+ $local_buffer .= "\000";
+ if (isset($res_rel[$field_name])) {
+ $local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
+ }
+ }
+ if ($do_comments && $cfgRelation['commwork']) {
+ $local_buffer .= "\000";
+ if (isset($comments[$field_name])) {
+ $local_buffer .= $comments[$field_name];
+ }
+ }
+ if ($do_mime && $cfgRelation['mimework']) {
+ $local_buffer .= "\000";
+ if (isset($mime_map[$field_name])) {
+ $local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']);
+ }
+ }
+ $local_buffer = PMA_texEscape($local_buffer);
+ if ($row['Key']=='PRI') {
+ $pos=strpos($local_buffer, "\000");
+ $local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
+ }
+ if (in_array($field_name, $unique_keys)) {
+ $pos=strpos($local_buffer, "\000");
+ $local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
+ }
+ $buffer = str_replace("\000", ' & ', $local_buffer);
+ $buffer .= ' \\\\ \\hline ' . $crlf;
+
+ if (!PMA_exportOutputHandler($buffer)) {
+ return false;
+ }
+ } // end while
+
+ $buffer = ' \\end{longtable}' . $crlf;
+ return PMA_exportOutputHandler($buffer);
+ } // end of the 'PMA_exportStructure' function
} // end else
?>
diff --git a/libraries/export/mediawiki.php b/libraries/export/mediawiki.php
index 8ec3749..d03610d 100644
--- a/libraries/export/mediawiki.php
+++ b/libraries/export/mediawiki.php
@@ -24,136 +24,136 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- return true;
-}
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ return true;
+ }
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ return true;
+ }
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ return true;
+ }
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
-/**
- * Outputs the content of a table in MediaWiki format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- $columns = PMA_DBI_get_columns($db, $table);
- $columns = array_values($columns);
- $row_cnt = count($columns);
+ /**
+ * Outputs the content of a table in MediaWiki format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ $columns = PMA_DBI_get_columns($db, $table);
+ $columns = array_values($columns);
+ $row_cnt = count($columns);
- $output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
- $output .= "|+'''" . $table . "'''\n";
- $output .= "|- style=\"background:#ffdead;\"\n";
- $output .= "! style=\"background:#ffffff\" | \n";
- for ($i = 0; $i < $row_cnt; ++$i) {
- $output .= " | " . $columns[$i]['Field'];
- if (($i + 1) != $row_cnt) {
- $output .= "\n";
+ $output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
+ $output .= "|+'''" . $table . "'''\n";
+ $output .= "|- style=\"background:#ffdead;\"\n";
+ $output .= "! style=\"background:#ffffff\" | \n";
+ for ($i = 0; $i < $row_cnt; ++$i) {
+ $output .= " | " . $columns[$i]['Field'];
+ if (($i + 1) != $row_cnt) {
+ $output .= "\n";
+ }
}
- }
- $output .= "\n";
+ $output .= "\n";
- $output .= "|- style=\"background:#f9f9f9;\"\n";
- $output .= "! style=\"background:#f2f2f2\" | Type\n";
- for ($i = 0; $i < $row_cnt; ++$i) {
- $output .= " | " . $columns[$i]['Type'];
- if (($i + 1) != $row_cnt) {
- $output .= "\n";
+ $output .= "|- style=\"background:#f9f9f9;\"\n";
+ $output .= "! style=\"background:#f2f2f2\" | Type\n";
+ for ($i = 0; $i < $row_cnt; ++$i) {
+ $output .= " | " . $columns[$i]['Type'];
+ if (($i + 1) != $row_cnt) {
+ $output .= "\n";
+ }
}
- }
- $output .= "\n";
+ $output .= "\n";
- $output .= "|- style=\"background:#f9f9f9;\"\n";
- $output .= "! style=\"background:#f2f2f2\" | Null\n";
- for ($i = 0; $i < $row_cnt; ++$i) {
- $output .= " | " . $columns[$i]['Null'];
- if (($i + 1) != $row_cnt) {
- $output .= "\n";
+ $output .= "|- style=\"background:#f9f9f9;\"\n";
+ $output .= "! style=\"background:#f2f2f2\" | Null\n";
+ for ($i = 0; $i < $row_cnt; ++$i) {
+ $output .= " | " . $columns[$i]['Null'];
+ if (($i + 1) != $row_cnt) {
+ $output .= "\n";
+ }
}
- }
- $output .= "\n";
+ $output .= "\n";
- $output .= "|- style=\"background:#f9f9f9;\"\n";
- $output .= "! style=\"background:#f2f2f2\" | Default\n";
- for ($i = 0; $i < $row_cnt; ++$i) {
- $output .= " | " . $columns[$i]['Default'];
- if (($i + 1) != $row_cnt) {
- $output .= "\n";
+ $output .= "|- style=\"background:#f9f9f9;\"\n";
+ $output .= "! style=\"background:#f2f2f2\" | Default\n";
+ for ($i = 0; $i < $row_cnt; ++$i) {
+ $output .= " | " . $columns[$i]['Default'];
+ if (($i + 1) != $row_cnt) {
+ $output .= "\n";
+ }
}
- }
- $output .= "\n";
+ $output .= "\n";
- $output .= "|- style=\"background:#f9f9f9;\"\n";
- $output .= "! style=\"background:#f2f2f2\" | Extra\n";
- for ($i = 0; $i < $row_cnt; ++$i) {
- $output .= " | " . $columns[$i]['Extra'];
- if (($i + 1) != $row_cnt) {
- $output .= "\n";
+ $output .= "|- style=\"background:#f9f9f9;\"\n";
+ $output .= "! style=\"background:#f2f2f2\" | Extra\n";
+ for ($i = 0; $i < $row_cnt; ++$i) {
+ $output .= " | " . $columns[$i]['Extra'];
+ if (($i + 1) != $row_cnt) {
+ $output .= "\n";
+ }
}
- }
- $output .= "\n";
+ $output .= "\n";
- $output .= "|}\n\n\n\n";
- return PMA_exportOutputHandler($output);
-}
+ $output .= "|}\n\n\n\n";
+ return PMA_exportOutputHandler($output);
+ }
}
?>
diff --git a/libraries/export/ods.php b/libraries/export/ods.php
index fa62a96..0c62878 100644
--- a/libraries/export/ods.php
+++ b/libraries/export/ods.php
@@ -30,192 +30,192 @@ if (isset($plugin_list)) {
);
} else {
-$GLOBALS['ods_buffer'] = '';
-require_once './libraries/opendocument.lib.php';
+ $GLOBALS['ods_buffer'] = '';
+ require_once './libraries/opendocument.lib.php';
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- $GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
- . '</office:body>'
- . '</office:document-content>';
- if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.spreadsheet', $GLOBALS['ods_buffer']))) {
- return false;
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ $GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
+ . '</office:body>'
+ . '</office:document-content>';
+ if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.spreadsheet', $GLOBALS['ods_buffer']))) {
+ return false;
+ }
+ return true;
}
- return true;
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- $GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
- . '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
- . '<office:automatic-styles>'
- . '<number:date-style style:name="N37" number:automatic-order="true">'
- . '<number:month number:style="long"/>'
- . '<number:text>/</number:text>'
- . '<number:day number:style="long"/>'
- . '<number:text>/</number:text>'
- . '<number:year/>'
- . '</number:date-style>'
- . '<number:time-style style:name="N43">'
- . '<number:hours number:style="long"/>'
- . '<number:text>:</number:text>'
- . '<number:minutes number:style="long"/>'
- . '<number:text>:</number:text>'
- . '<number:seconds number:style="long"/>'
- . '<number:text> </number:text>'
- . '<number:am-pm/>'
- . '</number:time-style>'
- . '<number:date-style style:name="N50" number:automatic-order="true" number:format-source="language">'
- . '<number:month/>'
- . '<number:text>/</number:text>'
- . '<number:day/>'
- . '<number:text>/</number:text>'
- . '<number:year/>'
- . '<number:text> </number:text>'
- . '<number:hours number:style="long"/>'
- . '<number:text>:</number:text>'
- . '<number:minutes number:style="long"/>'
- . '<number:text> </number:text>'
- . '<number:am-pm/>'
- . '</number:date-style>'
- . '<style:style style:name="DateCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>'
- . '<style:style style:name="TimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N43"/>'
- . '<style:style style:name="DateTimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N50"/>'
- . '</office:automatic-styles>'
- . '<office:body>'
- . '<office:spreadsheet>';
- return true;
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- return true;
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ $GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
+ . '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
+ . '<office:automatic-styles>'
+ . '<number:date-style style:name="N37" number:automatic-order="true">'
+ . '<number:month number:style="long"/>'
+ . '<number:text>/</number:text>'
+ . '<number:day number:style="long"/>'
+ . '<number:text>/</number:text>'
+ . '<number:year/>'
+ . '</number:date-style>'
+ . '<number:time-style style:name="N43">'
+ . '<number:hours number:style="long"/>'
+ . '<number:text>:</number:text>'
+ . '<number:minutes number:style="long"/>'
+ . '<number:text>:</number:text>'
+ . '<number:seconds number:style="long"/>'
+ . '<number:text> </number:text>'
+ . '<number:am-pm/>'
+ . '</number:time-style>'
+ . '<number:date-style style:name="N50" number:automatic-order="true" number:format-source="language">'
+ . '<number:month/>'
+ . '<number:text>/</number:text>'
+ . '<number:day/>'
+ . '<number:text>/</number:text>'
+ . '<number:year/>'
+ . '<number:text> </number:text>'
+ . '<number:hours number:style="long"/>'
+ . '<number:text>:</number:text>'
+ . '<number:minutes number:style="long"/>'
+ . '<number:text> </number:text>'
+ . '<number:am-pm/>'
+ . '</number:date-style>'
+ . '<style:style style:name="DateCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>'
+ . '<style:style style:name="TimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N43"/>'
+ . '<style:style style:name="DateTimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N50"/>'
+ . '</office:automatic-styles>'
+ . '<office:body>'
+ . '<office:spreadsheet>';
+ return true;
+ }
-/**
- * Outputs the content of a table in ODS format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- global $what;
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ return true;
+ }
- // Gets the data from the database
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- $fields_cnt = PMA_DBI_num_fields($result);
- $fields_meta = PMA_DBI_get_fields_meta($result);
- $field_flags = array();
- for ($j = 0; $j < $fields_cnt; $j++) {
- $field_flags[$j] = PMA_DBI_field_flags($result, $j);
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ return true;
}
- $GLOBALS['ods_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '">';
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
- // If required, get fields name at the first line
- if (isset($GLOBALS[$what . '_columns'])) {
- $GLOBALS['ods_buffer'] .= '<table:table-row>';
- for ($i = 0; $i < $fields_cnt; $i++) {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
- . '</table:table-cell>';
- } // end for
- $GLOBALS['ods_buffer'] .= '</table:table-row>';
- } // end if
+ /**
+ * Outputs the content of a table in ODS format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ global $what;
- // Format the data
- while ($row = PMA_DBI_fetch_row($result)) {
- $GLOBALS['ods_buffer'] .= '<table:table-row>';
+ // Gets the data from the database
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $fields_cnt = PMA_DBI_num_fields($result);
+ $fields_meta = PMA_DBI_get_fields_meta($result);
+ $field_flags = array();
for ($j = 0; $j < $fields_cnt; $j++) {
- if (!isset($row[$j]) || is_null($row[$j])) {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
- . '</table:table-cell>';
- // ignore BLOB
- } elseif (stristr($field_flags[$j], 'BINARY')
- && $fields_meta[$j]->blob) {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p></text:p>'
- . '</table:table-cell>';
- } elseif ($fields_meta[$j]->type == "date") {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d", strtotime($row[$j])) . '" table:style-name="DateCell">'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
- . '</table:table-cell>';
- } elseif ($fields_meta[$j]->type == "time") {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="time" office:time-value="' . date("\P\TH\Hi\Ms\S", strtotime($row[$j])) . '" table:style-name="TimeCell">'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
- . '</table:table-cell>';
- } elseif ($fields_meta[$j]->type == "datetime") {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d\TH:i:s", strtotime($row[$j])) . '" table:style-name="DateTimeCell">'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
- . '</table:table-cell>';
- } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
- $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
- . '</table:table-cell>';
- } else {
+ $field_flags[$j] = PMA_DBI_field_flags($result, $j);
+ }
+
+ $GLOBALS['ods_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '">';
+
+ // If required, get fields name at the first line
+ if (isset($GLOBALS[$what . '_columns'])) {
+ $GLOBALS['ods_buffer'] .= '<table:table-row>';
+ for ($i = 0; $i < $fields_cnt; $i++) {
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
. '</table:table-cell>';
- }
- } // end for
- $GLOBALS['ods_buffer'] .= '</table:table-row>';
- } // end while
- PMA_DBI_free_result($result);
+ } // end for
+ $GLOBALS['ods_buffer'] .= '</table:table-row>';
+ } // end if
- $GLOBALS['ods_buffer'] .= '</table:table>';
+ // Format the data
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $GLOBALS['ods_buffer'] .= '<table:table-row>';
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ if (!isset($row[$j]) || is_null($row[$j])) {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
+ . '</table:table-cell>';
+ // ignore BLOB
+ } elseif (stristr($field_flags[$j], 'BINARY')
+ && $fields_meta[$j]->blob) {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p></text:p>'
+ . '</table:table-cell>';
+ } elseif ($fields_meta[$j]->type == "date") {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d", strtotime($row[$j])) . '" table:style-name="DateCell">'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ } elseif ($fields_meta[$j]->type == "time") {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="time" office:time-value="' . date("\P\TH\Hi\Ms\S", strtotime($row[$j])) . '" table:style-name="TimeCell">'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ } elseif ($fields_meta[$j]->type == "datetime") {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d\TH:i:s", strtotime($row[$j])) . '" table:style-name="DateTimeCell">'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ } else {
+ $GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ }
+ } // end for
+ $GLOBALS['ods_buffer'] .= '</table:table-row>';
+ } // end while
+ PMA_DBI_free_result($result);
- return true;
-}
+ $GLOBALS['ods_buffer'] .= '</table:table>';
+
+ return true;
+ }
}
?>
diff --git a/libraries/export/odt.php b/libraries/export/odt.php
index dba6e1c..e02f8a6 100644
--- a/libraries/export/odt.php
+++ b/libraries/export/odt.php
@@ -62,345 +62,345 @@ if (isset($plugin_list)) {
array('type' => 'end_group');
} else {
-$GLOBALS['odt_buffer'] = '';
-require_once './libraries/opendocument.lib.php';
+ $GLOBALS['odt_buffer'] = '';
+ require_once './libraries/opendocument.lib.php';
-/**
- * Outputs export footer
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter() {
- $GLOBALS['odt_buffer'] .= '</office:text>'
- . '</office:body>'
- . '</office:document-content>';
- if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
- return false;
+ /**
+ * Outputs export footer
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter() {
+ $GLOBALS['odt_buffer'] .= '</office:text>'
+ . '</office:body>'
+ . '</office:document-content>';
+ if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
+ return false;
+ }
+ return true;
}
- return true;
-}
-
-/**
- * Outputs export header
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader() {
- $GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
- . '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
- . '<office:body>'
- . '<office:text>';
- return true;
-}
-
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db) {
- $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">' . htmlspecialchars(__('Database') . ' ' . $db) . '</text:h>';
- return true;
-}
-
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db) {
- return true;
-}
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db) {
- return true;
-}
+ /**
+ * Outputs export header
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader() {
+ $GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
+ . '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
+ . '<office:body>'
+ . '<office:text>';
+ return true;
+ }
-/**
- * Outputs the content of a table in ODT format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
- global $what;
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db) {
+ $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">' . htmlspecialchars(__('Database') . ' ' . $db) . '</text:h>';
+ return true;
+ }
- // Gets the data from the database
- $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
- $fields_cnt = PMA_DBI_num_fields($result);
- $fields_meta = PMA_DBI_get_fields_meta($result);
- $field_flags = array();
- for ($j = 0; $j < $fields_cnt; $j++) {
- $field_flags[$j] = PMA_DBI_field_flags($result, $j);
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db) {
+ return true;
}
- $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Dumping data for table') . ' ' . $table) . '</text:h>';
- $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
- $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db) {
+ return true;
+ }
- // If required, get fields name at the first line
- if (isset($GLOBALS[$what . '_columns'])) {
- $GLOBALS['odt_buffer'] .= '<table:table-row>';
- for ($i = 0; $i < $fields_cnt; $i++) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
- . '</table:table-cell>';
- } // end for
- $GLOBALS['odt_buffer'] .= '</table:table-row>';
- } // end if
+ /**
+ * Outputs the content of a table in ODT format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
+ global $what;
- // Format the data
- while ($row = PMA_DBI_fetch_row($result)) {
- $GLOBALS['odt_buffer'] .= '<table:table-row>';
+ // Gets the data from the database
+ $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $fields_cnt = PMA_DBI_num_fields($result);
+ $fields_meta = PMA_DBI_get_fields_meta($result);
+ $field_flags = array();
for ($j = 0; $j < $fields_cnt; $j++) {
- if (!isset($row[$j]) || is_null($row[$j])) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
- . '</table:table-cell>';
- // ignore BLOB
- } elseif (stristr($field_flags[$j], 'BINARY')
- && $fields_meta[$j]->blob) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p></text:p>'
- . '</table:table-cell>';
- } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
- . '</table:table-cell>';
- } else {
+ $field_flags[$j] = PMA_DBI_field_flags($result, $j);
+ }
+
+ $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Dumping data for table') . ' ' . $table) . '</text:h>';
+ $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
+ $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
+
+ // If required, get fields name at the first line
+ if (isset($GLOBALS[$what . '_columns'])) {
+ $GLOBALS['odt_buffer'] .= '<table:table-row>';
+ for ($i = 0; $i < $fields_cnt; $i++) {
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
. '</table:table-cell>';
- }
- } // end for
- $GLOBALS['odt_buffer'] .= '</table:table-row>';
- } // end while
- PMA_DBI_free_result($result);
+ } // end for
+ $GLOBALS['odt_buffer'] .= '</table:table-row>';
+ } // end if
- $GLOBALS['odt_buffer'] .= '</table:table>';
+ // Format the data
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $GLOBALS['odt_buffer'] .= '<table:table-row>';
+ for ($j = 0; $j < $fields_cnt; $j++) {
+ if (!isset($row[$j]) || is_null($row[$j])) {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
+ . '</table:table-cell>';
+ // ignore BLOB
+ } elseif (stristr($field_flags[$j], 'BINARY')
+ && $fields_meta[$j]->blob) {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p></text:p>'
+ . '</table:table-cell>';
+ } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ } else {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
+ . '</table:table-cell>';
+ }
+ } // end for
+ $GLOBALS['odt_buffer'] .= '</table:table-row>';
+ } // end while
+ PMA_DBI_free_result($result);
- return true;
-}
+ $GLOBALS['odt_buffer'] .= '</table:table>';
-/**
- * Outputs table's structure
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param bool $do_relation whether to include relation comments
- * @param bool $do_comments whether to include the pmadb-style column comments
- * as comments in the structure; this is deprecated
- * but the parameter is left here because export.php
- * calls PMA_exportStructure() also for other export
- * types which use this parameter
- * @param bool $do_mime whether to include mime comments
- * @param bool $dates whether to include creation/update/check dates
- * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
- * @param string $export_type 'server', 'database', 'table'
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
-{
- global $cfgRelation;
-
- /* Heading */
- $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Table structure for table') . ' ' . $table) . '</text:h>';
-
- /**
- * Get the unique keys in the table
- */
- $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
- $keys_result = PMA_DBI_query($keys_query);
- $unique_keys = array();
- while ($key = PMA_DBI_fetch_assoc($keys_result)) {
- if ($key['Non_unique'] == 0) {
- $unique_keys[] = $key['Column_name'];
- }
+ return true;
}
- PMA_DBI_free_result($keys_result);
/**
- * Gets fields properties
+ * Outputs table's structure
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param bool $do_relation whether to include relation comments
+ * @param bool $do_comments whether to include the pmadb-style column comments
+ * as comments in the structure; this is deprecated
+ * but the parameter is left here because export.php
+ * calls PMA_exportStructure() also for other export
+ * types which use this parameter
+ * @param bool $do_mime whether to include mime comments
+ * @param bool $dates whether to include creation/update/check dates
+ * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
+ * @param string $export_type 'server', 'database', 'table'
+ * @return bool Whether it suceeded
+ *
+ * @access public
*/
- PMA_DBI_select_db($db);
+ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
+ {
+ global $cfgRelation;
- // Check if we can use Relations
- if ($do_relation && !empty($cfgRelation['relation'])) {
- // Find which tables are related with the current one and write it in
- // an array
- $res_rel = PMA_getForeigners($db, $table);
+ /* Heading */
+ $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Table structure for table') . ' ' . $table) . '</text:h>';
- if ($res_rel && count($res_rel) > 0) {
- $have_rel = true;
- } else {
- $have_rel = false;
+ /**
+ * Get the unique keys in the table
+ */
+ $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
+ $keys_result = PMA_DBI_query($keys_query);
+ $unique_keys = array();
+ while ($key = PMA_DBI_fetch_assoc($keys_result)) {
+ if ($key['Non_unique'] == 0) {
+ $unique_keys[] = $key['Column_name'];
+ }
}
- } else {
- $have_rel = false;
- } // end if
+ PMA_DBI_free_result($keys_result);
- /**
- * Displays the table structure
- */
- $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
- $columns_cnt = 4;
- if ($do_relation && $have_rel) {
- $columns_cnt++;
- }
- if ($do_comments) {
- $columns_cnt++;
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $columns_cnt++;
- }
- $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
- /* Header */
- $GLOBALS['odt_buffer'] .= '<table:table-row>';
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('Column')) . '</text:p>'
- . '</table:table-cell>';
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('Type')) . '</text:p>'
- . '</table:table-cell>';
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('Null')) . '</text:p>'
- . '</table:table-cell>';
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('Default')) . '</text:p>'
- . '</table:table-cell>';
- if ($do_relation && $have_rel) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('Links to')) . '</text:p>'
- . '</table:table-cell>';
- }
- if ($do_comments) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('Comments')) . '</text:p>'
- . '</table:table-cell>';
- $comments = PMA_getComments($db, $table);
- }
- if ($do_mime && $cfgRelation['mimework']) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(__('MIME type')) . '</text:p>'
- . '</table:table-cell>';
- $mime_map = PMA_getMIME($db, $table, true);
- }
- $GLOBALS['odt_buffer'] .= '</table:table-row>';
+ /**
+ * Gets fields properties
+ */
+ PMA_DBI_select_db($db);
- $columns = PMA_DBI_get_columns($db, $table);
- foreach ($columns as $column) {
+ // Check if we can use Relations
+ if ($do_relation && !empty($cfgRelation['relation'])) {
+ // Find which tables are related with the current one and write it in
+ // an array
+ $res_rel = PMA_getForeigners($db, $table);
- $field_name = $column['Field'];
- $GLOBALS['odt_buffer'] .= '<table:table-row>';
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
- . '</table:table-cell>';
- // reformat mysql query output
- // set or enum types: slashes single quotes inside options
- $type = $column['Type'];
- if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
- $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
- $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
- $type_nowrap = '';
-
- $binary = 0;
- $unsigned = 0;
- $zerofill = 0;
- } else {
- $type_nowrap = ' nowrap="nowrap"';
- $type = preg_replace('/BINARY/i', '', $type);
- $type = preg_replace('/ZEROFILL/i', '', $type);
- $type = preg_replace('/UNSIGNED/i', '', $type);
- if (empty($type)) {
- $type = ' ';
+ if ($res_rel && count($res_rel) > 0) {
+ $have_rel = true;
+ } else {
+ $have_rel = false;
}
+ } else {
+ $have_rel = false;
+ } // end if
- $binary = preg_match('/BINARY/i', $column['Type']);
- $unsigned = preg_match('/UNSIGNED/i', $column['Type']);
- $zerofill = preg_match('/ZEROFILL/i', $column['Type']);
+ /**
+ * Displays the table structure
+ */
+ $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
+ $columns_cnt = 4;
+ if ($do_relation && $have_rel) {
+ $columns_cnt++;
+ }
+ if ($do_comments) {
+ $columns_cnt++;
}
+ if ($do_mime && $cfgRelation['mimework']) {
+ $columns_cnt++;
+ }
+ $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
+ /* Header */
+ $GLOBALS['odt_buffer'] .= '<table:table-row>';
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($type) . '</text:p>'
+ . '<text:p>' . htmlspecialchars(__('Column')) . '</text:p>'
. '</table:table-cell>';
- if (!isset($column['Default'])) {
- if ($column['Null'] != 'NO') {
- $column['Default'] = 'NULL';
- } else {
- $column['Default'] = '';
- }
- } else {
- $column['Default'] = $column['Default'];
- }
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</text:p>'
+ . '<text:p>' . htmlspecialchars(__('Type')) . '</text:p>'
. '</table:table-cell>';
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>'
+ . '<text:p>' . htmlspecialchars(__('Null')) . '</text:p>'
+ . '</table:table-cell>';
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars(__('Default')) . '</text:p>'
. '</table:table-cell>';
-
if ($do_relation && $have_rel) {
- if (isset($res_rel[$field_name])) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') . '</text:p>'
- . '</table:table-cell>';
- }
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars(__('Links to')) . '</text:p>'
+ . '</table:table-cell>';
}
if ($do_comments) {
- if (isset($comments[$field_name])) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars($comments[$field_name]) . '</text:p>'
- . '</table:table-cell>';
- } else {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p></text:p>'
- . '</table:table-cell>';
- }
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars(__('Comments')) . '</text:p>'
+ . '</table:table-cell>';
+ $comments = PMA_getComments($db, $table);
}
if ($do_mime && $cfgRelation['mimework']) {
- if (isset($mime_map[$field_name])) {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p>' . htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) . '</text:p>'
- . '</table:table-cell>';
- } else {
- $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
- . '<text:p></text:p>'
- . '</table:table-cell>';
- }
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars(__('MIME type')) . '</text:p>'
+ . '</table:table-cell>';
+ $mime_map = PMA_getMIME($db, $table, true);
}
$GLOBALS['odt_buffer'] .= '</table:table-row>';
- } // end while
- $GLOBALS['odt_buffer'] .= '</table:table>';
- return true;
-} // end of the 'PMA_exportStructure' function
+ $columns = PMA_DBI_get_columns($db, $table);
+ foreach ($columns as $column) {
+
+ $field_name = $column['Field'];
+ $GLOBALS['odt_buffer'] .= '<table:table-row>';
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
+ . '</table:table-cell>';
+ // reformat mysql query output
+ // set or enum types: slashes single quotes inside options
+ $type = $column['Type'];
+ if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
+ $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
+ $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
+ $type_nowrap = '';
+
+ $binary = 0;
+ $unsigned = 0;
+ $zerofill = 0;
+ } else {
+ $type_nowrap = ' nowrap="nowrap"';
+ $type = preg_replace('/BINARY/i', '', $type);
+ $type = preg_replace('/ZEROFILL/i', '', $type);
+ $type = preg_replace('/UNSIGNED/i', '', $type);
+ if (empty($type)) {
+ $type = ' ';
+ }
+
+ $binary = preg_match('/BINARY/i', $column['Type']);
+ $unsigned = preg_match('/UNSIGNED/i', $column['Type']);
+ $zerofill = preg_match('/ZEROFILL/i', $column['Type']);
+ }
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($type) . '</text:p>'
+ . '</table:table-cell>';
+ if (!isset($column['Default'])) {
+ if ($column['Null'] != 'NO') {
+ $column['Default'] = 'NULL';
+ } else {
+ $column['Default'] = '';
+ }
+ } else {
+ $column['Default'] = $column['Default'];
+ }
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</text:p>'
+ . '</table:table-cell>';
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>'
+ . '</table:table-cell>';
+
+ if ($do_relation && $have_rel) {
+ if (isset($res_rel[$field_name])) {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') . '</text:p>'
+ . '</table:table-cell>';
+ }
+ }
+ if ($do_comments) {
+ if (isset($comments[$field_name])) {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars($comments[$field_name]) . '</text:p>'
+ . '</table:table-cell>';
+ } else {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p></text:p>'
+ . '</table:table-cell>';
+ }
+ }
+ if ($do_mime && $cfgRelation['mimework']) {
+ if (isset($mime_map[$field_name])) {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p>' . htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) . '</text:p>'
+ . '</table:table-cell>';
+ } else {
+ $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
+ . '<text:p></text:p>'
+ . '</table:table-cell>';
+ }
+ }
+ $GLOBALS['odt_buffer'] .= '</table:table-row>';
+ } // end while
+
+ $GLOBALS['odt_buffer'] .= '</table:table>';
+ return true;
+ } // end of the 'PMA_exportStructure' function
} // end else
?>
diff --git a/libraries/export/pdf.php b/libraries/export/pdf.php
index 01ffc88..3cc0acf 100644
--- a/libraries/export/pdf.php
+++ b/libraries/export/pdf.php
@@ -30,441 +30,441 @@ if (isset($plugin_list)) {
);
} else {
-/**
- * Font used in PDF.
- *
- * @todo Make this configuratble (at least Sans/Serif).
- */
-define('PMA_PDF_FONT', 'DejaVuSans');
-require_once './libraries/tcpdf/tcpdf.php';
+ /**
+ * Font used in PDF.
+ *
+ * @todo Make this configuratble (at least Sans/Serif).
+ */
+ define('PMA_PDF_FONT', 'DejaVuSans');
+ require_once './libraries/tcpdf/tcpdf.php';
+
+ /**
+ * Adapted from a LGPL script by Philip Clarke
+ * @package phpMyAdmin-Export
+ * @subpackage PDF
+ */
+ class PMA_PDF extends TCPDF
+ {
+ var $tablewidths;
+ var $headerset;
+ var $footerset;
-/**
- * Adapted from a LGPL script by Philip Clarke
- * @package phpMyAdmin-Export
- * @subpackage PDF
- */
-class PMA_PDF extends TCPDF
-{
- var $tablewidths;
- var $headerset;
- var $footerset;
-
- function checkPageBreak($h=0, $y='', $addpage=true) {
- if ($this->empty_string($y)) {
- $y = $this->y;
- }
- $current_page = $this->page;
- if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND ($this->AcceptPageBreak())) {
- if ($addpage) {
- //Automatic page break
- $x = $this->x;
- $this->AddPage($this->CurOrientation);
- $this->y = $this->dataY;
- $oldpage = $this->page - 1;
- if ($this->rtl) {
- if ($this->pagedim[$this->page]['orm'] != $this->pagedim[$oldpage]['orm']) {
- $this->x = $x - ($this->pagedim[$this->page]['orm'] - $this->pagedim[$oldpage]['orm']);
- } else {
- $this->x = $x;
- }
- } else {
- if ($this->pagedim[$this->page]['olm'] != $this->pagedim[$oldpage]['olm']) {
- $this->x = $x + ($this->pagedim[$this->page]['olm'] - $this->pagedim[$oldpage]['olm']);
+ function checkPageBreak($h=0, $y='', $addpage=true) {
+ if ($this->empty_string($y)) {
+ $y = $this->y;
+ }
+ $current_page = $this->page;
+ if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND ($this->AcceptPageBreak())) {
+ if ($addpage) {
+ //Automatic page break
+ $x = $this->x;
+ $this->AddPage($this->CurOrientation);
+ $this->y = $this->dataY;
+ $oldpage = $this->page - 1;
+ if ($this->rtl) {
+ if ($this->pagedim[$this->page]['orm'] != $this->pagedim[$oldpage]['orm']) {
+ $this->x = $x - ($this->pagedim[$this->page]['orm'] - $this->pagedim[$oldpage]['orm']);
+ } else {
+ $this->x = $x;
+ }
} else {
- $this->x = $x;
+ if ($this->pagedim[$this->page]['olm'] != $this->pagedim[$oldpage]['olm']) {
+ $this->x = $x + ($this->pagedim[$this->page]['olm'] - $this->pagedim[$oldpage]['olm']);
+ } else {
+ $this->x = $x;
+ }
}
}
+ return true;
}
- return true;
- }
- if ($current_page != $this->page) {
- // account for columns mode
- return true;
- }
- return false;
- }
-
- function Header()
- {
- global $maxY;
- // Check if header for this page already exists
- if (!isset($this->headerset[$this->page])) {
- $fullwidth = 0;
- foreach ($this->tablewidths as $width) {
- $fullwidth += $width;
+ if ($current_page != $this->page) {
+ // account for columns mode
+ return true;
}
- $this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*3);
- $this->cellFontSize = $this->FontSizePt ;
- $this->SetFont(PMA_PDF_FONT, '', ($this->titleFontSize ? $this->titleFontSize : $this->FontSizePt));
- $this->Cell(0, $this->FontSizePt, $this->titleText, 0, 1, 'C');
- $this->SetFont(PMA_PDF_FONT, '', $this->cellFontSize);
- $this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*1.5);
- $this->Cell(0, $this->FontSizePt, __('Database') .': ' .$this->currentDb .', ' .__('Table') .': ' .$this->currentTable, 0, 1, 'L');
- $l = ($this->lMargin);
- foreach ($this->colTitles as $col => $txt) {
- $this->SetXY($l, ($this->tMargin));
- $this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt);
- $l += $this->tablewidths[$col] ;
- $maxY = ($maxY < $this->getY()) ? $this->getY() : $maxY ;
- }
- $this->SetXY($this->lMargin, $this->tMargin);
- $this->setFillColor(200, 200, 200);
- $l = ($this->lMargin);
- foreach ($this->colTitles as $col => $txt) {
- $this->SetXY($l, $this->tMargin);
- $this->cell($this->tablewidths[$col], $maxY-($this->tMargin), '', 1, 0, 'L', 1);
- $this->SetXY($l, $this->tMargin);
- $this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt, 0, 'C');
- $l += $this->tablewidths[$col];
- }
- $this->setFillColor(255, 255, 255);
- // set headerset
- $this->headerset[$this->page] = 1;
+ return false;
}
- $this->dataY = $maxY;
- }
+ function Header()
+ {
+ global $maxY;
+ // Check if header for this page already exists
+ if (!isset($this->headerset[$this->page])) {
+ $fullwidth = 0;
+ foreach ($this->tablewidths as $width) {
+ $fullwidth += $width;
+ }
+ $this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*3);
+ $this->cellFontSize = $this->FontSizePt ;
+ $this->SetFont(PMA_PDF_FONT, '', ($this->titleFontSize ? $this->titleFontSize : $this->FontSizePt));
+ $this->Cell(0, $this->FontSizePt, $this->titleText, 0, 1, 'C');
+ $this->SetFont(PMA_PDF_FONT, '', $this->cellFontSize);
+ $this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*1.5);
+ $this->Cell(0, $this->FontSizePt, __('Database') .': ' .$this->currentDb .', ' .__('Table') .': ' .$this->currentTable, 0, 1, 'L');
+ $l = ($this->lMargin);
+ foreach ($this->colTitles as $col => $txt) {
+ $this->SetXY($l, ($this->tMargin));
+ $this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt);
+ $l += $this->tablewidths[$col] ;
+ $maxY = ($maxY < $this->getY()) ? $this->getY() : $maxY ;
+ }
+ $this->SetXY($this->lMargin, $this->tMargin);
+ $this->setFillColor(200, 200, 200);
+ $l = ($this->lMargin);
+ foreach ($this->colTitles as $col => $txt) {
+ $this->SetXY($l, $this->tMargin);
+ $this->cell($this->tablewidths[$col], $maxY-($this->tMargin), '', 1, 0, 'L', 1);
+ $this->SetXY($l, $this->tMargin);
+ $this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt, 0, 'C');
+ $l += $this->tablewidths[$col];
+ }
+ $this->setFillColor(255, 255, 255);
+ // set headerset
+ $this->headerset[$this->page] = 1;
+ }
- function Footer()
- {
- // Check if footer for this page already exists
- if (!isset($this->footerset[$this->page])) {
- $this->SetY(-15);
- //Page number
- $this->setFooterFont(PMA_PDF_FONT, '', 14);
- $this->Cell(0, 6, __('Page number:') . ' ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 'T', 0, 'C');
-
- // set footerset
- $this->footerset[$this->page] = 1;
+ $this->dataY = $maxY;
}
- }
- function morepagestable($lineheight=8)
- {
- // some things to set and 'remember'
- $l = $this->lMargin;
- $startheight = $h = $this->dataY;
- $startpage = $currpage = $this->page;
-
- // calculate the whole width
- $fullwidth = 0;
- foreach ($this->tablewidths as $width) {
- $fullwidth += $width;
+ function Footer()
+ {
+ // Check if footer for this page already exists
+ if (!isset($this->footerset[$this->page])) {
+ $this->SetY(-15);
+ //Page number
+ $this->setFooterFont(PMA_PDF_FONT, '', 14);
+ $this->Cell(0, 6, __('Page number:') . ' ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 'T', 0, 'C');
+
+ // set footerset
+ $this->footerset[$this->page] = 1;
+ }
}
- // Now let's start to write the table
- $row = 0;
- $tmpheight = array();
- $maxpage = $this->page;
+ function morepagestable($lineheight=8)
+ {
+ // some things to set and 'remember'
+ $l = $this->lMargin;
+ $startheight = $h = $this->dataY;
+ $startpage = $currpage = $this->page;
- while ($data = PMA_DBI_fetch_row($this->results)) {
- $this->page = $currpage;
- // write the horizontal borders
- $this->Line($l, $h, $fullwidth+$l, $h);
- // write the content and remember the height of the highest col
- foreach ($data as $col => $txt) {
+ // calculate the whole width
+ $fullwidth = 0;
+ foreach ($this->tablewidths as $width) {
+ $fullwidth += $width;
+ }
+
+ // Now let's start to write the table
+ $row = 0;
+ $tmpheight = array();
+ $maxpage = $this->page;
+
+ while ($data = PMA_DBI_fetch_row($this->results)) {
$this->page = $currpage;
- $this->SetXY($l, $h);
- if ($this->tablewidths[$col] > 0) {
- $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]);
- $l += $this->tablewidths[$col];
- }
+ // write the horizontal borders
+ $this->Line($l, $h, $fullwidth+$l, $h);
+ // write the content and remember the height of the highest col
+ foreach ($data as $col => $txt) {
+ $this->page = $currpage;
+ $this->SetXY($l, $h);
+ if ($this->tablewidths[$col] > 0) {
+ $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]);
+ $l += $this->tablewidths[$col];
+ }
- if (!isset($tmpheight[$row.'-'.$this->page])) {
- $tmpheight[$row.'-'.$this->page] = 0;
- }
- if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) {
- $tmpheight[$row.'-'.$this->page] = $this->GetY();
- }
- if ($this->page > $maxpage) {
- $maxpage = $this->page;
+ if (!isset($tmpheight[$row.'-'.$this->page])) {
+ $tmpheight[$row.'-'.$this->page] = 0;
+ }
+ if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) {
+ $tmpheight[$row.'-'.$this->page] = $this->GetY();
+ }
+ if ($this->page > $maxpage) {
+ $maxpage = $this->page;
+ }
+ unset($data[$col]);
}
- unset($data[$col]);
- }
- // get the height we were in the last used page
- $h = $tmpheight[$row.'-'.$maxpage];
- // set the "pointer" to the left margin
- $l = $this->lMargin;
- // set the $currpage to the last page
- $currpage = $maxpage;
- unset($data[$row]);
- $row++;
- }
- // draw the borders
- // we start adding a horizontal line on the last page
- $this->page = $maxpage;
- $this->Line($l, $h, $fullwidth+$l, $h);
- // now we start at the top of the document and walk down
- for ($i = $startpage; $i <= $maxpage; $i++) {
- $this->page = $i;
- $l = $this->lMargin;
- $t = ($i == $startpage) ? $startheight : $this->tMargin;
- $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
- $this->Line($l, $t, $l, $lh);
- foreach ($this->tablewidths as $width) {
- $l += $width;
+ // get the height we were in the last used page
+ $h = $tmpheight[$row.'-'.$maxpage];
+ // set the "pointer" to the left margin
+ $l = $this->lMargin;
+ // set the $currpage to the last page
+ $currpage = $maxpage;
+ unset($data[$row]);
+ $row++;
+ }
+ // draw the borders
+ // we start adding a horizontal line on the last page
+ $this->page = $maxpage;
+ $this->Line($l, $h, $fullwidth+$l, $h);
+ // now we start at the top of the document and walk down
+ for ($i = $startpage; $i <= $maxpage; $i++) {
+ $this->page = $i;
+ $l = $this->lMargin;
+ $t = ($i == $startpage) ? $startheight : $this->tMargin;
+ $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
$this->Line($l, $t, $l, $lh);
+ foreach ($this->tablewidths as $width) {
+ $l += $width;
+ $this->Line($l, $t, $l, $lh);
+ }
}
+ // set it to the last page, if not it'll cause some problems
+ $this->page = $maxpage;
}
- // set it to the last page, if not it'll cause some problems
- $this->page = $maxpage;
- }
- function setAttributes($attr = array())
- {
- foreach ($attr as $key => $val) {
- $this->$key = $val ;
+ function setAttributes($attr = array())
+ {
+ foreach ($attr as $key => $val) {
+ $this->$key = $val ;
+ }
}
- }
- function setTopMargin($topMargin)
- {
- $this->tMargin = $topMargin;
- }
+ function setTopMargin($topMargin)
+ {
+ $this->tMargin = $topMargin;
+ }
- function mysql_report($query)
- {
- unset($this->tablewidths);
- unset($this->colTitles);
- unset($this->titleWidth);
- unset($this->colFits);
- unset($this->display_column);
- unset($this->colAlign);
-
- /**
- * Pass 1 for column widths
- */
- $this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
- $this->numFields = PMA_DBI_num_fields($this->results);
- $this->fields = PMA_DBI_get_fields_meta($this->results);
-
- // sColWidth = starting col width (an average size width)
- $availableWidth = $this->w - $this->lMargin - $this->rMargin;
- $this->sColWidth = $availableWidth / $this->numFields;
- $totalTitleWidth = 0;
-
- // loop through results header and set initial col widths/ titles/ alignment
- // if a col title is less than the starting col width, reduce that column size
- for ($i = 0; $i < $this->numFields; $i++) {
- $stringWidth = $this->getstringwidth($this->fields[$i]->name) + 6 ;
- // save the real title's width
- $titleWidth[$i] = $stringWidth;
- $totalTitleWidth += $stringWidth;
-
- // set any column titles less than the start width to the column title width
- if ($stringWidth < $this->sColWidth) {
- $colFits[$i] = $stringWidth ;
- }
- $this->colTitles[$i] = $this->fields[$i]->name;
- $this->display_column[$i] = true;
-
- switch ($this->fields[$i]->type) {
- case 'int':
- $this->colAlign[$i] = 'R';
- break;
- case 'blob':
- case 'tinyblob':
- case 'mediumblob':
- case 'longblob':
- /**
- * @todo do not deactivate completely the display
- * but show the field's name and [BLOB]
- */
- if (stristr($this->fields[$i]->flags, 'BINARY')) {
- $this->display_column[$i] = false;
- unset($this->colTitles[$i]);
+ function mysql_report($query)
+ {
+ unset($this->tablewidths);
+ unset($this->colTitles);
+ unset($this->titleWidth);
+ unset($this->colFits);
+ unset($this->display_column);
+ unset($this->colAlign);
+
+ /**
+ * Pass 1 for column widths
+ */
+ $this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $this->numFields = PMA_DBI_num_fields($this->results);
+ $this->fields = PMA_DBI_get_fields_meta($this->results);
+
+ // sColWidth = starting col width (an average size width)
+ $availableWidth = $this->w - $this->lMargin - $this->rMargin;
+ $this->sColWidth = $availableWidth / $this->numFields;
+ $totalTitleWidth = 0;
+
+ // loop through results header and set initial col widths/ titles/ alignment
+ // if a col title is less than the starting col width, reduce that column size
+ for ($i = 0; $i < $this->numFields; $i++) {
+ $stringWidth = $this->getstringwidth($this->fields[$i]->name) + 6 ;
+ // save the real title's width
+ $titleWidth[$i] = $stringWidth;
+ $totalTitleWidth += $stringWidth;
+
+ // set any column titles less than the start width to the column title width
+ if ($stringWidth < $this->sColWidth) {
+ $colFits[$i] = $stringWidth ;
+ }
+ $this->colTitles[$i] = $this->fields[$i]->name;
+ $this->display_column[$i] = true;
+
+ switch ($this->fields[$i]->type) {
+ case 'int':
+ $this->colAlign[$i] = 'R';
+ break;
+ case 'blob':
+ case 'tinyblob':
+ case 'mediumblob':
+ case 'longblob':
+ /**
+ * @todo do not deactivate completely the display
+ * but show the field's name and [BLOB]
+ */
+ if (stristr($this->fields[$i]->flags, 'BINARY')) {
+ $this->display_column[$i] = false;
+ unset($this->colTitles[$i]);
+ }
+ $this->colAlign[$i] = 'L';
+ break;
+ default:
+ $this->colAlign[$i] = 'L';
}
- $this->colAlign[$i] = 'L';
- break;
- default:
- $this->colAlign[$i] = 'L';
}
- }
- // title width verification
- if ($totalTitleWidth > $availableWidth) {
- $adjustingMode = true;
- } else {
- $adjustingMode = false;
- // we have enough space for all the titles at their
- // original width so use the true title's width
- foreach ($titleWidth as $key => $val) {
- $colFits[$key] = $val;
+ // title width verification
+ if ($totalTitleWidth > $availableWidth) {
+ $adjustingMode = true;
+ } else {
+ $adjustingMode = false;
+ // we have enough space for all the titles at their
+ // original width so use the true title's width
+ foreach ($titleWidth as $key => $val) {
+ $colFits[$key] = $val;
+ }
}
- }
- // loop through the data; any column whose contents
- // is greater than the column size is resized
- /**
- * @todo force here a LIMIT to avoid reading all rows
- */
- while ($row = PMA_DBI_fetch_row($this->results)) {
- foreach ($colFits as $key => $val) {
- $stringWidth = $this->getstringwidth($row[$key]) + 6 ;
- if ($adjustingMode && ($stringWidth > $this->sColWidth)) {
- // any column whose data's width is bigger than the start width is now discarded
- unset($colFits[$key]);
- } else {
- // if data's width is bigger than the current column width,
- // enlarge the column (but avoid enlarging it if the
- // data's width is very big)
- if ($stringWidth > $val && $stringWidth < ($this->sColWidth * 3)) {
- $colFits[$key] = $stringWidth ;
+ // loop through the data; any column whose contents
+ // is greater than the column size is resized
+ /**
+ * @todo force here a LIMIT to avoid reading all rows
+ */
+ while ($row = PMA_DBI_fetch_row($this->results)) {
+ foreach ($colFits as $key => $val) {
+ $stringWidth = $this->getstringwidth($row[$key]) + 6 ;
+ if ($adjustingMode && ($stringWidth > $this->sColWidth)) {
+ // any column whose data's width is bigger than the start width is now discarded
+ unset($colFits[$key]);
+ } else {
+ // if data's width is bigger than the current column width,
+ // enlarge the column (but avoid enlarging it if the
+ // data's width is very big)
+ if ($stringWidth > $val && $stringWidth < ($this->sColWidth * 3)) {
+ $colFits[$key] = $stringWidth ;
+ }
}
}
}
- }
-
- $totAlreadyFitted = 0;
- foreach ($colFits as $key => $val) {
- // set fitted columns to smallest size
- $this->tablewidths[$key] = $val;
- // to work out how much (if any) space has been freed up
- $totAlreadyFitted += $val;
- }
- if ($adjustingMode) {
- $surplus = (sizeof($colFits) * $this->sColWidth) - $totAlreadyFitted;
- $surplusToAdd = $surplus / ($this->numFields - sizeof($colFits));
- } else {
- $surplusToAdd = 0;
- }
+ $totAlreadyFitted = 0;
+ foreach ($colFits as $key => $val) {
+ // set fitted columns to smallest size
+ $this->tablewidths[$key] = $val;
+ // to work out how much (if any) space has been freed up
+ $totAlreadyFitted += $val;
+ }
- for ($i=0; $i < $this->numFields; $i++) {
- if (!in_array($i, array_keys($colFits))) {
- $this->tablewidths[$i] = $this->sColWidth + $surplusToAdd;
+ if ($adjustingMode) {
+ $surplus = (sizeof($colFits) * $this->sColWidth) - $totAlreadyFitted;
+ $surplusToAdd = $surplus / ($this->numFields - sizeof($colFits));
+ } else {
+ $surplusToAdd = 0;
}
- if ($this->display_column[$i] == false) {
- $this->tablewidths[$i] = 0;
+
+ for ($i=0; $i < $this->numFields; $i++) {
+ if (!in_array($i, array_keys($colFits))) {
+ $this->tablewidths[$i] = $this->sColWidth + $surplusToAdd;
+ }
+ if ($this->display_column[$i] == false) {
+ $this->tablewidths[$i] = 0;
+ }
}
- }
- ksort($this->tablewidths);
+ ksort($this->tablewidths);
- PMA_DBI_free_result($this->results);
+ PMA_DBI_free_result($this->results);
- // Pass 2
+ // Pass 2
- $this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
- $this->setY($this->tMargin);
- $this->AddPage();
- $this->morepagestable($this->FontSizePt);
- PMA_DBI_free_result($this->results);
+ $this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
+ $this->setY($this->tMargin);
+ $this->AddPage();
+ $this->morepagestable($this->FontSizePt);
+ PMA_DBI_free_result($this->results);
- } // end of mysql_report function
+ } // end of mysql_report function
-} // end of PMA_PDF class
+ } // end of PMA_PDF class
-$pdf = new PMA_PDF('L', 'pt', 'A3');
+ $pdf = new PMA_PDF('L', 'pt', 'A3');
-/**
- * Finalize the pdf.
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportFooter()
-{
- global $pdf;
+ /**
+ * Finalize the pdf.
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportFooter()
+ {
+ global $pdf;
- // instead of $pdf->Output():
- if (!PMA_exportOutputHandler($pdf->getPDFData())) {
- return false;
- }
+ // instead of $pdf->Output():
+ if (!PMA_exportOutputHandler($pdf->getPDFData())) {
+ return false;
+ }
- return true;
-}
+ return true;
+ }
-/**
- * Initialize the pdf to export data.
- *
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportHeader()
-{
- global $pdf_report_title;
- global $pdf;
-
- $pdf->AddFont('DejaVuSans', '', 'dejavusans.php');
- $pdf->AddFont('DejaVuSans', 'B', 'dejavusansb.php');
- $pdf->AddFont('DejaVuSerif', '', 'dejavuserif.php');
- $pdf->AddFont('DejaVuSerif', 'B', 'dejavuserifb.php');
- $pdf->SetFont(PMA_PDF_FONT, '', 11.5);
- $pdf->setFooterFont(array(PMA_PDF_FONT, '', 11.5));
- $pdf->AliasNbPages();
- $pdf->Open();
-
- $attr=array('titleFontSize' => 18, 'titleText' => $pdf_report_title);
- $pdf->setAttributes($attr);
- $pdf->setTopMargin(45);
-
- return true;
-}
+ /**
+ * Initialize the pdf to export data.
+ *
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportHeader()
+ {
+ global $pdf_report_title;
+ global $pdf;
+
+ $pdf->AddFont('DejaVuSans', '', 'dejavusans.php');
+ $pdf->AddFont('DejaVuSans', 'B', 'dejavusansb.php');
+ $pdf->AddFont('DejaVuSerif', '', 'dejavuserif.php');
+ $pdf->AddFont('DejaVuSerif', 'B', 'dejavuserifb.php');
+ $pdf->SetFont(PMA_PDF_FONT, '', 11.5);
+ $pdf->setFooterFont(array(PMA_PDF_FONT, '', 11.5));
+ $pdf->AliasNbPages();
+ $pdf->Open();
+
+ $attr=array('titleFontSize' => 18, 'titleText' => $pdf_report_title);
+ $pdf->setAttributes($attr);
+ $pdf->setTopMargin(45);
+
+ return true;
+ }
-/**
- * Outputs database header
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBHeader($db)
-{
- return true;
-}
+ /**
+ * Outputs database header
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBHeader($db)
+ {
+ return true;
+ }
-/**
- * Outputs database footer
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBFooter($db)
-{
- return true;
-}
+ /**
+ * Outputs database footer
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBFooter($db)
+ {
+ return true;
+ }
-/**
- * Outputs CREATE DATABASE statement
- *
- * @param string $db Database name
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportDBCreate($db)
-{
- return true;
-}
+ /**
+ * Outputs CREATE DATABASE statement
+ *
+ * @param string $db Database name
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportDBCreate($db)
+ {
+ return true;
+ }
-/**
- * Outputs the content of a table in PDF format
- *
- * @param string $db database name
- * @param string $table table name
- * @param string $crlf the end of line sequence
- * @param string $error_url the url to go back in case of error
- * @param string $sql_query SQL query for obtaining data
- * @return bool Whether it suceeded
- *
- * @access public
- */
-function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
-{
- global $pdf;
+ /**
+ * Outputs the content of a table in PDF format
+ *
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $crlf the end of line sequence
+ * @param string $error_url the url to go back in case of error
+ * @param string $sql_query SQL query for obtaining data
+ * @return bool Whether it suceeded
+ *
+ * @access public
+ */
+ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
+ {
+ global $pdf;
- $attr=array('currentDb' => $db, 'currentTable' => $table);
- $pdf->setAttributes($attr);
- $pdf->mysql_report($sql_query);
+ $attr=array('currentDb' => $db, 'currentTable' => $table);
+ $pdf->setAttributes($attr);
+ $pdf->mysql_report($sql_query);
- return true;
-} // end of the 'PMA_exportData()' function
+ return true;
+ } // end of the 'PMA_exportData()' function
}
?>
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12837-g8cb8a3d
by Michal Čihař 02 Aug '11
by Michal Čihař 02 Aug '11
02 Aug '11
The branch, master has been updated
via 8cb8a3d4c75dc6bf9665d4a3e80a2fea1a1b31eb (commit)
via 07690aa7ea77784bf6e203c8a2ed16960421f622 (commit)
via d74f90b848161a20b5cc2548dcad412cd7c4bf6e (commit)
via d7807aee241e7e5fea221b8e79af3f145aee67a0 (commit)
via 5cf92b0cc83c480e980f25e68c3b9884f34cfbb0 (commit)
via fdceb91948fd0cba308c877f34c276dda42e0f27 (commit)
via 5020a62da0e5b5228beb156bd4914fd5e4ab81fa (commit)
via a275af5e8b6a2ec3858b7a67231f365859125040 (commit)
via a0334dee871b40c85896f705cf04d982855c6f48 (commit)
via d0cd77517cd2ced62c789a77c4a9c6db2eda3d53 (commit)
via 29c398e923af5a00f885df6aff191201f39d93c5 (commit)
via 62cb73505c677f9dae2d6629b2503131c54a3ecd (commit)
via ffeaf03547ac26bb162309e351ae6c5c88c94728 (commit)
via 2e2ba2732f6b9f20460cdb2d2eca92262347b337 (commit)
via 4bea4ab7fe63c740cc6a066175600cc93b408ad4 (commit)
via 1182ef584d4a8bcb6b732e7bf332d66b8dd55382 (commit)
via 96c3dc32a49b9670cdd098713a6f992fcb584457 (commit)
via ec8a4e140f6192a8492dd861e48fba583f1637db (commit)
via cea2a9c5315ad520015670bc0a55870e7e043a99 (commit)
via 28e50fd5ba9742af157c3e1e5db56a56aa2080e9 (commit)
via f7323710ea2d150c14bc6ef3f30918063a5ec5c9 (commit)
via a458f0d64478651ccdc4e1640ee28d6ab33ada91 (commit)
via 6ef25991188b42bf2f509b95c93a131b469c9f51 (commit)
via 041448f4833b646dc203d5c2d4bb60fff48269ed (commit)
via d22260fe9950e5a5e09104caa344178bfa2a32af (commit)
via e94e6df9468e4576e821e9b4b6443ff6136cc9ae (commit)
via 04c13485078c5b217bb1e51e880975a057908ad0 (commit)
via 6c465718b8f6c54c7d1b8612c8b959e51b731096 (commit)
via 53e1de72e4c4e19c6a5f4a6c070f9962e3b2c6c0 (commit)
via c817f38d0694bfc06a418f0968251f3908c4a635 (commit)
via 62068de78f6b57f414a06ceb84a75695eb4a6eb9 (commit)
via 5f67e63aed986658ee43ac9eacee4175c94a2fe6 (commit)
via 7f8977747ea1e9c4b72af0e31e834698534306cf (commit)
via 809aa8944153ffc70b0afca88f4c4e86b9ce6952 (commit)
via 9e91fb4aeef46173d84af9f5cd6998d5bdf67382 (commit)
via 6a0af21e73e38926c3ef0c8a7c2a70d9cd9a15de (commit)
via ffcd0d8139c54e2596b8a348a70b29993813c314 (commit)
via 6049062c7dcbb191c6cf61940eead018b57fc7e7 (commit)
via a15f84b036beb82bce327871307d6be06d27c646 (commit)
via 566b75f0478a12ca9d154ec6275643802ade3217 (commit)
via 9b65d400d3ba3cf2341e67e5cafc2708c9e19eaa (commit)
from 3a373b4a14f9fbb3f8f7dbec3b0166efe17cac1f (commit)
- Log -----------------------------------------------------------------
commit 8cb8a3d4c75dc6bf9665d4a3e80a2fea1a1b31eb
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 12:41:35 2011 +0200
Translation update done using Pootle.
commit 07690aa7ea77784bf6e203c8a2ed16960421f622
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:59:31 2011 +0200
Translation update done using Pootle.
commit d74f90b848161a20b5cc2548dcad412cd7c4bf6e
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:53:15 2011 +0200
Translation update done using Pootle.
commit d7807aee241e7e5fea221b8e79af3f145aee67a0
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:52:12 2011 +0200
Translation update done using Pootle.
commit 5cf92b0cc83c480e980f25e68c3b9884f34cfbb0
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:50:41 2011 +0200
Translation update done using Pootle.
commit fdceb91948fd0cba308c877f34c276dda42e0f27
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:50:15 2011 +0200
Translation update done using Pootle.
commit 5020a62da0e5b5228beb156bd4914fd5e4ab81fa
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:49:57 2011 +0200
Translation update done using Pootle.
commit a275af5e8b6a2ec3858b7a67231f365859125040
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:49:42 2011 +0200
Translation update done using Pootle.
commit a0334dee871b40c85896f705cf04d982855c6f48
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:46:59 2011 +0200
Translation update done using Pootle.
commit d0cd77517cd2ced62c789a77c4a9c6db2eda3d53
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:46:11 2011 +0200
Translation update done using Pootle.
commit 29c398e923af5a00f885df6aff191201f39d93c5
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:45:25 2011 +0200
Translation update done using Pootle.
commit 62cb73505c677f9dae2d6629b2503131c54a3ecd
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:43:54 2011 +0200
Translation update done using Pootle.
commit ffeaf03547ac26bb162309e351ae6c5c88c94728
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Tue Aug 2 11:41:00 2011 +0200
Translation update done using Pootle.
commit 2e2ba2732f6b9f20460cdb2d2eca92262347b337
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:45:33 2011 +0200
Translation update done using Pootle.
commit 4bea4ab7fe63c740cc6a066175600cc93b408ad4
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:44:41 2011 +0200
Translation update done using Pootle.
commit 1182ef584d4a8bcb6b732e7bf332d66b8dd55382
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:44:03 2011 +0200
Translation update done using Pootle.
commit 96c3dc32a49b9670cdd098713a6f992fcb584457
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:41:17 2011 +0200
Translation update done using Pootle.
commit ec8a4e140f6192a8492dd861e48fba583f1637db
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:40:38 2011 +0200
Translation update done using Pootle.
commit cea2a9c5315ad520015670bc0a55870e7e043a99
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:38:27 2011 +0200
Translation update done using Pootle.
commit 28e50fd5ba9742af157c3e1e5db56a56aa2080e9
Author: Burak Yavuz <hitowerdigit(a)hotmail.com>
Date: Tue Aug 2 10:37:53 2011 +0200
Translation update done using Pootle.
commit f7323710ea2d150c14bc6ef3f30918063a5ec5c9
Merge: a458f0d64478651ccdc4e1640ee28d6ab33ada91 3a373b4a14f9fbb3f8f7dbec3b0166efe17cac1f
Author: Pootle server <pootle(a)cihar.com>
Date: Tue Aug 2 02:40:19 2011 +0200
Merge remote-tracking branch 'origin/master'
commit a458f0d64478651ccdc4e1640ee28d6ab33ada91
Author: Sven Strickroth <email(a)cs-ware.de>
Date: Mon Aug 1 20:57:39 2011 +0200
Translation update done using Pootle.
commit 6ef25991188b42bf2f509b95c93a131b469c9f51
Author: Sven Strickroth <email(a)cs-ware.de>
Date: Mon Aug 1 20:57:13 2011 +0200
Translation update done using Pootle.
commit 041448f4833b646dc203d5c2d4bb60fff48269ed
Author: Sven Strickroth <email(a)cs-ware.de>
Date: Mon Aug 1 20:55:15 2011 +0200
Translation update done using Pootle.
commit d22260fe9950e5a5e09104caa344178bfa2a32af
Author: Matías Bellone <matiasbellone(a)gmail.com>
Date: Mon Aug 1 18:53:18 2011 +0200
Translation update done using Pootle.
commit e94e6df9468e4576e821e9b4b6443ff6136cc9ae
Author: Matías Bellone <matiasbellone(a)gmail.com>
Date: Mon Aug 1 18:52:21 2011 +0200
Translation update done using Pootle.
commit 04c13485078c5b217bb1e51e880975a057908ad0
Author: Matías Bellone <matiasbellone(a)gmail.com>
Date: Mon Aug 1 18:46:56 2011 +0200
Translation update done using Pootle.
commit 6c465718b8f6c54c7d1b8612c8b959e51b731096
Author: Matías Bellone <matiasbellone(a)gmail.com>
Date: Mon Aug 1 18:46:13 2011 +0200
Translation update done using Pootle.
commit 53e1de72e4c4e19c6a5f4a6c070f9962e3b2c6c0
Author: Matías Bellone <matiasbellone(a)gmail.com>
Date: Mon Aug 1 18:46:00 2011 +0200
Translation update done using Pootle.
commit c817f38d0694bfc06a418f0968251f3908c4a635
Author: Matías Bellone <matiasbellone(a)gmail.com>
Date: Mon Aug 1 18:45:40 2011 +0200
Translation update done using Pootle.
commit 62068de78f6b57f414a06ceb84a75695eb4a6eb9
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 16:54:56 2011 +0200
Translation update done using Pootle.
commit 5f67e63aed986658ee43ac9eacee4175c94a2fe6
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 16:00:05 2011 +0200
Translation update done using Pootle.
commit 7f8977747ea1e9c4b72af0e31e834698534306cf
Author: Marc Delisle <marc(a)infomarc.info>
Date: Mon Aug 1 12:56:37 2011 +0200
Translation update done using Pootle.
commit 809aa8944153ffc70b0afca88f4c4e86b9ce6952
Author: Marc Delisle <marc(a)infomarc.info>
Date: Mon Aug 1 12:53:19 2011 +0200
Translation update done using Pootle.
commit 9e91fb4aeef46173d84af9f5cd6998d5bdf67382
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 12:45:18 2011 +0200
Translation update done using Pootle.
commit 6a0af21e73e38926c3ef0c8a7c2a70d9cd9a15de
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 12:42:40 2011 +0200
Translation update done using Pootle.
commit ffcd0d8139c54e2596b8a348a70b29993813c314
Author: Marc Delisle <marc(a)infomarc.info>
Date: Mon Aug 1 12:42:35 2011 +0200
Translation update done using Pootle.
commit 6049062c7dcbb191c6cf61940eead018b57fc7e7
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 12:41:22 2011 +0200
Translation update done using Pootle.
commit a15f84b036beb82bce327871307d6be06d27c646
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 12:40:57 2011 +0200
Translation update done using Pootle.
commit 566b75f0478a12ca9d154ec6275643802ade3217
Author: Marc Delisle <marc(a)infomarc.info>
Date: Mon Aug 1 12:38:15 2011 +0200
Translation update done using Pootle.
commit 9b65d400d3ba3cf2341e67e5cafc2708c9e19eaa
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Mon Aug 1 12:38:06 2011 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/de.po | 40 +++++++++++++++++-----------------------
po/es.po | 59 +++++++++++++++++++++++++++--------------------------------
po/fr.po | 27 +++++++++++++++++++++++++--
po/ja.po | 58 +++++++++++++++++++++++++++++-----------------------------
po/tr.po | 60 ++++++++++++++++++++++++------------------------------------
5 files changed, 122 insertions(+), 122 deletions(-)
diff --git a/po/de.po b/po/de.po
index b9903b2..2da471e 100644
--- a/po/de.po
+++ b/po/de.po
@@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-31 21:12+0200\n"
-"Last-Translator: <mrbendig(a)mrbendig.com>\n"
+"PO-Revision-Date: 2011-08-01 20:57+0200\n"
+"Last-Translator: Sven Strickroth <email(a)cs-ware.de>\n"
"Language-Team: german <de(a)li.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
@@ -10006,7 +10006,6 @@ msgid "Monitor Instructions"
msgstr "Einführung zur Überwachung"
#: server_status.php:1364
-#, fuzzy
#| msgid ""
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
#| "configuration and track down time intensive\n"
@@ -10023,14 +10022,13 @@ msgid ""
"increases server load by up to 15%"
msgstr ""
"Die phpMyAdmin-Überwachung kann Sie bei der Server-Konfiguration, und auch "
-"beim Aufspühren von zeitintensiven Abfragen unterstützen. Für das Letztere "
+"beim Aufspühren von zeitintensiven Abfragen unterstützen. Für Letzteres "
"müssen Sie log_output auf 'TABLE' stellen und entweder slow_query_log oder "
"general_log aktivieren. Beachten Sie aber, dass das Aktivieren der "
"general_log viele Daten produzieren und die Serverauslastung um bis zu 15% "
"erhöhen kann."
#: server_status.php:1371
-#, fuzzy
#| msgid ""
#| "<b>Using the monitor:</b><br/>\n"
#| " Ok, you are good to go! Once you click 'Start monitor' your "
@@ -10053,21 +10051,19 @@ msgid ""
"will load statistics from the logs helping you find what caused the activity "
"spike.</p>"
msgstr ""
-"<b>Verwendung der Überwachung:</b><br />\n"
-"OK, Sie sind bereit zum Starten! Sobald Sie 'Überwachung starten' angeklickt "
-"haben, wird Ihr Browser in regelmäßigen Intervallen alle angezeigten "
-"Diagramme aktualisieren. Unter 'Einstellungen' können Sie Diagramme "
-"hinzufügen und das Aktualisierungsintervall ändern oder beliebige Diagramme "
-"entfernen, wenn Sie das Zahnrad-Icon des entsprechenden Schaubilds "
-"verwenden.\n"
-"<p>Wenn Sie eine plötzliche Spitze in der Aktivität feststellen, wählen Sie "
-"den entsprechenden Zeitraum in einem beliebigen Diagramm, indem Sie die\n"
-"linke Maustaste gedrückt halten und über das Schaubild ziehen. Dies wird "
-"Statistiken aus den Protokollen laden um Sie bei der Auffindung der \n"
+"<b>Verwendung der Überwachung:</b><br />OK, Sie sind bereit zum Starten! "
+"Sobald Sie 'Überwachung starten' angeklickt haben, wird Ihr Browser in "
+"regelmäßigen Intervallen alle angezeigten Diagramme aktualisieren. Unter "
+"'Einstellungen' können Sie Diagramme hinzufügen und das "
+"Aktualisierungsintervall ändern oder beliebige Diagramme entfernen, wenn Sie "
+"das Zahnrad-Icon des entsprechenden Schaubilds verwenden.<p>Wenn Sie eine "
+"plötzliche Spitze in der Aktivität feststellen, wählen Sie den "
+"entsprechenden Zeitraum in einem beliebigen Diagramm, indem Sie die linke "
+"Maustaste gedrückt halten und über das Schaubild ziehen. Dies wird "
+"Statistiken aus den Protokollen laden um Sie bei der Auffindung der "
"Aktivitätsspitze zu unterstützen.</p>"
#: server_status.php:1375
-#, fuzzy
#| msgid ""
#| "<b>Please note:</b>\n"
#| " Enabling the general_log may increase the server load by 5-15%. "
@@ -10083,12 +10079,10 @@ msgid ""
"disable the general_log and empty its table once monitoring is not required "
"any more."
msgstr ""
-"<b>Bitte beachten Sie:</b>\n"
-"Das Aktivieren des general_log kann die Serverlast um 5-15% steigern. Seien "
-"Sie sich bewusst, dass das Erzeugen von Statistiken aus den Logs ein \n"
-"sehr aufwändiger Prozess ist. Deshalb ist es ratsam, nur einen kleinen "
-"Zeitraum auszuwählen.\n"
-" "
+"<b>Bitte beachten Sie:</b> Das Aktivieren des general_log kann die "
+"Serverlast um 5-15% steigern. Seien Sie sich bewusst, dass das Erzeugen von "
+"Statistiken aus den Logs ein sehr aufwändiger Prozess ist. Deshalb ist es "
+"ratsam, nur einen kleinen Zeitraum auszuwählen."
#: server_status.php:1385
msgid "CPU Usage"
diff --git a/po/es.po b/po/es.po
index 2caea98..a3464a2 100644
--- a/po/es.po
+++ b/po/es.po
@@ -4,13 +4,13 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-27 16:54+0200\n"
+"PO-Revision-Date: 2011-08-01 18:53+0200\n"
"Last-Translator: Matías Bellone <matiasbellone(a)gmail.com>\n"
"Language-Team: spanish <es(a)li.org>\n"
+"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Pootle 2.0.5\n"
@@ -1326,7 +1326,6 @@ msgid "Analysing & loading logs. This may take a while."
msgstr "Analizando y cargando registros. Esto puede demorar."
#: js/messages.php:143
-#, fuzzy
#| msgid ""
#| "This columns shows the amount of identical queries that are grouped "
#| "together. However only the SQL Text is being compared, thus the queries "
@@ -1337,8 +1336,9 @@ msgid ""
"the other attributes of queries, such as start time, may differ."
msgstr ""
"Esta columna muestra la cantidad de consultas idénticas que fueron "
-"agrupadas. Sin embargo, sólo el texto SQL es comparado, por lo que los demás "
-"atributos de las consultas como el tiempo de inicio podría diferir."
+"agrupadas. Sin embargo, sólo la consulta SQL en sí es es utilizada para "
+"agrupar, por lo que los demás atributos de las consultas como el tiempo de "
+"inicio podría diferir."
#: js/messages.php:144
msgid ""
@@ -1360,11 +1360,11 @@ msgid "Jump to Log table"
msgstr "Saltar a la tabla de registros"
#: js/messages.php:148
-#, fuzzy
#| msgid "Log analysed, but not data found in this time span."
msgid "Log analysed, but no data found in this time span."
msgstr ""
-"Registros analizados, pero no se encontraron datos en este período de tiempo."
+"Registros analizados, pero no se encontraron datos en este período de "
+"tiempo."
#. l10n: A collection of available filters
#: js/messages.php:151
@@ -1381,10 +1381,9 @@ msgid "Filter queries by word/regexp:"
msgstr "Filtrar consultas por palabra/expresión regular:"
#: js/messages.php:155
-#, fuzzy
#| msgid "Group queries, ignoring variable data in WHERE statements"
msgid "Group queries, ignoring variable data in WHERE clauses"
-msgstr "Agrupar consultas, ignorando datos variables en sentencias WHERE"
+msgstr "Agrupar consultas ignorando datos variables en sentencias WHERE"
#: js/messages.php:156
msgid "Sum of grouped rows:"
@@ -10061,7 +10060,6 @@ msgid "Monitor Instructions"
msgstr "Instrucciones de monitorización"
#: server_status.php:1364
-#, fuzzy
#| msgid ""
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
#| "configuration and track down time intensive\n"
@@ -10077,14 +10075,14 @@ msgid ""
"enabled. Note however, that the general_log produces a lot of data and "
"increases server load by up to 15%"
msgstr ""
-"El monitorizador de phpMyAdmin puede asistir en la optimización de la "
+"El Monitorizador de phpMyAdmin puede asistir en la optimización de la "
"configuración del servidor y rastrear consultas que toman mucho tiempo. Para "
"esto último necesitará que «log_output» esté definido como 'TABLE' y tener "
-"activado «slow_query_log» o «general_log». Note, sin embargo, que «general_log» "
-"produce mucha información y aumenta la carga en el servidor hasta en un 15%"
+"activado «slow_query_log» o «general_log». Note, sin embargo, que "
+"«general_log» produce mucha información y aumenta la carga en el servidor "
+"hasta en un 15%"
#: server_status.php:1371
-#, fuzzy
#| msgid ""
#| "<b>Using the monitor:</b><br/>\n"
#| " Ok, you are good to go! Once you click 'Start monitor' your "
@@ -10107,19 +10105,17 @@ msgid ""
"will load statistics from the logs helping you find what caused the activity "
"spike.</p>"
msgstr ""
-"<b>Utilizando el monitorizador:</b><br />\n"
-"¡Ya estás listo! Una vez que pulses en 'Iniciar monitorización' el navegador "
-"actualizará a intervalos regulares todos los gráficos mostrados. Podría "
-"agregar gráficos y cambiar la velocidad de actualización en 'Configuración', "
-"o eliminar cualquier gráfico utilizando el icono de rueda dentada en cada "
-"gráfico.\n"
-"<p>Cuando vea un pico repentino de actividad, seleccione el intervalo de "
-"tiempo relevante en el gráfico manteniendo pulsado el botón izquierdo y "
-"arrastrando sobre el gráfico. Esto cargará las estadísticas de los "
-"registros, lo que lo ayudará a encontrar la causa del pico de actividad.</p>"
+"<b>Utilizando el monitorizador:</b><br /> ¡Ya está listo! Una vez que pulse "
+"en 'Iniciar monitorización' el navegador actualizará a intervalos regulares "
+"todos los gráficos mostrados. Puede agregar gráficos y cambiar la velocidad "
+"de actualización en la sección 'Configuración' o eliminar cualquier gráfico "
+"utilizando el icono de rueda dentada en cada gráfico. <p>Cuando vea un pico "
+"repentino de actividad, seleccione el intervalo de tiempo relevante en el "
+"gráfico manteniendo pulsado el botón izquierdo y arrastrando sobre el "
+"gráfico. Esto cargará las estadísticas de los registros, lo que lo ayudará a "
+"encontrar la causa del pico de actividad.</p>"
#: server_status.php:1375
-#, fuzzy
#| msgid ""
#| "<b>Please note:</b>\n"
#| " Enabling the general_log may increase the server load by 5-15%. "
@@ -10135,13 +10131,12 @@ msgid ""
"disable the general_log and empty its table once monitoring is not required "
"any more."
msgstr ""
-"<b>Notar que:</b>\n"
-"Activar «general_log» puede aumentar la carga en el servidor hasta un 5-15%. "
-"También esté al tanto que generar estadísticas de los registros es una tarea "
-"muy intensiva por lo que se recomienda seleccionar un período de tiempo lo "
-"más pequeño posible y desactivar «general_log» y vaciar sus tablas una vez "
-"que ya no se necesite monitorizar.\n"
-" "
+"<b>Notar que:</b> Activar «general_log» puede aumentar la carga en el "
+"servidor hasta un 5-15%. También esté al tanto que generar estadísticas de "
+"los registros es una tarea muy intensiva por lo que se recomienda "
+"seleccionar un período de tiempo lo más pequeño posible y desactivar "
+"«general_log» y vaciar sus tablas una vez que ya no se necesite monitorizar. "
+" "
#: server_status.php:1385
msgid "CPU Usage"
diff --git a/po/fr.po b/po/fr.po
index 839fdec..b7488f0 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -4,13 +4,13 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-29 16:58+0200\n"
+"PO-Revision-Date: 2011-08-01 12:56+0200\n"
"Last-Translator: Marc Delisle <marc(a)infomarc.info>\n"
"Language-Team: french <fr(a)li.org>\n"
+"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Pootle 2.0.5\n"
@@ -1342,6 +1342,10 @@ msgid ""
"However only the SQL query itself has been used as a grouping criteria, so "
"the other attributes of queries, such as start time, may differ."
msgstr ""
+"Cette colonne montre le nombre de requêtes identiques qui sont regroupées. "
+"Cependant, seulement le texte SQL de la requête a été utilisé comme critère "
+"de regroupement, donc les autres propriétés des requêtes, comme l'heure de "
+"début, peuvent différer."
#: js/messages.php:144
msgid ""
@@ -9992,6 +9996,11 @@ msgid ""
"enabled. Note however, that the general_log produces a lot of data and "
"increases server load by up to 15%"
msgstr ""
+"Le moniteur phpMyAdmin peut vous aider à optimiser la configuration serveur "
+"et à traquer les requêtes qui prennent beaucoup de temps. Pour ce faire vous "
+"devrez régler le paramètre log_output à 'TABLE' et activer le journal "
+"slow_query_log ou general_log. Cependant, general_log produit beaucoup de "
+"données et augmente jusqu'à 15% la charge du serveur"
#: server_status.php:1371
msgid ""
@@ -10004,6 +10013,15 @@ msgid ""
"will load statistics from the logs helping you find what caused the activity "
"spike.</p>"
msgstr ""
+"<b>Utilisation de la surveillance :</b><br />Vous êtes maintenant prêt! "
+"Après avoir cliqué sur «Démarrer la surveillance», votre navigateur va "
+"rafraîchir les graphiques à intervalle régulier. Vous pouvez ajouter des "
+"graphiques et modifier le taux de rafraîchissement sous «Paramètres», ou "
+"supprimer tout graphique via l'cône de rouage.<p>Lorsque vous constatez un "
+"pic d'activité soudain, sélectionnez la portion de temps pertinent sur l'un "
+"des graphiques en tenant enfoncé le bouton gauche de la souris et en vous "
+"déplaçant sur le graphique. Ceci va charger les statistiques à partir des "
+"journaux et vous aidera à trouver la cause du pic dans l'activité.</p>"
#: server_status.php:1375
msgid ""
@@ -10013,6 +10031,11 @@ msgid ""
"disable the general_log and empty its table once monitoring is not required "
"any more."
msgstr ""
+"<b>À noter :</b>Activer le journal general_log peut causer une augmentation "
+"de charge de 5 à 15%. Également, la génération des statistiques à partir des "
+"journaux est une tâche intensive, donc il est suggéré de ne sélectionner "
+"qu'une petite portion de temps et de désactiver general_log puis de vider la "
+"table correspondante lorsque la surveillance n'est plus requise."
#: server_status.php:1385
msgid "CPU Usage"
diff --git a/po/ja.po b/po/ja.po
index 45da9a4..902574b 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -4,13 +4,13 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-27 12:14+0200\n"
+"PO-Revision-Date: 2011-08-02 12:41+0200\n"
"Last-Translator: Yuichiro <yuichiro(a)pop07.odn.ne.jp>\n"
"Language-Team: japanese <jp(a)li.org>\n"
+"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Pootle 2.0.5\n"
@@ -1201,27 +1201,27 @@ msgstr "モニタ一時中断"
#: js/messages.php:114
msgid "general_log and slow_query_log are enabled."
-msgstr ""
+msgstr "general_log および slow_query_log は有効です。"
#: js/messages.php:115
msgid "general_log is enabled."
-msgstr ""
+msgstr "general_log は有効です。"
#: js/messages.php:116
msgid "slow_query_log is enabled."
-msgstr ""
+msgstr "slow_query_log は有効です。"
#: js/messages.php:117
msgid "slow_query_log and general_log are disabled."
-msgstr ""
+msgstr "slow_query_log および general_log は無効です。"
#: js/messages.php:118
msgid "log_output is not set to TABLE."
-msgstr ""
+msgstr "log_output はテーブルに設定されていません。"
#: js/messages.php:119
msgid "log_output is set to TABLE."
-msgstr ""
+msgstr "log_output はテーブルに設定されています。"
#: js/messages.php:120
#, php-format
@@ -1246,10 +1246,10 @@ msgstr ""
#. l10n: %s is FILE or TABLE
#: js/messages.php:124
-#, fuzzy, php-format
+#, php-format
#| msgid "Save output to a file"
msgid "Set log_output to %s"
-msgstr "出力をファイルに保存する"
+msgstr "%s に log_output を設定する"
#. l10n: Enable in this context means setting a status variable to ON
#: js/messages.php:126
@@ -1311,7 +1311,7 @@ msgstr ""
#: js/messages.php:142
msgid "Analysing & loading logs. This may take a while."
-msgstr ""
+msgstr "ログの解析および読み込み中。すこし時間がかかることがあります。"
#: js/messages.php:143
msgid ""
@@ -1329,17 +1329,16 @@ msgstr ""
#: js/messages.php:145
msgid "Log data loaded. Queries executed in this time span:"
-msgstr ""
+msgstr "ログデータを読み込みました。この期間に行われたクエリは以下の通りです。"
#: js/messages.php:147
-#, fuzzy
#| msgid "Jump to database"
msgid "Jump to Log table"
-msgstr "データベースに移動"
+msgstr "ログの表に移動する"
#: js/messages.php:148
msgid "Log analysed, but no data found in this time span."
-msgstr ""
+msgstr "ログの解析を行いましたが、この期間のデータは見つかりませんでした。"
#. l10n: A collection of available filters
#: js/messages.php:151
@@ -1357,7 +1356,7 @@ msgstr ""
#: js/messages.php:155
msgid "Group queries, ignoring variable data in WHERE clauses"
-msgstr ""
+msgstr "クエリをまとめる(WHERE 句内のデータ部(文字列や数値など)は同一として扱われます)"
#: js/messages.php:156
#, fuzzy
@@ -1366,10 +1365,9 @@ msgid "Sum of grouped rows:"
msgstr "挿入する行数"
#: js/messages.php:157
-#, fuzzy
#| msgid "Total"
msgid "Total:"
-msgstr "合計"
+msgstr "合計:"
#: js/messages.php:161 libraries/tbl_properties.inc.php:780
#: pmd_general.php:388 pmd_general.php:425 pmd_general.php:545
@@ -9818,7 +9816,6 @@ msgid "Monitor Instructions"
msgstr "はじめに"
#: server_status.php:1364
-#, fuzzy
#| msgid ""
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
#| "configuration and track down time intensive\n"
@@ -9834,11 +9831,9 @@ msgid ""
"enabled. Note however, that the general_log produces a lot of data and "
"increases server load by up to 15%"
msgstr ""
-"phpMyAdmin モニタは、サーバ構成の最適化を支援し、時間のかかるクエリを追跡する"
-"ことができます。後者の場合には、テーブルに log_output を設定し、"
-"slow_query_log または general_log のいずれかを有効にする必要があります。な"
-"お、general_log を大量のデータを生成し、サーバの負荷を 15% 増加させますので、"
-"注意するようにしてください。"
+"phpMyAdmin モニタは、サーバ構成の最適化を支援し、時間のかかるクエリを追跡することができます。後者の場合には、テーブルに log_output "
+"を設定し、slow_query_log または general_log のいずれかを有効にする必要があります。なお、general_log "
+"を大量のデータを生成し、サーバの負荷を 15% 増加させますので、注意するようにしてください。"
#: server_status.php:1371
msgid ""
@@ -9851,6 +9846,10 @@ msgid ""
"will load statistics from the logs helping you find what caused the activity "
"spike.</p>"
msgstr ""
+"<b>モニタの使い方:</b><br/>「モニタ開始」をクリックすると、ブラウザは一定間隔で表示されている全てのグラフを更新します。「設定」のところより"
+"グラフを追加や再描画間隔の変更が行え、それぞれのグラフにある歯車のアイコンを通じて削除を行えます。<p>モニタリングしていてスパイク信号が見られることが"
+"あります。マウスの左ボタンを押したままグラフの上をドラッグするように移動させことで、グラフの任意の期間を選択できます。こうすることでログから統計の読み込"
+"みが行え、スパイク信号の原因を探ることができます。</p>"
#: server_status.php:1375
msgid ""
@@ -9860,6 +9859,9 @@ msgid ""
"disable the general_log and empty its table once monitoring is not required "
"any more."
msgstr ""
+"<b>注意事項:</b>general_log を有効にすると、5~15% サーバの負荷が増加することがあります。ログから生成される統計は、負荷が集中す"
+"る作業であることを認識しておいてください。ですから、テーブルのモニタで必要としないのであれば、しばらくの間 general_log "
+"を無効にして空にしておくのが望ましいです。"
#: server_status.php:1385
msgid "CPU Usage"
@@ -9916,10 +9918,9 @@ msgid "Series in Chart:"
msgstr "グラフの系列"
#: server_status.php:1445
-#, fuzzy
#| msgid "Loading"
msgid "Loading logs"
-msgstr "読み込み中"
+msgstr "ログの読み込み"
#: server_status.php:1448
#, fuzzy
@@ -9928,14 +9929,13 @@ msgid "Log statistics"
msgstr "統計を表示する"
#: server_status.php:1449
-#, fuzzy
#| msgid "Select page"
msgid "Selected time range:"
-msgstr "ページを選択してください"
+msgstr "選択期間:"
#: server_status.php:1454
msgid "Only retrieve SELECT,INSERT,UPDATE and DELETE Statements"
-msgstr ""
+msgstr "SELECT、INSERT、UPDATE、DELETE 文のみ取得する"
#: server_status.php:1459
msgid "Remove variable data in INSERT statements for better grouping"
diff --git a/po/tr.po b/po/tr.po
index e81dc1f..3e427dd 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -4,13 +4,13 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-29 21:55+0200\n"
+"PO-Revision-Date: 2011-08-02 10:45+0200\n"
"Last-Translator: Burak Yavuz <hitowerdigit(a)hotmail.com>\n"
"Language-Team: turkish <tr(a)li.org>\n"
+"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: tr\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Pootle 2.0.5\n"
@@ -1313,7 +1313,6 @@ msgid "Analysing & loading logs. This may take a while."
msgstr "Günlükler çözümleniyor ve yükleniyor. Bu biraz zaman alabilir."
#: js/messages.php:143
-#, fuzzy
#| msgid ""
#| "This columns shows the amount of identical queries that are grouped "
#| "together. However only the SQL Text is being compared, thus the queries "
@@ -1324,8 +1323,8 @@ msgid ""
"the other attributes of queries, such as start time, may differ."
msgstr ""
"Bu sütunlar birlikte gruplanmış özdeş sorguların miktarını gösterir. Ancak "
-"sadece SQL Metin karşılaştırılır, böylece başlama zamanı gibi sorgular diğer "
-"öznitelikler farklı olabilir."
+"sadece SQL Metnin kendisi gruplama kriteri olarak kullanılır, böylece "
+"başlama zamanı gibi, sorguların diğer öznitelikleri farklı olabilir."
#: js/messages.php:144
msgid ""
@@ -1346,10 +1345,9 @@ msgid "Jump to Log table"
msgstr "Günlük tablosuna atla"
#: js/messages.php:148
-#, fuzzy
#| msgid "Log analysed, but not data found in this time span."
msgid "Log analysed, but no data found in this time span."
-msgstr "Günlük çözümlendi, ama bu zaman aralığında bulunan veri yok."
+msgstr "Günlük çözümlendi, ama bu zaman aralığı içinde bulunan veri yok."
#. l10n: A collection of available filters
#: js/messages.php:151
@@ -1363,13 +1361,12 @@ msgstr "Süzgeç"
#: js/messages.php:154
msgid "Filter queries by word/regexp:"
-msgstr "Kelime/düzenli ifadeye göre sorguları süz"
+msgstr "Kelime/düzenli ifadeye göre sorguları süz:"
#: js/messages.php:155
-#, fuzzy
#| msgid "Group queries, ignoring variable data in WHERE statements"
msgid "Group queries, ignoring variable data in WHERE clauses"
-msgstr "Sorguları grupla, WHERE ifadelerindeki değişken veri yoksayılıyor"
+msgstr "Grup sorguları, WHERE cümleciklerindeki değişken veri yoksayılıyor"
#: js/messages.php:156
msgid "Sum of grouped rows:"
@@ -9897,7 +9894,6 @@ msgid "Monitor Instructions"
msgstr "İzleme Yönergeleri"
#: server_status.php:1364
-#, fuzzy
#| msgid ""
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
#| "configuration and track down time intensive\n"
@@ -9914,14 +9910,12 @@ msgid ""
"increases server load by up to 15%"
msgstr ""
"phpMyAdmin İzleyici sunucu yapılandırmasını uyarlamada ve yoğun sorgularda "
-"iz sürme süresinde size yardımcı\n"
-"olabilir. Sonrası için log_output'u 'TABLE'a ayarlamanız gerekecektir ve ya "
-"slow_query_log ya da general_log etkinleştirilir.\n"
-"Ancak unutmayın, general_log çok fazla veri üretir ve sunucu yükünü %15'e "
-"kadar arttırır"
+"iz sürme süresinde size yardımcı olabilir. Sonrası için log_output'u "
+"'TABLE'a ayarlamanız gerekecektir ve ya slow_query_log ya da general_log "
+"etkinleştirilir. Ancak unutmayın, general_log çok fazla veri üretir ve "
+"sunucu yükünü %15'e kadar arttırır"
#: server_status.php:1371
-#, fuzzy
#| msgid ""
#| "<b>Using the monitor:</b><br/>\n"
#| " Ok, you are good to go! Once you click 'Start monitor' your "
@@ -9944,17 +9938,14 @@ msgid ""
"will load statistics from the logs helping you find what caused the activity "
"spike.</p>"
msgstr ""
-"<b>İzleyici kullanımı:</b><br/>\n"
-"Tamam, ilerlemeye hazırsınız! Bir kere 'İzlemeyi başlat'a tıkladığınızda "
-"tarayıcınız tüm görüntülenen\n"
-"çizelgeleri düzenli aralıklarla yenileyecek. 'Ayarlar' altında çizelgeleri "
-"ekleyebilir ve yenileme oranını değiştirebilirsiniz\n"
-"veya her çizelgenin kendi dişli çark simgesini kullanarak herhangi bir "
-"çizelgeyi kaldırabilirsiniz.\n"
-"<p>Ani hareketlilik gördüğünüzde, herhangi bir çizlgede sol fare tuşunu "
-"basılı tutarak ve çizelge üzerinde kaydırarak\n"
-"ilgili zaman aralığını seçin. Bu, ani hareketlenmenin sebebini bulmanızda "
-"yardımcı olan istatistikleri günlükten\n"
+"<b>İzleyici kullanımı:</b><br/> Tamam, ilerlemeye hazırsınız! Bir kere "
+"'İzlemeyi başlat'a tıkladığınızda tarayıcınız tüm görüntülenen çizelgeleri "
+"düzenli aralıklarla yenileyecek. 'Ayarlar' altında çizelgeleri ekleyebilir "
+"ve yenileme oranını değiştirebilirsiniz veya her çizelgenin kendi dişli çark "
+"simgesini kullanarak herhangi bir çizelgeyi kaldırabilirsiniz. <p>Ani "
+"hareketlilik gördüğünüzde, herhangi bir çizlgede sol fare tuşunu basılı "
+"tutarak ve çizelge üzerinde kaydırarak ilgili zaman aralığını seçin. Bu, ani "
+"hareketlenmenin sebebini bulmanızda yardımcı olan istatistikleri günlükten "
"yükleyecek.</p>"
#: server_status.php:1375
@@ -9965,14 +9956,11 @@ msgid ""
"disable the general_log and empty its table once monitoring is not required "
"any more."
msgstr ""
-"<b>Lütfen unutmayın:</b>\n"
-" general_log'u etkinleştirmek sunucu yükünü %5-15 arttırabilir. Aynı "
-"zamanda günlükten oluşturulan istatistiklerin yoğun görev yükü olduğundan "
-"haberiniz olsun\n"
-" bu yüzden sadece küçük zaman aralıkları seçmek ve general_log'u "
-"etkisizleştirmek tavsiye edilir ve tablolarını bir defa boşaltmak daha fazla "
-"izlemeyi gerektirmez.\n"
-" "
+"<b>Lütfen unutmayın:</b> general_log'u etkinleştirmek sunucu yükünü %5-15 "
+"arttırabilir. Aynı zamanda günlükten oluşturulan istatistiklerin yoğun görev "
+"yükü olduğundan haberiniz olsun bu yüzden sadece küçük zaman aralıkları "
+"seçmek ve general_log'u etkisizleştirmek tavsiye edilir ve tablolarını bir "
+"defa boşaltmak daha fazla izlemeyi gerektirmez."
#: server_status.php:1385
msgid "CPU Usage"
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12796-g3a373b4
by Piotr Przybylski 02 Aug '11
by Piotr Przybylski 02 Aug '11
02 Aug '11
The branch, master has been updated
via 3a373b4a14f9fbb3f8f7dbec3b0166efe17cac1f (commit)
from 19172fb476a0082cb5e1e560c3613a99a4f085aa (commit)
- Log -----------------------------------------------------------------
commit 3a373b4a14f9fbb3f8f7dbec3b0166efe17cac1f
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Tue Aug 2 01:27:52 2011 +0200
Respect MaxCharactersInDisplayedSQL in process list on Server Status page
-----------------------------------------------------------------------
Summary of changes:
server_status.php | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/server_status.php b/server_status.php
index 7e4babd..e5bb06f 100644
--- a/server_status.php
+++ b/server_status.php
@@ -1055,7 +1055,19 @@ function printServerTraffic() {
<td><?php echo $process['Command']; ?></td>
<td class="value"><?php echo $process['Time']; ?></td>
<td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
- <td><?php echo (empty($process['Info']) ? '---' : PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']))); ?></td>
+ <td>
+ <?php
+ if (empty($process['Info'])) {
+ echo '---';
+ } else {
+ if (empty($_REQUEST['full']) && strlen($process['Info']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
+ echo htmlspecialchars(substr($process['Info'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'])) . '[...]';
+ } else {
+ echo PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']));
+ }
+ }
+ ?>
+ </td>
</tr>
<?php
$odd_row = ! $odd_row;
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12795-g19172fb
by Michal Čihař 01 Aug '11
by Michal Čihař 01 Aug '11
01 Aug '11
The branch, master has been updated
via 19172fb476a0082cb5e1e560c3613a99a4f085aa (commit)
via c1053d0f1f7a49608904b8cfd001cc20c7d8c263 (commit)
via c3ca1e2d27eb54efaf3aed1a87052ddc3d58b02e (commit)
via 623e3c636c2f1f76306f7aec5724b94b33c2d3ff (commit)
via a93037f6749ac84795efb1bcf578da40232e4f83 (commit)
via 70a876d31db6a50e424c6934086dce49ca57c2bb (commit)
via 0a74f2e791e1a509d17fa2756cb949b797f5fa19 (commit)
via ab4807defeb325dcf5d50e0f3faa4f91088312a0 (commit)
via 790e008d4ff705920d2df977ce25e6d881f2e5b9 (commit)
via da6711ccc14be5a70682382c1d54545ca8755fb2 (commit)
via 1ab3c16341a197a597b269f23169350557dca5c7 (commit)
via 83c0211ccf66d235193281b7eb4a2230f3e725a0 (commit)
via 444bfb0e234aed72aa2a3ff13af147c46b270c9d (commit)
via 0e626adafba604e72b5c3b1d7817c4aa7933f76c (commit)
from 15a384a2d510416857994908e6c6b45fc2b1e7e2 (commit)
- Log -----------------------------------------------------------------
commit 19172fb476a0082cb5e1e560c3613a99a4f085aa
Merge: c1053d0f1f7a49608904b8cfd001cc20c7d8c263 15a384a2d510416857994908e6c6b45fc2b1e7e2
Author: Pootle server <pootle(a)cihar.com>
Date: Sun Jul 31 22:40:15 2011 +0200
Merge remote-tracking branch 'origin/master'
commit c1053d0f1f7a49608904b8cfd001cc20c7d8c263
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:19:06 2011 +0200
Translation update done using Pootle.
commit c3ca1e2d27eb54efaf3aed1a87052ddc3d58b02e
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:18:15 2011 +0200
Translation update done using Pootle.
commit 623e3c636c2f1f76306f7aec5724b94b33c2d3ff
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:17:50 2011 +0200
Translation update done using Pootle.
commit a93037f6749ac84795efb1bcf578da40232e4f83
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:17:35 2011 +0200
Translation update done using Pootle.
commit 70a876d31db6a50e424c6934086dce49ca57c2bb
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:17:16 2011 +0200
Translation update done using Pootle.
commit 0a74f2e791e1a509d17fa2756cb949b797f5fa19
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:16:39 2011 +0200
Translation update done using Pootle.
commit ab4807defeb325dcf5d50e0f3faa4f91088312a0
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:16:14 2011 +0200
Translation update done using Pootle.
commit 790e008d4ff705920d2df977ce25e6d881f2e5b9
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:15:44 2011 +0200
Translation update done using Pootle.
commit da6711ccc14be5a70682382c1d54545ca8755fb2
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:15:27 2011 +0200
Translation update done using Pootle.
commit 1ab3c16341a197a597b269f23169350557dca5c7
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:14:15 2011 +0200
Translation update done using Pootle.
commit 83c0211ccf66d235193281b7eb4a2230f3e725a0
Author: stefan <stefan(a)inkopsforum.se>
Date: Sun Jul 31 21:13:18 2011 +0200
Translation update done using Pootle.
commit 444bfb0e234aed72aa2a3ff13af147c46b270c9d
Author: mrbendig <mrbendig(a)mrbendig.com>
Date: Sun Jul 31 21:12:19 2011 +0200
Translation update done using Pootle.
commit 0e626adafba604e72b5c3b1d7817c4aa7933f76c
Author: mrbendig <mrbendig(a)mrbendig.com>
Date: Sun Jul 31 21:11:59 2011 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/de.po | 12 +++++-------
po/sv.po | 35 ++++++++++++-----------------------
2 files changed, 17 insertions(+), 30 deletions(-)
diff --git a/po/de.po b/po/de.po
index ec26b35..b9903b2 100644
--- a/po/de.po
+++ b/po/de.po
@@ -4,13 +4,13 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-29 13:44+0200\n"
+"PO-Revision-Date: 2011-07-31 21:12+0200\n"
"Last-Translator: <mrbendig(a)mrbendig.com>\n"
"Language-Team: german <de(a)li.org>\n"
+"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Pootle 2.0.5\n"
@@ -1326,7 +1326,6 @@ msgid "Analysing & loading logs. This may take a while."
msgstr "Analysiere und Lade Protokolle. Dies kann eine Weile dauern."
#: js/messages.php:143
-#, fuzzy
#| msgid ""
#| "This columns shows the amount of identical queries that are grouped "
#| "together. However only the SQL Text is being compared, thus the queries "
@@ -1337,7 +1336,7 @@ msgid ""
"the other attributes of queries, such as start time, may differ."
msgstr ""
"Diese Spalte zeigt die Anzahl der identischen Abfragen an, die gruppiert "
-"wurden. Dennoch wird nur der SQL-Text verglichen, daher kann die Angabe von "
+"wurden. Jedoch wird nur der SQL-Text verglichen, daher kann die Angabe von "
"anderen Werten der Abfrage, wie die Startzeit, unterschiedlich sein."
#: js/messages.php:144
@@ -1360,12 +1359,11 @@ msgid "Jump to Log table"
msgstr "Springe zur Protokoll-Tabelle"
#: js/messages.php:148
-#, fuzzy
#| msgid "Log analysed, but not data found in this time span."
msgid "Log analysed, but no data found in this time span."
msgstr ""
-"Protokoll wurde analysiert, es wurden jedoch keine Daten im angegebenen "
-"Zeitraum gefunden."
+"Das Protokoll wurde analysiert, es wurden jedoch keine Daten für den "
+"angegebenen Zeitraum gefunden."
#. l10n: A collection of available filters
#: js/messages.php:151
diff --git a/po/sv.po b/po/sv.po
index b8904da..e014c8a 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -4,13 +4,13 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
-"PO-Revision-Date: 2011-07-31 20:58+0200\n"
+"PO-Revision-Date: 2011-07-31 21:19+0200\n"
"Last-Translator: <stefan(a)inkopsforum.se>\n"
"Language-Team: swedish <sv(a)li.org>\n"
+"Language: sv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: sv\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Pootle 2.0.5\n"
@@ -9952,42 +9952,37 @@ msgstr ""
"behövs längre. \n"
#: server_status.php:1385
-#, fuzzy
#| msgid "Usage"
msgid "CPU Usage"
-msgstr "Användning"
+msgstr "CPU Användning"
#: server_status.php:1388
msgid "Memory Usage"
msgstr "Minnesanvändning"
#: server_status.php:1391
-#, fuzzy
#| msgid "Usage"
msgid "Swap Usage"
-msgstr "Användning"
+msgstr "Swap användning"
#: server_status.php:1394
-#, fuzzy
#| msgid "All status variables"
msgid "Status variable(s)"
msgstr "Alla statusvariabler"
#: server_status.php:1396
-#, fuzzy
#| msgid "Select Tables"
msgid "Select series:"
-msgstr "Välj tabeller"
+msgstr "Välj serier:"
#: server_status.php:1398
msgid "Commonly monitored"
msgstr "Vanligen övervakade"
#: server_status.php:1413
-#, fuzzy
#| msgid "You must provide a routine name"
msgid "or type variable name:"
-msgstr "Du måste ange ett rutinnamn"
+msgstr "eller skriv ett variabelnamn:"
#: server_status.php:1417
msgid "Display as differential value"
@@ -10002,38 +9997,33 @@ msgid "Append unit to data values"
msgstr "Lägg till enhet till datavärdena"
#: server_status.php:1432
-#, fuzzy
#| msgid "Add a trigger"
msgid "Add this series"
-msgstr "Lägg till en ny Trigger"
+msgstr "Lägg till denna serie"
#: server_status.php:1434
msgid "Clear series"
msgstr "Rensa serier"
#: server_status.php:1437
-#, fuzzy
#| msgid "Series:"
msgid "Series in Chart:"
-msgstr "Serie:"
+msgstr "Serier i diagram:"
#: server_status.php:1445
-#, fuzzy
#| msgid "Loading"
msgid "Loading logs"
-msgstr "Laddar"
+msgstr "Läser in loggar"
#: server_status.php:1448
-#, fuzzy
#| msgid "Show statistics"
msgid "Log statistics"
-msgstr "Visa statistik"
+msgstr "Logga statistik"
#: server_status.php:1449
-#, fuzzy
#| msgid "Select page"
msgid "Selected time range:"
-msgstr "Välj sida"
+msgstr "Valt tidsintervall:"
#: server_status.php:1454
msgid "Only retrieve SELECT,INSERT,UPDATE and DELETE Statements"
@@ -10052,10 +10042,9 @@ msgstr ""
"grupperas efter frågetexten."
#: server_status.php:1465
-#, fuzzy
#| msgid "Query type"
msgid "Query analyzer"
-msgstr "Fråge-typ"
+msgstr "Fråge analyserare"
#: server_status.php:1501
#, php-format
hooks/post-receive
--
phpMyAdmin
1
0