addJSON('message', $message);
/* Persist always send settings */
if (! isset($_REQUEST['automatic'])
&& $_REQUEST['automatic'] !== "true"
&& isset($_REQUEST['always_send'])
&& $_REQUEST['always_send'] === "true"
) {
PMA_persistOption("SendErrorReports", "always", "ask");
}
} elseif (! empty($_REQUEST['get_settings'])) {
$response->addJSON('report_setting', $GLOBALS['cfg']['SendErrorReports']);
} else {
$response->addHTML(PMA_getErrorReportForm());
}
}elseif (isset($_REQUEST['exception_type'])
&& $_REQUEST['exception_type'] == 'php'
) {
if (isset($_REQUEST['send_error_report'])
&& $_REQUEST['send_error_report'] == '1'
) {
$reportData = PMA_getReportData('php');
if ($reportData) {
$server_response = PMA_sendErrorReport($reportData);
if ($server_response === false) {
$success = false;
} else {
$decoded_response = json_decode($server_response, true);
$success = !empty($decoded_response) ? $decoded_response["success"] : false;
}
if($GLOBALS['cfg']['SendErrorReports'] == 'ask'){
if($success) {
$errSubmitMsg = PMA_Message::error(
__('Thank You for subitting error report!!')
. '
'
. __('Report has been succesfully submitted.')
);
} else {
$errSubmitMsg = PMA_Message::error(
__('Thank You for subitting error report!!')
. '
'
. __(' Unfortunately submission failed.')
. '
'
. __(' If you experience any problems please submit a bug report manually.')
);
}
} elseif($GLOBALS['cfg']['SendErrorReports'] == 'always') {
if($success) {
$errSubmitMsg = PMA_Message::error(
__(
'An error has been detected on the server and an error report has been '
. 'automatically submitted based on your settings.'
)
);
} else {
$errSubmitMsg = PMA_Message::error(
__(
'An error has been detected and an error report has been '
. 'generated but failed to be sent.'
)
. '
'
. __('If you experience any problems please submit a bug report manually.')
);
}
}
if($response->isAjax()) {
$response->addJSON('_errSubmitMsg',$errSubmitMsg);
} else {
$jsCode = 'PMA_ajaxShowMessage("