Changeset 18394 for extensions/comments_blacklist
- Timestamp:
- Oct 1, 2012, 4:40:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/comments_blacklist/include/functions.inc.php
r18370 r18394 6 6 global $conf; 7 7 8 if ( $comment_action == $conf['comments_blacklist']['action'])8 if ( $comment_action==$conf['comments_blacklist']['action'] or $comment_action=='reject' ) 9 9 { 10 10 return $comment_action; … … 12 12 13 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']).' '; 14 $blacklist = array_map(create_function('$w', 'return " ".preg_quote($w)." ";'), $blacklist); 15 $blacklist = implode('|', $blacklist); 16 17 $content = str_replace(array("\r\n","\n"), ' ', $comm['content']); 17 18 18 foreach ($blacklist as $word)19 if ( preg_match('#('.$blacklist.')#i', ' '.$comm['author'].' ') or preg_match('#('.$blacklist.')#i', ' '.$content.' ') ) 19 20 { 20 $word = ' '.$word.' '; 21 if ( strpos($content, $word)!==false or strpos($author, $word)!==false ) 22 { 23 return $conf['comments_blacklist']['action']; 24 } 21 return $conf['comments_blacklist']['action']; 25 22 } 26 23
Note: See TracChangeset
for help on using the changeset viewer.