mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@252 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
9133108828
commit
2c67aa349a
7 changed files with 58 additions and 2 deletions
|
|
@ -58,8 +58,13 @@
|
|||
|
||||
// 스팸 간격을 체크하는 변수
|
||||
$interval = $config->interval?$config->interval:60;
|
||||
|
||||
// 스팸 간격내에 limit_count이상 작성을 시도하면 해당 ip를 금지 시킴
|
||||
$limit_count = $config->limit_count?$config->limit_count:5;
|
||||
|
||||
// 트랙백의 경우 한 글에 하나의 ip에서만 트랙백을 허용함
|
||||
$check_trackback = $config->check_trackback=='Y'?true:false;
|
||||
|
||||
// 스팸 IP에 등록되어 있는지 체크하여 등록되어 있으면 return
|
||||
$is_denied = $oSpamFilterModel->isDeniedIP($ipaddress);
|
||||
if($is_denied) {
|
||||
|
|
@ -68,6 +73,18 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// act==procReceiveTrackback (트랙백)일때 check_trackback==true이면 검사
|
||||
if($this->act=='procReceiveTrackback' && $check_trackback){
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$document_srl = Context::get('document_srl');
|
||||
$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $ipaddress);
|
||||
if($count>0) {
|
||||
$output = Object(-1, 'msg_alert_trackback_denied');
|
||||
$this->stop_proc = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 정해진 시간내에 글 작성 시도를 하였는지 체크
|
||||
$count = $oSpamFilterModel->getLogCount($interval, $ipaddress);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* @brief debug mode = true 일때 files/_debug_message.php 에 디버그 내용이 쌓임
|
||||
**/
|
||||
define('__DEBUG__', true);
|
||||
define('__DEBUG__', false);
|
||||
if(__DEBUG__) {
|
||||
|
||||
// php5이상이면 error handling을 handleError() 로 set
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
$lang->denied_ip = "금지 IP";
|
||||
$lang->interval = "스팸 처리 간격";
|
||||
$lang->limit_count = "제한수";
|
||||
$lang->check_trackback = "트랙백 검사";
|
||||
$lang->word = "단어";
|
||||
|
||||
// 설명문
|
||||
|
|
@ -20,9 +21,11 @@
|
|||
$lang->about_limit_count = "지정된 시간내에 제한수를 넘겨서 글 작성을 시도하면 스팸으로 인식, IP를 금지 시킵니다";
|
||||
$lang->about_denied_ip = "127.0.0.* 와 같이 * 로 정해진 패턴의 IP 대역을 모두 금지 시킬 수 있습니다";
|
||||
$lang->about_denied_word = "금지 단어로 등록되면 해당 단어가 있는 글은 등록을 금지 시킬 수 있습니다";
|
||||
$lang->about_check_trackback = "한 글에 한 IP에만 트랙백을 허용할 수 있습니다";
|
||||
|
||||
// 메세지 출력용
|
||||
$lang->msg_alert_limited_by_config = '%s 초 이내에 글 작성은 금지 됩니다. 계속 시도하시면 금지 IP에 등록되실 수 있습니다';
|
||||
$lang->msg_alert_denied_word = '"%s"는 사용 금지된 단어입니다';
|
||||
$lang->msg_alert_registered_denied_ip = '금지 IP에 등록되셔서 정상적인 활동에 제한을 받게 되셨습니다. 문의는 사이트 관리자에게 해주시기 바랍니다';
|
||||
$lang->msg_alert_trackback_denied = '한 글에는 하나의 트랙백만 허용이 됩니다';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
**/
|
||||
function procInsertConfig() {
|
||||
// 기본 정보를 받음
|
||||
$args = Context::gets('interval','limit_count');
|
||||
$args = Context::gets('interval','limit_count','check_trackback');
|
||||
if($args->check_trackback!='Y') $args->check_trackback = 'N';
|
||||
|
||||
// module Controller 객체 생성하여 입력
|
||||
$oModuleController = &getController('module');
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@
|
|||
<tr>
|
||||
<td>{$lang->about_limit_count}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th rowspan="2">{$lang->check_trackback}</th>
|
||||
<td><input type="checkbox" name="check_trackback" value="Y" <!--@if($config->check_trackback=='Y')-->checked="true"<!--@end--> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$lang->about_check_trackback}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{@getUrl('act','')}'" />
|
||||
|
|
|
|||
12
modules/trackback/queries/getTrackbackCountByIPAddress.xml
Normal file
12
modules/trackback/queries/getTrackbackCountByIPAddress.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="getTrackbackCountByIPAddress" action="select">
|
||||
<tables>
|
||||
<table name="trackbacks" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="ipaddress" var="ipaddress" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -36,6 +36,22 @@
|
|||
return (int)$total_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 document에 특정 ip로 기록된 트랙백의 갯수
|
||||
* spamfilter 에서 사용할 method임
|
||||
**/
|
||||
function getTrackbackCountByIPAddress($document_srl, $ipaddress) {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
$args->document_srl = $document_srl;
|
||||
$args->ipaddress = $ipaddress;
|
||||
$output = $oDB->executeQuery('trackback.getTrackbackCountByIPAddress', $args);
|
||||
debugPrint($output);
|
||||
$total_count = $output->data->count;
|
||||
|
||||
return (int)$total_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 문서에 속한 엮인글의 목록을 가져옴
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue