mirror of
https://gitlab.com/siarp/beethoven2000.de.git
synced 2026-08-07 19:18:18 +00:00
47 lines
879 B
PHP
47 lines
879 B
PHP
<?php
|
|
|
|
class Message {
|
|
|
|
/**
|
|
* Fehler beim Senden bzw. Speichern der Nachricht.
|
|
*/
|
|
public $error = false;
|
|
|
|
/**
|
|
* Nachricht enthält möglicherweise Spam.
|
|
*/
|
|
public $spam = false;
|
|
|
|
|
|
/**
|
|
* Gibt an, ob der Eintrag Spam enthalten könnte.
|
|
* Prüft, ob Zeilenumbrüche in den Werten von einzeiligen Eingabefeldern vorhanden sind.
|
|
* Prüft, ob der übergebene String einen Eintrag der Blacklist enthält.
|
|
*/
|
|
protected function contains_spam_hints ($test_string, $input) {
|
|
|
|
foreach ($input as $value) {
|
|
if (preg_match('~[\n\r]~', $value)) {
|
|
$this->spam = true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$blacklist = array(
|
|
'~Content\-T~i',
|
|
'~href=~i',
|
|
'~https?://.+?https?://~s',
|
|
);
|
|
|
|
foreach ($blacklist as $blackstring) {
|
|
if (preg_match($blackstring, $test_string)) {
|
|
$this->spam = true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
?>
|