Rename variable
This commit is contained in:
parent
a30f149376
commit
5275ed870b
|
@ -65,28 +65,28 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||||
|
|
||||||
if ($_POST["table_style"] || $_POST["data_style"]) {
|
if ($_POST["table_style"] || $_POST["data_style"]) {
|
||||||
$views = array();
|
$views = array();
|
||||||
foreach (table_status() as $row) {
|
foreach (table_status() as $table_status) {
|
||||||
$table = (DB == "" || in_array($row["Name"], (array) $_POST["tables"]));
|
$table = (DB == "" || in_array($table_status["Name"], (array) $_POST["tables"]));
|
||||||
$data = (DB == "" || in_array($row["Name"], (array) $_POST["data"]));
|
$data = (DB == "" || in_array($table_status["Name"], (array) $_POST["data"]));
|
||||||
if ($table || $data) {
|
if ($table || $data) {
|
||||||
if (!is_view($row)) {
|
if (!is_view($table_status)) {
|
||||||
if ($ext == "tar") {
|
if ($ext == "tar") {
|
||||||
ob_start();
|
ob_start();
|
||||||
}
|
}
|
||||||
$adminer->dumpTable($row["Name"], ($table ? $_POST["table_style"] : ""));
|
$adminer->dumpTable($table_status["Name"], ($table ? $_POST["table_style"] : ""));
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$adminer->dumpData($row["Name"], $_POST["data_style"], "SELECT * FROM " . table($row["Name"]));
|
$adminer->dumpData($table_status["Name"], $_POST["data_style"], "SELECT * FROM " . table($table_status["Name"]));
|
||||||
}
|
}
|
||||||
if ($is_sql && $_POST["triggers"] && $table && ($triggers = trigger_sql($row["Name"], $_POST["table_style"]))) {
|
if ($is_sql && $_POST["triggers"] && $table && ($triggers = trigger_sql($table_status["Name"], $_POST["table_style"]))) {
|
||||||
echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
|
echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
|
||||||
}
|
}
|
||||||
if ($ext == "tar") {
|
if ($ext == "tar") {
|
||||||
echo tar_file((DB != "" ? "" : "$db/") . "$row[Name].csv", ob_get_clean());
|
echo tar_file((DB != "" ? "" : "$db/") . "$table_status[Name].csv", ob_get_clean());
|
||||||
} elseif ($is_sql) {
|
} elseif ($is_sql) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
} elseif ($is_sql) {
|
} elseif ($is_sql) {
|
||||||
$views[] = $row["Name"];
|
$views[] = $table_status["Name"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,15 +193,15 @@ if (DB != "") {
|
||||||
echo "</thead>\n";
|
echo "</thead>\n";
|
||||||
$views = "";
|
$views = "";
|
||||||
//! defer number of rows to JavaScript
|
//! defer number of rows to JavaScript
|
||||||
foreach (table_status() as $row) {
|
foreach (table_status() as $table_status) {
|
||||||
$name = $row["Name"];
|
$name = $table_status["Name"];
|
||||||
$prefix = ereg_replace("_.*", "", $name);
|
$prefix = ereg_replace("_.*", "", $name);
|
||||||
$checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name
|
$checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name
|
||||||
$print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "formUncheck('check-tables');");
|
$print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "formUncheck('check-tables');");
|
||||||
if (is_view($row)) {
|
if (is_view($table_status)) {
|
||||||
$views .= "$print\n";
|
$views .= "$print\n";
|
||||||
} else {
|
} else {
|
||||||
echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? "~ " : "") . $row["Rows"] . checkbox("data[]", $name, $checked, "", "formUncheck('check-data');") . "</label>\n";
|
echo "$print<td align='right'><label>" . ($table_status["Engine"] == "InnoDB" && $table_status["Rows"] ? "~ " : "") . $table_status["Rows"] . checkbox("data[]", $name, $checked, "", "formUncheck('check-data');") . "</label>\n";
|
||||||
}
|
}
|
||||||
$prefixes[$prefix]++;
|
$prefixes[$prefix]++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,23 +16,23 @@ $base_left = -1;
|
||||||
$schema = array(); // table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
|
$schema = array(); // table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
|
||||||
$referenced = array(); // target_table => array(table => array(left => target_column))
|
$referenced = array(); // target_table => array(table => array(left => target_column))
|
||||||
$lefts = array(); // float => bool
|
$lefts = array(); // float => bool
|
||||||
foreach (table_status() as $row) {
|
foreach (table_status() as $table_status) {
|
||||||
if (!isset($row["Engine"])) { // view
|
if (!isset($table_status["Engine"])) { // view
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
$schema[$row["Name"]]["fields"] = array();
|
$schema[$table_status["Name"]]["fields"] = array();
|
||||||
foreach (fields($row["Name"]) as $name => $field) {
|
foreach (fields($table_status["Name"]) as $name => $field) {
|
||||||
$pos += 1.25;
|
$pos += 1.25;
|
||||||
$field["pos"] = $pos;
|
$field["pos"] = $pos;
|
||||||
$schema[$row["Name"]]["fields"][$name] = $field;
|
$schema[$table_status["Name"]]["fields"][$name] = $field;
|
||||||
}
|
}
|
||||||
$schema[$row["Name"]]["pos"] = ($table_pos[$row["Name"]] ? $table_pos[$row["Name"]] : array($top, 0));
|
$schema[$table_status["Name"]]["pos"] = ($table_pos[$table_status["Name"]] ? $table_pos[$table_status["Name"]] : array($top, 0));
|
||||||
foreach ($adminer->foreignKeys($row["Name"]) as $val) {
|
foreach ($adminer->foreignKeys($table_status["Name"]) as $val) {
|
||||||
if (!$val["db"]) {
|
if (!$val["db"]) {
|
||||||
$left = $base_left;
|
$left = $base_left;
|
||||||
if ($table_pos[$row["Name"]][1] || $table_pos[$val["table"]][1]) {
|
if ($table_pos[$table_status["Name"]][1] || $table_pos[$val["table"]][1]) {
|
||||||
$left = min(floatval($table_pos[$row["Name"]][1]), floatval($table_pos[$val["table"]][1])) - 1;
|
$left = min(floatval($table_pos[$table_status["Name"]][1]), floatval($table_pos[$val["table"]][1])) - 1;
|
||||||
} else {
|
} else {
|
||||||
$base_left -= .1;
|
$base_left -= .1;
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,12 @@ foreach (table_status() as $row) {
|
||||||
// find free $left
|
// find free $left
|
||||||
$left -= .0001;
|
$left -= .0001;
|
||||||
}
|
}
|
||||||
$schema[$row["Name"]]["references"][$val["table"]][(string) $left] = array($val["source"], $val["target"]);
|
$schema[$table_status["Name"]]["references"][$val["table"]][(string) $left] = array($val["source"], $val["target"]);
|
||||||
$referenced[$val["table"]][$row["Name"]][(string) $left] = $val["target"];
|
$referenced[$val["table"]][$table_status["Name"]][(string) $left] = $val["target"];
|
||||||
$lefts[(string) $left] = true;
|
$lefts[(string) $left] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$top = max($top, $schema[$row["Name"]]["pos"][0] + 2.5 + $pos);
|
$top = max($top, $schema[$table_status["Name"]]["pos"][0] + 2.5 + $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue