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"]) { $result = move_tables((array) $_POST["tables"], (array) $_POST["views"], $_POST["target"]); $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"]) . ": " . h($row["Msg_text"]) . "
"; } } queries_redirect(substr(ME, 0, -1), $message, $result); } page_header(($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema') . ": " . h($_GET["ns"])), $error, true); if ($adminer->homepage()) { if ($_GET["ns"] !== "") { echo '' . lang('Database schema') . "\n"; echo "

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

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

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

\n"; echo "

" . lang('Search data in tables') . ": \n"; if ($_POST["search"] && $_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 { foreach (array("Engine" => "", "Collation" => "", "Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "auto_increment=1&create", "Rows" => "select") as $key => $link) { echo ($link ? "?" : " "); } } echo (support("comment") ? " " : ""); } echo "
 " . lang('%d in total', count($tables_list)); echo "" . nbsp($connection->result("SELECT @@storage_engine")); echo "" . nbsp(db_collation(DB, collations())); foreach (array("Data_length", "Index_length", "Data_free") as $key) { echo " "; } echo "
\n"; if (!information_schema(DB)) { echo "

" . ($jush == "sql" ? " " : "") . " \n"; // 1 - eventStop $databases = (support("scheme") ? schemas() : get_databases()); if (count($databases) != 1 && $jush != "sqlite") { $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB)); echo "

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

\n"; } echo '

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

" . lang('Routines') . "

\n"; $routines = routines(); if ($routines) { echo "\n"; echo '\n"; odd(''); foreach ($routines as $row) { echo ''; echo '
' . lang('Name') . '' . lang('Type') . '' . lang('Return type') . " 
' . h($row["ROUTINE_NAME"]) . ''; echo '' . h($row["ROUTINE_TYPE"]); echo '' . h($row["DTD_IDENTIFIER"]); echo '' . lang('Alter') . ""; } echo "
\n"; } echo '

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

" . lang('Sequences') . "

\n"; $sequences = get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema()"); if ($sequences) { echo "\n"; echo "\n"; odd(''); foreach ($sequences as $val) { echo "
" . lang('Name') . "
" . h($val) . "\n"; } echo "
\n"; } echo "

" . lang('Create sequence') . "\n"; } if (support("type")) { echo "

" . lang('User types') . "

\n"; $types = types(); if ($types) { echo "\n"; echo "\n"; odd(''); foreach ($types as $val) { echo "
" . lang('Name') . "
" . h($val) . "\n"; } echo "
\n"; } echo "

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

" . lang('Events') . "

\n"; $rows = get_rows("SHOW EVENTS"); if ($rows) { echo "\n"; echo "\n"; foreach ($rows as $row) { 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"; } if ($tables_list) { echo "\n"; } } }