mirror of
https://github.com/vrana/adminer.git
synced 2025-12-15 21:10:28 +01:00
@@ -11,23 +11,23 @@ class AdminerEnumOption extends Adminer\Plugin {
|
|||||||
function editInput($table, $field, $attrs, $value) {
|
function editInput($table, $field, $attrs, $value) {
|
||||||
if ($field["type"] == "enum") {
|
if ($field["type"] == "enum") {
|
||||||
$options = array();
|
$options = array();
|
||||||
$selected = $value;
|
$selected = "val-$value";
|
||||||
if (isset($_GET["select"])) {
|
if (isset($_GET["select"])) {
|
||||||
$options[-1] = Adminer\lang('original');
|
$options["orig"] = Adminer\lang('original');
|
||||||
if ($selected === null) {
|
if ($value === null) {
|
||||||
$selected = -1;
|
$selected = "orig";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($field["null"]) {
|
if ($field["null"]) {
|
||||||
$options[""] = "NULL";
|
$options["null"] = "NULL";
|
||||||
if ($selected === null) {
|
if ($value === null) {
|
||||||
$selected = "";
|
$selected = "null";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
||||||
foreach ($matches[1] as $val) {
|
foreach ($matches[1] as $val) {
|
||||||
$val = stripcslashes(str_replace("''", "'", $val));
|
$val = stripcslashes(str_replace("''", "'", $val));
|
||||||
$options[$val] = $val;
|
$options["val-$val"] = $val;
|
||||||
}
|
}
|
||||||
return "<select$attrs>" . Adminer\optionlist($options, $selected, 1) . "</select>"; // 1 - use keys
|
return "<select$attrs>" . Adminer\optionlist($options, $selected, 1) . "</select>"; // 1 - use keys
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user