diff options
author | Ruslan Uzdenov <rxu@mail.ru> | 2009-06-18 23:21:19 +0000 |
---|---|---|
committer | Ruslan Uzdenov <rxu@mail.ru> | 2009-06-18 23:21:19 +0000 |
commit | ac1fd3c740bf396e27e882877b94ae246caedac6 (patch) | |
tree | 63b9fa3f466e2498298abac865f1378b106f545d /phpBB | |
parent | eb5498dd55fa3d3c5005656b70c9f4cb0630f34c (diff) | |
download | forums-ac1fd3c740bf396e27e882877b94ae246caedac6.tar forums-ac1fd3c740bf396e27e882877b94ae246caedac6.tar.gz forums-ac1fd3c740bf396e27e882877b94ae246caedac6.tar.bz2 forums-ac1fd3c740bf396e27e882877b94ae246caedac6.tar.xz forums-ac1fd3c740bf396e27e882877b94ae246caedac6.zip |
Fix bug #16555 - Word censoring doesn't support unicode strings
Authorised by: acydburn
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9624 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
-rw-r--r-- | phpBB/includes/cache.php | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7ea4eb26c2..cc00509fb5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -121,6 +121,7 @@ <li>[Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)</li> <li>[Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)</li> <li>[Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.</li> + <li>[Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)</li> <li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li> <li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li> <li>[Change] Template engine now permits to a limited extent variable includes.</li> diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index fc9a01ae4e..392f1377da 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -84,7 +84,15 @@ class cache extends acm $censors = array(); while ($row = $db->sql_fetchrow($result)) { - $censors['match'][] = '#(?<!\w)(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')(?!\w)#i'; + if ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) + { + $censors['match'][] = '#(?<!\p{L})(' . str_replace('\*', '\p{L}*?', preg_quote($row['word'], '#')) . ')(?!\p{L})#u'; + } + else + { + $censors['match'][] = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($row['word'], '#')) . ')(?!\S)#iu'; + } + $censors['replace'][] = $row['replacement']; } $db->sql_freeresult($result); |