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:
@@ -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.');
|
||||
}
|
||||
|
@@ -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.');
|
||||
}
|
||||
|
@@ -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.');
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user