diff options
author | blackpuma <blackpuma@users.sourceforge.net> | 2001-08-14 17:55:32 +0000 |
---|---|---|
committer | blackpuma <blackpuma@users.sourceforge.net> | 2001-08-14 17:55:32 +0000 |
commit | bd8652f1869c477b5b7e066eb61b435312c7cd3e (patch) | |
tree | 609e7914a5a2fde038005e803d60c70e98b7c5c8 /phpBB/viewtopic.php | |
parent | 7503c85590ccfa01634d2b071eb8e6ab1475db73 (diff) | |
download | forums-bd8652f1869c477b5b7e066eb61b435312c7cd3e.tar forums-bd8652f1869c477b5b7e066eb61b435312c7cd3e.tar.gz forums-bd8652f1869c477b5b7e066eb61b435312c7cd3e.tar.bz2 forums-bd8652f1869c477b5b7e066eb61b435312c7cd3e.tar.xz forums-bd8652f1869c477b5b7e066eb61b435312c7cd3e.zip |
Word censoring, first part. Does not support wildcards yet but that's coming in the next step.
git-svn-id: file:///svn/phpbb/trunk@876 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r-- | phpBB/viewtopic.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4f3b34bd0a..d073f2f5ee 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -554,6 +554,35 @@ for($i = 0; $i < $total_posts; $i++) $quote_img = "<a href=\"" . append_sid("posting.$phpEx?mode=quote&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_quote'] . "\" alt=\"" . $lang['Reply_with_quote'] ."\" border=\"0\" /></a>"; + // + // Filtering bad words + // + $message = stripslashes($postrow[$i]['post_text']); + + $sql = "SELECT * FROM " . WORDS_TABLE; + if(!$words_result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't get censored words from database.", "", __LINE__, __FILE__, $sql); + } + else + { // Some performance stuff + if(mysql_num_rows($words_result) != 0) + { + while($current_row = mysql_fetch_array($words_result)) + { + $word = $current_row['word']; + $replacement = $current_row['replacement']; + + $message = preg_replace("/$word/i", " $replacement", $message); + $message = preg_replace("/^$words\s/i", "$replacement ", $message); + $message = preg_replace("/<BR>$word$/i", "<BR>$replacement", $message); + $message = preg_replace("/<BR>$words\s/i", "<BR>$replacement ", $message); + } + } + } + + + if( $is_auth['auth_mod'] ) { $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=viewip&" . POST_POST_URL . "=" . $post_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>"; @@ -566,7 +595,6 @@ for($i = 0; $i < $total_posts; $i++) $bbcode_uid = $postrow[$i]['bbcode_uid']; $user_sig = stripslashes($postrow[$i]['user_sig']); - $message = stripslashes($postrow[$i]['post_text']); if(!$board_config['allow_html'] || !$postrow[$i]['enable_html']) { @@ -746,4 +774,4 @@ $template->pparse("body"); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); -?>
\ No newline at end of file +?> |