diff --git a/adminer/call.inc.php b/adminer/call.inc.php
index 1800ee16..b46eccd8 100644
--- a/adminer/call.inc.php
+++ b/adminer/call.inc.php
@@ -73,11 +73,8 @@ if ($in) {
echo "
| " . $adminer->fieldName($field);
$value = $_POST["fields"][$name];
if ($value != "") {
- if ($field["type"] == "enum") {
- $value = +$value;
- }
if ($field["type"] == "set") {
- $value = array_sum($value);
+ $value = implode(",", $value);
}
}
input($field, $value, (string) $_POST["function"][$name]); // param name can be empty
diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php
index 70148535..07381151 100644
--- a/adminer/edit.inc.php
+++ b/adminer/edit.inc.php
@@ -68,13 +68,7 @@ if ($_POST["save"]) {
$select = array();
foreach ($fields as $name => $field) {
if (isset($field["privileges"]["select"])) {
- $as = convert_field($field);
- if ($_POST["clone"] && $field["auto_increment"]) {
- $as = "''";
- }
- if (JUSH == "sql" && preg_match("~enum|set~", $field["type"])) {
- $as = "1*" . idf_escape($name);
- }
+ $as = ($_POST["clone"] && $field["auto_increment"] ? "''" : convert_field($field));
$select[] = ($as ? "$as AS " : "") . idf_escape($name);
}
}
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 0dcb1bd1..fbc086de 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -891,18 +891,18 @@ function column_foreign_keys($table) {
* @param string "radio"|"checkbox"
* @param string
* @param array
-* @param mixed int|string|array
+* @param mixed string|array
* @param string
* @return null
*/
function enum_input($type, $attrs, $field, $value, $empty = null) {
global $adminer;
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
- $return = ($empty !== null ? "" : "");
+ $return = ($empty !== null ? "" : "");
foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val));
- $checked = (is_int($value) ? $value == $i+1 : (is_array($value) ? in_array($i+1, $value) : $value === $val));
- $return .= " ';
+ $checked = (is_array($value) ? in_array($val, $value) : $value === $val);
+ $return .= " ';
}
return $return;
}
@@ -949,12 +949,12 @@ function input($field, $value, $function) {
} elseif (preg_match('~bool~', $field["type"])) {
echo ""
. "";
- } elseif ($field["type"] == "set") { //! 64 bits
+ } elseif ($field["type"] == "set") {
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val));
- $checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
- echo " ';
+ $checked = in_array($val, explode(",", $value), true);
+ echo " ';
}
} elseif (preg_match('~blob|bytea|raw|file~', $field["type"]) && ini_bool("file_uploads")) {
echo "";
@@ -1023,9 +1023,6 @@ function process_input($field) {
return "NULL";
}
}
- if ($field["type"] == "enum") {
- return +$value;
- }
if ($field["auto_increment"] && $value == "") {
return null;
}
@@ -1036,7 +1033,7 @@ function process_input($field) {
return "NULL";
}
if ($field["type"] == "set") {
- return array_sum((array) $value);
+ $value = implode(",", (array) $value);
}
if ($function == "json") {
$function = "";
@@ -1440,8 +1437,8 @@ function edit_form($table, $fields, $row, $update) {
}
}
$value = ($row !== null
- ? ($row[$name] != "" && JUSH == "sql" && preg_match("~enum|set~", $field["type"])
- ? (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name])
+ ? ($row[$name] != "" && JUSH == "sql" && preg_match("~enum|set~", $field["type"]) && is_array($row[$name])
+ ? implode(",", $row[$name])
: (is_bool($row[$name]) ? +$row[$name] : $row[$name])
)
: (!$update && $field["auto_increment"]
diff --git a/changes.txt b/changes.txt
index a6092a48..410fa9ea 100644
--- a/changes.txt
+++ b/changes.txt
@@ -3,6 +3,7 @@ Fix gzip export (bug #896)
Fix importing multiple SQL files not terminated by semicolon
Use |
|---|