]> git.joonet.de Git - adminer.git/commitdiff
Editor: Fix displaying of false values in PostgreSQL (bug #568)
authorJakub Vrana <jakub@vrana.cz>
Tue, 23 Jan 2018 10:02:15 +0000 (11:02 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 23 Jan 2018 10:02:15 +0000 (11:02 +0100)
adminer/include/functions.inc.php
changes.txt
editor/include/adminer.inc.php

index 2bf679b6f595a4e1050f728b2c51a15a5ac5b3d9..e0ded6ba6b146b758d68faaae75e7a2d5011a17a 100644 (file)
@@ -915,7 +915,7 @@ function input($field, $value, $function) {
                        echo $input;
                } elseif (preg_match('~bool~', $field["type"])) {
                        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
                        preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
                        foreach ($matches[1] as $i => $val) {
index 59b1319f9002b39d46a16c2590401f37566f531d..fdbcf68c0210c636095677862810a51d09db9405 100644 (file)
@@ -11,6 +11,7 @@ PostgreSQL: Export DROP SEQUENCE if dropping table
 MS SQL: Support freetds
 Elasticsearch: Insert, update, delete
 MongoDB: Support mongodb PHP extension
+Editor: Fix displaying of false values in PostgreSQL (bug #568)
 
 Adminer 4.4.0 (released 2018-01-17):
 Add Content Security Policy
index 81907bcabba1a4e732fed5b6c3ab5baa937b2ce0..16d90ec83933aef6691be25dd83fe08a0cce3a69 100644 (file)
@@ -183,7 +183,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                        }
                }
                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) {
                        $return = "<a href='$link'" . (is_url($link) ? " rel='noreferrer'" : "") . ">$return</a>";