'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '1.30');
+ $propbag->add('version', '1.31');
$propbag->add('event_hooks', array(
'frontend_saveComment' => true,
'external_plugin' => true,
'backend_comments_top' => true,
'backend_view_comment' => true
));
- $propbag->add('configuration', array('killswitch', 'bodyclone', 'entrytitle', 'ipflood', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'bloggdeblacklist', 'contentfilter_authors', 'hide_email', 'checkmail', 'required_fields', 'logtype', 'logfile'));
+ $propbag->add('configuration', array('killswitch', 'bodyclone', 'entrytitle', 'ipflood', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'trackback_check_url', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'bloggdeblacklist', 'contentfilter_authors', 'hide_email', 'checkmail', 'required_fields', 'logtype', 'logfile'));
$propbag->add('groups', array('ANTISPAM'));
$this->filter_defaults = array(
break;
+ case 'trackback_check_url':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_TRACKBACKURL);
+ $propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_TRACKBACKURL_DESC);
+ $propbag->add('default', false);
+ break;
+
case 'hide_email':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_HIDE_EMAIL);
}
return false;
}
+
+ // Check Trackback URLs?
+ if ($addData['type'] == 'TRACKBACK' && serendipity_db_bool($this->get_config('trackback_check_url')) {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+
+ $req = &new HTTP_Request($addData['url'], array('allowRedirects' => true, 'maxRedirects' => 5));
+ $is_valid = false;
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $is_valid = false;
+ } else {
+ $fdata = $req->getResponseBody();
+
+ // Check if the target page contains a link to our blog
+ if (preg_match('@' . preg_quote($serendipity['baseURL'], '@') . '@i', $fdata)) {
+ $is_valid = true;
+ } else {
+ $is_valid = false;
+ }
+ }
+
+ if ($is_valid === false) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_TRACKBACKURL, $addData);
+ $eventData = array('allow_comments' => false);
+ $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_REASON_TRACKBACKURL;
+ return false;
+ }
+ }
// Check for word filtering
if ($filter_type = $this->get_config('contentfilter_activate', 'moderate')) {