diff --git a/db_operations.php b/db_operations.php index 29e7b662b..5a01d2682 100644 --- a/db_operations.php +++ b/db_operations.php @@ -30,12 +30,15 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { $move = false; } + $_msg_type = 'success'; + if (!isset($newname) || !strlen($newname)) { - $message = $strDatabaseEmpty; + $_message = $strDatabaseEmpty; + $_msg_type = 'error'; } else { $sql_query = ''; // in case target db exists if ($move || - (isset($create_database_before_copying) && $create_database_before_copying)) { + (isset($create_database_before_copying) && $create_database_before_copying)) { /** * @todo activate this with the correct version of MySQL * when they fix the problem when the db contains a VIEW @@ -85,9 +88,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { // value of $what for this table only $this_what = $what; - if (!isset($tables_full[$each_table]['Engine'])) { - $tables_full[$each_table]['Engine'] = $tables_full[$each_table]['Type']; - } // do not copy the data from a Merge table // note: on the calling FORM, 'data' means 'structure and data' if ($tables_full[$each_table]['Engine'] == 'MRG_MyISAM') { @@ -107,7 +107,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { unset($GLOBALS['sql_constraints_query']); } } - + // $sql_query is filled by PMA_Table::moveCopy() $sql_query = $back . $sql_query; } // end (foreach) unset($each_table); @@ -154,10 +154,10 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { $sql_query .= "\n" . $local_query; PMA_DBI_query($local_query); } - $message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), + $_message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); } else { - $message = sprintf($strCopyDatabaseOK, htmlspecialchars($db), + $_message = sprintf($strCopyDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); } $reload = true; @@ -202,6 +202,11 @@ if (empty($is_info)) { $sub_part = '_structure'; require './libraries/db_info.inc.php'; echo "\n"; + + if (iseet($_message)) { + PMA_showMessage($_message, $sql_query, $_msg_type); + unset($_message, $_msg_type); + } } $db_collation = PMA_getDbCollation($db); diff --git a/import.php b/import.php index 1bc2e28f6..46acb2b23 100644 --- a/import.php +++ b/import.php @@ -50,8 +50,8 @@ if (!empty($sql_query)) { // upload limit has been reached, let's assume the second possibility. if ($_POST == array() && $_GET == array()) { require_once './libraries/header.inc.php'; - $show_error_header = TRUE; - PMA_showMessage(sprintf($strUploadLimit, '[a@./Documentation.html#faq1_16@_blank]', '[/a]')); + PMA_showMessage(sprintf($strUploadLimit, '[a@./Documentation.html#faq1_16@_blank]', '[/a]'), + null, 'error'); require './libraries/footer.inc.php'; } diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index 4265770df..2d86ae4c4 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -35,9 +35,7 @@ $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $exp /* Fail if we didn't find any plugin */ if (empty($export_list)) { - $GLOBALS['show_error_header'] = TRUE; - PMA_showMessage($strCanNotLoadExportPlugins); - unset($GLOBALS['show_error_header']); + PMA_showMessage($strCanNotLoadExportPlugins, null, 'error'); require './libraries/footer.inc.php'; } ?> diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index 6d22d7ef2..d753d31e3 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -16,9 +16,7 @@ $import_list = PMA_getPlugins('./libraries/import/', $import_type); /* Fail if we didn't find any plugin */ if (empty($import_list)) { - $GLOBALS['show_error_header'] = TRUE; - PMA_showMessage($strCanNotLoadImportPlugins); - unset($GLOBALS['show_error_header']); + PMA_showMessage($strCanNotLoadImportPlugins, null, 'error'); require './libraries/footer.inc.php'; } ?> diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 6757abfe8..047b2f460 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1868,7 +1868,13 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) $last_shown_rec = ($_SESSION['userconf']['max_rows'] == 'all' || $pos_next > $total) ? $total - 1 : $pos_next - 1; - PMA_showMessage($GLOBALS['strShowingRecords'] . ' ' . $_SESSION['userconf']['pos'] . ' - ' . $last_shown_rec . ' (' . $pre_count . PMA_formatNumber($total, 0) . $after_count . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')'); + PMA_showMessage($GLOBALS['strShowingRecords'] . ' ' + . $_SESSION['userconf']['pos'] . ' - ' . $last_shown_rec + . ' (' . $pre_count . PMA_formatNumber($total, 0) . $after_count + . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' + . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')', + $sql_query, + 'success'); if (PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCount']) { echo '
' . "\n"; @@ -1876,7 +1882,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) echo '
' . "\n"; } } elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { - PMA_showMessage($GLOBALS['strSQLQuery']); + PMA_showMessage($GLOBALS['strSuccess'], $sql_query, 'success'); } // 2.3 Displays the navigation bars diff --git a/server_binlog.php b/server_binlog.php index 7ba706f5d..5925b4e35 100644 --- a/server_binlog.php +++ b/server_binlog.php @@ -144,7 +144,7 @@ if (count($binary_logs) > 1) { echo ''; } -PMA_showMessage($GLOBALS['strSuccess']); +PMA_showMessage($GLOBALS['strSuccess'], null, 'success'); /** * Displays the page diff --git a/server_processlist.php b/server_processlist.php index d41e132e4..0a11c706b 100644 --- a/server_processlist.php +++ b/server_processlist.php @@ -49,7 +49,7 @@ echo '

' . "\n" $sql_query = 'SHOW' . (empty($full) ? '' : ' FULL') . ' PROCESSLIST'; $result = PMA_DBI_query($sql_query); -PMA_showMessage($GLOBALS['strSuccess']); +PMA_showMessage($GLOBALS['strSuccess'], null, 'success'); /** diff --git a/sql.php b/sql.php index 5c159de5a..d61fbe3e9 100644 --- a/sql.php +++ b/sql.php @@ -572,10 +572,7 @@ else { // Display previous update query (from tbl_replace) if (isset($disp_query) && $cfg['ShowSQL'] == true) { - $tmp_sql_query = $GLOBALS['sql_query']; - $GLOBALS['sql_query'] = $disp_query; - PMA_showMessage($disp_message); - $GLOBALS['sql_query'] = $tmp_sql_query; + PMA_showMessage($disp_message, $disp_query, 'success'); } if (isset($profiling_results)) { diff --git a/tbl_operations.php b/tbl_operations.php index d57fee7e7..d7c7c3c03 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -43,23 +43,23 @@ PMA_DBI_select_db($GLOBALS['db']); require './libraries/tbl_info.inc.php'; $reread_info = false; -$errors = array(); $table_alters = array(); /** * Updates table comment, type and options if required */ if (isset($_REQUEST['submitoptions'])) { - $message = ''; + $_message = ''; if (isset($_REQUEST['new_name'])) { if ($pma_table->rename($_REQUEST['new_name'])) { - $message .= $pma_table->getLastMessage(); - $GLOBALS['table'] = $pma_table->getName();; + $_message .= $pma_table->getLastMessage(); + $result = true; + $GLOBALS['table'] = $pma_table->getName(); $reread_info = true; $reload = true; } else { - $errors[] = $pma_table->getLastError(); - $message .= $pma_table->getLastError(); + $_message .= $pma_table->getLastError(); + $result = false; } } if (isset($_REQUEST['comment']) @@ -108,7 +108,7 @@ if (isset($_REQUEST['submitoptions'])) { if (count($table_alters) > 0) { $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']); $sql_query .= "\r\n" . implode("\r\n", $table_alters); - $message .= PMA_DBI_query($sql_query) ? $strSuccess : $strError; + $result .= PMA_DBI_query($sql_query) ? true : false; $reread_info = true; unset($table_alters); } @@ -123,7 +123,7 @@ if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) { if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') { $sql_query .= ' DESC'; } - $message = PMA_DBI_query($sql_query) ? $strSuccess : $strError; + $result = PMA_DBI_query($sql_query); } // end if @@ -138,6 +138,14 @@ unset($reread_info); */ require_once './libraries/tbl_links.inc.php'; +if (isset($result)) { + if (empty($_message)) { + $_message = $result ? $strSuccess : $strError; + $_type = $result ? 'success' : 'error'; + } + PMA_showMessage($_message, $sql_query, $_type); +} + $url_params['goto'] = 'tbl_operations.php'; $url_params['back'] = 'tbl_operations.php'; @@ -501,7 +509,7 @@ if ($cfgRelation['relwork'] && $tbl_type != "INNODB") { ?> ' . $strChangePassword . '

' . "\n\n"; - PMA_showMessage($strUpdateProfileMessage, $sql_query); + PMA_showMessage($strUpdateProfileMessage, $sql_query, 'success'); ?>