diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f8f672..606d3cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Warn about exceeded max_file_uploads in import - Display @ after username without server in existing logins - Display data length and index length for materialized views +- Link routines from syntax highlighting - MySQL 5.0-: Do not load partitioning info in alter table (bug #1099) - MariaDB: Parse COLLATE in routine definition (bug #1104) - PostgreSQL: Show structure of inherited tables diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index c57052d3..a7395f75 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -1048,7 +1048,15 @@ class Adminer { foreach ($tables as $table => $type) { $links[] = preg_quote($table, '/'); } - echo "var jushLinks = { " . JUSH . ": [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n"; + echo "var jushLinks = { " . JUSH . ":"; + json_row(js_escape(ME) . (support("table") ? "table" : "select") . '=$&', '/\b(' . implode('|', $links) . ')\b/g', false); + if (support('routine')) { + foreach (routines() as $row) { + json_row(js_escape(ME) . 'function=' . urlencode($row["SPECIFIC_NAME"]) . '&name=$&', '/\b' . preg_quote($row["ROUTINE_NAME"], '/') . '(?=["`]?\()/g', false); + } + } + json_row(''); + echo "};\n"; foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) { echo "jushLinks.$val = jushLinks." . JUSH . ";\n"; } diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index a7d3382a..19752c17 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -150,13 +150,13 @@ function select_input(string $attrs, array $options, ?string $value = "", string * @param string $key or "" to close the object * @param string|int $val */ -function json_row(string $key, $val = null): void { +function json_row(string $key, $val = null, bool $escape = true): void { static $first = true; if ($first) { echo "{"; } if ($key != "") { - echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null'); + echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? ($escape ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : $val) : 'null'); $first = false; } else { echo "\n}\n"; diff --git a/externals/jush b/externals/jush index 52a7d5ca..2f564fdb 160000 --- a/externals/jush +++ b/externals/jush @@ -1 +1 @@ -Subproject commit 52a7d5cadb2f87a77b1ec588aaf627b423349e9e +Subproject commit 2f564fdbdbdbcd745eac711fa963f1612b73eac0