mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
issue 70 spamfilter admin module UI modified
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8768 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aa694bce26
commit
727c569053
9 changed files with 133 additions and 60 deletions
|
|
@ -3,16 +3,17 @@
|
|||
<grants />
|
||||
<permissions />
|
||||
<actions>
|
||||
<action name="dispSpamfilterAdminConfig" type="view" admin_index="true" standalone="true" />
|
||||
<action name="dispSpamfilterAdminDeniedIPList" type="view" standalone="true" />
|
||||
<action name="dispSpamfilterAdminDeniedWordList" type="view" standalone="true" />
|
||||
|
||||
<action name="procSpamfilterAdminInsertConfig" type="controller" standalone="true" ruleset="insertConfig" />
|
||||
<action name="dispSpamfilterAdminSetting" type="view" admin_index="true" standalone="true" />
|
||||
|
||||
<action name="procSpamfilterAdminInsertConfig" type="controller" standalone="true" ruleset="insertConfig" />
|
||||
<action name="procSpamfilterAdminInsertDeniedIP" type="controller" standalone="true" ruleset="insertDeniedIp" />
|
||||
<action name="procSpamfilterAdminDeleteDeniedIP" type="controller" standalone="true" ruleset="deleteDeniedIp" />
|
||||
<action name="procSpamfilterAdminInsertDeniedWord" type="controller" standalone="true" ruleset="insertDeniedWord" />
|
||||
<action name="procSpamfilterAdminDeleteDeniedWord" type="controller" standalone="true" ruleset="deleteDeniedWord" />
|
||||
</actions>
|
||||
|
||||
<action name="procSpamfilterAdminInsertSetting" type="controller" standalone="true" ruleset="insertSetting" />
|
||||
|
||||
</actions>
|
||||
<menus>
|
||||
<menu name="spamFilter">
|
||||
<title xml:lang="en">Spam Filter</title>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Korean language pack (only the more basic)
|
||||
**/
|
||||
// action related to
|
||||
$lang->cmd_denied_ip = '금지IP 목록';
|
||||
$lang->cmd_denied_word = '금지 단어 목록';
|
||||
// action related to (Modify)
|
||||
$lang->cmd_denied_ip = '스팸 IP 목록';
|
||||
$lang->cmd_denied_word = '스팸 키워드 목록';
|
||||
// Common words
|
||||
$lang->spamfilter = '스팸필터';
|
||||
$lang->denied_ip = '금지 IP';
|
||||
|
|
@ -27,4 +27,14 @@
|
|||
$lang->msg_alert_denied_word = '"%s"는 사용 금지된 단어입니다.';
|
||||
$lang->msg_alert_registered_denied_ip = '금지 IP에 등록되셔서 정상적인 활동에 제한을 받게 되셨습니다. 문의는 사이트 관리자에게 해주시기 바랍니다.';
|
||||
$lang->msg_alert_trackback_denied = '한 글에는 하나의 트랙백만 허용 됩니다.';
|
||||
|
||||
|
||||
// Add (determine)
|
||||
$lang->cmd_interval = '10초 동안 3회 이상 글을 작성하면 스패머로 간주할까요? 글, 댓글 작성과 엮인글 발송을 차단합니다.';
|
||||
$lang->cmd_check_trackback = '하나의 글에 2회 이상 엮인글을 등록하면 스패머로 간주할까요? 엮인글을 차단합니다.';
|
||||
$lang->about_denied_ip = '\'<em>스팸 IP // 메모</em>\' 형식으로 입력하세요. 여러개의 목록은 줄을 바꾸어 입력하세요.';
|
||||
$lang->about_denied_word = '여러개의 목록은 줄을 바꾸어 입력하세요.';
|
||||
$lang->add = '추가';
|
||||
$lang->yes = '예';
|
||||
$lang->no = '아니오';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<customrules>
|
||||
<rule name="ip" type="regex" test="/((0|1[0-9]{0,2}|2[0-4][0-9]|25[0-5])|\*)(\.((0|1[0-9]{0,2}|2[0-4][0-9]|25[0-5])|\*)){3}/" />
|
||||
<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" />
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<customrules>
|
||||
</customrules>
|
||||
<rule name="word" type="regex" test="/(.*){1,125}/" />
|
||||
</customrules>
|
||||
<fields>
|
||||
<field name="act" required="true" default="procSpamfilterAdminDeleteDeniedWord" />
|
||||
<field name="word" required="true" length="1:250" />
|
||||
<field name="word" required="true" rule="word" />
|
||||
</fields>
|
||||
</ruleset>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<customrules>
|
||||
<rule name="ip" type="regex" test="/((0|1[0-9]{0,2}|2[0-4][0-9]|25[0-5])|\*)(\.((0|1[0-9]{0,2}|2[0-4][0-9]|25[0-5])|\*)){3}/" />
|
||||
<rule name="ip" type="regex" test="/^(\d{1,3}(?:.(\d{1,3}|\*)){3}\s*(\/\/[^\r\n]*)?[\r\n]*)*$/" />
|
||||
</customrules>
|
||||
<fields>
|
||||
<field name="ipaddress" required="true" rule="ip" />
|
||||
|
|
|
|||
|
|
@ -13,13 +13,55 @@
|
|||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
function procSpamfilterAdminInsertSetting() {
|
||||
debugPrint('Setting!!');
|
||||
|
||||
// Get the default information
|
||||
$argsConfig = Context::gets('limits','check_trackback');
|
||||
$ipaddressList = Context::get('ipaddressList');
|
||||
$wordList = Context::get('wordList');
|
||||
$flag = Context::get('flag');
|
||||
//interval, limit_count
|
||||
debugPrint($argsConfig);
|
||||
|
||||
if(!$flag){
|
||||
if($argsConfig->check_trackback && $argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
|
||||
//컬럼 변경하거나. 변경이 불가능하다면 룰셋에서 값을 고정 할 수 잇는지 알아볼 것 (config에서 값을 10,2f로 세팅할 것)
|
||||
if($argsConfig->limits && $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;
|
||||
}
|
||||
|
||||
//스팸IP 추가
|
||||
$oSpamfilterController = &getController('spamfilter');
|
||||
if($ipaddressList){
|
||||
$insertIPOutput = $oSpamfilterController->insertIP($ipaddressList);
|
||||
if(!$insertIPOutput->toBool()) return $insertIPOutput;
|
||||
}
|
||||
|
||||
//스팸 키워드 추가
|
||||
if($wordList){
|
||||
$insertWordOutput = $this->insertWord($wordList);
|
||||
if(!$insertWordOutput->toBool()) return $insertWordOutput;
|
||||
}
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**CUT!
|
||||
* @brief Spam filter configurations
|
||||
**/
|
||||
function procSpamfilterAdminInsertConfig() {
|
||||
// Get the default information
|
||||
$args = Context::gets('interval','limit_count','check_trackback');
|
||||
if($args->check_trackback!='Y') $args->check_trackback = 'N';
|
||||
if($args->check_trackback!='Y') $args->check_trackback = 'N';
|
||||
// Create and insert the module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('spamfilter',$args);
|
||||
|
|
@ -31,7 +73,7 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/** CUT!
|
||||
* @brief Register the banned IP address
|
||||
**/
|
||||
function procSpamfilterAdminInsertDeniedIP() {
|
||||
|
|
@ -49,21 +91,21 @@
|
|||
$ipaddress = Context::get('ipaddress');
|
||||
$output = $this->deleteIP($ipaddress);
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/** CUT!
|
||||
* @brief Register the prohibited word
|
||||
**/
|
||||
function procSpamfilterAdminInsertDeniedWord() {
|
||||
$word = Context::get('word');
|
||||
$output = $this->insertWord($word);
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
|
|
@ -74,10 +116,12 @@
|
|||
* @brief Delete the prohibited Word
|
||||
**/
|
||||
function procSpamfilterAdminDeleteDeniedWord() {
|
||||
$word = base64_decode(Context::get('word'));
|
||||
$word = Context::get('word');
|
||||
//$word = base64_decode(Context::get('word'));
|
||||
$output = $this->deleteWord($word);
|
||||
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
|
|
@ -99,11 +143,15 @@
|
|||
* @brief Register the spam word
|
||||
* The post, which contains the newly registered spam word, should be considered as a spam
|
||||
**/
|
||||
function insertWord($word) {
|
||||
if(!$word) return;
|
||||
|
||||
$args->word = $word;
|
||||
return executeQuery('spamfilter.insertDeniedWord', $args);
|
||||
function insertWord($wordList) {
|
||||
$wordList = str_replace("\r","",$wordList);
|
||||
$wordList = explode("\n",$wordList);
|
||||
foreach($wordList as $wordKey => $word) {
|
||||
if(trim($word)) $args->word = $word;
|
||||
$output = executeQuery('spamfilter.insertDeniedWord', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -112,7 +160,6 @@
|
|||
**/
|
||||
function deleteWord($word) {
|
||||
if(!$word) return;
|
||||
|
||||
$args->word = $word;
|
||||
return executeQuery('spamfilter.deleteDeniedWord', $args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,40 +17,23 @@
|
|||
|
||||
/**
|
||||
* @brief Spam Filter configurations
|
||||
* Output the list of banned IPs and words
|
||||
**/
|
||||
function dispSpamfilterAdminConfig() {
|
||||
function dispSpamfilterAdminSetting() {
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('spamfilter');
|
||||
Context::set('config',$config);
|
||||
// Set a template file
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Output the list of banned IPs
|
||||
**/
|
||||
function dispSpamfilterAdminDeniedIPList() {
|
||||
// Get the list of banned IP addresses
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
|
||||
// Get the list of denied IP addresses and words
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$ip_list = $oSpamFilterModel->getDeniedIPList();
|
||||
|
||||
Context::set('ip_list', $ip_list);
|
||||
// Set a template file
|
||||
$this->setTemplateFile('denied_ip_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Output the list of prohibited words
|
||||
**/
|
||||
function dispSpamfilterAdminDeniedWordList() {
|
||||
// Get the list of prohibited words
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$word_list = $oSpamFilterModel->getDeniedWordList();
|
||||
|
||||
Context::set('config',$config);
|
||||
Context::set('ip_list', $ip_list);
|
||||
Context::set('word_list', $word_list);
|
||||
// Set a template file
|
||||
$this->setTemplateFile('denied_word_list');
|
||||
}
|
||||
$this->setTemplateFile('spSpamFilter');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -136,11 +136,26 @@
|
|||
* @brief IP registration
|
||||
* The registered IP address is considered as a spammer
|
||||
**/
|
||||
function insertIP($ipaddress, $description = null) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
if($description) $args->description = $description;
|
||||
function insertIP($ipaddressList, $description = null) {
|
||||
//리눅스시.. 변환부분 체크하는 것 다시 봐야할 듯.
|
||||
$ipaddressList = str_replace("\r","",$ipaddressList);
|
||||
$ipaddressList = explode("\n",$ipaddressList);
|
||||
debugPrint('sdfsdf');
|
||||
foreach($ipaddressList as $ipaddressKey => $ipaddressValue) {
|
||||
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/\s*(.*))?/",$ipaddressValue,$matches);
|
||||
debugPrint($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;
|
||||
}
|
||||
return $output;
|
||||
|
||||
return executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
* @brief 금지 IP 삭제
|
||||
**/
|
||||
function doDeleteDeniedIP(ipaddress) {
|
||||
var fo_obj = get_by_id('fo_denied_ip');
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -11,7 +13,21 @@ function doDeleteDeniedIP(ipaddress) {
|
|||
* @brief 금지 단어 삭제
|
||||
**/
|
||||
function doDeleteDeniedWord(word) {
|
||||
var fo_obj = get_by_id('fo_denied_word');
|
||||
fo_obj.word.value = 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 doInsertDeniedSome(some){
|
||||
var fo_obj = get_by_id('spamfilterInsert');
|
||||
fo_obj.flag.value = 'addsome';
|
||||
if(some == 'ipaddressList'){
|
||||
fo_obj.wordList.value = '';
|
||||
}
|
||||
else if(some == 'wordList'){
|
||||
fo_obj.ipaddressList.value = '';
|
||||
}
|
||||
fo_obj.submit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue