diff --git a/libraries/rte/rte_events.lib.php b/libraries/rte/rte_events.lib.php
index c8619a0000..41fd467395 100644
--- a/libraries/rte/rte_events.lib.php
+++ b/libraries/rte/rte_events.lib.php
@@ -99,13 +99,21 @@ function PMA_EVN_handleEditor()
$drop_item = "DROP EVENT " . PMA_backquote($_REQUEST['item_original_name']) . ";\n";
$result = PMA_DBI_try_query($drop_item);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $drop_item) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($drop_item)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$result = PMA_DBI_try_query($item_query);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $item_query) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($item_query)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
// We dropped the old item, but were unable to create the new one
// Try to restore the backup query
$result = PMA_DBI_try_query($create_item);
@@ -113,9 +121,14 @@ function PMA_EVN_handleEditor()
// OMG, this is really bad! We dropped the query, failed to create a new one
// and now even the backup query does not execute!
// This should not happen, but we better handle this just in case.
- $errors[] = __('Sorry, we failed to restore the dropped event.') . '
'
- . __('The backed up query was:') . "\"$create_item\"" . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = __(
+ 'Sorry, we failed to restore the dropped event.'
+ )
+ . '
'
+ . __('The backed up query was:')
+ . "\"" . htmlspecialchars($create_item) . "\""
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Event %1$s has been modified.'));
@@ -127,8 +140,12 @@ function PMA_EVN_handleEditor()
// 'Add a new item' mode
$result = PMA_DBI_try_query($item_query);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $item_query) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($item_query)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$message = PMA_Message::success(__('Event %1$s has been created.'));
$message->addParam(PMA_backquote($_REQUEST['item_name']));
diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php
index 01652c2ee7..414cbc2d70 100644
--- a/libraries/rte/rte_routines.lib.php
+++ b/libraries/rte/rte_routines.lib.php
@@ -249,13 +249,21 @@ function PMA_RTN_handleEditor()
$drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA_backquote($_REQUEST['item_original_name']) . ";\n";
$result = PMA_DBI_try_query($drop_routine);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $drop_routine) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($drop_routine)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$result = PMA_DBI_try_query($routine_query);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $routine_query) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($routine_query)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
// We dropped the old routine, but were unable to create the new one
// Try to restore the backup query
$result = PMA_DBI_try_query($create_routine);
@@ -263,9 +271,14 @@ function PMA_RTN_handleEditor()
// OMG, this is really bad! We dropped the query, failed to create a new one
// and now even the backup query does not execute!
// This should not happen, but we better handle this just in case.
- $errors[] = __('Sorry, we failed to restore the dropped routine.') . '
'
- . __('The backed up query was:') . "\"$create_routine\"" . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = __(
+ 'Sorry, we failed to restore the dropped routine.'
+ )
+ . '
'
+ . __('The backed up query was:')
+ . "\"" . htmlspecialchars($create_routine) . "\""
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Routine %1$s has been modified.'));
@@ -278,8 +291,12 @@ function PMA_RTN_handleEditor()
// 'Add a new routine' mode
$result = PMA_DBI_try_query($routine_query);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $routine_query) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($routine_query)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_backquote($_REQUEST['item_name']));
@@ -1251,8 +1268,14 @@ function PMA_RTN_handleExecute()
}
} else {
$output = '';
- $message = PMA_message::error(sprintf(__('The following query has failed: "%s"'), $query) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null));
+ $message = PMA_message::error(
+ sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($query)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null)
+ );
}
// Print/send output
if ($GLOBALS['is_ajax_request']) {
diff --git a/libraries/rte/rte_triggers.lib.php b/libraries/rte/rte_triggers.lib.php
index 4e344ce474..cc76685f04 100644
--- a/libraries/rte/rte_triggers.lib.php
+++ b/libraries/rte/rte_triggers.lib.php
@@ -72,13 +72,21 @@ function PMA_TRI_handleEditor()
$drop_item = $trigger['drop'] . ';';
$result = PMA_DBI_try_query($drop_item);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $drop_item) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($drop_item)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$result = PMA_DBI_try_query($item_query);
if (! $result) {
- $errors[] = sprintf(__('The following query has failed: "%s"'), $item_query) . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = sprintf(
+ __('The following query has failed: "%s"'),
+ htmlspecialchars($item_query)
+ )
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
// We dropped the old item, but were unable to create the new one
// Try to restore the backup query
$result = PMA_DBI_try_query($create_item);
@@ -86,9 +94,14 @@ function PMA_TRI_handleEditor()
// OMG, this is really bad! We dropped the query, failed to create a new one
// and now even the backup query does not execute!
// This should not happen, but we better handle this just in case.
- $errors[] = __('Sorry, we failed to restore the dropped trigger.') . '
'
- . __('The backed up query was:') . "\"$create_item\"" . '
'
- . __('MySQL said: ') . PMA_DBI_getError(null);
+ $errors[] = __(
+ 'Sorry, we failed to restore the dropped trigger.'
+ )
+ . '
'
+ . __('The backed up query was:')
+ . "\"" . htmlspecialchars($create_item) . "\""
+ . '
'
+ . __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Trigger %1$s has been modified.'));