1 && ($_POST["drop"] || $_POST["truncate"])) { queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once } if ($_POST["truncate"]) { if ($_POST["tables"]) { $result = truncate_tables($_POST["tables"]); } $message = lang('Tables have been truncated.'); } elseif ($_POST["move"]) { $rename = array(); foreach ($tables_views as $table) { $rename[] = idf_escape($table) . " TO " . idf_escape($_POST["target"]) . "." . idf_escape($table); } $result = queries("RENAME TABLE " . implode(", ", $rename)); //! move triggers $message = lang('Tables have been moved.'); } elseif ($_POST["drop"]) { if ($_POST["views"]) { $result = drop_views($_POST["views"]); } if ($result && $_POST["tables"]) { $result = drop_tables($_POST["tables"]); } $message = lang('Tables have been dropped.'); } elseif ($_POST["tables"] && ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) { while ($row = $result->fetch_assoc()) { $message .= h("$row[Table]: $row[Msg_text]") . "
"; } } queries_redirect(substr(ME, 0, -1), $message, $result); } page_header(lang('Database') . ": " . h(DB), $error, true); echo '

' . lang('Alter database') . "\n"; echo '' . lang('Database schema') . "\n"; $sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0); echo "

" . lang('Tables and views') . "

\n"; $tables_list = tables_list(); if (!$tables_list) { echo "

" . lang('No tables.') . "\n"; } else { echo "

\n"; echo "

\n"; if ($_POST["search"] && $_POST["query"] != "") { $_GET["where"][0]["op"] = "LIKE %%"; $_GET["where"][0]["val"] = $_POST["query"]; search_tables(); } echo "\n"; echo '\n"; foreach ($tables_list as $name => $type) { $view = (isset($type) && !eregi("table", $type)); echo '
' . lang('Table') . '' . lang('Engine') . '' . lang('Collation') . '' . lang('Data Length') . '' . lang('Index Length') . '' . lang('Data Free') . '' . lang('Auto Increment') . '' . lang('Rows') . (support("comment") ? '' . lang('Comment') : '') . "
' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');"); echo '' . h($name) . ''; if ($view) { echo '' . lang('View') . ''; echo '?'; } else { echo "  "; foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "auto_increment=1&create", "Rows" => "select") as $key => $link) { echo "?"; } } echo (support("comment") ? " " : ""); } echo "
 " . lang('%d in total', count($tables_list)); echo "" . $connection->result("SELECT @@storage_engine"); echo "" . db_collation(DB, collations()); foreach ($sums as $key => $val) { echo " "; } echo "
\n"; if (!information_schema(DB)) { echo "

" . ($driver == "sql" ? " " : "") . " \n"; $dbs = get_databases(); if (count($dbs) != 1) { $db = (isset($_POST["target"]) ? $_POST["target"] : DB); echo "

" . lang('Move to other database') . ($dbs ? ": " . html_select("target", $dbs, $db) : ': ') . " \n"; } } echo "

\n"; } echo '

' . lang('Create table') . "\n"; if (support("view")) { echo '' . lang('Create view') . "\n"; } if (support("routine")) { echo "

" . lang('Routines') . "

\n"; $result = $connection->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . $connection->quote(DB)); if ($result->num_rows) { echo "\n"; while ($row = $result->fetch_assoc()) { echo ""; echo "
" . h($row["ROUTINE_TYPE"]); echo '' . h($row["ROUTINE_NAME"]) . ''; echo '' . lang('Alter') . ""; } echo "
\n"; } echo '

' . lang('Create procedure') . ' ' . lang('Create function') . "\n"; } if (support("event")) { echo "

" . lang('Events') . "

\n"; $result = $connection->query("SHOW EVENTS"); if ($result && $result->num_rows) { echo "\n"; echo "\n"; while ($row = $result->fetch_assoc()) { echo ""; echo '
" . lang('Name') . "" . lang('Schedule') . "" . lang('Start') . "" . lang('End') . "
' . h($row["Name"]) . ""; echo "" . ($row["Execute at"] ? lang('At given time') . "" . $row["Execute at"] : lang('Every') . " " . $row["Interval value"] . " " . $row["Interval field"] . "$row[Starts]"); echo "$row[Ends]"; } echo "
\n"; } echo '

' . lang('Create event') . "\n"; } page_footer(); $table_status = table_status(); if ($table_status) { echo "\n"; } exit; // page_footer() already called