Remove trackback integration from spamfilter module

This commit is contained in:
Kijin Sung 2021-02-23 21:51:45 +09:00
parent bc448af4fd
commit 9df05d20db
4 changed files with 4 additions and 56 deletions

View file

@ -20,17 +20,13 @@ class spamfilterAdminController extends spamfilter
$config = ModuleModel::getModuleConfig('spamfilter') ?: new stdClass;
// Get the default information
$args = Context::gets('limits', 'limits_interval', 'limits_count', 'check_trackback', 'ipv4_block_range', 'ipv6_block_range', 'custom_message');
$args = Context::gets('limits', 'limits_interval', 'limits_count', 'ipv4_block_range', 'ipv6_block_range', 'custom_message');
// Set default values
if($args->limits != 'Y')
{
$args->limits = 'N';
}
if($args->check_trackback != 'Y')
{
$args->check_trackback = 'N';
}
if(!preg_match('#^/(\d+)$#', $args->ipv4_block_range, $matches) || $matches[1] > 32 || $matches[1] < 16)
{
$args->ipv4_block_range = '';

View file

@ -13,12 +13,13 @@ class spamfilter extends ModuleObject
array('document.manage', 'before', 'controller', 'triggerManageDocument'),
array('comment.insertComment', 'before', 'controller', 'triggerInsertComment'),
array('comment.updateComment', 'before', 'controller', 'triggerInsertComment'),
array('trackback.insertTrackback', 'before', 'controller', 'triggerInsertTrackback'),
array('communication.sendMessage', 'before', 'controller', 'triggerSendMessage'),
array('moduleObject.proc', 'before', 'controller', 'triggerCheckCaptcha'),
);
protected static $_delete_triggers = array();
protected static $_delete_triggers = array(
array('trackback.insertTrackback', 'before', 'controller', 'triggerInsertTrackback'),
);
/**
* Register all triggers.

View file

@ -122,41 +122,6 @@ class spamfilterController extends spamfilter
$this->insertLog();
}
/**
* @brief Inspect the trackback creation time and IP
*/
function triggerInsertTrackback(&$obj)
{
if($_SESSION['avoid_log']) return;
$oFilterModel = getModel('spamfilter');
// Confirm if the trackbacks have been added more than once to your document
$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
if(!$output->toBool()) return $output;
// Check if the IP is prohibited
$output = $oFilterModel->isDeniedIP();
if(!$output->toBool()) return $output;
// Check if there is a ban on the word
$text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url;
$output = $oFilterModel->isDeniedWord($text);
if(!$output->toBool()) return $output;
// Start Filtering
$oTrackbackController = getController('trackback');
if (is_object($oTrackbackController) && method_exists($oTrackbackController, 'deleteTrackbackSender'))
{
// In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it.
if($obj->title == $obj->excerpt)
{
$oTrackbackController->deleteTrackbackSender(60*60*6, \RX_CLIENT_IP, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
$this->insertIP(\RX_CLIENT_IP, 'AUTO-DENIED : trackback.insertTrackback');
return new BaseObject(-1, 'msg_alert_trackback_denied');
}
}
}
/**
* @brief IP registration
* The registered IP address is considered as a spammer

View file

@ -18,20 +18,6 @@
<p class="x_help-block">{$lang->cmd_interval_help}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_check_trackback}</label>
<div class="x_controls">
<label for="spamCond2_yes" class="x_inline">
<input type="radio" name="check_trackback" id="spamCond2_yes" value="Y" checked="checked"|cond="$config->check_trackback=='Y' || $config->check_trackback==''" />
{$lang->cmd_yes}
</label>
<label for="spamCond2_no" class="x_inline">
<input type="radio" name="check_trackback" id="spamCond2_no" value="N" checked="checked"|cond="$config->check_trackback!='Y' && $config->check_trackback!=''" / >
{$lang->cmd_no}
</label>
<p class="x_help-block">{$lang->cmd_check_trackback_help}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="custom_message">{$lang->custom_message}</label>
<div class="x_controls">