0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00

try and make config reading a bit more robust - see https://github.com/postfixadmin/postfixadmin/issues/429

This commit is contained in:
David Goodwin 2021-01-22 18:04:39 +00:00
parent 59db09d337
commit d81be5640d

View File

@ -1587,7 +1587,11 @@ function db_connect() {
$dsn = null;
if (db_mysql()) {
$socket = Config::read_string('database_socket');
$socket = false;
if (Config::has('database_socket')) {
$socket = Config::read_string('database_socket');
}
$database_name = Config::read_string('database_name');
if ($socket) {
@ -2226,13 +2230,13 @@ function gen_show_status($show_alias) {
}
// Expired CHECK
if ( Config::bool('password_expiration') && Config::bool('show_expired') ) {
if (Config::has('password_expiration') && Config::bool('password_expiration') && Config::bool('show_expired')) {
$now = 'now()';
if (db_sqlite()) {
$now = "datetime('now')";
}
$stat_result = db_query_one("SELECT * FROM ". table_by_key('mailbox') ." WHERE username = ? AND password_expiry <= $now AND active = ?", array( $show_alias , db_get_boolean(true) ));
$stat_result = db_query_one("SELECT * FROM " . table_by_key('mailbox') . " WHERE username = ? AND password_expiry <= $now AND active = ?", array($show_alias, db_get_boolean(true)));
if (!empty($stat_result)) {
$stat_string .= "<span style='background-color:" . $CONF['show_expired_color'] . "'>" . $CONF['show_status_text'] . "</span>&nbsp;";