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

Use connection() instead of $connection

This commit is contained in:
Jakub Vrana
2025-03-29 21:16:28 +01:00
parent 168ea5ae6d
commit 712d96b22c
36 changed files with 130 additions and 196 deletions

View File

@@ -1,8 +1,6 @@
<?php
namespace Adminer;
$connection = '';
$permanent = array();
if ($_COOKIE["adminer_permanent"]) {
foreach (explode(" ", $_COOKIE["adminer_permanent"]) as $val) {
@@ -175,18 +173,18 @@ if (isset($_GET["username"]) && is_string(get_password())) {
auth_error(lang('Connecting to privileged ports is not allowed.'), $permanent);
}
check_invalid_login($permanent);
$connection = connect(adminer()->credentials());
if (is_object($connection)) {
Driver::$instance = new Driver($connection);
if ($connection->flavor) {
Db::$instance = connect(adminer()->credentials());
if (is_object(Db::$instance)) {
Driver::$instance = new Driver(Db::$instance);
if (Db::$instance->flavor) {
save_settings(array("vendor-" . DRIVER . "-" . SERVER => get_driver(DRIVER)));
}
}
}
$login = null;
if (!is_object($connection) || ($login = adminer()->login($_GET["username"], get_password())) !== true) {
$error = (is_string($connection) ? nl_br(h($connection)) : (is_string($login) ? $login : lang('Invalid credentials.')));
if (!is_object(connection()) || ($login = adminer()->login($_GET["username"], get_password())) !== true) {
$error = (is_string(connection()) ? nl_br(h(connection())) : (is_string($login) ? $login : lang('Invalid credentials.')));
auth_error(
$error . (preg_match('~^ | $~', get_password()) ? '<br>' . lang('There is a space in the input password which might be the cause.') : ''),
$permanent