From fa3dd557c60e5b6a61d40a4cddd0c328acfb9ac7 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Mon, 2 Jul 2007 15:52:15 +0000 Subject: [PATCH] Parent IS NULL hides value git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@10 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- select.inc.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/select.inc.php b/select.inc.php index fd9cc31a..9deea4b0 100644 --- a/select.inc.php +++ b/select.inc.php @@ -5,7 +5,7 @@ echo "

" . lang('Select') . ": " . htmlspecialchars($_GET["select"]) . "

echo '

' . lang('New item') . "

\n"; $indexes = indexes($_GET["select"]); -echo "
\n"; +echo "
\n"; if (strlen($_GET["server"])) { echo ''; } @@ -17,19 +17,22 @@ $columns = array(); foreach (fields($_GET["select"]) as $name => $field) { $columns[] = $name; } -$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "REGEXP", "IS NULL"); //! IS NULL - hide input by JavaScript +$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "REGEXP", "IS NULL"); $i = 0; foreach ((array) $_GET["where"] as $val) { if ($val["col"] && in_array($val["op"], $operators)) { $where[] = idf_escape($val["col"]) . " $val[op]" . ($val["op"] != "IS NULL" ? " '" . mysql_real_escape_string($val["val"]) . "'" : ""); echo ""; - echo ""; + echo ""; echo "
\n"; $i++; } } +if ($i) { + echo "\n"; +} echo ""; -echo ""; +echo ""; echo "
\n"; //! JavaScript for adding next //! fulltext search @@ -65,13 +68,15 @@ if (!mysql_num_rows($result)) { $val = "NULL"; } else { $val = htmlspecialchars($val); - if (count($foreign_keys[$key]) == 1) { - $foreign_key = $foreign_keys[$key][0]; - $val = '">' . "$val"; - foreach ($foreign_key[2] as $i => $source) { - $val = "&where[$i][col]=" . urlencode($foreign_key[3][$i]) . "&where[$i][op]=%3D&where[$i][val]=" . urlencode($row[$source]) . $val; + foreach ((array) $foreign_keys[$key] as $foreign_key) { + if (count($foreign_keys[$key]) == 1 || count($foreign_key[2]) == 1) { + $val = '">' . "$val"; + foreach ($foreign_key[2] as $i => $source) { + $val = "&where[$i][col]=" . urlencode($foreign_key[3][$i]) . "&where[$i][op]=%3D&where[$i][val]=" . urlencode($row[$source]) . $val; + } + $val = '