From 55858bf3a0d33c7c9f9a9a58b43137579c4fdda3 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 30 Jun 2019 15:28:25 +0200 Subject: [PATCH] Fix table names in gen_show_status() ... by using table_by_key() instead of reading $CONF directly. Otherwise, $CONF['database_prefix'] gets ignored and the query tries to use a wrong table name. This fixes a bug introduced in d809e0fbf7ccb80cf166b50761d0108dc10a0f5e --- functions.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index 92dc1bbf..18f2dec6 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -2088,7 +2088,7 @@ function gen_show_status($show_alias) { // Vacation CHECK if ( $CONF['show_vacation'] == 'YES' ) { - $stat_result = db_query_one("SELECT * FROM ". $CONF['database_tables']['vacation'] ." WHERE email = ? AND active = ? ", array($show_alias, db_get_boolean(true) )) ; + $stat_result = db_query_one("SELECT * FROM ". table_by_key('vacation') ." WHERE email = ? AND active = ? ", array($show_alias, db_get_boolean(true) )) ; if (!empty($stat_result)) { $stat_string .= "" . $CONF['show_status_text'] . " "; } else { @@ -2099,7 +2099,7 @@ function gen_show_status($show_alias) { // Disabled CHECK if ( $CONF['show_disabled'] == 'YES' ) { $stat_result = db_query_one( - "SELECT * FROM ". $CONF['database_tables']['mailbox'] ." WHERE username = ? AND active = ?", + "SELECT * FROM ". table_by_key('mailbox') ." WHERE username = ? AND active = ?", array($show_alias, db_get_boolean(false)) ); if (!empty($stat_result)) { @@ -2116,7 +2116,7 @@ function gen_show_status($show_alias) { $now = "datetime('now')"; } - $stat_result = db_query_one("SELECT * FROM ". $CONF['database_tables']['mailbox'] ." WHERE username = ? AND password_expiry <= ? AND active = ?", array( $show_alias , $now , db_get_boolean(true) )); + $stat_result = db_query_one("SELECT * FROM ". table_by_key('mailbox') ." WHERE username = ? AND password_expiry <= ? AND active = ?", array( $show_alias , $now , db_get_boolean(true) )); if (!empty($stat_result)) { $stat_string .= "" . $CONF['show_status_text'] . " ";