1 && ($_POST["drop"] || $_POST["truncate"] || $_POST["copy"])) { 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["copy"]) { $result = copy_tables((array) $_POST["tables"], (array) $_POST["views"], $_POST["target"]); $message = lang('Tables have been copied.'); } 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 ($jush == "sqlite") { $result = queries("VACUUM"); $message = lang('Tables have been optimized.'); } 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('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 '
'; echo '' . lang('Table'); echo '' . lang('Engine'); echo '' . lang('Collation'); echo '' . lang('Data Length'); echo '' . lang('Index Length'); echo '' . lang('Data Free'); echo '' . lang('Auto Increment'); echo '' . lang('Rows'); echo (support("comment") ? '' . lang('Comment') : ''); echo "
' . 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" => array(), "Collation" => array(), "Data_length" => array("create", lang('Alter table')), "Index_length" => array("indexes", lang('Alter indexes')), "Data_free" => array("edit", lang('New item')), "Auto_increment" => array("auto_increment=1&create", lang('Alter table')), "Rows" => array("select", lang('Select data')), ) as $key => $link) { echo ($link ? "?" : " "); } } echo (support("comment") ? " " : ""); } echo "
 " . lang('%d in total', count($tables_list)); echo "" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : ""); echo "" . nbsp(db_collation(DB, collations())); foreach (array("Data_length", "Index_length", "Data_free") as $key) { echo " "; } echo "
\n"; echo "\n"; if (!information_schema(DB)) { echo "

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

" . lang('Move to other database') . ": "; echo ($databases ? html_select("target", $databases, $db) : ''); echo " "; echo (support("copy") ? " " : ""); echo "\n"; } echo "\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 '

' . (support("procedure") ? '' . 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"; } } }