mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
[Admin UI Refactoring] Content > Spam Filter
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11558 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
44ff6f1c1f
commit
e58a54edc7
8 changed files with 110 additions and 80 deletions
|
|
@ -132,4 +132,4 @@ jQuery(function($){
|
|||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<div class="x_page-header">
|
||||
<h1>RSS</h1>
|
||||
</div>
|
||||
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<section class="section">
|
||||
<h1>{$lang->total_feed} {$lang->cmd_management}</h1>
|
||||
<form ruleset="insertRssConfig" action="./" method="post" enctype="multipart/form-data" class="x_form-horizontal">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
</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" />
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
$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');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
|
|
@ -36,22 +36,27 @@
|
|||
$ipaddress_list = Context::get('ipaddress_list');
|
||||
$oSpamfilterController = &getController('spamfilter');
|
||||
if($ipaddress_list){
|
||||
$insertIPOutput = $oSpamfilterController->insertIP($ipaddress_list);
|
||||
if(!$insertIPOutput->toBool()) return $insertIPOutput;
|
||||
$output = $oSpamfilterController->insertIP($ipaddress_list);
|
||||
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
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);
|
||||
|
||||
$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){
|
||||
$insertWordOutput = $this->insertWord($word_list);
|
||||
if(!$insertWordOutput->toBool()) return $insertWordOutput;
|
||||
$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);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +67,7 @@
|
|||
$ipaddress = Context::get('ipaddress');
|
||||
$output = $this->deleteIP($ipaddress);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +79,7 @@
|
|||
//$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');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
|
|
@ -94,13 +99,17 @@
|
|||
* The post, which contains the newly registered spam word, should be considered as a spam
|
||||
**/
|
||||
function insertWord($word_list) {
|
||||
if(!preg_match("/^(.{2,40}\s*)*$/",$word_list)) return new Object(-1, 'msg_invalid');
|
||||
|
||||
$word_list = str_replace("\r","",$word_list);
|
||||
$word_list = explode("\n",$word_list);
|
||||
$fail_word = '';
|
||||
foreach($word_list as $word) {
|
||||
if(trim($word)) $args->word = $word;
|
||||
$output = executeQuery('spamfilter.insertDeniedWord', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool()) $fail_word .= $word.'<br />';
|
||||
}
|
||||
$output->add('fail_list',$fail_word);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
class spamfilterAdminView extends spamfilter
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init()
|
||||
{
|
||||
// Set template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
// Set template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
/**
|
||||
* @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 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();
|
||||
$security = new Security();
|
||||
$security->encodeHTML('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('denied_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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -137,6 +137,9 @@
|
|||
* The registered IP address is considered as a spammer
|
||||
**/
|
||||
function insertIP($ipaddress_list, $description = null) {
|
||||
print_r($ipaddress_list);
|
||||
$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) {
|
||||
|
|
@ -146,11 +149,11 @@
|
|||
if(!$description && $matches[4]) $args->description = $matches[4];
|
||||
else $args->description = $description;
|
||||
}
|
||||
|
||||
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
|
||||
}
|
||||
|
||||
$output->add('fail_list',$fail_list);
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,26 +19,3 @@ function doDeleteDeniedWord(word) {
|
|||
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