mirror of
https://gitlab.com/siarp/beethoven2000.de.git
synced 2026-08-07 19:18:18 +00:00
initial - based on https://gitlab.com/siarp/beethoven2000.de_old
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?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',
|
||||
'~http://.+?http://.+?http://~s',
|
||||
);
|
||||
|
||||
foreach ($blacklist as $blackstring) {
|
||||
if (preg_match($blackstring, $test_string)) {
|
||||
$this->spam = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user