Avoid double escaping in script=db (thanks to trestna smradlavice)

This commit is contained in:
Jakub Vrana 2015-01-12 09:46:53 -08:00
parent 65f8a87629
commit 5b38a5b6f1

View file

@ -4,16 +4,15 @@ 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 $name => $table_status) {
$id = js_escape($name);
json_row("Comment-$id", nbsp($table_status["Comment"]));
json_row("Comment-$name", nbsp($table_status["Comment"]));
if (!is_view($table_status)) {
foreach (array("Engine", "Collation") as $key) {
json_row("$key-$id", nbsp($table_status[$key]));
json_row("$key-$name", nbsp($table_status[$key]));
}
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($table_status[$key] != "") {
$val = format_number($table_status[$key]);
json_row("$key-$id", ($key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB")
json_row("$key-$name", ($key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB")
? "~ $val"
: $val
));
@ -22,7 +21,7 @@ if ($_GET["script"] == "db") {
$sums[$key] += ($table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0);
}
} elseif (array_key_exists($key, $table_status)) {
json_row("$key-$id");
json_row("$key-$name");
}
}
}