aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/db/dbal.php2
-rw-r--r--phpBB/includes/functions.php32
2 files changed, 13 insertions, 21 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index cfebb61440..ed1d67b8e9 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -790,7 +790,7 @@ class dbal
</div>
</div>
<div id="page-footer">
- Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>
+ Powered by <a href="http://www.phpbb.com/">phpBB</a> &copy; phpBB Group
</div>
</div>
</body>
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 12e4ebc597..06de40a764 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3245,30 +3245,18 @@ function get_preg_expression($mode)
* Generate regexp for naughty words censoring
* Depends on whether installed PHP version supports unicode properties
*
-* @param string $word word template to be replaced
+* @param string $word word template to be replaced
+* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode
*
* @return string $preg_expr regex to use with word censor
*/
-function get_censor_preg_expression($word)
+function get_censor_preg_expression($word, $use_unicode = true)
{
- static $unicode = null;
+ // Unescape the asterisk to simplify further conversions
+ $word = str_replace('\*', '*', preg_quote($word, '#'));
- if (empty($word))
+ if ($use_unicode && pcre_utf8_support())
{
- return '';
- }
-
- // Check whether PHP version supports unicode properties
- if (is_null($unicode))
- {
- $unicode = pcre_utf8_support();
- }
-
- if ($unicode)
- {
- // Unescape the asterisk to simplify further conversions
- $word = str_replace('\*', '*', preg_quote($word, '#'));
-
// Replace asterisk(s) inside the pattern, at the start and at the end of it with regexes
$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}_-]*?'), $word);
@@ -3277,7 +3265,11 @@ function get_censor_preg_expression($word)
}
else
{
- $preg_expr = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($word, '#')) . ')(?!\S)#iu';
+ // Replace the asterisk inside the pattern, at the start and at the end of it with regexes
+ $word = preg_replace(array('#(?<=\S)\*+(?=\S)#iu', '#^\*+#', '#\*+$#'), array('(\x20*?\S*?)', '\S*?', '\S*?'), $word);
+
+ // Generate the final substitution
+ $preg_expr = '#(?<!\S)(' . $word . ')(?!\S)#iu';
}
return $preg_expr;
@@ -3829,7 +3821,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
echo ' </div>';
echo ' </div>';
echo ' <div id="page-footer">';
- echo ' Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>';
+ echo ' Powered by <a href="http://www.phpbb.com/">phpBB</a> &copy; phpBB Group';
echo ' </div>';
echo '</div>';
echo '</body>';