From 3c1128ca4dcae881bd1bceff751085c3f4a75dde Mon Sep 17 00:00:00 2001 From: JensFalk Date: Tue, 22 Sep 2026 09:34:00 +0200 Subject: [PATCH] AltchaService: Config-Getter fuer Namensmuster-Filter und Project Honey Pot --- .../src/Service/AltchaService.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/fp_altcha_spamschutz/src/Service/AltchaService.php b/fp_altcha_spamschutz/src/Service/AltchaService.php index 4b0214a..0cc4c82 100644 --- a/fp_altcha_spamschutz/src/Service/AltchaService.php +++ b/fp_altcha_spamschutz/src/Service/AltchaService.php @@ -63,6 +63,45 @@ class AltchaService return $this->getConfigValue('fp_altcha_debug', '') === 'on'; } + /** + * Kommagetrennte Liste bekannter Bot-Namensmuster (z. B. "Test,Test User"), konfigurierbar + * in den Plugin-Einstellungen. Leere/nur aus Leerzeichen bestehende Einträge werden ignoriert. + * + * @return string[] + */ + public function getNameBlocklist(): array + { + $raw = $this->getConfigValue('fp_altcha_name_blocklist', ''); + if ($raw === '') { + return []; + } + + $parts = \array_map('trim', \explode(',', $raw)); + + return \array_values(\array_filter($parts, static fn(string $p): bool => $p !== '')); + } + + /** + * Project Honey Pot (http:BL) ist nur aktiv, wenn ein Zugangsschluessel hinterlegt wurde. + */ + public function isHoneypotEnabled(): bool + { + return $this->getHoneypotApiKey() !== ''; + } + + public function getHoneypotApiKey(): string + { + return $this->getConfigValue('fp_altcha_honeypot_key', ''); + } + + /** + * Ab dieser von http:BL gemeldeten Bedrohungsstufe (0-255) wird zusaetzlich abgelehnt. + */ + public function getHoneypotThreshold(): int + { + return (int) $this->getConfigValue('fp_altcha_honeypot_threshold', '50'); + } + /** * Erzeugt eine neue Prüfung und liefert sie als Array, das 1:1 als JSON in die Seite * eingebettet werden kann (siehe TemplateHandler).