diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 4117cc4a3..67078f577 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -432,14 +432,19 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false)
* @return string html code for a footnote marker
* @access public
*/
-function PMA_showHint($hint_message, $bbcode = false, $type = 'notice')
+function PMA_showHint($message, $bbcode = false, $type = 'notice')
{
- $key = md5($hint_message);
+ if ($message instanceof PMA_Message) {
+ $key = $message->getHash();
+ $type = $message->getLevel();
+ } else {
+ $key = md5($message);
+ }
if (! isset($GLOBALS['footnotes'][$key])) {
$nr = count($GLOBALS['footnotes']) + 1;
$GLOBALS['footnotes'][$key] = array(
- 'note' => $hint_message,
+ 'note' => $message,
'type' => $type,
'nr' => $nr,
);
@@ -1006,13 +1011,17 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
echo '
' . $GLOBALS['strError'] . '
' . "\n";
}
- echo '';
- echo PMA_sanitize($message);
- if (isset($GLOBALS['special_message'])) {
- echo PMA_sanitize($GLOBALS['special_message']);
- unset($GLOBALS['special_message']);
+ if ($message instanceof PMA_Message) {
+ $message->display();
+ } else {
+ echo '
';
+ echo PMA_sanitize($message);
+ if (isset($GLOBALS['special_message'])) {
+ echo PMA_sanitize($GLOBALS['special_message']);
+ unset($GLOBALS['special_message']);
+ }
+ echo '
';
}
- echo '
';
if (!empty($GLOBALS['show_error_header'])) {
echo '';
@@ -1141,15 +1150,15 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
if (preg_match('@^SELECT[[:space:]]+@i', $sql_query)) {
$explain_link .= urlencode('EXPLAIN ' . $sql_query);
- $message = $GLOBALS['strExplain'];
+ $_message = $GLOBALS['strExplain'];
} elseif (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $sql_query)) {
$explain_link .= urlencode(substr($sql_query, 8));
- $message = $GLOBALS['strNoExplain'];
+ $_message = $GLOBALS['strNoExplain'];
} else {
$explain_link = '';
}
if (!empty($explain_link)) {
- $explain_link = ' [' . PMA_linkOrButton($explain_link, $message) . ']';
+ $explain_link = ' [' . PMA_linkOrButton($explain_link, $_message) . ']';
}
} else {
$explain_link = '';
@@ -1168,12 +1177,12 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
if (!empty($GLOBALS['show_as_php'])) {
$php_link .= '0';
- $message = $GLOBALS['strNoPhp'];
+ $_message = $GLOBALS['strNoPhp'];
} else {
$php_link .= '1';
- $message = $GLOBALS['strPhp'];
+ $_message = $GLOBALS['strPhp'];
}
- $php_link = ' [' . PMA_linkOrButton($php_link, $message) . ']';
+ $php_link = ' [' . PMA_linkOrButton($php_link, $_message) . ']';
if (isset($GLOBALS['show_as_php'])) {
$runquery_link
diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php
index 2d86ae4c4..5694f9955 100644
--- a/libraries/display_export.lib.php
+++ b/libraries/display_export.lib.php
@@ -146,13 +146,18 @@ echo PMA_pluginGetJavascript($export_list);
$trans = '__SERVER__/' . $strFileNameTemplateDescriptionServer;
if ($export_type == 'database' || $export_type == 'table') {
$trans .= ', __DB__/' . $strFileNameTemplateDescriptionDatabase;
+ if ($export_type == 'table') {
+ $trans .= ', __TABLE__/' . $strFileNameTemplateDescriptionTable;
+ }
}
- if ($export_type == 'table') {
- $trans .= ', __TABLE__/' . $strFileNameTemplateDescriptionTable;
- }
- echo PMA_showHint(sprintf($strFileNameTemplateDescription,
- '', '', $trans));
+
+ $message = new PMA_Message('strFileNameTemplateDescription');
+ $message->addParam('');
+ $message->addParam('');
+ $message->addParam($trans);
+
+ echo PMA_showHint($message);
?>
:
0) {
unset($query_fields, $value_sets);
- $message .= $GLOBALS['strInsertedRows'] . ' ';
+ $message->setString('strInsertedRows');
+ $message->isSuccess(true);
} elseif (! empty($query)) {
- $message .= $GLOBALS['strAffectedRows'] . ' ';
+ $message->setString('strAffectedRows');
+ $message->isSuccess(true);
} else {
// No change -> move back to the calling script
- $message .= $GLOBALS['strNoModification'];
+ $message->setString('strNoModification');
+ $message->isSuccess(true);
$GLOBALS['js_include'][] = 'functions.js';
$active_page = $goto_include;
require_once './libraries/header.inc.php';
@@ -300,6 +303,7 @@ $GLOBALS['sql_query'] = implode('; ', $query) . ';';
$total_affected_rows = 0;
$last_message = '';
$warning_message = '';
+$error_message = '';
foreach ($query as $single_query) {
if ($GLOBALS['cfg']['IgnoreMultiSubmitErrors']) {
@@ -309,7 +313,7 @@ foreach ($query as $single_query) {
}
if (! $result) {
- $message .= PMA_DBI_getError();
+ $error_message .= '
' . PMA_DBI_getError();
} else {
if (@PMA_DBI_affected_rows()) {
$total_affected_rows += @PMA_DBI_affected_rows();
@@ -323,30 +327,35 @@ foreach ($query as $single_query) {
if ($total_affected_rows > 0) {
$insert_id = $insert_id + $total_affected_rows - 1;
}
- $last_message .= '[br]' . $GLOBALS['strInsertedRowId'] . ' ' . $insert_id;
+ $last_message .= '
' . $GLOBALS['strInsertedRowId'] . ' ' . $insert_id;
}
PMA_DBI_free_result($result);
} // end if
foreach (PMA_DBI_get_warnings() as $warning) {
- $warning_message .= $warning['Level'] . ': #' . $warning['Code']
- . ' ' . $warning['Message'] . '[br]';
+ $warning_message .= '
' . $warning['Level'] . ': #' . $warning['Code']
+ . ' ' . $warning['Message'];
}
unset($result);
}
unset($single_query, $query);
-$message .= $total_affected_rows . $last_message;
+$message->append(' ' . $total_affected_rows . $last_message);
if (! empty($warning_message)) {
/**
* @todo use a in PMA_showMessage() for this part of
* the message
*/
- $message .= '[br]' . $warning_message;
+ $message->append($warning_message);
+ $message->isWarning(true);
}
-unset($warning_message, $total_affected_rows, $last_message);
+if (! empty($error_message)) {
+ $message->append($error_message);
+ $message->isError(true);
+}
+unset($error_message, $warning_message, $total_affected_rows, $last_message);
if (isset($return_to_sql_query)) {
$disp_query = $GLOBALS['sql_query'];