diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 8f8168d38..2067a5580 100755 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -661,6 +661,9 @@ 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); } @@ -1009,6 +1012,12 @@ if (!$jsonly) */ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false) { + /* + * PMA_ajaxResponse uses this function to collect the string of HTML generated + * for showing the message. Use output buffering to collect it and return it + * in a string. In some special cases on sql.php, buffering has to be disabled + * and hence we check with $GLOBALS['buffer_message'] + */ if( $GLOBALS['is_ajax_request'] == true && !isset($GLOBALS['buffer_message']) ) { ob_start(); } @@ -1050,6 +1059,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view } unset($tbl_status); + // In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence, + // check for it's presence before using it echo '
' . "\n"; if ($message instanceof PMA_Message) { @@ -1286,6 +1297,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view } // see in js/functions.js the jQuery code attached to id inline_edit + // document.write conflicts with jQuery, hence used $().append() $inline_edit = "