From e7e5559df55a812e56481dd2fd555712e0722fda Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 5 Aug 2013 18:55:27 -0700 Subject: [PATCH] Generalize doc_link() --- adminer/database.inc.php | 5 ++++- adminer/foreign.inc.php | 7 ++++++- adminer/include/editing.inc.php | 20 +++++++++----------- adminer/processlist.inc.php | 6 +++++- adminer/user.inc.php | 2 +- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/adminer/database.inc.php b/adminer/database.inc.php index b0f5db6c..61b71443 100644 --- a/adminer/database.inc.php +++ b/adminer/database.inc.php @@ -60,7 +60,10 @@ if ($_POST) { echo ($_POST["add_x"] || strpos($name, "\n") ? '
' : '' -) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link("charset-charsets.html") : ""); +) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array( + 'sql' => "charset-charsets.html", + 'mssql' => "ms187963.aspx", +)) : ""); ?> diff --git a/adminer/foreign.inc.php b/adminer/foreign.inc.php index 307e288e..5ddce3a7 100644 --- a/adminer/foreign.inc.php +++ b/adminer/foreign.inc.php @@ -69,7 +69,12 @@ foreach ($row["source"] as $key => $val) {

: "") + explode("|", $on_actions), $row["on_delete"]); ?> : "") + explode("|", $on_actions), $row["on_update"]); ?> - + "innodb-foreign-key-constraints.html", + 'pgsql' => "sql-createtable.html#SQL-CREATETABLE-REFERENCES", + 'mssql' => "ms174979.aspx", + 'oracle' => "clauses002.htm#sthref2903", +)); ?>

diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index efe90c69..f18bd1fc 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -49,7 +49,7 @@ function select($result, $connection2 = null, $orgtables = array()) { } $types[$j] = $field->type; echo "name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name) - . ($orgtables ? doc_link("explain-output.html#explain_" . strtolower($name)) : "") + . ($orgtables ? doc_link(array('sql' => "explain-output.html#explain_" . strtolower($name))) : "") ; } echo "\n"; @@ -452,21 +452,19 @@ function ini_bytes($ini) { } /** Create link to database documentation -* @param string +* @param array $jush => $path * @return string HTML code */ -function doc_link($path) { +function doc_link($paths) { global $jush, $connection; $urls = array( - 'sql' => "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/", - /* not used: - 'sqlite' => "http://www.sqlite.org/", - 'pgsql' => "http://www.postgresql.org/docs/" . substr($connection->server_info, 0, 3) . "/static/", - 'mssql' => "http://msdn.microsoft.com/library/", - 'oracle' => "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/", - */ + 'sql' => "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/", + 'sqlite' => "http://www.sqlite.org/", + 'pgsql' => "http://www.postgresql.org/docs/" . substr($connection->server_info, 0, 3) . "/static/", + 'mssql' => "http://msdn.microsoft.com/library/", + 'oracle' => "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/", ); - return ($urls[$jush] ? "?" : ""); + return ($paths[$jush] ? "?" : ""); } /** Return events to display help on mouse over diff --git a/adminer/processlist.inc.php b/adminer/processlist.inc.php index b360fdc6..d6e660a9 100644 --- a/adminer/processlist.inc.php +++ b/adminer/processlist.inc.php @@ -22,7 +22,11 @@ foreach (process_list() as $i => $row) { if (!$i) { echo "" . (support("kill") ? " " : ""); foreach ($row as $key => $val) { - echo "$key" . doc_link("show-processlist.html#processlist_" . strtolower($key)); + echo "$key" . doc_link(array( + 'sql' => "show-processlist.html#processlist_" . strtolower($key), + 'pgsql' => "monitoring-stats.html#PG-STAT-ACTIVITY-VIEW", + 'oracle' => "../b14237/dynviews_2088.htm", + )); } echo "\n"; } diff --git a/adminer/user.inc.php b/adminer/user.inc.php index 7657832b..f45078ab 100644 --- a/adminer/user.inc.php +++ b/adminer/user.inc.php @@ -142,7 +142,7 @@ if ($_POST) { \n"; -echo "" . lang('Privileges') . doc_link("grant.html#priv_level"); +echo "" . lang('Privileges') . doc_link(array('sql' => "grant.html#priv_level")); $i = 0; foreach ($grants as $object => $grant) { echo '' . ($object != "*.*" ? "" : "*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine