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

probable fix for https://github.com/postfixadmin/postfixadmin/issues/516 - admins can see all domains so no fDomain parameter etc

This commit is contained in:
David Goodwin 2021-07-17 10:31:06 +01:00
parent 284e1f7eb2
commit 6d00833c75

View File

@ -67,14 +67,24 @@ if ($error != 1) {
$table_log = table_by_key('log');
$page_size = isset($CONF['page_size']) ? intval($CONF['page_size']) : 35;
$where_domain = $fDomain ? 'WHERE domain= :domain' : '';
$where = [];
$params = [];
if($fDomain) {
$where[] = 'domain = :domain' ;
$params['domain'] = $fDomain;
}
$query = "SELECT timestamp,username,domain,action,data FROM $table_log $where_domain ORDER BY timestamp DESC LIMIT $page_size";
$where_sql = '';
if(!empty($where)) {
$where_sql = 'WHERE ' . implode(' AND ', $where);
}
$query = "SELECT timestamp,username,domain,action,data FROM $table_log $where_sql ORDER BY timestamp DESC LIMIT $page_size";
if (db_pgsql()) {
$query = "SELECT extract(epoch from timestamp) as timestamp,username,domain,action,data FROM $table_log $where_domain ORDER BY timestamp DESC LIMIT $page_size";
$query = "SELECT extract(epoch from timestamp) as timestamp,username,domain,action,data FROM $table_log $where_sql ORDER BY timestamp DESC LIMIT $page_size";
}
$result = db_query_all($query, array('domain' => $fDomain));
$result = db_query_all($query, $params);
foreach ($result as $row) {
if (is_array($row) && db_pgsql()) {
$row['timestamp'] = gmstrftime('%c %Z', $row['timestamp']);