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

Link routines from syntax highlighting

This commit is contained in:
Jakub Vrana
2025-07-07 15:01:46 +02:00
parent 9424b7431e
commit c9a52cd28c
4 changed files with 13 additions and 4 deletions

View File

@@ -6,6 +6,7 @@
- Warn about exceeded max_file_uploads in import - Warn about exceeded max_file_uploads in import
- Display @ after username without server in existing logins - Display @ after username without server in existing logins
- Display data length and index length for materialized views - 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) - MySQL 5.0-: Do not load partitioning info in alter table (bug #1099)
- MariaDB: Parse COLLATE in routine definition (bug #1104) - MariaDB: Parse COLLATE in routine definition (bug #1104)
- PostgreSQL: Show structure of inherited tables - PostgreSQL: Show structure of inherited tables

View File

@@ -1048,7 +1048,15 @@ class Adminer {
foreach ($tables as $table => $type) { foreach ($tables as $table => $type) {
$links[] = preg_quote($table, '/'); $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) { foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
echo "jushLinks.$val = jushLinks." . JUSH . ";\n"; echo "jushLinks.$val = jushLinks." . JUSH . ";\n";
} }

View File

@@ -150,13 +150,13 @@ function select_input(string $attrs, array $options, ?string $value = "", string
* @param string $key or "" to close the object * @param string $key or "" to close the object
* @param string|int $val * @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; static $first = true;
if ($first) { if ($first) {
echo "{"; echo "{";
} }
if ($key != "") { 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; $first = false;
} else { } else {
echo "\n}\n"; echo "\n}\n";

2
externals/jush vendored