diff --git a/ChangeLog b/ChangeLog index 792a0fc623..d45ccd61c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,9 @@ phpMyAdmin - ChangeLog - issue #12320 Copying a user does not copy usergroup - issue #12272 Adding a new row with default enum goes to no selection when you want to add more then 2 rows - issue #12487 Drag and drop import prevents file dropping to blob column file selector on the insert tab +- issue #12554 Absence of scrolling makes it impossible to read longer text values in grid editing +- issue #12530 "Edit routine" crashes when the current user is not the definer, even if privileges are adequate +- issue #12300 Export selective tables by-default dumps Events also 4.6.4 (2016-08-16) - issue [security] Weaknesses with cookie encryption, see PMASA-2016-29 diff --git a/js/export.js b/js/export.js index 8d59c6e6d0..a0da0f251e 100644 --- a/js/export.js +++ b/js/export.js @@ -545,6 +545,16 @@ function toggle_table_select(row) { } } +function handleAddProcCheckbox() { + if ($('#table_structure_all').is(':checked') === true + && $('#table_data_all').is(':checked') === true + ) { + $('#checkbox_sql_procedure_function').prop('checked', true); + } else { + $('#checkbox_sql_procedure_function').prop('checked', false); + } +} + AJAX.registerOnload('export.js', function () { /** * For SQL plugin, if "CREATE TABLE options" is checked/unchecked, check/uncheck each of its sub-options @@ -584,26 +594,31 @@ AJAX.registerOnload('export.js', function () { $('input[name="table_select[]"]').on('change', function() { toggle_table_select($(this).closest('tr')); check_table_select_all(); + handleAddProcCheckbox(); }); $('input[name="table_structure[]"]').on('change', function() { check_table_selected($(this).closest('tr')); check_table_select_all(); + handleAddProcCheckbox(); }); $('input[name="table_data[]"]').on('change', function() { check_table_selected($(this).closest('tr')); check_table_select_all(); + handleAddProcCheckbox(); }); $('#table_structure_all').on('change', function() { toggle_table_select_all_str(); check_selected_tables(); + handleAddProcCheckbox(); }); $('#table_data_all').on('change', function() { toggle_table_select_all_data(); check_selected_tables(); + handleAddProcCheckbox(); }); if ($("input[name='export_type']").val() == 'database') { @@ -810,6 +825,8 @@ AJAX.registerOnload('export.js', function () { toggle_quick_or_custom(); toggle_structure_data_opts(); toggle_sql_include_comments(); + check_table_select_all(); + handleAddProcCheckbox(); /** * Initially disables the "Dump some row(s)" sub-options diff --git a/js/messages.php b/js/messages.php index 75a296fd34..17ea572c8e 100644 --- a/js/messages.php +++ b/js/messages.php @@ -390,6 +390,8 @@ $js_messages['strDeleting'] = __('Deleting'); $js_messages['MissingReturn'] = __('The definition of a stored function must contain a RETURN statement!'); $js_messages['strExport'] = __('Export'); +$js_messages['NoExportable'] + = __('No routine is exportable. Required privileges may be lacking.'); /* For ENUM/SET editor*/ $js_messages['enum_editor'] = __('ENUM/SET editor'); diff --git a/js/rte.js b/js/rte.js index 73e3964b2a..0d082154e2 100644 --- a/js/rte.js +++ b/js/rte.js @@ -128,6 +128,11 @@ RTE.COMMON = { var count = export_anchors.length; var returnCount = 0; + // No routine is exportable (due to privilege issues) + if (count === 0) { + PMA_ajaxShowMessage(PMA_messages.NoExportable); + } + export_anchors.each(function () { $.get($(this).attr('href'), {'ajax_request': true}, function (data) { returnCount++; @@ -149,6 +154,7 @@ RTE.COMMON = { } else { $.get($this.attr('href'), {'ajax_request': true}, showExport); } + PMA_ajaxRemoveMessage($msg); function showExport(data) { if (data.success === true) { diff --git a/libraries/DatabaseInterface.php b/libraries/DatabaseInterface.php index 4d02f6e421..6e8b44c90b 100644 --- a/libraries/DatabaseInterface.php +++ b/libraries/DatabaseInterface.php @@ -1748,10 +1748,11 @@ class DatabaseInterface * @param string $db db name * @param string $which PROCEDURE | FUNCTION | EVENT | VIEW * @param string $name the procedure|function|event|view name + * @param object $link MySQL link * * @return string the definition */ - public function getDefinition($db, $which, $name) + public function getDefinition($db, $which, $name, $link = null) { $returned_field = array( 'PROCEDURE' => 'Create Procedure', @@ -1762,7 +1763,7 @@ class DatabaseInterface $query = 'SHOW CREATE ' . $which . ' ' . Util::backquote($db) . '.' . Util::backquote($name); - return($this->fetchValue($query, 0, $returned_field[$which])); + return($this->fetchValue($query, 0, $returned_field[$which], $link)); } /** diff --git a/libraries/rte/rte_export.lib.php b/libraries/rte/rte_export.lib.php index 55f9c2da57..94b59ff5aa 100644 --- a/libraries/rte/rte_export.lib.php +++ b/libraries/rte/rte_export.lib.php @@ -44,15 +44,16 @@ function PMA_RTE_handleExport($export_data) } else { $_db = htmlspecialchars(PMA\libraries\Util::backquote($db)); $message = __('Error in processing request:') . ' ' - . sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db); - $response = Message::error($message); + . sprintf(PMA_RTE_getWord('no_view'), $item_name, $_db); + $message = Message::error($message); + if ($GLOBALS['is_ajax_request'] == true) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus(false); $response->addJSON('message', $message); exit; } else { - $response->display(); + $message->display(); } } } // end PMA_RTE_handleExport() @@ -70,6 +71,9 @@ function PMA_EVN_handleExport() if (! empty($_GET['export_item']) && ! empty($_GET['item_name'])) { $item_name = $_GET['item_name']; $export_data = $GLOBALS['dbi']->getDefinition($db, 'EVENT', $item_name); + if (! $export_data) { + $export_data = false; + } PMA_RTE_handleExport($export_data); } } // end PMA_EVN_handleExport() @@ -89,13 +93,20 @@ function PMA_RTN_handleExport() && ! empty($_GET['item_type']) ) { if ($_GET['item_type'] == 'FUNCTION' || $_GET['item_type'] == 'PROCEDURE') { - $export_data = "DELIMITER $$\n" - . $GLOBALS['dbi']->getDefinition( + $rtn_definition + = $GLOBALS['dbi']->getDefinition( $db, $_GET['item_type'], $_GET['item_name'] - ) - . "$$\nDELIMITER ;\n"; + ); + if (! $rtn_definition) { + $export_data = false; + } else { + $export_data = "DELIMITER $$\n" + . $rtn_definition + . "$$\nDELIMITER ;\n"; + } + PMA_RTE_handleExport($export_data); } } diff --git a/libraries/rte/rte_list.lib.php b/libraries/rte/rte_list.lib.php index 11b403d765..fe33e17d8c 100644 --- a/libraries/rte/rte_list.lib.php +++ b/libraries/rte/rte_list.lib.php @@ -204,9 +204,24 @@ function PMA_RTN_getRowForList($routine, $rowclass = '') $retval .= " \n"; $retval .= " \n"; $retval .= "