Voeg IP-uitsluitingen toe aan configuratie: IP's niet meetellen in statistieken en overslaan bij beveiliging
This commit is contained in:
+5
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user