Editor: Fix displaying of false values in PostgreSQL (bug #568)

This commit is contained in:
Jakub Vrana 2018-01-23 11:02:15 +01:00
parent 7b9d5a29aa
commit 0cdd8beab1
3 changed files with 3 additions and 2 deletions

View file

@ -915,7 +915,7 @@ function input($field, $value, $function) {
echo $input; echo $input;
} elseif (preg_match('~bool~', $field["type"])) { } elseif (preg_match('~bool~', $field["type"])) {
echo "<input type='hidden'$attrs value='0'>" . echo "<input type='hidden'$attrs value='0'>" .
"<input type='checkbox'" . (in_array(strtolower($value), array('1', 't', 'true', 'y', 'yes', 'on')) ? " checked='checked'" : "") . "$attrs value='1'>"; "<input type='checkbox'" . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? " checked='checked'" : "") . "$attrs value='1'>";
} elseif ($field["type"] == "set") { //! 64 bits } elseif ($field["type"] == "set") { //! 64 bits
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) { foreach ($matches[1] as $i => $val) {

View file

@ -11,6 +11,7 @@ PostgreSQL: Export DROP SEQUENCE if dropping table
MS SQL: Support freetds MS SQL: Support freetds
Elasticsearch: Insert, update, delete Elasticsearch: Insert, update, delete
MongoDB: Support mongodb PHP extension MongoDB: Support mongodb PHP extension
Editor: Fix displaying of false values in PostgreSQL (bug #568)
Adminer 4.4.0 (released 2018-01-17): Adminer 4.4.0 (released 2018-01-17):
Add Content Security Policy Add Content Security Policy

View file

@ -183,7 +183,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
} }
if (like_bool($field) && $return != "&nbsp;") { // bool if (like_bool($field) && $return != "&nbsp;") { // bool
$return = ($val ? lang('yes') : lang('no')); $return = (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? lang('yes') : lang('no'));
} }
if ($link) { if ($link) {
$return = "<a href='$link'" . (is_url($link) ? " rel='noreferrer'" : "") . ">$return</a>"; $return = "<a href='$link'" . (is_url($link) ? " rel='noreferrer'" : "") . ">$return</a>";