From 4b6342c71c962b1994ca1e54b1d772ee73d503c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 12 May 2003 18:57:24 +0000 Subject: [PATCH] Add confirmation when dropping databases --- ChangeLog | 2 ++ mult_submits.inc.php3 | 8 +++++++- server_databases.php3 | 24 ++++++++---------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index da6c58089..2597c8e83 100755 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ $Source$ 2003-05-12 Michal Cihar * index.php3: Better fix for #736003. * libraries/common.lib.php3: Light tabs were displayed wrong, bug #736590. + * mult_submits.inc.php3, server_databases.php: Add confirmation when + dropping databases (bug #736238). 2003-05-11 Michal Cihar * Documentation.html, config.inc.php3, diff --git a/mult_submits.inc.php3 b/mult_submits.inc.php3 index 49b571be7..861f40a4c 100644 --- a/mult_submits.inc.php3 +++ b/mult_submits.inc.php3 @@ -19,6 +19,9 @@ if (!empty($submit_mult) } else { $selected = $selected_tbl; switch ($submit_mult) { + case 'drop_db': + $what = 'drop_db'; + break; case $strDrop: $what = 'drop_tbl'; break; @@ -70,7 +73,7 @@ if (!empty($submit_mult) && !empty($what)) { $url_query .= '&goto=tbl_properties.php3&back=tbl_properties.php3'; include('./tbl_properties_table_info.php3'); } - else { + elseif (!empty($db)) { include('./db_details_common.php3'); include('./db_details_db_info.php3'); } @@ -131,6 +134,8 @@ if (!empty($submit_mult) && !empty($what)) { echo PMA_generate_common_hidden_inputs($db); } else if (strpos(' ' . $action, 'tbl_properties') == 1) { echo PMA_generate_common_hidden_inputs($db,$table); + } else { + echo PMA_generate_common_hidden_inputs(); } for ($i = 0; $i < $selected_cnt; $i++) { echo ' ' . "\n"; @@ -210,6 +215,7 @@ else if ($mult_btn == $strYes) { && $query_type != 'analyze_tbl' && $query_type != 'optimize_tbl' && $query_type != 'check_tbl') { + $sql_query .= $a_query . ';' . "\n"; if ($query_type != 'drop_db') { diff --git a/server_databases.php3 b/server_databases.php3 index a2ad63979..46f4cf87d 100644 --- a/server_databases.php3 +++ b/server_databases.php3 @@ -54,23 +54,15 @@ if ($server > 0 && empty($dblist)) { /** * Drops multiple databases */ -if (!empty($drop_selected_dbs) && ($is_superuser || $cfg['AllowUserDropDatabase'])) { - if (empty($selected_db)) { +if ((!empty($drop_selected_dbs) || isset($query_type)) && ($is_superuser || $cfg['AllowUserDropDatabase'])) { + if (empty($selected_db) && ! (isset($query_type) && !empty($selected))) { $message = $strNoDatabasesSelected; } else { - $sql_query = array(); - while (list(, $current_db) = each($selected_db)) { - $current_query = 'DROP DATABASE ' . PMA_backquote($current_db) . ';'; - $sql_query[] = $current_query; - PMA_mysql_query($current_query, $userlink) - // rabus: in case of an error, we display the full query in - // order to let the user know which databases have already been - // dropped. - or PMA_mysqlDie(PMA_mysql_error($userlink), join("\n", $sql_query)); - } - // PMA_showMessage() needs a string... - $sql_query = join("\n", $sql_query); - $message = sprintf($strDatabasesDropped, count($selected_db)); + $action = 'server_databases.php3'; + $submit_mult = 'drop_db' ; + $err_url = 'server_databases.php3?' . PMA_generate_common_url(); + include('./mult_submits.inc.php3'); + $message = sprintf($strDatabasesDropped, count($selected)); // we need to reload the database list now. PMA_availableDatabases(); $reload = 1; @@ -369,4 +361,4 @@ if (count($statistics) > 0) { */ require('./footer.inc.php3'); -?> \ No newline at end of file +?>