]> git.joonet.de Git - adminer.git/commitdiff
Search operators
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 25 Sep 2009 13:48:00 +0000 (13:48 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 25 Sep 2009 13:48:00 +0000 (13:48 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1148 7c3ca157-0c34-0410-bff1-cbf682f78f5c

changes.txt
editor/include/adminer.inc.php

index 1bffc86d47dc0e033a22b79af99add843cad2b6e..46c0d654cbda992a0e09b8ed04b964531b5a9763 100644 (file)
@@ -5,6 +5,7 @@ Display whitespace in texts (bug #2858042)
 Display number of manipulated rows in JS confirm
 E-mail attachments (Editor)
 Optional year in date (Editor)
+Search operators (Editor)
 Move <h1> to $adminer->navigation (customization)
 Rename get_dbh to connection (customization)
 
index 3bbf807505b571eeecbc42fa9e221cd8df57c0f4..e67edff341e426b4bfa1cd811b595943bd6912fb 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 class Adminer {
+       var $operators = array("<=", ">=");
        
        function name() {
                return lang('Editor');
@@ -167,11 +168,13 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
                foreach ((array) $_GET["where"] as $val) {
                        if (strlen("$val[col]$val[val]")) {
                                echo "<div><select name='where[$i][col]'><option value=''>" . lang('(anywhere)') . optionlist($columns, $val["col"], true) . "</select>";
+                               echo "<select name='where[$i][op]'><option>" . optionlist($this->operators, $val["op"]) . "</select>";
                                echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
                                $i++;
                        }
                }
                echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>";
+               echo "<select name='where[$i][op]'><option>" . optionlist($this->operators) . "</select>";
                echo "<input name='where[$i][val]'></div>\n";
                echo "</div></fieldset>\n";
        }
@@ -238,7 +241,7 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
                                        if (strlen($col) || is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) {
                                                $text_type = ereg('char|text|enum|set', $field["type"]);
                                                $value = $this->processInput($field, (strlen($val["val"]) && $text_type && strpos($val["val"], "%") === false ? "%$val[val]%" : $val["val"]));
-                                               $conds[] = idf_escape($name) . ($value == "NULL" ? " IS" : ($val["op"] != "=" && $text_type ? " LIKE" : " =")) . " $value";
+                                               $conds[] = idf_escape($name) . (in_array($val["op"], $this->operators) ? " $val[op]" : ($value == "NULL" ? " IS" : ($val["op"] != "=" && $text_type ? " LIKE" : " ="))) . " $value";
                                        }
                                }
                                $return[] = ($conds ? "(" . implode(" OR ", $conds) . ")" : "0");