Another file that shouldve commited ages ago, adds word censor to topic titles

git-svn-id: file:///svn/phpbb/trunk@887 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-08-15 22:53:57 +00:00
parent d4ca9eb809
commit 88d259a6c2

View file

@ -264,6 +264,31 @@ if(!$ta_result = $db->sql_query($sql))
}
$total_announcements = $db->sql_numrows($ta_result);
//
// Define censored word matches
//
$sql = "SELECT word, replacement
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
{
$word_list = $db->sql_fetchrowset($words_result);
$orig_word = array();
$replacement_word = array();
for($i = 0; $i < count($word_list); $i++)
{
$word = str_replace("\*", "\w*?", preg_quote($word_list[$i]['word']));
$orig_word[] = "/\b(" . $word . ")\b/i";
$replacement_word[] = $word_list[$i]['replacement'];
}
}
//
// Post URL generation for templating vars
//
@ -368,7 +393,10 @@ if($total_topics || $total_announcements)
for($i = 0; $i < $total_topics; $i++)
{
$topic_title = stripslashes($topic_rowset[$i]['topic_title']);
if( count($orig_word) )
{
$topic_title = preg_replace($orig_word, $replacement_word, stripslashes($topic_rowset[$i]['topic_title']));
}
$topic_type = $topic_rowset[$i]['topic_type'];