Spam Blocker
Identifies and blocks spam posts by Shabbir Bhimani
2.0
Spam Blocker Libraries
global_start
options['spamblockerrules']);
$data = array();
foreach($rules as $rule) {
// comment lines
if( strpos($rule,'#') === 0 )
continue;
// split up the line
$bits = preg_split('/(?userinfo['posts'] > $GLOBALS['vbulletin']->options['spamblockerpostcount'] )
return false;
// parts of the post
$req = array();
$req['title'] = $obj->fetch_field('title',$table);
$req['body'] = $obj->fetch_field('pagetext',$table);
$req['any'] = $req['title'] ."\n". $req['body'];
// fetch the list of tests
$tests = sb_parse_config();
// run each test
foreach($tests as $test) {
$test_pass=false;
$no_of_times = 1;
// regular expression test
if( $test['type'] == 'regexp' ) {
$no_of_times = @preg_match_all($test['data'][0],$req[ $test['field'] ],$old);
$test_pass = ($no_of_times >= $test['score']);
}
// record the test if it was a hit
if( $test_pass ) {
$hits[ $test['name'] ] = $test['score'];
$hits['total'] += $test['score'];
}
}
// it isn't spam
if( $hits['total'] < $GLOBALS['vbulletin']->options['spamblockertrigger'] )
return false;
// it's spam
// prevent it from being displayed?
if( $GLOBALS['vbulletin']->options['spamblockermoderate'] ) {
$obj->set('visible',0);
}
// it is spam - return a list of the hits
return $hits;
}
]]>
Spam Blocker: Normal posts check
postdata_presave
error('linkfloodcheck');
}
}]]>
Spam Blocker: New thread check
threadfpdata_presave
fetch_field('userid','post') != $this->registry->options['spamblockeruser'] ) {
if ( function_exists('sb_test') ) {
if(sb_test($this,'post') != false) {
$this->error('linkfloodcheck');
}
}
}]]>
number
1
number
10
free
textarea