]> git.joonet.de Git - adminer.git/commitdiff
Extract variable
authorJakub Vrana <jakub@vrana.cz>
Sat, 8 Mar 2025 22:12:08 +0000 (23:12 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sat, 8 Mar 2025 22:12:08 +0000 (23:12 +0100)
adminer/select.inc.php

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