Turning "ask question" on and off

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

bouton
Posts: 10
Joined: Thu Jan 19, 2006 3:13 pm

Post by bouton »

i don't think it quite works just yet.
seems to always return false!! i forgot to test it with a non bad word coment!

am fixing it
will keep you posted

sorry
bouton
Posts: 10
Joined: Thu Jan 19, 2006 3:13 pm

Post by bouton »

ok corrected functions which seems to work

function checkBannedWord($content)
{
$blockedWordsFile = 'blockedWords.txt';
// got original from from blocklist2 cookbook at pmwiki.org
require_once('local_changes/fileIterator.php');
// this include is from Richard Heyes (http://www.phpguru.org/)
$numBlocked=0;
if(!is_file($blockedWordsFile)){
// echo 'ERROR: Could not find blockedWordsFile file "'.$blockedWordsFile.'"';
exit;
} else {
foreach (new FileIterator($blockedWordsFile) as $badword) {
$badword = trim($badword); // get the word from the file
if (preg_match('/'.$badword.'/', $content)) {
$numBlocked++;
}
}
}
if ($numBlocked >0) {
return false;
//echo "NO SPAMMING ALLOWED2<P>";
} else {
//echo "OK good to go2<P>";
return true;
}
}
Thorsten
Posts: 15731
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

can you send me all your changes? I would add it into the next version of phpMyFAQ.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply