mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 11:34:10 +02:00
Search for empty enum
This commit is contained in:
@@ -440,8 +440,7 @@ document.getElementById('username').focus();
|
||||
if ($field["type"] == "enum") {
|
||||
return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "")
|
||||
. ($field["null"] ? "<label><input type='radio'$attrs value=''" . (isset($value) || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
|
||||
. "<label><input type='radio'$attrs value='0'" . ($value === 0 ? " checked" : "") . "><i>" . lang('empty') . "</i></label>"
|
||||
. enum_input("radio", $attrs, $field, $value)
|
||||
. enum_input("radio", $attrs, $field, $value, 0) // 0 - empty
|
||||
;
|
||||
}
|
||||
return "";
|
||||
|
@@ -620,12 +620,13 @@ function column_foreign_keys($table) {
|
||||
* @param string
|
||||
* @param array
|
||||
* @param mixed int|string|array
|
||||
* @param string
|
||||
* @return null
|
||||
*/
|
||||
function enum_input($type, $attrs, $field, $value) {
|
||||
function enum_input($type, $attrs, $field, $value, $empty = null) {
|
||||
global $adminer;
|
||||
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
||||
$return = "";
|
||||
$return = (isset($empty) ? "<label><input type='$type'$attrs value='$empty'" . ((is_array($value) ? in_array($empty, $value) : $value === 0) ? " checked" : "") . "><i>" . lang('empty') . "</i></label>" : "");
|
||||
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));
|
||||
|
Reference in New Issue
Block a user