diff --git a/error_report.php b/error_report.php
index 78f909e098..327a5a8d9b 100644
--- a/error_report.php
+++ b/error_report.php
@@ -19,74 +19,50 @@ if (isset($_REQUEST['send_error_report'])
$success = false;
} else {
$decoded_response = json_decode($server_response, true);
- $success = !empty($decoded_response) ? $decoded_response["success"] : false;
- }
+ $success = !empty($decoded_response) ? $decoded_response["success"] : false; }
- if (isset($_REQUEST['automatic'])
- && $_REQUEST['automatic'] === "true"
- ) {
- if ($success) {
- $response->addJSON(
- 'message',
- PMA_Message::error(
- __(
- 'An error has been detected and an error report has been '
- . 'automatically submitted based on your settings.'
- )
- . '
'
- . __('You may want to refresh the page.')
- )
+ /* Message to show to the user */
+ if ($success) {
+ if (isset($_REQUEST['automatic'])
+ && $_REQUEST['automatic'] === "true"
+ ) {
+ $message = __(
+ 'An error has been detected and an error report has been '
+ . 'automatically submitted based on your settings.'
);
} else {
- $response->addJSON(
- 'message',
- 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.'
- )
- . '
'
- . __('You may want to refresh the page.')
- )
- );
+ $message = __('Thank you for submitting this report.');
}
} else {
- if ($success) {
- $response->addJSON(
- 'message',
- PMA_Message::success(
- __('Thank you for submitting this report.')
- . '
'
- . __('You may want to refresh the page.')
- )
- );
- } else {
- $response->addJSON(
- 'message',
- PMA_Message::error(
- __('Thank you for submitting this report.')
- . ' '
- . __('Unfortunately the submission failed.')
- . ' '
- . __(
- 'If you experience any '
- . 'problems please submit a bug report manually.'
- )
- . '
'
- . __('You may want to refresh the page.')
- )
- );
- }
- if (isset($_REQUEST['always_send'])
- && $_REQUEST['always_send'] === "true"
- ) {
- PMA_persistOption("SendErrorReports", "always", "ask");
- }
+ $message = __(
+ '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.'
+ );
+ }
+ $message .= ' ' . __('You may want to refresh the page.');
+
+ /* Create message object */
+ if ($success) {
+ $message = PMA_Message::notice($message);
+ } else {
+ $message = PMA_Message::error($message);
+ }
+
+ /* Add message to JSON response */
+ $response->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']);