mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-20 11:49:56 +09:00
merge from 1.7.3.5(r13153:r13167)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@13168 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cc47d2b247
commit
2d3f149b5a
2042 changed files with 129266 additions and 126243 deletions
|
|
@ -18,13 +18,15 @@
|
|||
</menu>
|
||||
</menus>
|
||||
<actions>
|
||||
<action name="dispSpamfilterAdminSetting" type="view" admin_index="true" standalone="true" menu_name="spamFilter" menu_index="true" />
|
||||
<action name="dispSpamfilterAdminDeniedIPList" type="view" admin_index="true" standalone="true" menu_name="spamFilter" menu_index="true" />
|
||||
<action name="dispSpamfilterAdminDeniedWordList" type="view" standalone="true" menu_name="spamFilter" />
|
||||
<action name="dispSpamfilterAdminConfigBlock" type="view" standalone="true" menu_name="spamFilter" />
|
||||
|
||||
<action name="procSpamfilterAdminInsertDeniedIP" type="controller" standalone="true" ruleset="insertDeniedIp" />
|
||||
<action name="procSpamfilterAdminInsertDeniedWord" type="controller" standalone="true" ruleset="insertDeniedWord" />
|
||||
<action name="procSpamfilterAdminInsertDeniedIP" type="controller" standalone="true" />
|
||||
<action name="procSpamfilterAdminInsertDeniedWord" type="controller" standalone="true" />
|
||||
|
||||
<action name="procSpamfilterAdminDeleteDeniedIP" type="controller" standalone="true" ruleset="deleteDeniedIp" />
|
||||
<action name="procSpamfilterAdminDeleteDeniedWord" type="controller" standalone="true" ruleset="deleteDeniedWord" />
|
||||
<action name="procSpamfilterAdminDeleteDeniedIP" type="controller" standalone="true" />
|
||||
<action name="procSpamfilterAdminDeleteDeniedWord" type="controller" standalone="true" />
|
||||
<action name="procSpamfilterAdminInsertConfig" type="controller" standalone="true" ruleset="insertConfig" />
|
||||
|
||||
</actions>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,15 @@
|
|||
<value xml:lang="tr"><![CDATA[Yasak Sözcük Listesi]]></value>
|
||||
<value xml:lang="vi"><![CDATA[Danh sách từ cấm]]></value>
|
||||
</item>
|
||||
<item name="cmd_config_block">
|
||||
<value xml:lang="ko"><![CDATA[자동 차단 설정]]></value>
|
||||
</item>
|
||||
<item name="add_denied_ip">
|
||||
<value xml:lang="ko"><![CDATA[스팸 IP 추가]]></value>
|
||||
</item>
|
||||
<item name="add_denied_word">
|
||||
<value xml:lang="ko"><![CDATA[스팸 키워드 추가]]></value>
|
||||
</item>
|
||||
<item name="spamfilter">
|
||||
<value xml:lang="ko"><![CDATA[스팸필터]]></value>
|
||||
<value xml:lang="en"><![CDATA[Spam filter]]></value>
|
||||
|
|
@ -85,8 +94,8 @@
|
|||
<value xml:lang="vi"><![CDATA[Kiểm tra liên kết Web]]></value>
|
||||
</item>
|
||||
<item name="word">
|
||||
<value xml:lang="ko"><![CDATA[단어]]></value>
|
||||
<value xml:lang="en"><![CDATA[Word]]></value>
|
||||
<value xml:lang="ko"><![CDATA[키워드]]></value>
|
||||
<value xml:lang="en"><![CDATA[Keyword]]></value>
|
||||
<value xml:lang="jp"><![CDATA[ワード]]></value>
|
||||
<value xml:lang="zh-CN"><![CDATA[单词]]></value>
|
||||
<value xml:lang="zh-TW"><![CDATA[單字]]></value>
|
||||
|
|
@ -142,7 +151,7 @@ les articles en plus seront reconnus comme polluriel, et l'adresse IP sera bloqu
|
|||
bài viết của bạn sẽ bị ghi vào danh sách và IP của bạn sẽ bị lưu vào danh sách IP bị cấm.]]></value>
|
||||
</item>
|
||||
<item name="about_denied_ip">
|
||||
<value xml:lang="ko"><![CDATA['<em>스팸 IP // 메모</em>' 형식으로 입력하세요. 여러개의 항목은 줄을 바꾸어 입력하세요.]]></value>
|
||||
<value xml:lang="ko"><![CDATA['스팸 IP // 메모' 형식으로 입력하세요. 여러개의 항목은 줄을 바꾸어 입력하세요.]]></value>
|
||||
<value xml:lang="en"><![CDATA[You can add IP address range like 127.0.0.* by using *.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[「127.0.0.* 」のように「*」で、「127.0.0」以下のIP帯域をすべて禁止することができます。]]></value>
|
||||
<value xml:lang="zh-CN"><![CDATA[禁止IP可以使用通配符。(如:如 "127.0.*.*")]]></value>
|
||||
|
|
@ -154,7 +163,7 @@ les articles en plus seront reconnus comme polluriel, et l'adresse IP sera bloqu
|
|||
<value xml:lang="vi"><![CDATA[Bạn có thể thêm IP vào danh sách bị cấm dạng 127.0.0.* bằng cách sử dụng *.]]></value>
|
||||
</item>
|
||||
<item name="about_denied_word">
|
||||
<value xml:lang="ko"><![CDATA[여러개의 항목은 줄을 바꾸어 입력하세요.]]></value>
|
||||
<value xml:lang="ko"><![CDATA[여러개의 항목은 줄을 바꾸어 입력하세요. (글자 제한 2~40 byte)]]></value>
|
||||
<value xml:lang="en"><![CDATA[When you add a word to Word Blacklist,
|
||||
articles including it will be blocked.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[禁止ワードとして登録されると該当するワードが存在する書き込みを禁することができます。]]></value>
|
||||
|
|
@ -184,7 +193,7 @@ l'article qui comporte le mot ne sera pas affichagé.]]></value>
|
|||
<value xml:lang="vi"><![CDATA[Chỉ cho phép gửi một bài viết với một IP trên một liên kết Web.]]></value>
|
||||
</item>
|
||||
<item name="msg_alert_limited_by_config">
|
||||
<value xml:lang="ko"><![CDATA[%s 초 이내에 글 작성은 금지 됩니다. 계속 시도하시면 금지 IP에 등록되실 수 있습니다.]]></value>
|
||||
<value xml:lang="ko"><![CDATA[%s 초 이내에 글 작성은 금지 됩니다. 계속 시도하면 금지 IP에 등록될 수 있습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Posting an article within %s seconda is not allowed.\n If you keep trying, your IP address will be blacklisted.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[%s秒以内の書き込みは禁止されます。続けて行うとスパムとして認識され、禁止IPに登録されます。]]></value>
|
||||
<value xml:lang="zh-CN"><![CDATA[%s秒之内不能连续发表新主题。如您继续再试系统将自动禁止您的IP。]]></value>
|
||||
|
|
@ -208,7 +217,7 @@ l'article qui comporte le mot ne sera pas affichagé.]]></value>
|
|||
<value xml:lang="vi"><![CDATA[Không được phép gửi từ "%s".]]></value>
|
||||
</item>
|
||||
<item name="msg_alert_registered_denied_ip">
|
||||
<value xml:lang="ko"><![CDATA[금지 IP에 등록되셔서 정상적인 활동에 제한을 받게 되셨습니다. 문의는 사이트 관리자에게 해주시기 바랍니다.]]></value>
|
||||
<value xml:lang="ko"><![CDATA[금지 IP에 등록되어 정상적인 활동에 제한을 받게 됐습니다. 사이트 관리자에게 문의 바랍니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Your IP address is blacklisted,\n so you may have limitations on normal using of this site.\n If you have any questions on that matter, please contact the site administrator.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[禁止IPに登録され、サイト内で正常な活動が制限されています。管理者にお問い合わせください。]]></value>
|
||||
<value xml:lang="zh-CN"><![CDATA[您的IP已被禁止,详情请联系网站管理员。]]></value>
|
||||
|
|
@ -232,12 +241,12 @@ l'article qui comporte le mot ne sera pas affichagé.]]></value>
|
|||
<value xml:lang="vi"><![CDATA[Chỉ cho phép một liên kết Web trên một bài viết.]]></value>
|
||||
</item>
|
||||
<item name="cmd_interval">
|
||||
<value xml:lang="ko"><![CDATA[10초 동안 3회 이상 글을 작성하면 스패머로 간주할까요? 글, 댓글 작성과 엮인글 발송을 차단합니다.]]></value>
|
||||
<value xml:lang="ko"><![CDATA[10초 동안 3회 이상 글을 작성하면 스패머로 간주하시겠습니까? 글, 댓글 작성과 엮인글 발송을 차단합니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Do you want to blacklist the users who attempt to post articles more than 3 times for 10 seconds? The blacklisted users cannot write articles or comments and send trackbacks.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[10秒の間3回以上書き込みをすると、スパムとみなしますか?書き込み、コメント作成とトラックバックの送信をブロックします。]]></value>
|
||||
</item>
|
||||
<item name="cmd_check_trackback">
|
||||
<value xml:lang="ko"><![CDATA[하나의 글에 2회 이상 엮인글을 등록하면 스패머로 간주할까요? 엮인글을 차단합니다.]]></value>
|
||||
<value xml:lang="ko"><![CDATA[하나의 글에 2회 이상 엮인글을 등록하면 스패머로 간주하시겠습니까? 엮인글을 차단합니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Do you want to blacklist the users who attempt to post more than 2 trackbacks to one article? The blacklisted users cannot post trackbacks.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[ひとつの書き込みに2回以上トラックバックを登録するとスパムとみなしますか?トラックバックをブロックします。]]></value>
|
||||
</item>
|
||||
|
|
@ -258,8 +267,15 @@ l'article qui comporte le mot ne sera pas affichagé.]]></value>
|
|||
<value xml:lang="de"><![CDATA[Nein]]></value>
|
||||
<value xml:lang="mn"><![CDATA[Дугаар]]></value>
|
||||
</item>
|
||||
<item name="invalid">
|
||||
<item name="msg_duplicate">
|
||||
<value xml:lang="ko"><![CDATA[이미 존재합니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[The value is invalid.]]></value>
|
||||
</item>
|
||||
<item name="msg_invalid">
|
||||
<value xml:lang="ko"><![CDATA[형식이 유효하지 않습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[The value is invalid.]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
<item name="msg_faillist">
|
||||
<value xml:lang="ko"><![CDATA[<br />실패(이미 존재합니다.) <br /> %s ]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
<table name="spamfilter_denied_ip" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="ipaddress" var="ipaddress" notnull="notnull" />
|
||||
<condition operation="in" column="ipaddress" var="ipaddress" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
<table name="spamfilter_denied_word" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="word" var="word" notnull="notnull" />
|
||||
<condition operation="in" column="word" var="word" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<customrules>
|
||||
<rule name="ip" type="regex" test="/^(\d{1,3}(?:.(\d{1,3}|\*)){3}\s*(\/\/[^\r\n]*)?[\r\n]*)*$/" />
|
||||
</customrules>
|
||||
<fields>
|
||||
<field name="act" required="true" default="procSpamfilterAdminDeleteDeniedIP" />
|
||||
<field name="ipaddress" required="true" rule="ip" />
|
||||
</fields>
|
||||
</ruleset>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<customrules>
|
||||
<rule name="word" type="regex" test="/^(.{2,40}[\r\n]+)*.{2,40}$/" />
|
||||
</customrules>
|
||||
<fields>
|
||||
<field name="act" required="true" default="procSpamfilterAdminDeleteDeniedWord" />
|
||||
<field name="word" required="true" rule="word" />
|
||||
</fields>
|
||||
</ruleset>
|
||||
|
|
@ -1,118 +1,149 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin controller class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin controller class of the spamfilter module
|
||||
*/
|
||||
class spamfilterAdminController extends spamfilter
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class spamfilterAdminController extends spamfilter {
|
||||
function procSpamfilterAdminInsertConfig()
|
||||
{
|
||||
// Get the default information
|
||||
$argsConfig = Context::gets('limits','check_trackback');
|
||||
$flag = Context::get('flag');
|
||||
//interval, limit_count
|
||||
if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
|
||||
if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
|
||||
// Create and insert the module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
|
||||
if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
function procSpamfilterAdminInsertDeniedIP()
|
||||
{
|
||||
//스팸IP 추가
|
||||
$ipaddress_list = Context::get('ipaddress_list');
|
||||
$oSpamfilterController = &getController('spamfilter');
|
||||
if($ipaddress_list)
|
||||
{
|
||||
$output = $oSpamfilterController->insertIP($ipaddress_list);
|
||||
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
||||
|
||||
function procSpamfilterAdminInsertConfig() {
|
||||
|
||||
// Get the default information
|
||||
$argsConfig = Context::gets('limits','check_trackback');
|
||||
$flag = Context::get('flag');
|
||||
//interval, limit_count
|
||||
if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
|
||||
if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
|
||||
// Create and insert the module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
|
||||
if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
|
||||
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
||||
}
|
||||
|
||||
function procSpamfilterAdminInsertDeniedIP(){
|
||||
//스팸IP 추가
|
||||
$ipaddress_list = Context::get('ipaddress_list');
|
||||
$oSpamfilterController = &getController('spamfilter');
|
||||
if($ipaddress_list){
|
||||
$insertIPOutput = $oSpamfilterController->insertIP($ipaddress_list);
|
||||
if(!$insertIPOutput->toBool()) return $insertIPOutput;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
function procSpamfilterAdminInsertDeniedWord()
|
||||
{
|
||||
//스팸 키워드 추가
|
||||
$word_list = Context::get('word_list');
|
||||
if($word_list)
|
||||
{
|
||||
$output = $this->insertWord($word_list);
|
||||
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
||||
|
||||
if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
|
||||
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
||||
}
|
||||
function procSpamfilterAdminInsertDeniedWord(){
|
||||
//스팸 키워드 추가
|
||||
$word_list = Context::get('word_list');
|
||||
if($word_list){
|
||||
$insertWordOutput = $this->insertWord($word_list);
|
||||
if(!$insertWordOutput->toBool()) return $insertWordOutput;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete the banned IP
|
||||
*/
|
||||
function procSpamfilterAdminDeleteDeniedIP()
|
||||
{
|
||||
$ipAddressList = Context::get('ipaddress');
|
||||
if($ipAddressList) $this->deleteIP($ipAddressList);
|
||||
|
||||
$this->setMessage(Context::getLang('success_deleted'));
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||
return $this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete the prohibited Word
|
||||
*/
|
||||
function procSpamfilterAdminDeleteDeniedWord()
|
||||
{
|
||||
$wordList = Context::get('word');
|
||||
$this->deleteWord($wordList);
|
||||
|
||||
$this->setMessage(Context::getLang('success_deleted'));
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
|
||||
return $this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete IP
|
||||
* Remove the IP address which was previously registered as a spammers
|
||||
*/
|
||||
function deleteIP($ipaddress)
|
||||
{
|
||||
if(!$ipaddress) return;
|
||||
|
||||
$args->ipaddress = $ipaddress;
|
||||
return executeQuery('spamfilter.deleteDeniedIP', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register the spam word
|
||||
* The post, which contains the newly registered spam word, should be considered as a spam
|
||||
*/
|
||||
function insertWord($word_list)
|
||||
{
|
||||
$word_list = str_replace("\r","",$word_list);
|
||||
$word_list = explode("\n",$word_list);
|
||||
|
||||
foreach($word_list as $word)
|
||||
{
|
||||
if(!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word))
|
||||
{
|
||||
return new Object(-1, 'msg_invalid');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete the banned IP
|
||||
**/
|
||||
function procSpamfilterAdminDeleteDeniedIP() {
|
||||
$ipaddress = Context::get('ipaddress');
|
||||
$output = $this->deleteIP($ipaddress);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete the prohibited Word
|
||||
**/
|
||||
function procSpamfilterAdminDeleteDeniedWord() {
|
||||
$word = Context::get('word');
|
||||
//$word = base64_decode(Context::get('word'));
|
||||
$output = $this->deleteWord($word);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
$fail_word = '';
|
||||
foreach($word_list as $word)
|
||||
{
|
||||
if(trim($word)) $args->word = $word;
|
||||
$output = executeQuery('spamfilter.insertDeniedWord', $args);
|
||||
if(!$output->toBool()) $fail_word .= $word.'<br />';
|
||||
}
|
||||
$output->add('fail_list',$fail_word);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete IP
|
||||
* Remove the IP address which was previously registered as a spammers
|
||||
**/
|
||||
function deleteIP($ipaddress) {
|
||||
if(!$ipaddress) return;
|
||||
|
||||
$args->ipaddress = $ipaddress;
|
||||
return executeQuery('spamfilter.deleteDeniedIP', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register the spam word
|
||||
* The post, which contains the newly registered spam word, should be considered as a spam
|
||||
**/
|
||||
function insertWord($word_list) {
|
||||
$word_list = str_replace("\r","",$word_list);
|
||||
$word_list = explode("\n",$word_list);
|
||||
foreach($word_list as $word) {
|
||||
if(trim($word)) $args->word = $word;
|
||||
$output = executeQuery('spamfilter.insertDeniedWord', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove the spam word
|
||||
* Remove the word which was previously registered as a spam word
|
||||
**/
|
||||
function deleteWord($word) {
|
||||
if(!$word) return;
|
||||
$args->word = $word;
|
||||
return executeQuery('spamfilter.deleteDeniedWord', $args);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Remove the spam word
|
||||
* Remove the word which was previously registered as a spam word
|
||||
*/
|
||||
function deleteWord($word)
|
||||
{
|
||||
if(!$word) return;
|
||||
$args->word = $word;
|
||||
return executeQuery('spamfilter.deleteDeniedWord', $args);
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.admin.controller.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,44 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin view class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin view class of the spamfilter module
|
||||
*/
|
||||
class spamfilterAdminView extends spamfilter
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// Set template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
class spamfilterAdminView extends spamfilter {
|
||||
/**
|
||||
* @brief Output the list of banned IPs
|
||||
*/
|
||||
function dispSpamfilterAdminDeniedIPList()
|
||||
{
|
||||
// Get the list of denied IP addresses and words
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$ip_list = $oSpamFilterModel->getDeniedIPList();
|
||||
Context::set('ip_list', $ip_list);
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
// Set template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
$security = new Security();
|
||||
$security->encodeHTML('ip_list..');
|
||||
|
||||
/**
|
||||
* @brief Spam Filter configurations
|
||||
* Output the list of banned IPs and words
|
||||
**/
|
||||
function dispSpamfilterAdminSetting() {
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('spamfilter');
|
||||
|
||||
// Get the list of denied IP addresses and words
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$ip_list = $oSpamFilterModel->getDeniedIPList();
|
||||
$word_list = $oSpamFilterModel->getDeniedWordList();
|
||||
// Set a template file
|
||||
$this->setTemplateFile('denied_ip_list');
|
||||
|
||||
Context::set('config',$config);
|
||||
Context::set('ip_list', $ip_list);
|
||||
Context::set('word_list', $word_list);
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('word_list..word');
|
||||
$security->encodeHTML('ip_list..');
|
||||
}
|
||||
|
||||
// Set a template file
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Output the list of banned words
|
||||
*/
|
||||
function dispSpamfilterAdminDeniedWordList()
|
||||
{
|
||||
// Get the list of denied IP addresses and words
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$word_list = $oSpamFilterModel->getDeniedWordList();
|
||||
Context::set('word_list', $word_list);
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('word_list..word');
|
||||
|
||||
// Set a template file
|
||||
$this->setTemplateFile('denied_word_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure auto block
|
||||
*/
|
||||
function dispSpamfilterAdminConfigBlock()
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('spamfilter');
|
||||
Context::set('config',$config);
|
||||
|
||||
$this->setTemplateFile('config_block');
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.admin.view.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,101 +1,109 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilter
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The parent class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilter
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The parent class of the spamfilter module
|
||||
*/
|
||||
class spamfilter extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* @brief Additional tasks required to accomplish during the installation
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
|
||||
class spamfilter extends ModuleObject {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Additional tasks required to accomplish during the installation
|
||||
**/
|
||||
function moduleInstall() {
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
/**
|
||||
* @brief A method to check if the installation has been successful
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true;
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
||||
|
||||
/**
|
||||
* Add the hit count field (hit)
|
||||
*/
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true;
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true;
|
||||
|
||||
/**
|
||||
* @brief A method to check if the installation has been successful
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true;
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the hit count field (hit)
|
||||
**/
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true;
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true;
|
||||
/**
|
||||
* @brief Execute update
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'))
|
||||
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'))
|
||||
{
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
}
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'))
|
||||
{
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true;
|
||||
/**
|
||||
* Add the hit count field (hit)
|
||||
*/
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit'))
|
||||
{
|
||||
$oDB->addColumn('spamfilter_denied_word','hit','number',12,0,true);
|
||||
$oDB->addIndex('spamfilter_denied_word','idx_hit', 'hit');
|
||||
}
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit'))
|
||||
{
|
||||
$oDB->addColumn('spamfilter_denied_word','latest_hit','date');
|
||||
$oDB->addIndex('spamfilter_denied_word','idx_latest_hit', 'latest_hit');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description'))
|
||||
{
|
||||
$oDB->addColumn('spamfilter_denied_ip','description','varchar', 250);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute update
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'))
|
||||
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')){
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||
}
|
||||
// 2008-12-17 Add a spamfilter for post modification actions
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')){
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||
}
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the hit count field (hit)
|
||||
**/
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) {
|
||||
$oDB->addColumn('spamfilter_denied_word','hit','number',12,0,true);
|
||||
$oDB->addIndex('spamfilter_denied_word','idx_hit', 'hit');
|
||||
}
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) {
|
||||
$oDB->addColumn('spamfilter_denied_word','latest_hit','date');
|
||||
$oDB->addIndex('spamfilter_denied_word','idx_latest_hit', 'latest_hit');
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) {
|
||||
$oDB->addColumn('spamfilter_denied_ip','description','varchar', 250);
|
||||
}
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.class.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.class.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,168 +1,184 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The controller class for the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The controller class for the spamfilter module
|
||||
*/
|
||||
class spamfilterController extends spamfilter
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class spamfilterController extends spamfilter {
|
||||
/**
|
||||
* @brief Call this function in case you need to stop the spam filter's usage during the batch work
|
||||
*/
|
||||
function setAvoidLog()
|
||||
{
|
||||
$_SESSION['avoid_log'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* @brief The routine process to check the time it takes to store a document, when writing it, and to ban IP/word
|
||||
*/
|
||||
function triggerInsertDocument(&$obj)
|
||||
{
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
// Check the login status, login information, and permission
|
||||
$is_logged = Context::get('is_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$grant = Context::get('grant');
|
||||
// In case logged in, check if it is an administrator
|
||||
if($is_logged)
|
||||
{
|
||||
if($logged_info->is_admin == 'Y') return new Object();
|
||||
if($grant->manager) return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Call this function in case you need to stop the spam filter's usage during the batch work
|
||||
**/
|
||||
function setAvoidLog() {
|
||||
$_SESSION['avoid_log'] = true;
|
||||
}
|
||||
$oFilterModel = &getModel('spamfilter');
|
||||
// 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->title.$obj->content;
|
||||
$output = $oFilterModel->isDeniedWord($text);
|
||||
if(!$output->toBool()) return $output;
|
||||
// Check the specified time beside the modificaiton time
|
||||
if($obj->document_srl == 0)
|
||||
{
|
||||
$output = $oFilterModel->checkLimited();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
// Save a log
|
||||
$this->insertLog();
|
||||
|
||||
/**
|
||||
* @brief The routine process to check the time it takes to store a document, when writing it, and to ban IP/word
|
||||
**/
|
||||
function triggerInsertDocument(&$obj) {
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
// Check the login status, login information, and permission
|
||||
$is_logged = Context::get('is_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$grant = Context::get('grant');
|
||||
// In case logged in, check if it is an administrator
|
||||
if($is_logged) {
|
||||
if($logged_info->is_admin == 'Y') return new Object();
|
||||
if($grant->manager) return new Object();
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$oFilterModel = &getModel('spamfilter');
|
||||
// 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->title.$obj->content;
|
||||
$output = $oFilterModel->isDeniedWord($text);
|
||||
if(!$output->toBool()) return $output;
|
||||
// Check the specified time beside the modificaiton time
|
||||
if($obj->document_srl == 0){
|
||||
$output = $oFilterModel->checkLimited();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
// Save a log
|
||||
$this->insertLog();
|
||||
/**
|
||||
* @brief The routine process to check the time it takes to store a comment, and to ban IP/word
|
||||
*/
|
||||
function triggerInsertComment(&$obj)
|
||||
{
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
// Check the login status, login information, and permission
|
||||
$is_logged = Context::get('is_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$grant = Context::get('grant');
|
||||
// In case logged in, check if it is an administrator
|
||||
if($is_logged)
|
||||
{
|
||||
if($logged_info->is_admin == 'Y') return new Object();
|
||||
if($grant->manager) return new Object();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
$oFilterModel = &getModel('spamfilter');
|
||||
// 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->content;
|
||||
$output = $oFilterModel->isDeniedWord($text);
|
||||
if(!$output->toBool()) return $output;
|
||||
// If the specified time check is not modified
|
||||
if(!$obj->__isupdate)
|
||||
{
|
||||
$output = $oFilterModel->checkLimited();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
unset($obj->__isupdate);
|
||||
// Save a log
|
||||
$this->insertLog();
|
||||
|
||||
/**
|
||||
* @brief The routine process to check the time it takes to store a comment, and to ban IP/word
|
||||
**/
|
||||
function triggerInsertComment(&$obj) {
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
// Check the login status, login information, and permission
|
||||
$is_logged = Context::get('is_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$grant = Context::get('grant');
|
||||
// In case logged in, check if it is an administrator
|
||||
if($is_logged) {
|
||||
if($logged_info->is_admin == 'Y') return new Object();
|
||||
if($grant->manager) return new Object();
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$oFilterModel = &getModel('spamfilter');
|
||||
// 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->content;
|
||||
$output = $oFilterModel->isDeniedWord($text);
|
||||
if(!$output->toBool()) return $output;
|
||||
// If the specified time check is not modified
|
||||
if(!$obj->__isupdate){
|
||||
$output = $oFilterModel->checkLimited();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
unset($obj->__isupdate);
|
||||
// Save a log
|
||||
$this->insertLog();
|
||||
/**
|
||||
* @brief Inspect the trackback creation time and IP
|
||||
*/
|
||||
function triggerInsertTrackback(&$obj)
|
||||
{
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
|
||||
return new Object();
|
||||
}
|
||||
$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;
|
||||
|
||||
/**
|
||||
* @brief Inspect the trackback creation time and IP
|
||||
**/
|
||||
function triggerInsertTrackback(&$obj) {
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
// 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
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$oTrackbackController = &getController('trackback');
|
||||
|
||||
$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
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$oTrackbackController = &getController('trackback');
|
||||
list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
|
||||
$ipaddress = $ipA.'.'.$ipB.'.'.$ipC;
|
||||
// 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, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||
$this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback');
|
||||
return new Object(-1,'msg_alert_trackback_denied');
|
||||
}
|
||||
// If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts
|
||||
/* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리
|
||||
$count = $oTrackbackModel->getRegistedTrackback(30*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||
if($count > 1) {
|
||||
$oTrackbackController->deleteTrackbackSender(3*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||
$this->insertIP($ipaddress.'.*');
|
||||
return new Object(-1,'msg_alert_trackback_denied');
|
||||
}
|
||||
*/
|
||||
|
||||
list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
|
||||
$ipaddress = $ipA.'.'.$ipB.'.'.$ipC;
|
||||
// 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, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||
$this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback');
|
||||
return new Object(-1,'msg_alert_trackback_denied');
|
||||
}
|
||||
// If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts
|
||||
/* ?¸ìФ???˜ê²½??ê°<EFBFBD>안?˜ì—¬ ?¼ë‹¨ ??부분ì? ?™ìž‘?˜ì? ?Šë<EFBFBD>„ë¡?주ì„<EFBFBD> 처리
|
||||
$count = $oTrackbackModel->getRegistedTrackback(30*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||
if($count > 1) {
|
||||
$oTrackbackController->deleteTrackbackSender(3*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||
$this->insertIP($ipaddress.'.*');
|
||||
return new Object(-1,'msg_alert_trackback_denied');
|
||||
}
|
||||
*/
|
||||
return new Object();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief IP registration
|
||||
* The registered IP address is considered as a spammer
|
||||
**/
|
||||
function insertIP($ipaddress_list, $description = null) {
|
||||
$ipaddress_list = str_replace("\r","",$ipaddress_list);
|
||||
$ipaddress_list = explode("\n",$ipaddress_list);
|
||||
foreach($ipaddress_list as $ipaddressValue) {
|
||||
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
|
||||
if($ipaddress=trim($matches[1])) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
if(!$description && $matches[4]) $args->description = $matches[4];
|
||||
else $args->description = $description;
|
||||
}
|
||||
|
||||
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
|
||||
if(!$output->toBool()) return $output;
|
||||
/**
|
||||
* @brief IP registration
|
||||
* The registered IP address is considered as a spammer
|
||||
*/
|
||||
function insertIP($ipaddress_list, $description = null)
|
||||
{
|
||||
$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
|
||||
if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
|
||||
$ipaddress_list = str_replace("\r","",$ipaddress_list);
|
||||
$ipaddress_list = explode("\n",$ipaddress_list);
|
||||
foreach($ipaddress_list as $ipaddressValue)
|
||||
{
|
||||
$args = new stdClass();
|
||||
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
|
||||
if($ipaddress=trim($matches[1]))
|
||||
{
|
||||
$args->ipaddress = $ipaddress;
|
||||
if(!$description && $matches[4]) $args->description = $matches[4];
|
||||
else $args->description = $description;
|
||||
}
|
||||
return $output;
|
||||
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
|
||||
}
|
||||
|
||||
}
|
||||
$output->add('fail_list',$fail_list);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Log registration
|
||||
* Register the newly accessed IP address in the log. In case the log interval is withing a certain time,
|
||||
* register it as a spammer
|
||||
**/
|
||||
function insertLog() {
|
||||
$output = executeQuery('spamfilter.insertLog');
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Log registration
|
||||
* Register the newly accessed IP address in the log. In case the log interval is withing a certain time,
|
||||
* register it as a spammer
|
||||
*/
|
||||
function insertLog()
|
||||
{
|
||||
$output = executeQuery('spamfilter.insertLog');
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.controller.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,144 +1,157 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The Model class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The Model class of the spamfilter module
|
||||
*/
|
||||
class spamfilterModel extends spamfilter
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class spamfilterModel extends spamfilter {
|
||||
/**
|
||||
* @brief Return the user setting values of the Spam filter module
|
||||
*/
|
||||
function getConfig()
|
||||
{
|
||||
// Get configurations (using the module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
return $oModuleModel->getModuleConfig('spamfilter');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* @brief Return the list of registered IP addresses which were banned
|
||||
*/
|
||||
function getDeniedIPList()
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->sort_index = "regdate";
|
||||
$args->page = Context::get('page')?Context::get('page'):1;
|
||||
$output = executeQuery('spamfilter.getDeniedIPList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the user setting values of the Spam filter module
|
||||
**/
|
||||
function getConfig() {
|
||||
// Get configurations (using the module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
return $oModuleModel->getModuleConfig('spamfilter');
|
||||
}
|
||||
/**
|
||||
* @brief Check if the ipaddress is in the list of banned IP addresses
|
||||
*/
|
||||
function isDeniedIP()
|
||||
{
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
/**
|
||||
* @brief Return the list of registered IP addresses which were banned
|
||||
**/
|
||||
function getDeniedIPList() {
|
||||
$args->sort_index = "regdate";
|
||||
$args->page = Context::get('page')?Context::get('page'):1;
|
||||
$output = executeQuery('spamfilter.getDeniedIPList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
$ip_list = $this->getDeniedIPList();
|
||||
if(!count($ip_list)) return new Object();
|
||||
|
||||
/**
|
||||
* @brief Check if the ipaddress is in the list of banned IP addresses
|
||||
**/
|
||||
function isDeniedIP() {
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$count = count($ip_list);
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
|
||||
if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new Object(-1,'msg_alert_registered_denied_ip');
|
||||
}
|
||||
|
||||
$ip_list = $this->getDeniedIPList();
|
||||
if(!count($ip_list)) return new Object();
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$count = count($ip_list);
|
||||
for($i=0;$i<$count;$i++) {
|
||||
$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
|
||||
if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new Object(-1,'msg_alert_registered_denied_ip');
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Return the list of registered Words which were banned
|
||||
*/
|
||||
function getDeniedWordList()
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->sort_index = "hit";
|
||||
$output = executeQuery('spamfilter.getDeniedWordList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the list of registered Words which were banned
|
||||
**/
|
||||
function getDeniedWordList() {
|
||||
$args->sort_index = "hit";
|
||||
$output = executeQuery('spamfilter.getDeniedWordList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
/**
|
||||
* @brief Check if the text, received as a parameter, is banned or not
|
||||
*/
|
||||
function isDeniedWord($text)
|
||||
{
|
||||
$word_list = $this->getDeniedWordList();
|
||||
if(!count($word_list)) return new Object();
|
||||
|
||||
/**
|
||||
* @brief Check if the text, received as a parameter, is banned or not
|
||||
**/
|
||||
function isDeniedWord($text) {
|
||||
$word_list = $this->getDeniedWordList();
|
||||
if(!count($word_list)) return new Object();
|
||||
$count = count($word_list);
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
$word = $word_list[$i]->word;
|
||||
if(preg_match('/'.preg_quote($word,'/').'/is', $text))
|
||||
{
|
||||
$args->word = $word;
|
||||
$output = executeQuery('spamfilter.updateDeniedWordHit', $args);
|
||||
return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word));
|
||||
}
|
||||
}
|
||||
|
||||
$count = count($word_list);
|
||||
for($i=0;$i<$count;$i++) {
|
||||
$word = $word_list[$i]->word;
|
||||
if(preg_match('/'.preg_quote($word,'/').'/is', $text)) {
|
||||
$args->word = $word;
|
||||
$output = executeQuery('spamfilter.updateDeniedWordHit', $args);
|
||||
return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word));
|
||||
}
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Check the specified time
|
||||
*/
|
||||
function checkLimited()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
|
||||
/**
|
||||
* @brief Check the specified time
|
||||
**/
|
||||
function checkLimited() {
|
||||
$config = $this->getConfig();
|
||||
|
||||
if($config->limits != 'Y') return new Object();
|
||||
$limit_count = '3';
|
||||
$interval = '10';
|
||||
if($config->limits != 'Y') return new Object();
|
||||
$limit_count = '3';
|
||||
$interval = '10';
|
||||
|
||||
$count = $this->getLogCount($interval);
|
||||
$count = $this->getLogCount($interval);
|
||||
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
// Ban the IP address if the interval is exceeded
|
||||
if($count>=$limit_count) {
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertIP($ipaddress, 'AUTO-DENIED : Over limit');
|
||||
return new Object(-1, 'msg_alert_registered_denied_ip');
|
||||
}
|
||||
// If the number of limited posts is not reached, keep creating.
|
||||
if($count) {
|
||||
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
// Ban the IP address if the interval is exceeded
|
||||
if($count>=$limit_count)
|
||||
{
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertIP($ipaddress, 'AUTO-DENIED : Over limit');
|
||||
return new Object(-1, 'msg_alert_registered_denied_ip');
|
||||
}
|
||||
// If the number of limited posts is not reached, keep creating.
|
||||
if($count)
|
||||
{
|
||||
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
||||
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertLog();
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertLog();
|
||||
|
||||
return new Object(-1, $message);
|
||||
}
|
||||
return new Object(-1, $message);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Check if the trackbacks have already been registered to a particular article
|
||||
*/
|
||||
function isInsertedTrackback($document_srl)
|
||||
{
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
|
||||
if($count>0) return new Object(-1, 'msg_alert_trackback_denied');
|
||||
|
||||
/**
|
||||
* @brief Check if the trackbacks have already been registered to a particular article
|
||||
**/
|
||||
function isInsertedTrackback($document_srl) {
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
|
||||
if($count>0) return new Object(-1, 'msg_alert_trackback_denied');
|
||||
return new Object();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Return the number of logs recorded within the interval for the specified IPaddress
|
||||
*/
|
||||
function getLogCount($time = 60, $ipaddress='')
|
||||
{
|
||||
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
/**
|
||||
* @brief Return the number of logs recorded within the interval for the specified IPaddress
|
||||
**/
|
||||
function getLogCount($time = 60, $ipaddress='') {
|
||||
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$args->ipaddress = $ipaddress;
|
||||
$args->regdate = date("YmdHis", time()-$time);
|
||||
$output = executeQuery('spamfilter.getLogCount', $args);
|
||||
$count = $output->data->count;
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
$args->ipaddress = $ipaddress;
|
||||
$args->regdate = date("YmdHis", time()-$time);
|
||||
$output = executeQuery('spamfilter.getLogCount', $args);
|
||||
$count = $output->data->count;
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.model.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.model.php */
|
||||
|
|
|
|||
44
modules/spamfilter/tpl/config_block.html
Normal file
44
modules/spamfilter/tpl/config_block.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<include target="./header.html" />
|
||||
<section class="section">
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li class="x_active"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
</ul>
|
||||
<form action="./" id="spamfilterConfig" ruleset="@insertConfig">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertConfig" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="ruleset" value="insertConfig" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/spamfilter/tpl/1" />
|
||||
<div class="x_control-group">
|
||||
<p><strong>{$lang->cmd_interval}</strong></p>
|
||||
<label for="spamCond1_yes" class="x_inline">
|
||||
<input type="radio" name="limits" id="spamCond1_yes" value="Y" checked="checked"|cond="$config->limits=='Y' || $config->limits ==''" />
|
||||
{$lang->cmd_yes}
|
||||
</label>
|
||||
<label for="spamCond1_no" class="x_inline">
|
||||
<input type="radio" name="limits" id="spamCond1_no" value="N" checked="checked"|cond="$config->limits!='Y' && $config->limits !=''" />
|
||||
{$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<p><strong>{$lang->cmd_check_trackback}</strong></p>
|
||||
<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>
|
||||
</div>
|
||||
<div class="x_clearfix btnArea">
|
||||
<div class="x_pull-right">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<include target="./footer.html" />
|
||||
|
||||
|
||||
49
modules/spamfilter/tpl/denied_ip_list.html
Normal file
49
modules/spamfilter/tpl/denied_ip_list.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<include target="./header.html" />
|
||||
<section>
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li class="x_active"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
</ul>
|
||||
<form action="./" method="post">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminDeleteDeniedIP" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/spamfilter/tpl/1" />
|
||||
<table class="x_table x_table-striped x_table-hover">
|
||||
<caption>
|
||||
<strong>{$lang->cmd_denied_ip}</strong>
|
||||
<button type="submit" class="x_btn x_pull-right">{$lang->cmd_delete}</button>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">IP</th>
|
||||
<th scope="col">{$lang->description}</th>
|
||||
<th scope="col">{$lang->regdate}</th>
|
||||
<th scope="col"><input type="checkbox" name="ipaddress" title="Check All" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr loop="$ip_list => $ip_info">
|
||||
<td>{$ip_info->ipaddress}</td>
|
||||
<td>{$ip_info->description}</td>
|
||||
<td>{zdate($ip_info->regdate,'Y-m-d')}</td>
|
||||
<td><input type="checkbox" name="ipaddress[]" value="{$ip_info->ipaddress}" /></td>
|
||||
</tr>
|
||||
<tr cond="!$ip_list">
|
||||
<td colspan="4" style="text-align:center">{$lang->no_data}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<form action="./" style="margin-right:14px" method="post">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertDeniedIP" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/spamfilter/tpl/1" />
|
||||
<input type="hidden" name="active" value="ip" />
|
||||
<textarea name="ipaddress_list" title="{$lang->add_denied_ip}: {$lang->about_denied_ip}" rows="4" cols="42" style="width:100%" placeholder="{$lang->about_denied_ip}"></textarea>
|
||||
<span class="x_pull-right" style="margin-right:-14px">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->add_denied_ip}</button>
|
||||
</span>
|
||||
</form>
|
||||
</section>
|
||||
<include target="./footer.html" />
|
||||
51
modules/spamfilter/tpl/denied_word_list.html
Normal file
51
modules/spamfilter/tpl/denied_word_list.html
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<include target="./header.html" />
|
||||
<section>
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li class="x_active"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
</ul>
|
||||
<form action="./" method="post">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminDeleteDeniedWord" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/spamfilter/tpl/1" />
|
||||
<table class="x_table x_table-striped x_table-hover">
|
||||
<caption>
|
||||
<strong>{$lang->cmd_denied_word}</strong>
|
||||
<button type="submit" class="x_btn x_pull-right">{$lang->cmd_delete}</button>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{$lang->word}</th>
|
||||
<th scope="col">{$lang->latest_hit}</th>
|
||||
<th scope="col">{$lang->hit}</th>
|
||||
<th scope="col">{$lang->regdate}</th>
|
||||
<th scope="col"><input type="checkbox" name="word" title="Check All" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr loop="$word_list => $word_info">
|
||||
<td>{$word_info->word}</td>
|
||||
<td><!--@if($word_info->latest_hit)-->{zdate($word_info->latest_hit,'Y-m-d H:i')}<!--@else-->-<!--@end--></td>
|
||||
<td>{$word_info->hit}</td>
|
||||
<td>{zdate($word_info->regdate,'Y-m-d')}</td>
|
||||
<td><input type="checkbox" name="word[]" value="{$word_info->word}" /></td>
|
||||
</tr>
|
||||
<tr cond="!$word_list">
|
||||
<td colspan="5" style="text-align:center">{$lang->no_data}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<form action="./" style="margin-right:14px" method="post">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertDeniedWord" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="active" value="word" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/spamfilter/tpl/1" />
|
||||
<textarea name="word_list" title="{$lang->add_denied_word}: {$lang->about_denied_word}" placeholder="{$lang->about_denied_word}" rows="4" cols="42" style="width:100%"></textarea>
|
||||
<span class="x_pull-right" style="margin-right:-14px">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->add_denied_word}</button>
|
||||
</span>
|
||||
</form>
|
||||
</section>
|
||||
<include target="./footer.html" />
|
||||
0
modules/spamfilter/tpl/footer.html
Normal file
0
modules/spamfilter/tpl/footer.html
Normal file
7
modules/spamfilter/tpl/header.html
Normal file
7
modules/spamfilter/tpl/header.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<load target="js/spamfilter_admin.js" usecdn="true" />
|
||||
<div class="x_page-header">
|
||||
<h1>{$lang->spamfilter} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_content_spamfilter" target="_blank">{$lang->help}</a></h1>
|
||||
</div>
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/spamfilter/tpl/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
<load target="js/spamfilter_admin.js" usecdn="true" />
|
||||
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<form id="spamfilterDelete" action="" method="post">
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="act" value="" />
|
||||
<input type="hidden" name="ipaddress" value="" />
|
||||
<input type="hidden" name="word" value="" />
|
||||
<input type="hidden" name="ruleset" value="">
|
||||
</form>
|
||||
<form action="" id="spamfilterConfig" class="form" ruleset="@insertConfig">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertConfig" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="ruleset" value="insertConfig" />
|
||||
<h1 class="h1">{$lang->spamfilter}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<p class="q">{$lang->cmd_interval}</p>
|
||||
<p class="a">
|
||||
<input type="radio" name="limits" id="spamCond1_yes" value="Y" <!--@if($config->limits=='Y' || $config->limits =='')-->checked="checked"<!--@end--> />
|
||||
<label for="spamCond1_yes">{$lang->cmd_yes}</label>
|
||||
<input type="radio" name="limits" id="spamCond1_no" value="N" <!--@if($config->limits!='Y' && $config->limits !='')--> checked="checked"<!--@end--> /> <label for="spamCond1_no">{$lang->cmd_no}</label>
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p class="q">{$lang->cmd_check_trackback}</p>
|
||||
<p class="a">
|
||||
<input type="radio" name="check_trackback" id="spamCond2_yes" value="Y" <!--@if($config->check_trackback=='Y' || $config->check_trackback=='')--> checked="checked"<!--@end--> />
|
||||
<label for="spamCond2_yes">{$lang->cmd_yes}</label>
|
||||
<input type="radio" name="check_trackback" id="spamCond2_yes" value="N" <!--@if($config->check_trackback!='Y' && $config->check_trackback!='')--> checked="checked"<!--@end--> / > <label for="spamCond2_yes">{$lang->cmd_no}</label>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="btnArea">
|
||||
<span class="btn medium"><input type="submit" value="{$lang->cmd_save}" /></span>
|
||||
</div>
|
||||
</form>
|
||||
<form action="" id="spamfilterInsert" class="form">
|
||||
<input type="hidden" name="act" value="" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="ruleset" value="" />
|
||||
<ul>
|
||||
<li>
|
||||
<p class="q">{$lang->cmd_denied_ip}</p>
|
||||
<div class="a">
|
||||
<ul class="textList">
|
||||
<!--@foreach($ip_list as $ipListKey)-->
|
||||
<li>{$ipListKey->ipaddress} <!--@if($ipListKey->description)-->// {$ipListKey->description} <!--@end-->
|
||||
<a href="#" onclick="doDeleteDeniedIP('{$ipListKey->ipaddress}')" class="side">{$lang->cmd_delete}</a>
|
||||
</li>
|
||||
<!--@endforeach-->
|
||||
</ul>
|
||||
</div>
|
||||
<p class="a">
|
||||
<textarea rows="8" cols="42" name="ipaddress_list" title="스팸 IP 추가"></textarea>
|
||||
<span class="btn small"><button type="button" onclick="doInsertDeniedIP('{$lang->msg_invalid_format}')">{$lang->cmd_insert}</button></span>
|
||||
<span class="desc">{$lang->about_denied_ip}</span>
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p class="q"><label for="spamKeyword">{$lang->cmd_denied_word}</label></p>
|
||||
<div class="a">
|
||||
<ul class="textList">
|
||||
<!--@foreach($word_list as $wordListKey)-->
|
||||
<li>{$wordListKey->word} <a href="#" onclick="doDeleteDeniedWord('{$wordListKey->word}')" class="side">{$lang->cmd_delete}</a></li>
|
||||
<!--@end-->
|
||||
</ul>
|
||||
</div>
|
||||
<p class="a">
|
||||
<textarea rows="8" cols="42" name="word_list" title="스팸 키워드 추가"></textarea>
|
||||
<span class="btn small"><button type="button" onclick="doInsertDeniedWord('{$lang->msg_invalid_format}')">{$lang->add}</button></span>
|
||||
<span class="desc">{$lang->about_denied_word}</span>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
|
|
@ -5,7 +5,6 @@ function doDeleteDeniedIP(ipaddress) {
|
|||
var fo_obj = get_by_id('spamfilterDelete');
|
||||
fo_obj.ipaddress.value = ipaddress;
|
||||
fo_obj.act.value = "procSpamfilterAdminDeleteDeniedIP";
|
||||
fo_obj.ruleset.value = 'deleteDeniedIp';
|
||||
fo_obj.submit();
|
||||
}
|
||||
|
||||
|
|
@ -16,29 +15,5 @@ function doDeleteDeniedWord(word) {
|
|||
var fo_obj = get_by_id('spamfilterDelete');
|
||||
fo_obj.word.value = word;
|
||||
fo_obj.act.value = "procSpamfilterAdminDeleteDeniedWord";
|
||||
fo_obj.ruleset.value = 'deleteDeniedWord';
|
||||
fo_obj.submit();
|
||||
}
|
||||
function doInsertDeniedIP(msg_invalid_format){
|
||||
var fo_obj = get_by_id('spamfilterInsert');
|
||||
var reg_ipaddress = /^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/;
|
||||
var matchStr_ipaddress = fo_obj.ipaddress_list.value;
|
||||
if(!matchStr_ipaddress.match(reg_ipaddress)) {
|
||||
alert(msg_invalid_format); return false;
|
||||
}
|
||||
fo_obj.act.value = "procSpamfilterAdminInsertDeniedIP";
|
||||
fo_obj.ruleset.value = "insertDeniedIp";
|
||||
fo_obj.submit();
|
||||
}
|
||||
function doInsertDeniedWord(msg_invalid_format){
|
||||
var fo_obj = get_by_id('spamfilterInsert');
|
||||
var reg_word = /^(.{2,40}\s*)*$/;
|
||||
var matchStr_word = fo_obj.word_list.value;
|
||||
if(!matchStr_word.match(reg_word)) {
|
||||
alert(msg_invalid_format); return false;
|
||||
}
|
||||
fo_obj.act.value = "procSpamfilterAdminInsertDeniedWord";
|
||||
fo_obj.ruleset.value = "insertDeniedWord";
|
||||
fo_obj.submit();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue