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

Extract variable

This commit is contained in:
Jakub Vrana
2025-03-08 23:12:08 +01:00
parent e883ad428e
commit 4991817b0d

View File

@@ -16,17 +16,18 @@ $order_columns = array(); // searchable columns
$text_length = null; $text_length = null;
foreach ($fields as $key => $field) { foreach ($fields as $key => $field) {
$name = $adminer->fieldName($field); $name = $adminer->fieldName($field);
$name_plain = html_entity_decode(strip_tags($name), ENT_QUOTES);
if (isset($field["privileges"]["select"]) && $name != "") { if (isset($field["privileges"]["select"]) && $name != "") {
$columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES); $columns[$key] = $name_plain;
if (is_shortable($field)) { if (is_shortable($field)) {
$text_length = $adminer->selectLengthProcess(); $text_length = $adminer->selectLengthProcess();
} }
} }
if (isset($field["privileges"]["where"]) && $name != "") { if (isset($field["privileges"]["where"]) && $name != "") {
$search_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES); $search_columns[$key] = $name_plain;
} }
if (isset($field["privileges"]["order"]) && $name != "") { if (isset($field["privileges"]["order"]) && $name != "") {
$order_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES); $order_columns[$key] = $name_plain;
} }
$rights += $field["privileges"]; $rights += $field["privileges"];
} }
@@ -348,13 +349,8 @@ if (!$columns && support("table")) {
$desc = "&desc%5B0%5D=1"; $desc = "&desc%5B0%5D=1";
$sortable = isset($field["privileges"]["order"]); $sortable = isset($field["privileges"]["order"]);
echo "<th id='th[" . h(bracket_escape($key)) . "]'>" . script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});", ""); echo "<th id='th[" . h(bracket_escape($key)) . "]'>" . script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});", "");
if ($sortable) { $fun = apply_sql_function($val["fun"], $name); //! columns looking like functions
echo '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">'; // $order[0] == $key - COUNT(*) echo ($sortable ? '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">' . "$fun</a>" : $fun); // $order[0] == $key - COUNT(*)
}
echo apply_sql_function($val["fun"], $name); //! columns looking like functions
if ($sortable) {
echo "</a>";
}
echo "<span class='column hidden'>"; echo "<span class='column hidden'>";
if ($sortable) { if ($sortable) {
echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>"; echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";