make use of new message object
This commit is contained in:
@@ -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 '<h1>' . $GLOBALS['strError'] . '</h1>' . "\n";
|
||||
}
|
||||
|
||||
echo '<div class="' . $type . '">';
|
||||
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 '<div class="' . $type . '">';
|
||||
echo PMA_sanitize($message);
|
||||
if (isset($GLOBALS['special_message'])) {
|
||||
echo PMA_sanitize($GLOBALS['special_message']);
|
||||
unset($GLOBALS['special_message']);
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
if (!empty($GLOBALS['show_error_header'])) {
|
||||
echo '</div>';
|
||||
@@ -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
|
||||
|
@@ -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,
|
||||
'<a href="http://www.php.net/strftime" target="documentation" title="'
|
||||
. $strDocu . '">', '</a>', $trans));
|
||||
|
||||
$message = new PMA_Message('strFileNameTemplateDescription');
|
||||
$message->addParam('<a href="http://php.net/strftime" target="documentation" title="'
|
||||
. $strDocu . '">');
|
||||
$message->addParam('</a>');
|
||||
$message->addParam($trans);
|
||||
|
||||
echo PMA_showHint($message);
|
||||
?>
|
||||
</label>:
|
||||
<input type="text" name="filename_template" id="filename_template"
|
||||
|
@@ -150,7 +150,7 @@ if (isset($_REQUEST['primary_key'])) {
|
||||
}
|
||||
|
||||
$query = array();
|
||||
$message = '';
|
||||
$message = new PMA_Message();
|
||||
$value_sets = array();
|
||||
$func_no_param = array(
|
||||
'NOW',
|
||||
@@ -274,12 +274,15 @@ if ($is_insert && count($value_sets) > 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 .= '<br />' . 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 .= '<br />' . $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 .= '<br />' . $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 <div class="warning"> 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'];
|
||||
|
Reference in New Issue
Block a user