Add ability to pass sslmode for postgres

This commit is contained in:
Sebastian (Iglu) 2023-12-01 11:17:10 +00:00 committed by GitHub
parent eb7ee8bb18
commit ae1ecae3b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,10 @@ if (isset($_GET["pgsql"])) {
$db = $adminer->database();
set_error_handler(array($this, '_error'));
$this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'";
$ssl = $adminer->connectSsl();
if ($ssl) {
$this->_string.= " sslmode='" . ($ssl['sslmode'] ?: 'require') . "'";
}
$this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", PGSQL_CONNECT_FORCE_NEW);
if (!$this->_link && $db != "") {
// try to connect directly with database for performance