'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '1.27');
+ $propbag->add('version', '1.30');
$propbag->add('event_hooks', array(
'frontend_saveComment' => true,
'external_plugin' => true,
$this->filter_defaults = array(
'authors' => 'casino;phentermine;credit;loans;poker',
- 'urls' => '8gold\.com;911easymoney\.com;canadianlabels\.net;condodream\.com;crepesuzette\.com;debt-help-bill-consolidation-elimination\.com;fidelityfunding\.net;flafeber\.com;gb\.com;houseofsevengables\.com;instant-quick-money-cash-advance-personal-loans-until-pay-day\.com;mediavisor\.com;newtruths\.com;oiline\.com;onlinegamingassociation\.com;online\-+poker\.com;popwow\.com;royalmailhotel\.com;spoodles\.com;sportsparent\.com;stmaryonline\.org;thatwhichis\.com;tmsathai\.org;uaeecommerce\.com;learnhowtoplay\.com'
+ 'urls' => '8gold\.com;911easymoney\.com;canadianlabels\.net;condodream\.com;crepesuzette\.com;debt-help-bill-consolidation-elimination\.com;fidelityfunding\.net;flafeber\.com;gb\.com;houseofsevengables\.com;instant-quick-money-cash-advance-personal-loans-until-pay-day\.com;mediavisor\.com;newtruths\.com;oiline\.com;onlinegamingassociation\.com;online\-+poker\.com;popwow\.com;royalmailhotel\.com;spoodles\.com;sportsparent\.com;stmaryonline\.org;thatwhichis\.com;tmsathai\.org;uaeecommerce\.com;learnhowtoplay\.com',
+ 'words' => 'very good site!;Real good stuff!'
);
}
$propbag->add('default', $this->filter_defaults['authors']);
break;
+ case 'contentfilter_words':
+ $propbag->add('type', 'text');
+ $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_FILTER_WORDS);
+ $propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS_DESC);
+ $propbag->add('default', $this->filter_defaults['words']);
+ break;
+
case 'logfile':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_LOGFILE);
function getBlacklist($where) {
global $serendipity;
-
+
switch($where) {
case 'blogg.de':
$target = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE . '/blogg.de.blacklist.txt';
$timeout = 3600; // One hour
-
+
if (file_exists($target) && filemtime($target) > time()-$timeout) {
$data = file_get_contents($target);
} else {
$data = '';
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
$req = &new HTTP_Request('http://spam.blogg.de/blacklist.txt');
-
+
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
if (file_exists($target) && filesize($target) > 0) {
$data = file_get_contents($target);
// Fetch file
$data = $req->getResponseBody();
$fp = @fopen($target, 'w');
-
+
if ($fp) {
fwrite($fp, $data);
fclose($fp);
}
}
}
-
+
$blacklist = explode("\n", $data);
return $blacklist;
-
+
default:
return false;
}
$serendipity['csuccess'] = 'true';
$logfile = $this->get_config('logfile', $serendipity['serendipityPath'] . 'spamblock.log');
$required_fields = $this->get_config('required_fields', '');
-
+
// Check required fields
if ($addData['type'] == 'NORMAL' && !empty($required_fields)) {
$required_field_list = explode(',', $required_fields);
}
}
}
-
+
// Check if entry title is the same as comment body
if (serendipity_db_bool($this->get_config('entrytitle')) && trim($eventData['title']) == trim($addData['comment'])) {
$this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_TITLE, $addData);
}
}
}
+
+ // Filter Content
+ $filter_bodys = explode(';', $this->get_config('contentfilter_words', $this->filter_defaults['words']));
+ if (is_array($filter_bodys)) {
+ foreach($filter_bodys AS $filter_body) {
+ if (empty($filter_body)) {
+ continue;
+ }
+ if (preg_match('@' . $filter_body . '@', $addData['comment'])) {
+ if ($filter_type == 'moderate') {
+ $this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_FILTER_WORDS, $addData);
+ $eventData['moderate_comments'] = true;
+ $serendipity['csuccess'] = 'moderate';
+ $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
+ return false;
+ } else {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_FILTER_WORDS, $addData);
+ $eventData = array('allow_comments' => false);
+ $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
+ return false;
+ }
+ }
+ }
+ }
}
-
+
// Filter Blogg.de Blacklist?
$bloggdeblacklist = $this->get_config('bloggdeblacklist');
if ($bloggdeblacklist == 'moderate' || $bloggdeblacklist == 'reject') {
if (empty($domain)) {
continue;
}
-
+
if (preg_match('@' . preg_quote($domain) . '@i', $addData['url'])) {
if ($bloggdeblacklist == 'moderate') {
$this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_REASON_BLOGG_SPAMLIST . ': ' . $domain, $addData);
return false;
}
}
-
+
// Check invalid email
if ($addData['type'] == 'NORMAL' && serendipity_db_bool($this->get_config('checkmail', false))) {
if (!empty($addData['email']) && strstr($addData['email'], '@') === false) {
}
}
}
-
+
return true;
break;
}
}
}
-
+
if ($getItems) {
if (!$filtered && !empty($match)) {
$items[] = preg_quote($match, '@');
return $items;
}
-
+
return $filtered;
}
function getComment($key, $id) {
global $serendipity;
$c = serendipity_db_query("SELECT $key FROM {$serendipity['dbPrefix']}comments WHERE id = '" . (int)$id . "'", true, 'assoc');
-
+
if (!is_array($c) || !isset($c[$key])) {
return false;
}
-
+
return $c[$key];
}