Respect original values in mass edit and clone

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@677 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-06-13 17:00:48 +00:00
parent 5805ebaf96
commit f81740967f
2 changed files with 4 additions and 3 deletions

View file

@ -47,8 +47,8 @@ if ($_POST["save"]) {
} elseif ($where) {
$select = array();
foreach ($fields as $name => $field) {
if (isset($field["privileges"]["select"]) && (!$_POST["clone"] || !$field["auto_increment"])) {
$select[] = ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "") . idf_escape($name);
if (isset($field["privileges"]["select"])) {
$select[] = ($_POST["clone"] && $field["auto_increment"] ? "'' AS " : ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "")) . idf_escape($name);
}
}
$row = array();
@ -67,7 +67,7 @@ if ($fields) {
echo "<table cellspacing='0'>\n";
foreach ($fields as $name => $field) {
echo "<tr><th>" . htmlspecialchars($name) . "</th>";
$value = (!isset($row) ? ($_POST["clone"] && $field["auto_increment"] ? "" : $field["default"])
$value = (!isset($row) ? ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : null))
: (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
);
input($name, $field, $value);

View file

@ -10,6 +10,7 @@ Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.ph
Utilize information_schema.USER_PRIVILEGES in Privileges
Highlight SQL textarea - may use external CodePress
Column and table names auto-completition in SQL textarea
Mass editation of individual rows
? Save token also to cookie - for session expiration and login in other window
? Save uploaded files after error to session variable instead of hidden field
? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS packer can save 1 KB