/**
* This function is called from one of the other functions in this file
* and it completes the handling of the export functionality.
*
* @param string $export_data The SQL query to create the requested item
*
* @return void
*/
function PMA_RTE_handleExport($export_data)
{
global $db;
$item_name = htmlspecialchars(PMA\libraries\Util::backquote($_GET['item_name']));
if ($export_data !== false) {
$export_data = htmlspecialchars(trim($export_data));
$title = sprintf(PMA_RTE_getWord('export'), $item_name);
if ($GLOBALS['is_ajax_request'] == true) {
$response = PMA\libraries\Response::getInstance();
$response->addJSON('message', $export_data);
$response->addJSON('title', $title);
exit;
} else {
$export_data = '<textarea cols="40" rows="15" style="width: 100%;">' . $export_data . '</textarea>';
echo "<fieldset>\n" . "<legend>{$title}</legend>\n" . $export_data . "</fieldset>\n";
}
} 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);
if ($GLOBALS['is_ajax_request'] == true) {
$response = PMA\libraries\Response::getInstance();
$response->setRequestStatus(false);
$response->addJSON('message', $message);
exit;
} else {
$response->display();
}
}
}