Skip to content

Commit 2f55ad3

Browse files
committed
Flag account when chinese or korean is posted
1 parent 5c4d984 commit 2f55ad3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/Lio/Forum/Threads/ThreadCreator.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,23 @@ private function validateAndSave($thread, $listener, $data)
9595
*/
9696
private function containsSpam($subject)
9797
{
98+
if ($this->containsKoreanOrChinese($subject)) {
99+
return true;
100+
}
101+
98102
// If the validator detects phone numbers, return false.
99103
return ! $this->phoneNumbers->validate($subject);
100104
}
101105

106+
/**
107+
* @param string $subject
108+
* @return bool
109+
*/
110+
private function containsKoreanOrChinese($subject)
111+
{
112+
return (bool) preg_match("/[\p{Hangul}|\p{Han}]+/u", $subject);
113+
}
114+
102115
/**
103116
* Increases a user's spam count
104117
*

0 commit comments

Comments
 (0)