UBB.Dev
Posted By: The Team Auto Approve Hack - 02/05/2001 11:57 AM
We were looking for a way to auto aprove messages as long as they don't contain certain words....here's a hack to do this:

in config.inc.php this was added:
// Auto Approve "on" or ""
$config['autoapprove'] = "on";

right after the checking for filtered "badwords" the following code was added:

// ---------------------------------------------------------------------
// Make sure there are no words in autoapprove file. if so this message will
// not be autoapproved

if ($config[autoapprove] == "on") {
$lowerbody = strtolower($Body);
$lowersubject = strtolower($Subject);
$Approved = "yes";
$autoapprove = file("$config[path]/filters/autoapprove");
while (list($linenum,$line) = each($autoapprove) ) {
$line = chop($line);
if ( (ereg("^\r",$line)) || (ereg("^\n",$line)) ) {
continue;ยท
}
$lower_line = strtolower($line);
$pos = strpos($lowerbody,$lower_line);
if ($pos !== false) $Approved = "no";
$pos = strpos($lowersubject,$lower_line);
if ($pos !== false) $Approved = "no";
}
}


if the post or subject contains any of the words in wwwthreads/filters/autoapprove the message will not be autoapproved. If the post/subject doesn't contain any of the words/phrases it will automatically be approved.



Posted By: jay_maltese Re: Auto Approve Hack - 08/06/2001 1:46 AM
Will this work on the perl version as well?
© UBB.Developers