From 20b1eb842ec1a82f008bd15fe480c7b59ff0a9dd Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 28 Dec 2018 19:57:21 +0000 Subject: [PATCH] fix sqlite display of password expired check for mailboxes --- config.inc.php | 2 +- functions.inc.php | 8 ++++---- public/list-virtual.php | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/config.inc.php b/config.inc.php index 40d5ca44..c993038f 100644 --- a/config.inc.php +++ b/config.inc.php @@ -516,7 +516,7 @@ $CONF['show_undeliverable']='YES'; $CONF['show_undeliverable_color']='tomato'; // mails to these domains will never be flagged as undeliverable $CONF['show_undeliverable_exceptions']=array("unixmail.domain.ext","exchangeserver.domain.ext"); -// show mailboxes with expired password +// show mailboxes with expired password; requires password_expiration to be enabled $CONF['show_expired']='YES'; $CONF['show_expired_color']='orange'; // show vacation enabled mailboxes diff --git a/functions.inc.php b/functions.inc.php index c54b6a34..be044724 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1948,7 +1948,6 @@ function db_update_q($table, $where, $values, $timestamp = array('modified')) { if (Config::bool('password_expiration')) { if ($table == 'mailbox') { - error_log("db_update_q : " . json_Encode($where)); $where_type = explode('=', $where); $email = ($where_type[1]); $domain_dirty = explode('@',$email)[1]; @@ -2247,13 +2246,14 @@ function gen_show_status($show_alias) { } // Expired CHECK - if ( $CONF['show_expired'] == 'YES' ) { - $now = ' now() '; + if ( Config::bool('password_expiration') && Config::bool('show_expired') ) { + $now = 'now()'; if (db_sqlite()) { $now = "datetime('now')"; } - $stat_result = db_query("SELECT /* crapquery */ * FROM ". $CONF['database_tables']['mailbox'] ." WHERE username = '" . $show_alias . "' AND password_expiry <= $now "); + $stat_result = db_query("SELECT /* crapquery */ * FROM ". $CONF['database_tables']['mailbox'] ." WHERE username = '" . $show_alias . "' AND password_expiry <= $now "); + if ($stat_result['rows'] == 1) { $stat_string .= "" . $CONF['show_status_text'] . " "; } else { diff --git a/public/list-virtual.php b/public/list-virtual.php index 70b1d53a..1c3a16cc 100644 --- a/public/list-virtual.php +++ b/public/list-virtual.php @@ -163,7 +163,6 @@ $pagebrowser_alias = $handler->getPagebrowser($search_alias, array()); $tAlias = $handler->result(); - # # mailboxes #