diff --git a/db_stats.php3 b/db_stats.php3 index bb5ebd751..305e97775 100644 --- a/db_stats.php3 +++ b/db_stats.php3 @@ -2,13 +2,80 @@ /* $Id$ */ /** - * Gets the variables sent to this script, retains the db name that may have - * been defined as startup option and include a core library + * Gets the variables sent to this script and send headers */ require('./grab_globals.inc.php3'); +$js_to_run = 'functions.js'; require('./header.inc.php3'); +/* ---------------- The user requires some db to be dropped ---------------- */ + +if (!empty($submit) || isset($btnDrop)) { + + /** + * Confirmation form + */ + if (!empty($submit) && !empty($selected_db)) { + + // 1.1 Builds the query + $full_query = ''; + $drop_cnt = count($selected_db); + for ($i = 0; $i < $drop_cnt; $i++) { + $full_query .= 'DROP DATABASE ' . backquote(htmlspecialchars(urldecode($selected_db[$i]))) . ';
'; + } + + // 1.2 Displays the form + echo $strDoYouReally . ' :
' . "\n"; + echo '' . $full_query . ' ?
' . "\n"; + ?> +
+ + + ' . "\n"; + } + ?> + + +
+ + + 0) { } + /** * Displays the page */ @@ -114,8 +182,12 @@ if ($server > 0) { if ($num_dbs > 0) { // Defines the urls used to sort the table $common_url = 'db_stats.php3?lang=' . $lang . '&server=' . $server; - if (empty($sort_order)) { - $sort_order = ((empty($sort_by) || $sort_by == 'db_name') ? 'asc' : 'desc'); + if (empty($sort_by)) { + $sort_by = 'db_name'; + $sort_order = 'asc'; + } + else if (empty($sort_order)) { + $sort_order = (($sort_by == 'db_name') ? 'asc' : 'desc'); } $img_tag = ' ' . "\n" . ' ' @@ -126,7 +198,7 @@ if ($num_dbs > 0) { $url_sort[$i]['order'] = (($i == 0) ? 'asc' : 'desc'); $url_sort[$i]['img_tag'] = ''; } - if (empty($sort_by) || $sort_by == 'db_name') { + if ($sort_by == 'db_name') { $url_sort[0]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[0]['img_tag'] = $img_tag; $col = 'key'; // used in 'pmaDbCmp()' @@ -148,35 +220,39 @@ if ($num_dbs > 0) { $col = 3; } ?> - - - - - - - - - + + + + +
  -   - -   - -   - -   - -   - -   - -   - -   - -   - -   -
+ + + + + + + + 0) { } } // end for - // Sorts the dbs arrays (already sorted if 'db_name' ascending order) - if (!empty($sort_by) - && !($sort_by == 'db_name' && $sort_order == 'asc')) { - uksort($dbs_array, 'pmaDbCmp'); - reset($dbs_array); - } + // Sorts the dbs arrays + uksort($dbs_array, 'pmaDbCmp'); + reset($dbs_array); // Displays the tables stats per database $i = 0; @@ -231,14 +304,16 @@ if ($num_dbs > 0) { list($idx_size, $idx_unit) = format_byte_down($dbs_array[$db_name][2], 3, 1); list($tot_size, $tot_unit) = format_byte_down($dbs_array[$db_name][3], 3, 1); - echo '' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo '' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; $i++; } // end while @@ -249,15 +324,25 @@ if ($num_dbs > 0) { list($idx_size, $idx_unit) = format_byte_down($total_array[2], 3, 1); list($tot_size, $tot_unit) = format_byte_down($total_array[3], 3, 1); - echo '' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo '' . "\n"; - echo '
  +   + +   + +   + +   + +   + +   + +   + +   + +   + +   +
 ' . ($i + 1) . '  ' . htmlentities($db_name) . '  ' . $dbs_array[$db_name][0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
' . "\n"; + echo '   ' . "\n"; + echo '  ' . htmlentities($db_name) . '  ' . $dbs_array[$db_name][0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
  ' . $strSum . ': ' . $num_dbs . ' ' . $total_array[0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
' . "\n"; + echo ' ' . "\n"; + echo '  ' . "\n"; + echo '  ' . $strSum . ': ' . $num_dbs . '' . "\n"; + echo '  ' . $total_array[0] . ' ' . "\n"; + echo '  ' . $data_size . ' ' . $data_unit . ' ' . "\n"; + echo '  ' . $idx_size . ' ' . $idx_unit . ' ' . "\n"; + echo '  ' . $tot_size . ' ' . $tot_unit . ' ' . "\n"; + echo ' ' . "\n\n"; + + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . $strWithChecked . '' . "\n"; + echo ' ' . $strWithChecked . '  ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + + echo ' ' . "\n\n"; + + echo '' . "\n"; unset($total_array); } // end if ($num_dbs > 0) @@ -272,7 +357,10 @@ else { - - + +/** + * Displays the footer + */ +require('./footer.inc.php3'); +?> diff --git a/images/arrow.gif b/images/arrow.gif new file mode 100644 index 000000000..3716c54e1 Binary files /dev/null and b/images/arrow.gif differ