source: extensions/comments_blacklist/include/functions.inc.php @ 18369

Last change on this file since 18369 was 18369, checked in by mistic100, 12 years ago

first commit

File size: 705 bytes
Line 
1<?php
2defined('COMM_BLACKLIST_PATH') or die('Hacking attempt!');
3
4function 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    if ( strpos($content, $word)!==false or strpos($author, $word)!==false )
21    {
22      return $conf['comments_blacklist']['action'];
23    }
24  }
25 
26  return $comment_action;
27}
28
29?>
Note: See TracBrowser for help on using the repository browser.