From 158fe133c9a10aaca2d6b22c520ad9638a75d61d Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Fri, 4 May 2012 12:02:20 +0300 Subject: [PATCH 1/4] Export odt coding style: improve readability --- libraries/export/odt.php | 88 ++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/libraries/export/odt.php b/libraries/export/odt.php index 1f4ee08bd2..f32ab6215e 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -222,12 +222,10 @@ if (isset($plugin_list)) { '' . __('Dumping data for table') . ' ' . htmlspecialchars($table) - . ''; - $GLOBALS['odt_buffer'] .= - ''; - $GLOBALS['odt_buffer'] .= - '' + . '' + . ''; // If required, get fields name at the first line @@ -323,20 +321,20 @@ if (isset($plugin_list)) { ''; /* Header */ - $GLOBALS['odt_buffer'] .= ''; - $GLOBALS['odt_buffer'] .= '' + $GLOBALS['odt_buffer'] .= '' + . '' . '' . __('Column') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Type') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Null') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Default') . '' - . ''; - $GLOBALS['odt_buffer'] .= ''; + . '' + . ''; $columns = PMA_DBI_get_columns($db, $view); foreach ($columns as $column) { @@ -423,17 +421,17 @@ if (isset($plugin_list)) { $GLOBALS['odt_buffer'] .= ''; /* Header */ - $GLOBALS['odt_buffer'] .= ''; - $GLOBALS['odt_buffer'] .= '' + $GLOBALS['odt_buffer'] .= '' + . '' . '' . __('Column') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Type') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Null') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Default') . '' . ''; if ($do_relation && $have_rel) { @@ -524,23 +522,23 @@ if (isset($plugin_list)) { function PMA_getTriggers($db, $table) { $GLOBALS['odt_buffer'] .= ''; - $GLOBALS['odt_buffer'] .= ''; - $GLOBALS['odt_buffer'] .= ''; - $GLOBALS['odt_buffer'] .= '' + . ' table:name="' . htmlspecialchars($table) . '_triggers">' + . '' + . '' + . '' . '' . __('Name') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Time') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Event') . '' - . ''; - $GLOBALS['odt_buffer'] .= '' + . '' + . '' . '' . __('Definition') . '' - . ''; - $GLOBALS['odt_buffer'] .= ''; + . '' + . ''; $triggers = PMA_DBI_get_triggers($db, $table); @@ -625,12 +623,12 @@ if (isset($plugin_list)) { $triggers = PMA_DBI_get_triggers($db, $table); if ($triggers) { $GLOBALS['odt_buffer'] .= - '' - . __('Triggers') . ' ' - . htmlspecialchars($table) - . ''; - PMA_getTriggers($db, $table); + '' + . __('Triggers') . ' ' + . htmlspecialchars($table) + . ''; + PMA_getTriggers($db, $table); } break; case 'create_view': @@ -683,8 +681,8 @@ if (isset($plugin_list)) { } $definition .= '' - . '' . htmlspecialchars($type) . '' - . ''; + . '' . htmlspecialchars($type) . '' + . ''; if (! isset($column['Default'])) { if ($column['Null'] != 'NO') { $column['Default'] = 'NULL'; From a0d18070ac891684f88185e40ce40203adf0e0f1 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Fri, 4 May 2012 12:33:46 +0300 Subject: [PATCH 2/4] Export odt bug: add missing variable declaration --- libraries/export/odt.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/export/odt.php b/libraries/export/odt.php index f32ab6215e..bf6bbb5c85 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -455,6 +455,7 @@ if (isset($plugin_list)) { $columns = PMA_DBI_get_columns($db, $table); foreach ($columns as $column) { + $field_name = $column['Field']; $GLOBALS['odt_buffer'] .= PMA_formatOneColumnDefinition($column); if ($do_relation && $have_rel) { From c126615635e5c247728ce145d0b37d2ad2bda57f Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Fri, 4 May 2012 12:36:12 +0300 Subject: [PATCH 3/4] Export odt bug: remove undefined variable call --- libraries/export/odt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/export/odt.php b/libraries/export/odt.php index bf6bbb5c85..ef159f7dd3 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -655,7 +655,7 @@ if (isset($plugin_list)) { PMA_getTableDefStandIn($db, $table, $crlf); } // end switch - return PMA_exportOutputHandler($dump); + return true; } // end of the 'PMA_exportStructure' function /** From 2e9093b59066090626cded4735952462cbdf7824 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Fri, 4 May 2012 13:07:42 +0300 Subject: [PATCH 4/4] Export odt: remove trailing whitespaces --- libraries/export/odt.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/export/odt.php b/libraries/export/odt.php index ef159f7dd3..49da5d0a76 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -340,7 +340,7 @@ if (isset($plugin_list)) { foreach ($columns as $column) { $GLOBALS['odt_buffer'] .= PMA_formatOneColumnDefinition($column); $GLOBALS['odt_buffer'] .= ''; - } // end foreach + } // end foreach $GLOBALS['odt_buffer'] .= ''; return true; @@ -504,7 +504,7 @@ if (isset($plugin_list)) { } } $GLOBALS['odt_buffer'] .= ''; - } // end foreach + } // end foreach $GLOBALS['odt_buffer'] .= ''; return true; @@ -659,7 +659,7 @@ if (isset($plugin_list)) { } // end of the 'PMA_exportStructure' function /** - * Formats the definition for one column + * Formats the definition for one column * * @param array $column info about this column * @@ -694,10 +694,10 @@ if (isset($plugin_list)) { $column['Default'] = $column['Default']; } $definition .= '' - . '' - . (($column['Null'] == '' || $column['Null'] == 'NO') - ? __('No') - : __('Yes')) + . '' + . (($column['Null'] == '' || $column['Null'] == 'NO') + ? __('No') + : __('Yes')) . '' . ''; $definition .= ''