}
if ($_GET["ns"] !== "") {
echo '<a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n";
- $sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
-
echo "<h3>" . lang('Tables and views') . "</h3>\n";
$tables_list = tables_list();
if (!$tables_list) {
echo "<tr><td> <th>" . lang('%d in total', count($tables_list));
echo "<td>" . nbsp($connection->result("SELECT @@storage_engine"));
echo "<td>" . nbsp(db_collation(DB, collations()));
- foreach ($sums as $key => $val) {
+ foreach (array("Data_length", "Index_length", "Data_free") as $key) {
echo "<td align='right' id='sum-$key'> ";
}
echo "</table>\n";
}
page_footer();
- $table_status = table_status();
- if ($table_status) {
- echo "<script type='text/javascript'>\n";
- foreach ($table_status as $row) {
- $id = addcslashes($row["Name"], "\\'/");
- echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
- if (!is_view($row)) {
- foreach (array("Engine", "Collation") as $key) {
- echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
- }
- foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
- if ($row[$key] != "") {
- $val = number_format($row[$key], 0, '.', lang(','));
- echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
- if (isset($sums[$key])) {
- $sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
- }
- } elseif (array_key_exists($key, $row)) {
- echo "setHtml('$key-$id');\n";
- }
- }
- }
- }
- foreach ($sums as $key => $val) {
- echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
- }
- echo "</script>\n";
- }
+ echo "<script type='text/javascript' src='" . h(ME) . "script=db'></script>\n";
exit; // page_footer() already called
}
}
}
page_footer("db");
- echo "<script type='text/javascript'>\n";
- foreach (count_tables($databases) as $db => $val) {
- echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
- }
- echo "</script>\n";
+ echo "<script type='text/javascript' src='" . h(ME) . "script=connect'></script>\n";
}
if (isset($_GET["status"])) {
$_GET["variables"] = $_GET["status"];
}
-if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]))) {
+if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]) || $_GET["script"] == "connect")) {
if (DB != "") {
set_session("dbs", null);
}
<?php $adminer->navigation($missing); ?>
</div>
<?php
- // don't wait for code after footer
- session_write_close();
- ob_flush();
- flush();
}
include "./select.inc.php";
} elseif (isset($_GET["variables"])) {
include "./variables.inc.php";
+} elseif (isset($_GET["script"])) {
+ include "./script.inc.php";
} else {
include "./db.inc.php";
}
--- /dev/null
+<?php
+header("Content-Type: text/javascript; charset=utf-8");
+
+if ($_GET["script"] == "db") {
+ $sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
+ foreach (table_status() as $row) {
+ $id = addcslashes($row["Name"], "\\'/");
+ echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
+ if (!is_view($row)) {
+ foreach (array("Engine", "Collation") as $key) {
+ echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
+ }
+ foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
+ if ($row[$key] != "") {
+ $val = number_format($row[$key], 0, '.', lang(','));
+ echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
+ if (isset($sums[$key])) {
+ $sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
+ }
+ } elseif (array_key_exists($key, $row)) {
+ echo "setHtml('$key-$id');\n";
+ }
+ }
+ }
+ }
+ foreach ($sums as $key => $val) {
+ echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
+ }
+} else { // connect
+ foreach (count_tables(get_databases()) as $db => $val) {
+ echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
+ }
+}
+
+exit; // don't print footer