Ignore:
Timestamp:
Dec 23, 2013, 11:45:56 AM (7 years ago)
Author:
mistic100
Message:

use \b delimiter instead of whitespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/comments_blacklist/include/functions.inc.php

    r18651 r26112  
    66  global $conf;
    77 
    8   if ( $comment_action==$conf['comments_blacklist']['action'] or $comment_action=='reject' )
     8  if ($comment_action==$conf['comments_blacklist']['action'] or $comment_action=='reject')
    99  {
    1010    return $comment_action;
     
    1818  }
    1919 
    20   $blacklist = array_map(create_function('$w', 'return " ".preg_quote($w)." ";'), $blacklist);
     20  $blacklist = array_map(create_function('$w', 'return preg_quote($w);'), $blacklist);
    2121  $blacklist = implode('|', $blacklist);
    22 
    23   $content = str_replace(array("\r\n","\n"), ' ', $comm['content']);
    2422 
    25   if ( preg_match('#('.$blacklist.')#i', ' '.$comm['author'].' ') or preg_match('#('.$blacklist.')#i', ' '.$content.' ') )
     23  if (preg_match('#\b('.$blacklist.')\b#i', $comm['author']) or
     24      preg_match('#\b('.$blacklist.')\b#i', $comm['content'])
     25    )
    2626  {
    2727    return $conf['comments_blacklist']['action'];
Note: See TracChangeset for help on using the changeset viewer.