aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/functions_display.php11
2 files changed, 10 insertions, 3 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index c322c58779..f55eda4b5e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -739,7 +739,7 @@ function obtain_word_list(&$censors)
{
do
{
- $censors['match'][] = '#(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')#i';
+ $censors['match'][] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
$censors['replace'][] = $row['replacement'];
}
while ($row = $db->sql_fetchrow($result));
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 9c6d0fd844..e48249bdfc 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -290,10 +290,17 @@ function display_forums($root_data = '', $display_moderators = TRUE)
function display_attachments($attachment_data, &$update_count, $force_physical = false)
{
global $extensions, $template;
- global $config, $user, $phpbb_root_path, $phpEx, $SID;
+ global $config, $user, $phpbb_root_path, $phpEx, $SID, $censors;
+ if (empty($censors))
+ {
+ $censors = array();
+ obtain_word_list($censors);
+ }
+
if (empty($extensions) || !is_array($extensions))
{
+ $extensions = array();
obtain_attach_extensions($extensions);
}
@@ -323,7 +330,7 @@ function display_attachments($attachment_data, &$update_count, $force_physical =
$filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize);
$display_name = $attachment['real_filename'];
- $comment = str_replace("\n", '<br />', $attachment['comment']);
+ $comment = (sizeof($censors)) ? preg_replace($censors['match'], $censors['replace'], str_replace("\n", '<br />', $attachment['comment'])) : str_replace("\n", '<br />', $attachment['comment']);
$denied = FALSE;