Audit Logs. * Record pages link here for all of one record's history (type, entity). */ // Default Column Sortby Filter $sort = "log_id"; $order = "DESC"; if (!isset($_GET['client_id'])) { // Every client's is Admin > Audit Logs require_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/functions.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/check_login.php'; redirect($session_is_admin ? '/admin/audit_logs.php' : '/agent/clients.php'); } require_once "includes/inc_all_client.php"; $page_title = 'Audit Log'; $sortable_columns = [ 'log_id' => "log_id $order", 'log_created_at' => "log_created_at $order, log_id $order", 'user_name' => "user_name IS NULL, user_name $order, log_id DESC", 'log_type' => "log_type $order, log_action $order, log_id DESC", 'log_action' => "log_action $order, log_id DESC", 'log_ip' => "log_ip IS NULL, log_ip $order, log_id DESC", ]; if (!isset($sortable_columns[$sort])) { $sort = 'log_id'; } // Security is sign-ins, users and settings - an admin's, and in Admin > Audit Logs $views = auditLogViews(); unset($views['security']); $views['signins']['title'] = 'Their contacts signing in to the client portal'; $view = isset($_GET['view']) && is_string($_GET['view']) && isset($views[$_GET['view']]) ? $_GET['view'] : ''; $scope = "log_client_id = $client_id AND " . auditLogRoleSql(); $filter_src = array_merge($_GET, ['client' => $client_id, 'dtf' => $dtf, 'dtt' => $dtt, 'view' => $view]); $joins = auditLogJoinsSql(); $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS log_id, log_type, log_action, log_description, log_ip, log_user_agent, log_created_at, log_client_id, log_user_id, log_entity_id, user_name, user_avatar, user_type, client_name FROM logs $joins WHERE $scope AND " . auditLogFiltersSql($filter_src) . " ORDER BY {$sortable_columns[$sort]} LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $rows = []; while ($row = mysqli_fetch_assoc($sql)) { $rows[] = $row; } $records = auditLogRecords($rows); $new_ips = signInNewIpIds($rows); $kinds = auditLogKinds(); // Each view counted for the rest of the filters $count_sql = []; foreach ($views as $definition) { $count_sql[] = 'COALESCE(SUM(' . ($definition['where'] === '' ? '1' : $definition['where']) . '), 0)'; } $counts = array_combine(array_keys($views), array_map('intval', mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', $count_sql) . " FROM logs $joins WHERE $scope AND " . auditLogFiltersSql(array_merge($filter_src, ['view' => ''])))))); $user_filter = is_string($_GET['user'] ?? null) ? $_GET['user'] : ''; $type_filter = is_string($_GET['type'] ?? null) ? $_GET['type'] : ''; $action_filter = is_string($_GET['action'] ?? null) ? $_GET['action'] : ''; $entity_filter = is_scalar($_GET['entity'] ?? null) ? intval($_GET['entity']) : 0; $more_filters = $action_filter !== '' || $entity_filter; $any_filter = $q !== '' || $user_filter !== '' || $type_filter !== '' || $action_filter !== '' || $entity_filter || $dtf !== '1970-01-01' || $dtt !== '2099-12-31'; $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $view_url = function ($key) { $query = $_GET; unset($query['page']); $query['view'] = $key; return '?' . http_build_query(array_filter($query, function ($value) { return $value !== '' && $value !== null && $value !== []; })); }; $view_empty = [ 'changes' => 'No changes yet', 'deletions' => 'Nothing deleted yet', 'signins' => 'No portal sign-ins yet', 'data' => 'Nothing looked at or taken out yet', ]; ?>

Audit Log

$type_filter, 'log_entity_id' => $entity_filter]])[$type_filter . '|' . $entity_filter] ?? null; ?>
Just one record: # Every record
"> 0 && isset($kinds[$type]['table']); $device = auditLogDevice($row['log_user_agent']); $from = implode(' ยท ', array_filter([(string) $row['log_ip'], $device])); ?>
Description
No longer here
'audit log entries', 'icon' => 'fa-history', 'filtered' => $any_filter, 'views' => ['view'], 'view' => $view !== '' ? ['icon' => $views[$view]['icon'], 'title' => $view_empty[$view], 'text' => escapeHtml($views[$view]['title']) . ' show here.'] : null, 'text' => 'Who changed what for ' . $client_name . ', looked at a password or took something out - when, and from where - shows here.', ]; require_once "../includes/filter_footer.php"; ?>