Last change
on this file since 18370 was
18370,
checked in by mistic100, 12 years ago
|
avoid false positive ("ass" won't block "classroom")
|
File size:
748 bytes
|
Line | |
---|
1 | <?php |
---|
2 | defined('COMM_BLACKLIST_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | function comm_blacklist_user_comment_check($comment_action, $comm) |
---|
5 | { |
---|
6 | global $conf; |
---|
7 | |
---|
8 | if ($comment_action == $conf['comments_blacklist']['action']) |
---|
9 | { |
---|
10 | return $comment_action; |
---|
11 | } |
---|
12 | |
---|
13 | $blacklist = file(COMM_BLACKLIST_FILE, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
---|
14 | $blacklist = array_map('strtolower', $blacklist); |
---|
15 | $content = ' '.strtolower($comm['content']).' '; |
---|
16 | $author = ' '.strtolower($comm['author']).' '; |
---|
17 | |
---|
18 | foreach ($blacklist as $word) |
---|
19 | { |
---|
20 | $word = ' '.$word.' '; |
---|
21 | if ( strpos($content, $word)!==false or strpos($author, $word)!==false ) |
---|
22 | { |
---|
23 | return $conf['comments_blacklist']['action']; |
---|
24 | } |
---|
25 | } |
---|
26 | |
---|
27 | return $comment_action; |
---|
28 | } |
---|
29 | |
---|
30 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.