diff --git a/db.inc.php b/db.inc.php
new file mode 100644
index 00000000..50f378fe
--- /dev/null
+++ b/db.inc.php
@@ -0,0 +1,105 @@
+fetch_assoc()) {
+ $message .= htmlspecialchars("$row[Table]: $row[Msg_text]") . "
";
+ }
+ }
+ }
+ query_redirect(queries(), substr($SELF, 0, -1), $message, $result, false, !$result);
+}
+
+page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), $error, false);
+echo '
' . lang('Alter database') . "
\n";
+echo '' . lang('Database schema') . "
\n";
+
+echo "" . lang('Tables and views') . "
\n";
+$result = $dbh->query("SHOW TABLE STATUS");
+if (!$result->num_rows) {
+ echo "" . lang('No tables.') . "
\n";
+} else {
+ echo "\n";
+}
+$result->free();
+
+if ($dbh->server_info >= 5) {
+ echo '' . lang('Create view') . "
\n";
+ echo "" . lang('Routines') . "
\n";
+ $result = $dbh->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . $dbh->escape_string($_GET["db"]) . "'");
+ if ($result->num_rows) {
+ echo "\n";
+ }
+ $result->free();
+ echo '' . lang('Create procedure') . ' ' . lang('Create function') . "
\n";
+}
+
+if ($dbh->server_info >= 5.1 && ($result = $dbh->query("SHOW EVENTS"))) {
+ echo "" . lang('Events') . "
\n";
+ if ($result->num_rows) {
+ echo "\n";
+ echo "" . lang('Name') . " | " . lang('Schedule') . " | " . lang('Start') . " | " . lang('End') . " |
\n";
+ while ($row = $result->fetch_assoc()) {
+ echo "";
+ echo '' . htmlspecialchars($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 "
\n";
+ }
+ $result->free();
+ echo '' . lang('Create event') . "
\n";
+}
diff --git a/index.php b/index.php
index 02b52737..d2e6a4ad 100644
--- a/index.php
+++ b/index.php
@@ -127,110 +127,7 @@ if (isset($_GET["download"])) {
} elseif (isset($_GET["select"])) {
include "./select.inc.php";
} else {
- if ($_POST["tables"] && !$error) {
- $result = true;
- $message = "";
- if (isset($_POST["truncate"])) {
- 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 ($_POST["tables"] 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 ($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 .= htmlspecialchars("$row[Table]: $row[Msg_text]") . "
";
- }
- }
- }
- query_redirect(queries(), substr($SELF, 0, -1), $message, $result, false, !$result);
- }
-
- page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), $error, false);
- echo '' . lang('Alter database') . "
\n";
- echo '' . lang('Database schema') . "
\n";
-
- echo "" . lang('Tables and views') . "
\n";
- $result = $dbh->query("SHOW TABLE STATUS");
- if (!$result->num_rows) {
- echo "" . lang('No tables.') . "
\n";
- } else {
- echo "\n";
- }
- $result->free();
-
- if ($dbh->server_info >= 5) {
- echo '' . lang('Create view') . "
\n";
- echo "" . lang('Routines') . "
\n";
- $result = $dbh->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . $dbh->escape_string($_GET["db"]) . "'");
- if ($result->num_rows) {
- echo "\n";
- }
- $result->free();
- echo '' . lang('Create procedure') . ' ' . lang('Create function') . "
\n";
- }
-
- if ($dbh->server_info >= 5.1 && ($result = $dbh->query("SHOW EVENTS"))) {
- echo "" . lang('Events') . "
\n";
- if ($result->num_rows) {
- echo "\n";
- echo "" . lang('Name') . " | " . lang('Schedule') . " | " . lang('Start') . " | " . lang('End') . " |
\n";
- while ($row = $result->fetch_assoc()) {
- echo "";
- echo '' . htmlspecialchars($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 "
\n";
- }
- $result->free();
- echo '' . lang('Create event') . "
\n";
- }
+ include "./db.inc.php";
}
}
page_footer();