mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 17:44:07 +02:00
Pass credentials to connect()
This commit is contained in:
@@ -421,10 +421,10 @@ if (isset($_GET["mongo"])) {
|
||||
return $credentials[1];
|
||||
}
|
||||
|
||||
function connect() {
|
||||
function connect($credentials) {
|
||||
global $adminer;
|
||||
$connection = new Db;
|
||||
list($server, $username, $password) = $adminer->credentials();
|
||||
list($server, $username, $password) = $credentials;
|
||||
|
||||
if ($server == "") {
|
||||
$server = "localhost:27017";
|
||||
|
@@ -280,15 +280,11 @@ if (isset($_GET["mssql"])) {
|
||||
return ($_GET["ns"] != "" ? idf_escape($_GET["ns"]) . "." : "") . idf_escape($idf);
|
||||
}
|
||||
|
||||
function connect() {
|
||||
global $adminer;
|
||||
function connect($credentials) {
|
||||
$connection = new Db;
|
||||
$credentials = $adminer->credentials();
|
||||
|
||||
if ($credentials[0] == "") {
|
||||
$credentials[0] = "localhost:1433";
|
||||
}
|
||||
|
||||
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
|
||||
return $connection;
|
||||
}
|
||||
|
@@ -421,12 +421,11 @@ if (!defined('Adminer\DRIVER')) {
|
||||
}
|
||||
|
||||
/** Connect to the database
|
||||
* @param array [$server, $username, $password]
|
||||
* @return mixed Db or string for error
|
||||
*/
|
||||
function connect() {
|
||||
global $adminer;
|
||||
function connect($credentials) {
|
||||
$connection = new Db;
|
||||
$credentials = $adminer->credentials();
|
||||
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
|
||||
$connection->set_charset(charset($connection)); // available in MySQLi since PHP 5.0.5
|
||||
$connection->query("SET sql_quote_show_create = 1, autocommit = 1");
|
||||
|
@@ -211,10 +211,8 @@ if (isset($_GET["oracle"])) {
|
||||
return idf_escape($idf);
|
||||
}
|
||||
|
||||
function connect() {
|
||||
global $adminer;
|
||||
function connect($credentials) {
|
||||
$connection = new Db;
|
||||
$credentials = $adminer->credentials();
|
||||
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
|
||||
return $connection;
|
||||
}
|
||||
|
@@ -312,10 +312,8 @@ if (isset($_GET["pgsql"])) {
|
||||
return idf_escape($idf);
|
||||
}
|
||||
|
||||
function connect() {
|
||||
global $adminer;
|
||||
function connect($credentials) {
|
||||
$connection = new Db;
|
||||
$credentials = $adminer->credentials();
|
||||
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
|
||||
if (min_version(9, 0, $connection)) {
|
||||
$connection->query("SET application_name = 'Adminer'");
|
||||
|
@@ -190,9 +190,8 @@ if (isset($_GET["sqlite"])) {
|
||||
return idf_escape($idf);
|
||||
}
|
||||
|
||||
function connect() {
|
||||
global $adminer;
|
||||
list(, , $password) = $adminer->credentials();
|
||||
function connect($credentials) {
|
||||
list(, , $password) = $credentials;
|
||||
if ($password != "") {
|
||||
return lang('Database does not support password.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user