Voeg IP-uitsluitingen toe aan configuratie: IP's niet meetellen in statistieken en overslaan bij beveiliging

This commit is contained in:
2026-07-29 16:01:14 +02:00
parent 0fe5c75eae
commit 92d782e6c5
4 changed files with 34 additions and 3 deletions
+5 -2
View File
@@ -112,7 +112,10 @@ $secSettings = $config['security'] ?? [
];
$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';
$isAllowedIp = in_array($clientIp, $secSettings['allowed_ips'] ?? [], true);
$analyticsSettings = $config['analytics'] ?? [];
$excludedIps = $analyticsSettings['excluded_ips'] ?? [];
$isAllowedIp = in_array($clientIp, $secSettings['allowed_ips'] ?? [], true)
|| in_array($clientIp, $excludedIps, true);
$requestStatus = 'ok';
if (!$isAllowedIp) {
@@ -182,7 +185,7 @@ if (!str_starts_with($path, '/-media/') && !str_starts_with($path, '/-assets/'))
);
// Record aggregated statistics
if (!empty($analyticsSettings['enabled'])) {
if (!empty($analyticsSettings['enabled']) && !in_array($clientIp, $excludedIps, true)) {
$analytics = new Analytics($analyticsSettings);
$analytics->record($currentPage, $storedIp, $userAgent, $referrer, $geoCountry, $requestStatus);
}