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
|
* @return string html code for a footnote marker
|
||||||
* @access public
|
* @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])) {
|
if (! isset($GLOBALS['footnotes'][$key])) {
|
||||||
$nr = count($GLOBALS['footnotes']) + 1;
|
$nr = count($GLOBALS['footnotes']) + 1;
|
||||||
$GLOBALS['footnotes'][$key] = array(
|
$GLOBALS['footnotes'][$key] = array(
|
||||||
'note' => $hint_message,
|
'note' => $message,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'nr' => $nr,
|
'nr' => $nr,
|
||||||
);
|
);
|
||||||
@@ -1006,6 +1011,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
|
|||||||
echo '<h1>' . $GLOBALS['strError'] . '</h1>' . "\n";
|
echo '<h1>' . $GLOBALS['strError'] . '</h1>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($message instanceof PMA_Message) {
|
||||||
|
$message->display();
|
||||||
|
} else {
|
||||||
echo '<div class="' . $type . '">';
|
echo '<div class="' . $type . '">';
|
||||||
echo PMA_sanitize($message);
|
echo PMA_sanitize($message);
|
||||||
if (isset($GLOBALS['special_message'])) {
|
if (isset($GLOBALS['special_message'])) {
|
||||||
@@ -1013,6 +1021,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
|
|||||||
unset($GLOBALS['special_message']);
|
unset($GLOBALS['special_message']);
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($GLOBALS['show_error_header'])) {
|
if (!empty($GLOBALS['show_error_header'])) {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@@ -1141,15 +1150,15 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
|
|||||||
|
|
||||||
if (preg_match('@^SELECT[[:space:]]+@i', $sql_query)) {
|
if (preg_match('@^SELECT[[:space:]]+@i', $sql_query)) {
|
||||||
$explain_link .= urlencode('EXPLAIN ' . $sql_query);
|
$explain_link .= urlencode('EXPLAIN ' . $sql_query);
|
||||||
$message = $GLOBALS['strExplain'];
|
$_message = $GLOBALS['strExplain'];
|
||||||
} elseif (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $sql_query)) {
|
} elseif (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $sql_query)) {
|
||||||
$explain_link .= urlencode(substr($sql_query, 8));
|
$explain_link .= urlencode(substr($sql_query, 8));
|
||||||
$message = $GLOBALS['strNoExplain'];
|
$_message = $GLOBALS['strNoExplain'];
|
||||||
} else {
|
} else {
|
||||||
$explain_link = '';
|
$explain_link = '';
|
||||||
}
|
}
|
||||||
if (!empty($explain_link)) {
|
if (!empty($explain_link)) {
|
||||||
$explain_link = ' [' . PMA_linkOrButton($explain_link, $message) . ']';
|
$explain_link = ' [' . PMA_linkOrButton($explain_link, $_message) . ']';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$explain_link = '';
|
$explain_link = '';
|
||||||
@@ -1168,12 +1177,12 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
|
|||||||
|
|
||||||
if (!empty($GLOBALS['show_as_php'])) {
|
if (!empty($GLOBALS['show_as_php'])) {
|
||||||
$php_link .= '0';
|
$php_link .= '0';
|
||||||
$message = $GLOBALS['strNoPhp'];
|
$_message = $GLOBALS['strNoPhp'];
|
||||||
} else {
|
} else {
|
||||||
$php_link .= '1';
|
$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'])) {
|
if (isset($GLOBALS['show_as_php'])) {
|
||||||
$runquery_link
|
$runquery_link
|
||||||
|
@@ -146,13 +146,18 @@ echo PMA_pluginGetJavascript($export_list);
|
|||||||
$trans = '__SERVER__/' . $strFileNameTemplateDescriptionServer;
|
$trans = '__SERVER__/' . $strFileNameTemplateDescriptionServer;
|
||||||
if ($export_type == 'database' || $export_type == 'table') {
|
if ($export_type == 'database' || $export_type == 'table') {
|
||||||
$trans .= ', __DB__/' . $strFileNameTemplateDescriptionDatabase;
|
$trans .= ', __DB__/' . $strFileNameTemplateDescriptionDatabase;
|
||||||
}
|
|
||||||
if ($export_type == 'table') {
|
if ($export_type == 'table') {
|
||||||
$trans .= ', __TABLE__/' . $strFileNameTemplateDescriptionTable;
|
$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>:
|
</label>:
|
||||||
<input type="text" name="filename_template" id="filename_template"
|
<input type="text" name="filename_template" id="filename_template"
|
||||||
|
@@ -150,7 +150,7 @@ if (isset($_REQUEST['primary_key'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query = array();
|
$query = array();
|
||||||
$message = '';
|
$message = new PMA_Message();
|
||||||
$value_sets = array();
|
$value_sets = array();
|
||||||
$func_no_param = array(
|
$func_no_param = array(
|
||||||
'NOW',
|
'NOW',
|
||||||
@@ -274,12 +274,15 @@ if ($is_insert && count($value_sets) > 0) {
|
|||||||
|
|
||||||
unset($query_fields, $value_sets);
|
unset($query_fields, $value_sets);
|
||||||
|
|
||||||
$message .= $GLOBALS['strInsertedRows'] . ' ';
|
$message->setString('strInsertedRows');
|
||||||
|
$message->isSuccess(true);
|
||||||
} elseif (! empty($query)) {
|
} elseif (! empty($query)) {
|
||||||
$message .= $GLOBALS['strAffectedRows'] . ' ';
|
$message->setString('strAffectedRows');
|
||||||
|
$message->isSuccess(true);
|
||||||
} else {
|
} else {
|
||||||
// No change -> move back to the calling script
|
// No change -> move back to the calling script
|
||||||
$message .= $GLOBALS['strNoModification'];
|
$message->setString('strNoModification');
|
||||||
|
$message->isSuccess(true);
|
||||||
$GLOBALS['js_include'][] = 'functions.js';
|
$GLOBALS['js_include'][] = 'functions.js';
|
||||||
$active_page = $goto_include;
|
$active_page = $goto_include;
|
||||||
require_once './libraries/header.inc.php';
|
require_once './libraries/header.inc.php';
|
||||||
@@ -300,6 +303,7 @@ $GLOBALS['sql_query'] = implode('; ', $query) . ';';
|
|||||||
$total_affected_rows = 0;
|
$total_affected_rows = 0;
|
||||||
$last_message = '';
|
$last_message = '';
|
||||||
$warning_message = '';
|
$warning_message = '';
|
||||||
|
$error_message = '';
|
||||||
|
|
||||||
foreach ($query as $single_query) {
|
foreach ($query as $single_query) {
|
||||||
if ($GLOBALS['cfg']['IgnoreMultiSubmitErrors']) {
|
if ($GLOBALS['cfg']['IgnoreMultiSubmitErrors']) {
|
||||||
@@ -309,7 +313,7 @@ foreach ($query as $single_query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
$message .= PMA_DBI_getError();
|
$error_message .= '<br />' . PMA_DBI_getError();
|
||||||
} else {
|
} else {
|
||||||
if (@PMA_DBI_affected_rows()) {
|
if (@PMA_DBI_affected_rows()) {
|
||||||
$total_affected_rows += @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) {
|
if ($total_affected_rows > 0) {
|
||||||
$insert_id = $insert_id + $total_affected_rows - 1;
|
$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);
|
PMA_DBI_free_result($result);
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
foreach (PMA_DBI_get_warnings() as $warning) {
|
foreach (PMA_DBI_get_warnings() as $warning) {
|
||||||
$warning_message .= $warning['Level'] . ': #' . $warning['Code']
|
$warning_message .= '<br />' . $warning['Level'] . ': #' . $warning['Code']
|
||||||
. ' ' . $warning['Message'] . '[br]';
|
. ' ' . $warning['Message'];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($result);
|
unset($result);
|
||||||
}
|
}
|
||||||
unset($single_query, $query);
|
unset($single_query, $query);
|
||||||
|
|
||||||
$message .= $total_affected_rows . $last_message;
|
$message->append(' ' . $total_affected_rows . $last_message);
|
||||||
|
|
||||||
if (! empty($warning_message)) {
|
if (! empty($warning_message)) {
|
||||||
/**
|
/**
|
||||||
* @todo use a <div class="warning"> in PMA_showMessage() for this part of
|
* @todo use a <div class="warning"> in PMA_showMessage() for this part of
|
||||||
* the message
|
* 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)) {
|
if (isset($return_to_sql_query)) {
|
||||||
$disp_query = $GLOBALS['sql_query'];
|
$disp_query = $GLOBALS['sql_query'];
|
||||||
|
Reference in New Issue
Block a user