1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

Editor: Fix building links with array parameters

This solves a situation when enum data type has a foreign key to another table.
This commit is contained in:
Peter Knut
2024-10-09 09:19:37 +02:00
committed by Jakub Vrana
parent 927444ffdd
commit 4e825a36d3

View File

@@ -224,14 +224,16 @@ if (is_ajax()) {
$set = null;
if (isset($rights["insert"]) || !support("table")) {
$set = "";
$params = [];
foreach ((array) $_GET["where"] as $val) {
if ($foreign_keys[$val["col"]] && count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "="
|| (!$val["op"] && !preg_match('~[_%]~', $val["val"])) // LIKE in Editor
if (isset($foreign_keys[$val["col"]]) && count($foreign_keys[$val["col"]]) == 1
&& ($val["op"] == "=" || (!$val["op"] && (is_array($val["val"]) || !preg_match('~[_%]~', $val["val"]))) // LIKE in Editor
)) {
$set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]);
$params["set" . "[" . bracket_escape($val["col"]) . "]"] = $val["val"];
}
}
$set = $params ? "&" . http_build_query($params) : "";
}
$adminer->selectLinks($table_status, $set);
@@ -430,7 +432,7 @@ if (!$columns && support("table")) {
$link .= where_link($i++, $k, $v);
}
}
$val = select_value($val, $link, $field, $text_length);
$id = h("val[$unique_idf][" . bracket_escape($key) . "]");
$value = $_POST["val"][$unique_idf][bracket_escape($key)];
@@ -491,7 +493,7 @@ if (!$columns && support("table")) {
echo "\n";
}
}
echo "<div class='footer'><div>\n";
if ($rows || $page) {
if ($pagination) {
@@ -523,7 +525,7 @@ if (!$columns && support("table")) {
}
echo "</fieldset>\n";
}
echo "<fieldset>";
echo "<legend>" . lang('Whole result') . "</legend>";
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;