mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
issue 160, change spamfilter
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9353 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
be8f7fe300
commit
94217bdd73
4 changed files with 64 additions and 53 deletions
|
|
@ -20,9 +20,12 @@
|
||||||
<actions>
|
<actions>
|
||||||
<action name="dispSpamfilterAdminSetting" type="view" admin_index="true" standalone="true" menu_name="spamFilter" menu_index="true" />
|
<action name="dispSpamfilterAdminSetting" type="view" admin_index="true" standalone="true" menu_name="spamFilter" menu_index="true" />
|
||||||
|
|
||||||
|
<action name="procSpamfilterAdminInsertDeniedIP" type="controller" standalone="true" ruleset="insertDeniedIp" />
|
||||||
|
<action name="procSpamfilterAdminInsertDeniedWord" type="controller" standalone="true" ruleset="insertDeniedWord" />
|
||||||
|
|
||||||
<action name="procSpamfilterAdminDeleteDeniedIP" type="controller" standalone="true" ruleset="deleteDeniedIp" />
|
<action name="procSpamfilterAdminDeleteDeniedIP" type="controller" standalone="true" ruleset="deleteDeniedIp" />
|
||||||
<action name="procSpamfilterAdminDeleteDeniedWord" type="controller" standalone="true" ruleset="deleteDeniedWord" />
|
<action name="procSpamfilterAdminDeleteDeniedWord" type="controller" standalone="true" ruleset="deleteDeniedWord" />
|
||||||
<action name="procSpamfilterAdminInsertSetting" type="controller" standalone="true" ruleset="insertSetting" />
|
<action name="procSpamfilterAdminInsertConfig" type="controller" standalone="true" ruleset="insertSetting" />
|
||||||
|
|
||||||
</actions>
|
</actions>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -14,38 +14,50 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function procSpamfilterAdminInsertSetting() {
|
function procSpamfilterAdminInsertConfig() {
|
||||||
|
|
||||||
// Get the default information
|
// Get the default information
|
||||||
$argsConfig = Context::gets('limits','check_trackback');
|
$argsConfig = Context::gets('limits','check_trackback');
|
||||||
$ipaddressList = Context::get('ipaddressList');
|
|
||||||
$wordList = Context::get('wordList');
|
|
||||||
$flag = Context::get('flag');
|
$flag = Context::get('flag');
|
||||||
//interval, limit_count
|
//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;
|
||||||
|
|
||||||
if(!$flag){
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||||
if($argsConfig->check_trackback && $argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting');
|
||||||
//컬럼 변경하거나. 변경이 불가능하다면 룰셋에서 값을 고정 할 수 잇는지 알아볼 것 (config에서 값을 10,2f로 세팅할 것)
|
header('location:'.$returnUrl);
|
||||||
if($argsConfig->limits && $argsConfig->limits!='Y') $argsConfig->limits = 'N';
|
return;
|
||||||
// Create and insert the module Controller object
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
|
|
||||||
if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function procSpamfilterAdminInsertDeniedIP(){
|
||||||
//스팸IP 추가
|
//스팸IP 추가
|
||||||
|
$ipaddressList = Context::get('ipaddressList');
|
||||||
$oSpamfilterController = &getController('spamfilter');
|
$oSpamfilterController = &getController('spamfilter');
|
||||||
if($ipaddressList){
|
if($ipaddressList){
|
||||||
$insertIPOutput = $oSpamfilterController->insertIP($ipaddressList);
|
$insertIPOutput = $oSpamfilterController->insertIP($ipaddressList);
|
||||||
if(!$insertIPOutput->toBool()) return $insertIPOutput;
|
if(!$insertIPOutput->toBool()) return $insertIPOutput;
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
function procSpamfilterAdminInsertDeniedWord(){
|
||||||
//스팸 키워드 추가
|
//스팸 키워드 추가
|
||||||
|
$wordList = Context::get('wordList');
|
||||||
if($wordList){
|
if($wordList){
|
||||||
$insertWordOutput = $this->insertWord($wordList);
|
$insertWordOutput = $this->insertWord($wordList);
|
||||||
if(!$insertWordOutput->toBool()) return $insertWordOutput;
|
if(!$insertWordOutput->toBool()) return $insertWordOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||||
$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', 'dispSpamfilterAdminSetting');
|
||||||
header('location:'.$returnUrl);
|
header('location:'.$returnUrl);
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,20 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function doInsertDeniedSome(some){
|
|
||||||
if(!checkSomeValid(some)) {
|
|
||||||
alert('{$lang->invalid}');
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
jQuery("#spamfilterInsert").submit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<load target="js/spamfilter_admin.js" usecdn="true" />
|
<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">
|
<form id="spamfilterDelete" action="" method="post">
|
||||||
<input type="hidden" name="act" value="" />
|
<input type="hidden" name="act" value="" />
|
||||||
<input type="hidden" name="ipaddress" value="" />
|
<input type="hidden" name="ipaddress" value="" />
|
||||||
<input type="hidden" name="word" value="" />
|
<input type="hidden" name="word" value="" />
|
||||||
<input type="hidden" name="ruleset" value="">
|
<input type="hidden" name="ruleset" value="">
|
||||||
</form>
|
</form>
|
||||||
<form action="" id="spamfilterInsert" class="form" ruleset="@insertSetting">
|
<form action="" id="spamfilterConfig" class="form" ruleset="@insertConfig">
|
||||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertSetting">
|
<input type="hidden" name="act" value="procSpamfilterAdminInsertConfig">
|
||||||
<input type="hidden" name="module" value="spamfilter">
|
<input type="hidden" name="module" value="spamfilter">
|
||||||
<input type="hidden" name="ruleset" value="insertSetting">
|
<input type="hidden" name="ruleset" value="insertConfig">
|
||||||
<input type="hidden" name="flag" value="">
|
<h1 class="h1">{$lang->spamfilter}</h1>
|
||||||
<h1 class="h1">Spam Filter</h1>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p class="q">{$lang->cmd_interval}</p>
|
<p class="q">{$lang->cmd_interval}</p>
|
||||||
|
|
@ -38,6 +32,16 @@ function doInsertDeniedSome(some){
|
||||||
<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>
|
<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>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="btnArea">
|
||||||
|
<span class="btn medium"><input type="submit" value="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>
|
<li>
|
||||||
<p class="q">{$lang->cmd_denied_ip}</p>
|
<p class="q">{$lang->cmd_denied_ip}</p>
|
||||||
<div class="a">
|
<div class="a">
|
||||||
|
|
@ -51,7 +55,7 @@ function doInsertDeniedSome(some){
|
||||||
</div>
|
</div>
|
||||||
<p class="a">
|
<p class="a">
|
||||||
<textarea rows="4" cols="42" name="ipaddressList" title="스팸 IP 추가"></textarea>
|
<textarea rows="4" cols="42" name="ipaddressList" title="스팸 IP 추가"></textarea>
|
||||||
<span class="btn small"><button type="button" onclick="doInsertDeniedSome('ip')">{$lang->cmd_insert}</button></span>
|
<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>
|
<span class="desc">{$lang->about_denied_ip}</span>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -66,12 +70,9 @@ function doInsertDeniedSome(some){
|
||||||
</div>
|
</div>
|
||||||
<p class="a">
|
<p class="a">
|
||||||
<textarea rows="4" cols="42" name="wordList" title="스팸 키워드 추가"></textarea>
|
<textarea rows="4" cols="42" name="wordList" title="스팸 키워드 추가"></textarea>
|
||||||
<span class="btn small"><button type="button" onclick="doInsertDeniedSome('word')">{$lang->add}</button></span>
|
<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>
|
<span class="desc">{$lang->about_denied_word}</span>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="btnArea">
|
|
||||||
<span class="btn medium"><input type="submit" value="Save" /></span>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -19,31 +19,26 @@ function doDeleteDeniedWord(word) {
|
||||||
fo_obj.ruleset.value = 'deleteDeniedWord';
|
fo_obj.ruleset.value = 'deleteDeniedWord';
|
||||||
fo_obj.submit();
|
fo_obj.submit();
|
||||||
}
|
}
|
||||||
|
function doInsertDeniedIP(msg_invalid_format){
|
||||||
function checkSomeValid(some){
|
|
||||||
var fo_obj = get_by_id('spamfilterInsert');
|
var fo_obj = get_by_id('spamfilterInsert');
|
||||||
|
|
||||||
var reg_ipaddress = /^(\d{1,3}(?:.(\d{1,3}|\*)){3}\s*(\/\/[^\r\n]*)?[\r\n]*)*$/;
|
var reg_ipaddress = /^(\d{1,3}(?:.(\d{1,3}|\*)){3}\s*(\/\/[^\r\n]*)?[\r\n]*)*$/;
|
||||||
var matchStr_ipaddress = fo_obj.ipaddressList.value;
|
var matchStr_ipaddress = fo_obj.ipaddressList.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}[\r\n]+)*.{0,40}$/;
|
var reg_word = /^(.{2,40}[\r\n]+)*.{0,40}$/;
|
||||||
var matchStr_word = fo_obj.wordList.value;
|
var matchStr_word = fo_obj.wordList.value;
|
||||||
|
if(!matchStr_word.match(reg_word)) {
|
||||||
var valid_word = true;
|
alert(msg_invalid_format); return false;
|
||||||
var valid_ip = true;
|
|
||||||
|
|
||||||
if(!matchStr_ipaddress.match(reg_ipaddress)) valid_ip = false;
|
|
||||||
if(!matchStr_word.match(reg_word)) valid_word = false;
|
|
||||||
|
|
||||||
if(some == 'ip'){
|
|
||||||
fo_obj.wordList.value = '';
|
|
||||||
valid_word = true;
|
|
||||||
} else if(some == 'word'){
|
|
||||||
fo_obj.ipaddressList.value = '';
|
|
||||||
valid_ip = true;
|
|
||||||
}
|
}
|
||||||
|
fo_obj.act.value = "procSpamfilterAdminInsertDeniedWord";
|
||||||
if(valid_ip && valid_word) return true;
|
fo_obj.ruleset.value = "insertDeniedWord";
|
||||||
else return false;
|
fo_obj.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue