From 29dbdde4ffb4c4cbb13fd2351eabb5f22042c9ac Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 23 Mar 2011 08:10:22 -0400 Subject: [PATCH] Avoid displaying a Back link in a error message if we are in Ajax mode --- libraries/common.lib.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index bea2c6530..ef8c637d5 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -661,6 +661,14 @@ function PMA_mysqlDie($error_message = '', $the_query = '', $_SESSION['Import_message']['message'] = $error_msg_output; if ($exit) { + /** + * If in an Ajax request + * - avoid displaying a Back link + * - use PMA_ajaxResponse() to transmit the message and exit + */ + if($GLOBALS['is_ajax_request'] == true) { + PMA_ajaxResponse($error_msg_output, false); + } if (! empty($back_url)) { if (strstr($back_url, '?')) { $back_url .= '&no_history=true'; @@ -675,16 +683,10 @@ function PMA_mysqlDie($error_message = '', $the_query = '', $error_msg_output .= '' . "\n\n"; } - /** - * If in an Ajax request, don't just echo and exit. Use PMA_ajaxResponse() - */ - if($GLOBALS['is_ajax_request'] == true) { - PMA_ajaxResponse($error_msg_output, false); - } - echo $error_msg_output; - /** - * display footer and exit - */ + echo $error_msg_output; + /** + * display footer and exit + */ require './libraries/footer.inc.php'; } else { echo $error_msg_output;