fixed core plugins db tables, ip column to IPv6 length
This commit is contained in:
@ -28,7 +28,7 @@ var $filter_defaults;
|
||||
'smarty' => '2.6.7',
|
||||
'php' => '4.1.0'
|
||||
));
|
||||
$propbag->add('version', '1.81');
|
||||
$propbag->add('version', '1.82');
|
||||
$propbag->add('event_hooks', array(
|
||||
'frontend_saveComment' => true,
|
||||
'external_plugin' => true,
|
||||
@ -277,7 +277,7 @@ var $filter_defaults;
|
||||
$propbag->add('type', 'radio');
|
||||
$propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_AKISMET_SERVER);
|
||||
$propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_AKISMET_SERVER_DESC);
|
||||
// If the user has an API key, but hasn't set a server, he
|
||||
// If the user has an API key, but hasn't set a server, he
|
||||
// must be using an older version of the plugin; default
|
||||
// to akismet. Otherwise, encourage adoption of the Open
|
||||
// Source alternative, TypePad Antispam.
|
||||
@ -487,7 +487,7 @@ var $filter_defaults;
|
||||
'timeout' => 20,
|
||||
'allowRedirects' => true,
|
||||
'maxRedirects' => 3,
|
||||
'readTimeout' => array(5,0),
|
||||
'readTimeout' => array(5,0),
|
||||
);
|
||||
|
||||
// Default server type to akismet, in case user has an older version of the plugin
|
||||
@ -502,7 +502,7 @@ var $filter_defaults;
|
||||
case 'tpas':
|
||||
$server = 'api.antispam.typepad.com';
|
||||
break;
|
||||
|
||||
|
||||
case 'anon-akismet':
|
||||
$anon = true;
|
||||
case 'akismet':
|
||||
@ -699,7 +699,7 @@ var $filter_defaults;
|
||||
global $serendipity;
|
||||
|
||||
$dbversion = $this->get_config('dbversion', '1');
|
||||
|
||||
|
||||
if ($dbversion == '1') {
|
||||
$q = "CREATE TABLE {$serendipity['dbPrefix']}spamblocklog (
|
||||
timestamp int(10) {UNSIGNED} default null,
|
||||
@ -710,7 +710,7 @@ var $filter_defaults;
|
||||
email varchar(200),
|
||||
url varchar(200),
|
||||
useragent varchar(255),
|
||||
ip varchar(15),
|
||||
ip varchar(45),
|
||||
referer varchar(255),
|
||||
body text)";
|
||||
$sql = serendipity_db_schema_import($q);
|
||||
@ -732,7 +732,17 @@ var $filter_defaults;
|
||||
$q = "CREATE INDEX kshtaidx ON {$serendipity['dbPrefix']}spamblock_htaccess (timestamp);";
|
||||
$sql = serendipity_db_schema_import($q);
|
||||
|
||||
$this->set_config('dbversion', '2');
|
||||
$this->set_config('dbversion', '3');
|
||||
}
|
||||
|
||||
if ($dbversion == '2') {
|
||||
$q = "ALTER TABLE {$serendipity['dbPrefix']}spamblocklog CHANGE COLUMN ip ip VARCHAR(45)";
|
||||
$sql = serendipity_db_schema_import($q);
|
||||
|
||||
$q = "ALTER TABLE {$serendipity['dbPrefix']}spamblock_htaccess CHANGE COLUMN ip ip VARCHAR(45)";
|
||||
$sql = serendipity_db_schema_import($q);
|
||||
|
||||
$this->set_config('dbversion', '3');
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -828,7 +838,7 @@ var $filter_defaults;
|
||||
// Check if the entry is older than the allowed amount of time. Enforce kaptchas if that is true
|
||||
// of if kaptchas are activated for every entry
|
||||
$show_captcha = ($captchas && isset($eventData['timestamp']) && ($captchas_ttl < 1 || ($eventData['timestamp'] < (time() - ($captchas_ttl*60*60*24)))) ? true : false);
|
||||
|
||||
|
||||
// Plugins can override with custom captchas
|
||||
if (isset($serendipity['plugins']['disable_internal_captcha'])) {
|
||||
$show_captcha = false;
|
||||
@ -867,7 +877,7 @@ var $filter_defaults;
|
||||
$fp = fopen('/tmp/spamblock2.log', 'a');
|
||||
fwrite($fp, date('Y-m-d H:i') . "\n" . print_r($eventData, true) . "\n" . print_r($addData, true) . "\n");
|
||||
fclose($fp);
|
||||
*/
|
||||
*/
|
||||
|
||||
if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
|
||||
$this->checkScheme();
|
||||
@ -923,7 +933,7 @@ var $filter_defaults;
|
||||
if (!is_array($auth)) {
|
||||
// Filter authors names, Filter URL, Filter Content, Filter Emails, Check for maximum number of links before rejecting
|
||||
// moderate false
|
||||
if(false === $this->wordfilter($logfile, $eventData, $wordmatch, $addData, true)) {
|
||||
if(false === $this->wordfilter($logfile, $eventData, $wordmatch, $addData, true)) {
|
||||
// already there #$this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_FILTER_WORDS, $addData);
|
||||
// already there #$eventData = array('allow_comments' => false);
|
||||
// already there #$serendipity['messagestack']['emails'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
|
||||
@ -933,7 +943,7 @@ var $filter_defaults;
|
||||
$eventData = array('allow_comments' => false);
|
||||
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_KILLSWITCH;
|
||||
return false;
|
||||
} else {
|
||||
} else {
|
||||
$this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL_VERIFICATION_MAIL, $addData);
|
||||
$eventData['moderate_comments'] = true;
|
||||
$eventData['status'] = 'confirm1';
|
||||
@ -987,7 +997,7 @@ var $filter_defaults;
|
||||
$found_exclude_url = false;
|
||||
foreach ($exclude_urls as $exclude_url) {
|
||||
$exclude_url = trim($exclude_url);
|
||||
if (empty($exclude_url)) continue;
|
||||
if (empty($exclude_url)) continue;
|
||||
$found_exclude_url = preg_match('@' . $exclude_url . '@',$addData['url']);
|
||||
if ($found_exclude_url) {
|
||||
break;
|
||||
@ -1078,7 +1088,7 @@ var $filter_defaults;
|
||||
}
|
||||
}
|
||||
|
||||
if(false === $this->wordfilter($logfile, $eventData, $wordmatch, $addData)) {
|
||||
if(false === $this->wordfilter($logfile, $eventData, $wordmatch, $addData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1228,7 +1238,7 @@ var $filter_defaults;
|
||||
if (serendipity_db_bool($this->get_config('hide_email', false))) {
|
||||
echo '<div class="serendipity_commentDirection serendipity_comment_spamblock">' . PLUGIN_EVENT_SPAMBLOCK_HIDE_EMAIL_NOTICE . '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ((string)$this->get_config('checkmail') === 'verify_always' || (string)$this->get_config('checkmail') === 'verify_once') {
|
||||
echo '<div class="serendipity_commentDirection serendipity_comment_spamblock">' . PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL_VERIFICATION_INFO . '</div>';
|
||||
}
|
||||
@ -1435,7 +1445,7 @@ var $filter_defaults;
|
||||
/**
|
||||
* wordfilter, email and additional link check moved to this function, to allow comment user to opt-in (verify_once), but reject all truly spam comments before.
|
||||
**/
|
||||
function wordfilter($logfile, &$eventData, $wordmatch, $addData, $ftc = false) {
|
||||
function wordfilter($logfile, &$eventData, $wordmatch, $addData, $ftc = false) {
|
||||
global $serendipity;
|
||||
|
||||
// Check for word filtering
|
||||
@ -1541,7 +1551,7 @@ var $filter_defaults;
|
||||
}
|
||||
} // Content filtering end
|
||||
|
||||
if($ftc) {
|
||||
if($ftc) {
|
||||
// Check for maximum number of links before rejecting
|
||||
$link_count = substr_count(strtolower($addData['comment']), 'http://');
|
||||
$links_reject = $this->get_config('links_reject', 20);
|
||||
|
Reference in New Issue
Block a user