Modified PMA_showMessage so that it can show the sql query even in an
ajax request, by using output buffering. Added a function to handle the output buffer for the ajax request. Fixed a typo in PMA_ajaxResponse
This commit is contained in:
@@ -1021,6 +1021,9 @@ if (!$jsonly)
|
|||||||
*/
|
*/
|
||||||
function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
|
function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
|
||||||
{
|
{
|
||||||
|
if( $GLOBALS['is_ajax_request'] == true) {
|
||||||
|
ob_start("PMA_ajaxOutputBufferHandler");
|
||||||
|
}
|
||||||
global $cfg;
|
global $cfg;
|
||||||
|
|
||||||
if (null === $sql_query) {
|
if (null === $sql_query) {
|
||||||
@@ -1285,6 +1288,12 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
echo '</div><br />' . "\n";
|
echo '</div><br />' . "\n";
|
||||||
|
|
||||||
|
if( $GLOBALS['is_ajax_request'] == true) {
|
||||||
|
$buffer_contents = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
return $buffer_contents;
|
||||||
|
}
|
||||||
} // end of the 'PMA_showMessage()' function
|
} // end of the 'PMA_showMessage()' function
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2881,7 +2890,7 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array())
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$response['success'] = false;
|
$response['success'] = false;
|
||||||
$response['error'] = $message;
|
$response['error'] = $message->getDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( count($extra_data) > 0 ) {
|
if( count($extra_data) > 0 ) {
|
||||||
@@ -2894,4 +2903,10 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array())
|
|||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PMA_ajaxOutputBufferHandler($output_buffer) {
|
||||||
|
$response = array();
|
||||||
|
$response['message'] = $output_buffer;
|
||||||
|
return json_encode($response);
|
||||||
|
}
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user