1) { queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once } if (isset($_POST["truncate"])) { if ($_POST["tables"]) { foreach ($_POST["tables"] as $table) { if (!queries("TRUNCATE " . idf_escape($table))) { $result = false; break; } } $message = lang('Tables have been truncated.'); } } elseif (isset($_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)); $message = lang('Tables have been moved.'); } elseif ((!isset($_POST["drop"]) || !$_POST["views"] || queries("DROP VIEW " . implode(", ", array_map('idf_escape', $_POST["views"])))) && (!$_POST["tables"] || ($result = queries((isset($_POST["optimize"]) ? "OPTIMIZE" : (isset($_POST["check"]) ? "CHECK" : (isset($_POST["repair"]) ? "REPAIR" : (isset($_POST["drop"]) ? "DROP" : "ANALYZE")))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) ) { if (isset($_POST["drop"])) { $message = lang('Tables have been dropped.'); } else { while ($row = $result->fetch_assoc()) { $message .= h("$row[Table]: $row[Msg_text]") . "
"; } } } query_redirect(queries(), substr(ME, 0, -1), $message, $result, false, !$result); } page_header(lang('Database') . ": " . h(DB), $error, false); echo '

' . lang('Alter database') . "\n"; echo '

' . lang('Database schema') . "\n"; echo "

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

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

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

\n"; echo "\n"; echo '\n"; foreach ($table_status as $row) { $name = $row["Name"]; echo '
' . lang('Table') . '' . lang('Engine') . '' . lang('Collation') . '' . lang('Data Length') . '' . lang('Index Length') . '' . lang('Data Free') . '' . lang('Auto Increment') . '' . lang('Rows') . '' . lang('Comment') . "
'; echo '' . h($name) . ''; if (isset($row["Rows"])) { echo "$row[Engine]$row[Collation]"; foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create", "Rows" => "select") as $key => $link) { $val = number_format($row[$key], 0, '.', lang(',')); echo '' . (strlen($row[$key]) ? '' . str_replace(" ", " ", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '' : ' '); } echo "" . nbsp($row["Comment"]); } else { echo '' . lang('View') . ''; } } echo "
\n"; echo "

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

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

\n"; } if ($connection->server_info >= 5) { echo '

' . lang('Create view') . "\n"; 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 ($connection->server_info >= 5.1 && ($result = $connection->query("SHOW EVENTS"))) { echo "

" . lang('Events') . "

\n"; if ($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"; }