]> git.joonet.de Git - adminer.git/commitdiff
Utilize where_link function
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 15 Apr 2010 14:43:44 +0000 (14:43 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 15 Apr 2010 14:43:44 +0000 (14:43 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1442 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/functions.inc.php
adminer/select.inc.php

index 5dab809abdc7ed229eb923d59712a0830e84e85e..42a46e96d9542eb1c3a50d2586f25cfc537ebd1d 100644 (file)
@@ -188,9 +188,10 @@ function where_check($val) {
 * @param string column identifier
 * @param string
 * @return string
+* @return string
 */
-function where_link($i, $column, $value) {
-       return "&where%5B$i%5D%5Bcol%5D=" . urlencode($column) . "&where%5B$i%5D%5Bop%5D=%3D&where%5B$i%5D%5Bval%5D=" . urlencode($value);
+function where_link($i, $column, $value, $operator = "=") {
+       return "&where%5B$i%5D%5Bcol%5D=" . urlencode($column) . "&where%5B$i%5D%5Bop%5D=" . urlencode($operator) . "&where%5B$i%5D%5Bval%5D=" . urlencode($value);
 }
 
 /** Set cookie valid for 1 month
index 16386e7133aaea7e5af938705103b39a5e3e47f3..76604d3fdc437509dafb9b75d0a6d42e365822b5 100644 (file)
@@ -249,13 +249,11 @@ if (!$columns) {
                                                                $i = 0;
                                                                foreach ((array) $_GET["where"] as $v) {
                                                                        if (!array_key_exists($v["col"], $unique_array)) {
-                                                                               $link .= h("&where[$i][col]=" . urlencode($v["col"]) . "&where[$i][op]=" . urlencode($v["op"]) . "&where[$i][val]=" . urlencode($v["val"]));
-                                                                               $i++;
+                                                                               $link .= h(where_link($i++, $v["col"], $v["val"], urlencode($v["op"])));
                                                                        }
                                                                }
                                                                foreach ($unique_array as $k => $v) {
-                                                                       $link .= h("&where[$i][col]=" . urlencode($k) . "&where[$i][op]=" . (isset($v) ? "%3D&where[$i][val]=" . urlencode($v) : "IS+NULL"));
-                                                                       $i++;
+                                                                       $link .= h(where_link($i++, $k, $v, (isset($v) ? "=" : "IS NULL")));
                                                                }
                                                        }
                                                }