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

Pass credentials to connect()

This commit is contained in:
Jakub Vrana
2025-03-07 12:03:29 +01:00
parent 95e6a65999
commit 9918f4155e
15 changed files with 22 additions and 36 deletions

View File

@@ -234,10 +234,9 @@ if (isset($_GET["clickhouse"])) {
return apply_queries("DROP TABLE", $tables);
}
function connect() {
$adminer = adminer();
function connect($credentials) {
$connection = new Db;
list($server, $username, $password) = $adminer->credentials();
list($server, $username, $password) = $credentials;
if (!preg_match('~^(https?://)?[-a-z\d.]+(:\d+)?$~', $server)) {
return lang('Invalid server.');
}

View File

@@ -286,10 +286,10 @@ if (isset($_GET["elastic"])) {
}
}
function connect() {
function connect($credentials) {
$connection = new Db;
list($server, $username, $password) = adminer()->credentials();
list($server, $username, $password) = $credentials;
if (!preg_match('~^(https?://)?[-a-z\d.]+(:\d+)?$~', $server)) {
return lang('Invalid server.');
}

View File

@@ -273,10 +273,10 @@ if (isset($_GET["elastic5"])) {
}
}
function connect() {
function connect($credentials) {
$connection = new Db;
list($server, $username, $password) = adminer()->credentials();
list($server, $username, $password) = $credentials;
if (!preg_match('~^(https?://)?[-a-z\d.]+(:\d+)?$~', $server)) {
return lang('Invalid server.');
}

View File

@@ -131,10 +131,8 @@ if (isset($_GET["firebird"])) {
return idf_escape($idf);
}
function connect() {
$adminer = adminer();
function connect($credentials) {
$connection = new Db;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
return $connection;
}

View File

@@ -251,9 +251,8 @@ if (isset($_GET["simpledb"])) {
function connect() {
$adminer = adminer();
list($host, , $password) = $adminer->credentials();
function connect($credentials) {
list($host, , $password) = $credentials;
if (!preg_match('~^(https?://)?[-a-z\d.]+(:\d+)?$~', $host)) {
return lang('Invalid server.');
}