mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
스팸필터 애드온을 제거하고 스팸필터 모듈에서 직접 trigger로 글/댓글/스팸글에 대한 스팸필터링 제어. 엮인글 스팸필터링 기능 강화
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3216 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0729e06b31
commit
cb1e31bf5e
9 changed files with 272 additions and 140 deletions
|
|
@ -37,11 +37,24 @@
|
|||
/**
|
||||
* @brief 인자로 넘겨진 ipaddress가 금지 ip인지 체크하여 return
|
||||
**/
|
||||
function isDeniedIP($ipaddress) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
$output = executeQuery('spamfilter.isDeniedIP', $args);
|
||||
if($output->data->count>0) return true;
|
||||
return false;
|
||||
function isDeniedIP() {
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ip_list = $this->getDeniedIPList();
|
||||
if(!count($ip_list)) return false;
|
||||
|
||||
$count = count($ip_list);
|
||||
$patterns = array();
|
||||
for($i=0;$i<$count;$i++) {
|
||||
$ip = str_replace('*','',$ip_list[$i]->ipaddress);
|
||||
$patterns[] = $ip;
|
||||
}
|
||||
|
||||
$pattern = '/^('.implode($patterns,'|').')/';
|
||||
|
||||
if(preg_match($pattern, $ipaddress, $matches)) return new Object(-1,'msg_alert_registered_denied_ip');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -55,6 +68,69 @@
|
|||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 넘어온 text에 금지 단어가 있는지 확인
|
||||
**/
|
||||
function isDeniedWord($text) {
|
||||
$word_list = $this->getDeniedWordList();
|
||||
if(!count($word_list)) return false;
|
||||
|
||||
$count = count($word_list);
|
||||
for($i=0;$i<$count;$i++) {
|
||||
$word = $word_list[$i]->word;
|
||||
if(strpos($text, $word)!==false) return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word));
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 지정된 시간을 체크
|
||||
**/
|
||||
function checkLimited() {
|
||||
$config = $this->getConfig();
|
||||
$limit_count = $config->limit_count?$config->limit_count:5;
|
||||
$interval = $config->interval?$config->interval:60;
|
||||
|
||||
$count = $this->getLogCount($interval);
|
||||
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// 정해진 시간보다 클 경우 금지 ip로 등록
|
||||
if($count>=$limit_count) {
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertIP($ipaddress);
|
||||
return new Object(-1, 'msg_alert_registered_denied_ip');
|
||||
}
|
||||
|
||||
// 제한 글수까지는 아니지만 정해진 시간내에 글 작성을 계속 할때
|
||||
if($count) {
|
||||
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
||||
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertLog();
|
||||
|
||||
return new Object(-1, $message);
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 글에 이미 엮인글이 등록되어 있는지 확인
|
||||
**/
|
||||
function isInsertedTrackback($document_srl) {
|
||||
$config = $this->getConfig();
|
||||
$check_trackback = $config->check_trackback=='Y'?true:false;
|
||||
if(!$check_trackback) return new Object();
|
||||
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
|
||||
if($count>0) return Object(-1, 'msg_alert_trackback_denied');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 지정된 IPaddress의 특정 시간대 내의 로그 수를 return
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue