diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index 1c8c9822..b3f9d301 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -92,7 +92,7 @@ if (!$fields) { $value = $adminer->editVal($value, $field); } $function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($update && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL')))); - if ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") { + if (ereg("time", $field["type"]) && $value == "CURRENT_TIMESTAMP") { $value = ""; $function = "now"; } diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 21de175a..e31d5908 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -186,7 +186,7 @@ function process_field($field, $type_field) { idf_escape(trim($field["field"])), process_type($type_field), ($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp - (isset($field["default"]) ? " DEFAULT " . (($field["type"] == "timestamp" && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""), + (isset($field["default"]) ? " DEFAULT " . ((ereg("time", $field["type"]) && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""), ($field["on_update"] ? " ON UPDATE $field[on_update]" : ""), (support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""), ($field["auto_increment"] ? auto_increment() : null), diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 876318d7..d0557b1d 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -699,7 +699,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) { * @return null */ function input($field, $value, $function) { - global $types, $adminer, $jush; + global $connection, $types, $adminer, $jush; $name = h(bracket_escape($field["field"])); echo "