1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

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
This commit is contained in:
blackpuma 2001-08-14 17:55:32 +00:00
parent 7503c85590
commit bd8652f186

View File

@ -554,6 +554,35 @@ for($i = 0; $i < $total_posts; $i++)
$quote_img = "<a href=\"" . append_sid("posting.$phpEx?mode=quote&amp;" . 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&amp;" . 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);
?>
?>