Skip to content

Commit

Permalink
Merge branch 'MAINT_3_5_3' into QA_3_5
Browse files Browse the repository at this point in the history
  • Loading branch information
ruleant committed Oct 3, 2012
2 parents 1b399f9 + cfd688d commit b27785a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 27 deletions.
35 changes: 26 additions & 9 deletions libraries/rte/rte_events.lib.php
Expand Up @@ -99,23 +99,36 @@ 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) . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($drop_item)
)
. '<br />'
. __('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) . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($item_query)
)
. '<br />'
. __('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);
if (! $result) {
// 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.') . '<br />'
. __('The backed up query was:') . "\"$create_item\"" . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = __(
'Sorry, we failed to restore the dropped event.'
)
. '<br />'
. __('The backed up query was:')
. "\"" . htmlspecialchars($create_item) . "\""
. '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Event %1$s has been modified.'));
Expand All @@ -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) . '<br /><br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($item_query)
)
. '<br /><br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$message = PMA_Message::success(__('Event %1$s has been created.'));
$message->addParam(PMA_backquote($_REQUEST['item_name']));
Expand Down
45 changes: 34 additions & 11 deletions libraries/rte/rte_routines.lib.php
Expand Up @@ -249,23 +249,36 @@ 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) . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($drop_routine)
)
. '<br />'
. __('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) . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($routine_query)
)
. '<br />'
. __('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);
if (! $result) {
// 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.') . '<br />'
. __('The backed up query was:') . "\"$create_routine\"" . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = __(
'Sorry, we failed to restore the dropped routine.'
)
. '<br />'
. __('The backed up query was:')
. "\"" . htmlspecialchars($create_routine) . "\""
. '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Routine %1$s has been modified.'));
Expand All @@ -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) . '<br /><br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($routine_query)
)
. '<br /><br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_backquote($_REQUEST['item_name']));
Expand Down Expand Up @@ -1251,8 +1268,14 @@ function PMA_RTN_handleExecute()
}
} else {
$output = '';
$message = PMA_message::error(sprintf(__('The following query has failed: "%s"'), $query) . '<br /><br />'
. __('MySQL said: ') . PMA_DBI_getError(null));
$message = PMA_message::error(
sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($query)
)
. '<br /><br />'
. __('MySQL said: ') . PMA_DBI_getError(null)
);
}
// Print/send output
if ($GLOBALS['is_ajax_request']) {
Expand Down
27 changes: 20 additions & 7 deletions libraries/rte/rte_triggers.lib.php
Expand Up @@ -72,23 +72,36 @@ 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) . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($drop_item)
)
. '<br />'
. __('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) . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = sprintf(
__('The following query has failed: "%s"'),
htmlspecialchars($item_query)
)
. '<br />'
. __('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);
if (! $result) {
// 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.') . '<br />'
. __('The backed up query was:') . "\"$create_item\"" . '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
$errors[] = __(
'Sorry, we failed to restore the dropped trigger.'
)
. '<br />'
. __('The backed up query was:')
. "\"" . htmlspecialchars($create_item) . "\""
. '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Trigger %1$s has been modified.'));
Expand Down

0 comments on commit b27785a

Please sign in to comment.