1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 01:24:17 +02:00

Generalize doc_link()

This commit is contained in:
Jakub Vrana
2013-08-05 18:55:27 -07:00
parent 3cf3560a20
commit e7e5559df5
5 changed files with 25 additions and 15 deletions

View File

@@ -49,7 +49,7 @@ function select($result, $connection2 = null, $orgtables = array()) {
}
$types[$j] = $field->type;
echo "<th" . ($orgtable != "" || $field->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 "</thead>\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] ? "<a href='$urls[$jush]$path' target='_blank' rel='noreferrer'><sup>?</sup></a>" : "");
return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]' target='_blank' rel='noreferrer'><sup>?</sup></a>" : "");
}
/** Return events to display help on mouse over