From 84d62e1fd8c2ad4e5aa78a7a94091342e843ea02 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 21 Jun 2011 18:46:41 +0100 Subject: [PATCH 1/5] Fixed incorrect queuing of objects in PMA_slidingMessage() --- js/functions.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/functions.js b/js/functions.js index 14f3b46b76..5c4bb5fd2a 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2460,15 +2460,17 @@ function PMA_slidingMessage($obj, msg) { // If there already is a message inside the // target object, we must get rid of it $obj - .append('
' + msg + '
') .find('div') .first() .fadeOut(function () { - $(this).remove(); - $obj.animate({ - height: $obj.find('div').first().height() - }); $obj + .children() + .remove(); + $obj + .append('
' + msg + '
') + .animate({ + height: $obj.find('div').first().height() + }) .find('div') .first() .fadeIn(); From 70656e2b6a6661e381ef1d5dcdc43fcd14b1086d Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 21 Jun 2011 19:29:48 +0100 Subject: [PATCH 2/5] Made the 'object' parameter for PMA_slidingMessage() optional --- js/db_routines.js | 6 +-- js/functions.js | 102 ++++++++++++++++++++++++++-------------------- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/js/db_routines.js b/js/db_routines.js index 1c03b6b74b..95254ca064 100644 --- a/js/db_routines.js +++ b/js/db_routines.js @@ -246,7 +246,7 @@ $(document).ready(function() { if(data.success == true) { // Routine created successfully PMA_ajaxRemoveMessage($msg); - PMA_slidingMessage($('#js_query_display'), data.message); + PMA_slidingMessage(data.message); $ajaxDialog.dialog('close'); // If we are in 'edit' mode, we must remove the reference to the old row. if (mode == 'edit') { @@ -516,7 +516,7 @@ $(document).ready(function() { if(data.success == true) { // Routine executed successfully PMA_ajaxRemoveMessage($msg); - PMA_slidingMessage($('#js_query_display'), data.message); + PMA_slidingMessage(data.message); $ajaxDialog.dialog('close'); } else { PMA_ajaxShowMessage(data.error); @@ -542,7 +542,7 @@ $(document).ready(function() { $ajaxDialog.find('input[name^=params]').first().focus(); } else { // Routine executed successfully - PMA_slidingMessage($('#js_query_display'), data.message); + PMA_slidingMessage(data.message); } } else { PMA_ajaxShowMessage(data.error); diff --git a/js/functions.js b/js/functions.js index 5c4bb5fd2a..fab0b5803f 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2448,57 +2448,69 @@ $(document).ready(function() { /** * Creates a message inside an object with a sliding effect * + * @param msg A string containing the text to display * @param $obj a jQuery object containing the reference * to the element where to put the message - * @param msg A string containing the text to display + * This is optional, if no element is + * provided, one will be created below the + * navigation links at the top of the page * * @return bool True on success, false on failure */ -function PMA_slidingMessage($obj, msg) { - if ($obj != 'undefined' && $obj instanceof jQuery) { - if ($obj.has('div').length > 0) { - // If there already is a message inside the - // target object, we must get rid of it - $obj - .find('div') - .first() - .fadeOut(function () { - $obj - .children() - .remove(); - $obj - .append('
' + msg + '
') - .animate({ - height: $obj.find('div').first().height() - }) - .find('div') - .first() - .fadeIn(); - }); - } else { - // Object does not already have a message - // inside it, so we simply slide it down - $obj - .width('100%') - .html('
' + msg + '
') - .find('div') - .first() - .slideDown(function() { - // Set the height of the parent - // to the height of the child - $obj - .height( - $obj - .find('div') - .first() - .height() - ); - }); - } - return true; - } else { +function PMA_slidingMessage(msg, $obj) { + if (msg == undefined || msg.length == 0) { + // Don't show an empty message return false; } + if ($obj == undefined || ! $obj instanceof jQuery) { + // If the second argument was not supplied, + // we might have to create a new DOM node. + if ($('#PMA_slidingMessage').length == 0) { + $('#topmenucontainer') + .after(''); + } + $obj = $('#PMA_slidingMessage'); + } + if ($obj.has('div').length > 0) { + // If there already is a message inside the + // target object, we must get rid of it + $obj + .find('div') + .first() + .fadeOut(function () { + $obj + .children() + .remove(); + $obj + .append('
' + msg + '
') + .animate({ + height: $obj.find('div').first().height() + }) + .find('div') + .first() + .fadeIn(); + }); + } else { + // Object does not already have a message + // inside it, so we simply slide it down + $obj + .width('100%') + .html('
' + msg + '
') + .find('div') + .first() + .slideDown(function() { + // Set the height of the parent + // to the height of the child + $obj + .height( + $obj + .find('div') + .first() + .height() + ); + }); + } + return true; } // end PMA_slidingMessage() /** @@ -2555,7 +2567,7 @@ $(document).ready(function() { } // Show the query that we just executed PMA_ajaxRemoveMessage($msg); - PMA_slidingMessage($('#js_query_display'), data.sql_query); + PMA_slidingMessage(data.sql_query); } else { PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error); } From 180f0882df651c6cf338f93081d141ca84b8fde3 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 21 Jun 2011 19:43:45 +0100 Subject: [PATCH 3/5] undefined is a keyword, not a string --- js/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/functions.js b/js/functions.js index f56f6de0a2..c3900f33c4 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1300,7 +1300,7 @@ function PMA_ajaxShowMessage(message, timeout) { * Removes the message shown for an Ajax operation when it's completed */ function PMA_ajaxRemoveMessage($this_msgbox) { - if ($this_msgbox != 'undefined' && $this_msgbox instanceof jQuery) { + if ($this_msgbox != undefined && $this_msgbox instanceof jQuery) { $this_msgbox .stop(true, true) .fadeOut('medium'); From c2dd99965dea7756e9de5a58100c1c701ef83de3 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 21 Jun 2011 20:33:32 +0100 Subject: [PATCH 4/5] Fixed bug #3323060 - SQL parser breaks AJAX requests if query has unclosed quotes --- ChangeLog | 1 + libraries/sqlparser.lib.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9bb28a813c..64d0b8fc6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ phpMyAdmin - ChangeLog - bug #3317293 [edit] Inline edit places HTML line breaks in edit area - bug #3319466 [interface] Inline query edit does not escape special characters - minor XSS (require a valid token) +- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes 3.4.2.0 (2011-06-07) - bug #3301249 [interface] Iconic table operations does not remove inline edit label diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 2171560afc..df8bd6babe 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -360,7 +360,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { $sql_array['raw'] = $sql; $pos = $pos_quote_separator; } - if (class_exists('PMA_Message')) { + if (class_exists('PMA_Message') && $GLOBALS['is_ajax_request'] != true) { PMA_Message::notice(__('Automatically appended backtick to the end of query!'))->display(); } } else { From 9e224184d786068317b801291c8f960109f0bdc5 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 21 Jun 2011 20:38:42 +0100 Subject: [PATCH 5/5] Fixed bug #3323101 - Invalid escape sequence in SQL parser --- ChangeLog | 1 + libraries/sqlparser.lib.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 64d0b8fc6e..e12b2713f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ phpMyAdmin - ChangeLog - bug #3319466 [interface] Inline query edit does not escape special characters - minor XSS (require a valid token) - bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes +- bug #3323101 [parser] Invalid escape sequence in SQL parser 3.4.2.0 (2011-06-07) - bug #3301249 [interface] Iconic table operations does not remove inline edit label diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index df8bd6babe..0c13187176 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -379,7 +379,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { // Checks for MySQL escaping using a \ // And checks for ANSI escaping using the $quotetype character - if (($pos < $len) && PMA_STR_charIsEscaped($sql, $pos)) { + if (($pos < $len) && PMA_STR_charIsEscaped($sql, $pos) && $c != '`') { $pos ++; continue; } elseif (($pos + 1 < $len) && ($GLOBALS['PMA_substr']($sql, $pos, 1) == $quotetype) && ($GLOBALS['PMA_substr']($sql, $pos + 1, 1) == $quotetype)) {