<?php
if (!strlen($_GET["db"])) {
- echo "<table cellspacing='0'>\n<thead><tr><th align='left'><label><input type='checkbox' id='check-databases' checked='checked' onclick='dump_check(this, /^databases\\[/);' />" . lang('Database') . "</label></th></tr></thead>\n";
+ echo "<table cellspacing='0'>\n<thead><tr><th align='left'><label><input type='checkbox' id='check-databases' checked='checked' onclick='form_check(this, /^databases\\[/);' />" . lang('Database') . "</label></th></tr></thead>\n";
foreach (get_databases() as $db) {
if ($db != "information_schema" || $dbh->server_info < 5) {
- echo '<tr><td><label><input type="checkbox" name="databases[]" value="' . htmlspecialchars($db) . '" checked="checked" onclick="dump_uncheck(\'check-databases\');" />' . htmlspecialchars($db) . "</label></td></tr>\n";
+ echo '<tr><td><label><input type="checkbox" name="databases[]" value="' . htmlspecialchars($db) . '" checked="checked" onclick="form_uncheck(\'check-databases\');" />' . htmlspecialchars($db) . "</label></td></tr>\n";
}
}
echo "</table>\n";
if (strlen($_GET["db"])) {
$checked = (strlen($_GET["dump"]) ? "" : " checked='checked'");
echo "<table cellspacing='0'>\n<thead><tr>";
- echo "<th align='left'><label><input type='checkbox' id='check-tables'$checked onclick='dump_check(this, /^tables\\[/);' />" . lang('Tables') . "</label></th>";
- echo "<th align='right'><label>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='dump_check(this, /^data\\[/);' /></label></th>";
+ echo "<th align='left'><label><input type='checkbox' id='check-tables'$checked onclick='form_check(this, /^tables\\[/);' />" . lang('Tables') . "</label></th>";
+ echo "<th align='right'><label>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='form_check(this, /^data\\[/);' /></label></th>";
echo "</tr></thead>\n";
$views = "";
$result = $dbh->query("SHOW TABLE STATUS");
while ($row = $result->fetch_assoc()) {
$checked = (strlen($_GET["dump"]) && $row["Name"] != $_GET["dump"] ? '' : " checked='checked'");
- $print = '<tr><td><label><input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . "\"$checked onclick=\"dump_uncheck('check-tables');\" />" . htmlspecialchars($row["Name"]) . "</label></td>";
+ $print = '<tr><td><label><input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . "\"$checked onclick=\"form_uncheck('check-tables');\" />" . htmlspecialchars($row["Name"]) . "</label></td>";
if (!$row["Engine"]) {
$views .= "$print</tr>\n";
} else {
- echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? lang('~ %s', $row["Rows"]) : $row["Rows"]) . '<input type="checkbox" name="data[]" value="' . htmlspecialchars($row["Name"]) . "\"$checked onclick=\"dump_uncheck('check-data');\" /></label></td></tr>\n";
+ echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? lang('~ %s', $row["Rows"]) : $row["Rows"]) . '<input type="checkbox" name="data[]" value="' . htmlspecialchars($row["Name"]) . "\"$checked onclick=\"form_uncheck('check-data');\" /></label></td></tr>\n";
}
}
echo "$views</table>\n";
return true;
}
-function check_version(version) {
+function verify_version(version) {
document.cookie = 'phpMinAdmin_version=0';
var script = document.createElement('script');
script.src = 'http://www.phpminadmin.net/version.php?version=' + version;
document.body.appendChild(script);
}
-function tables_check(el) {
+function form_check(el, name) {
var elems = el.form.elements;
for (var i=0; i < elems.length; i++) {
- if (elems[i].name == 'tables[]') {
+ if (name.test(elems[i].name)) {
elems[i].checked = el.checked;
}
}
}
+function form_uncheck(id) {
+ document.getElementById(id).checked = false;
+}
+
function where_change(op) {
document.cookie = 'schema=' + encodeURIComponent(s.substr(1)) + '; expires=' + date + '; path=' + location.pathname + location.search;
}
}
-
-
-
-function dump_check(el, name) {
- var inputs = el.form.getElementsByTagName('input');
- for (var i=0; i < inputs.length; i++) {
- if (name.test(inputs[i].name)) {
- inputs[i].checked = el.checked;
- }
- }
- return true;
-}
-
-function dump_uncheck(id) {
- document.getElementById(id).checked = false;
-}
?>
<script type="text/javascript">
onload = function () {
- check_version('<?php echo $VERSION; ?>');
+ verify_version('<?php echo $VERSION; ?>');
};
</script>
<?php
} else {
echo "<form action='' method='post'>\n";
echo "<table cellspacing='0'>\n";
- echo '<thead><tr><td><input type="checkbox" onclick="tables_check(this);" /></td><th>' . lang('Table') . '</th><td>' . lang('Engine') . '</td><td>' . lang('Comment') . '</td><td>' . lang('Collation') . '</td><td>' . lang('Data Length') . '</td><td>' . lang('Index Length') . '</td><td>' . lang('Data Free') . '</td><td>' . lang('Auto Increment') . '</td><td>' . lang('Rows') . "</td></tr></thead>\n";
+ echo '<thead><tr><td><input id="check-all" type="checkbox" onclick="form_check(this, /^tables\[/);" /></td><th>' . lang('Table') . '</th><td>' . lang('Engine') . '</td><td>' . lang('Comment') . '</td><td>' . lang('Collation') . '</td><td>' . lang('Data Length') . '</td><td>' . lang('Index Length') . '</td><td>' . lang('Data Free') . '</td><td>' . lang('Auto Increment') . '</td><td>' . lang('Rows') . "</td></tr></thead>\n";
while ($row = $result->fetch_assoc()) {
table_comment($row);
- echo '<tr class="nowrap' . odd(' odd') . '"><td>' . (isset($row["Rows"]) ? '<input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '"' . (in_array($row["Name"], (array) $_POST["tables"], true) ? ' checked="checked"' : '') . ' /></td><th><a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th><td>$row[Engine]</td><td>" . (strlen(trim($row["Comment"])) ? htmlspecialchars($row["Comment"]) : " ") . "</td><td>$row[Collation]" : ' </td><th><a href="' . htmlspecialchars($SELF) . 'view=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . '</a></th><td colspan="8"><a href="' . htmlspecialchars($SELF) . "select=" . urlencode($row["Name"]) . '">' . lang('View') . '</a>');
+ echo '<tr class="nowrap' . odd(' odd') . '"><td>' . (isset($row["Rows"]) ? '<input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '"' . (in_array($row["Name"], (array) $_POST["tables"], true) ? ' checked="checked"' : '') . ' onclick="form_uncheck(\'check-all\');" /></td><th><a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th><td>$row[Engine]</td><td>" . (strlen(trim($row["Comment"])) ? htmlspecialchars($row["Comment"]) : " ") . "</td><td>$row[Collation]" : ' </td><th><a href="' . htmlspecialchars($SELF) . 'view=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . '</a></th><td colspan="8"><a href="' . htmlspecialchars($SELF) . "select=" . urlencode($row["Name"]) . '">' . lang('View') . '</a>');
foreach ((isset($row["Rows"]) ? array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create", "Rows" => "select") : array()) as $key => $link) {
$val = number_format($row[$key], 0, '.', lang(','));
echo '</td><td align="right">' . (strlen($row[$key]) ? '<a href="' . htmlspecialchars("$SELF$link=") . urlencode($row["Name"]) . '">' . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val) . '</a>' : ' ');