AltchaService: Config-Getter fuer Namensmuster-Filter und Project Honey Pot

This commit is contained in:
2026-09-22 09:34:00 +02:00
parent 17f5c7b98f
commit 3c1128ca4d
@@ -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).