diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2011-01-07 15:58:10 +0100 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2011-01-07 15:58:10 +0100 |
| commit | 1c95101284d1545443bf6070d2f9dbc2880165f6 (patch) | |
| tree | fe969e58749941a6754ecc882223a7c3b921e026 /phpBB/includes/cache.php | |
| parent | 08f6a12325ab02696e0093ff7ddfb005dd7d2321 (diff) | |
| parent | a469e804930e66c244da27deb4dc94b5e280659f (diff) | |
| download | forums-1c95101284d1545443bf6070d2f9dbc2880165f6.tar forums-1c95101284d1545443bf6070d2f9dbc2880165f6.tar.gz forums-1c95101284d1545443bf6070d2f9dbc2880165f6.tar.bz2 forums-1c95101284d1545443bf6070d2f9dbc2880165f6.tar.xz forums-1c95101284d1545443bf6070d2f9dbc2880165f6.zip | |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/9933] Create unit test for word censor regular expression.
[ticket/9933] Move word censor regex into separate function in functions.php
[ticket/9933] Wrong handling consecutive multiple asterisks in word censor
Conflicts:
phpBB/includes/cache.php
Diffstat (limited to 'phpBB/includes/cache.php')
| -rw-r--r-- | phpBB/includes/cache.php | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index 1986f021c6..49b690f1a4 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -82,26 +82,9 @@ class cache extends acm $result = $db->sql_query($sql); $censors = array(); - $unicode = pcre_utf8_support(); - while ($row = $db->sql_fetchrow($result)) { - if ($unicode) - { - // Unescape the asterisk to simplify further conversions - $row['word'] = str_replace('\*', '*', preg_quote($row['word'], '#')); - - // Replace the asterisk inside the pattern, at the start and at the end of it with regexes - $row['word'] = preg_replace(array('#(?<=[\p{Nd}\p{L}_])\*(?=[\p{Nd}\p{L}_])#iu', '#^\*#', '#\*$#'), array('([\x20]*?|[\p{Nd}\p{L}_-]*?)', '[\p{Nd}\p{L}_-]*?', '[\p{Nd}\p{L}_-]*?'), $row['word']); - - // Generate the final substitution - $censors['match'][] = '#(?<![\p{Nd}\p{L}_-])(' . $row['word'] . ')(?![\p{Nd}\p{L}_-])#iu'; - } - else - { - $censors['match'][] = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($row['word'], '#')) . ')(?!\S)#iu'; - } - + $censors['match'][] = get_censor_preg_expression($row['word']); $censors['replace'][] = $row['replacement']; } $db->sql_freeresult($result); |
