git-svn-id: http://xe-core.googlecode.com/svn/trunk@237 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-05 06:31:22 +00:00
parent 6ead633151
commit a5f53d4b25
12 changed files with 158 additions and 47 deletions

View file

@ -0,0 +1,9 @@
<?php
/**
* @file : modules/spamfilter/lang/ko.lang.php
* @author : zero <zero@nzeo.com>
* @desc : 한국어 언어팩 (기본적인 내용만 수록)
**/
$lang->msg_alert_registered_spamer = '스패머로 등록되셨습니다';
?>

View file

@ -0,0 +1,8 @@
<query id="deleteDeniedIP" action="delete">
<tables>
<table name="spamfilter_denied_ip" />
</tables>
<conditions>
<condition operation="equal" column="ipaddress" var="ipaddress" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteDeniedWord" action="delete">
<tables>
<table name="spamfilter_denied_word" />
</tables>
<conditions>
<condition operation="equal" column="word" var="word" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,12 @@
<query id="getLogCount" action="select">
<tables>
<table name="spamfilter_log" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="ipaddress" var="ipaddress" filter="number" notnull="notnull" />
<condition operation="more" column="regdate" var="regdate" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -0,0 +1,9 @@
<query id="insertDeniedIP" action="insert">
<tables>
<table name="spamfilter_denied_ip" />
</tables>
<columns>
<column name="ipaddress" var="ipaddress" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -0,0 +1,9 @@
<query id="insertDeniedIP" action="insert">
<tables>
<table name="spamfilter_denied_word" />
</tables>
<columns>
<column name="word" var="word" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -0,0 +1,10 @@
<query id="insertLog" action="insert">
<tables>
<table name="spamfilter_log" />
</tables>
<columns>
<column name="spamfilter_log_srl" default="sequence()" />
<column name="ipaddress" default="ipaddress()" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -0,0 +1,4 @@
<table name="spamfilter_denied_word">
<column name="word" type="varchar" size="250" notnull="notnull" primary_key="primary_key" />
<column name="regdate" type="date" index="idx_regdate" />
</table>

View file

@ -0,0 +1,5 @@
<table name="spamfilter_log">
<column name="spamfilter_log_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="ipaddress" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="regdate" type="date" index="idx_regdate" />
</table>

View file

@ -1,11 +1,11 @@
<?php
/**
* @class tag
* @class spamfilter
* @author zero (zero@nzeo.com)
* @brief tag 모듈의 high class
* @brief spamfilter 모듈의 high class
**/
class tag extends ModuleObject {
class spamfilter extends ModuleObject {
}
?>

View file

@ -1,11 +1,11 @@
<?php
/**
* @class tagController
* @class spamfilterController
* @author zero (zero@nzeo.com)
* @brief tag 모듈의 controller class
* @brief spamfilter 모듈의 controller class
**/
class tagController extends tag {
class spamfilterController extends spamfilter {
/**
* @brief 초기화
@ -14,60 +14,65 @@
}
/**
* @brief 태그 입력
* 태그 입력은 해당 글의 모든 태그를 삭제 입력하는 방식을 이용
* @brief IP 등록
* 등록된 IP는 스패머로 간주
**/
function insertTag($module_srl, $document_srl, $tags) {
function insertIP($ipaddress = '') {
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
// 해당 글의 tags를 모두 삭제
$this->deleteTag($document_srl);
if(!$tags) return;
// tags변수 정리
$tmp_tag_list = explode(',', $tags);
$tag_count = count($tmp_tag_list);
for($i=0;$i<$tag_count;$i++) {
$tag = trim($tmp_tag_list[$i]);
if(!$tag) continue;
$tag_list[] = $tag;
}
if(!count($tag_list)) return;
// DB 객체 생성
$oDB = &DB::getInstance();
// 다시 태그를 입력
$args->module_srl = $module_srl;
$args->document_srl = $document_srl;
$tag_count = count($tag_list);
for($i=0;$i<$tag_count;$i++) {
$args->tag = $tag_list[$i];
$oDB->executeQuery('tag.insertTag', $args);
}
return implode(',',$tag_list);
$args->ipaddress = $ipaddress;
return $oDB->executeQuery('spamfilter.insertDeniedIP', $args);
}
/**
* @brief 특정 문서의 태그 삭제
* @brief IP 제거
* 스패머로 등록된 IP를 제거
**/
function deleteTag($document_srl) {
// DB 객체 생성
$oDB = &DB::getInstance();
function deleteIP($ipaddress) {
if(!$ipaddress) return;
$args->document_srl = $document_srl;
return $oDB->executeQuery('tag.deleteTag', $args);
$oDB = &DB::getInstance();
$args->ipaddress = $ipaddress;
return $oDB->executeQuery('spamfilter.deleteDeniedIP', $args);
}
/**
* @brief 특정 모듈의 태그 삭제
* @brief 스팸단어 등록
* 등록된 단어가 포함된 글은 스팸글로 간주
**/
function deleteModuleTags($module_srl) {
// DB 객체 생성
$oDB = &DB::getInstance();
function insertWord($word) {
if(!$word) return;
$args->module_srl = $module_srl;
return $oDB->executeQuery('tag.deleteModuleTags', $args);
$oDB = &DB::getInstance();
$args->word = $word;
return $oDB->executeQuery('spamfilter.insertDeniedWord', $args);
}
/**
* @brief 스팸단어 제거
* 스팸 단어로 등록된 단어 제거
**/
function deleteWord($word) {
if(!$word) return;
$oDB = &DB::getInstance();
$args->word = $word;
return $oDB->executeQuery('spamfilter.deleteDeniedWord', $args);
}
/**
* @brief 로그 등록
* 접속 IP를 로그에 등록, 로그의 간격이 특정 시간 이내일 경우 도배로 간주하여
* 스패머로 등록할 있음
**/
function insertLog() {
$ipaddress = $_SERVER['REMOTE_ADDR'];
$oDB = &DB::getInstance();
$args->word = $word;
return $oDB->executeQuery('spamfilter.insertLog', $args);
}
}
?>

View file

@ -0,0 +1,32 @@
<?php
/**
* @class spamfilterModel
* @author zero (zero@nzeo.com)
* @brief spamfilter 모듈의 controller class
**/
class spamfilterModel extends spamfilter {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 지정된 IPaddress의 특정 시간대 내의 로그 수를 return
**/
function getLogCount($time = 3600, $ipaddress='') {
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
$oDB = &DB::getInstance();
$args->ipaddress = $ipaddress;
$args->regdate = date("YmdHis", time()-$time);
$output = $oDB->executeQuery('spamfilter.getLogCount');
$count = $output->data->count;
return $count;
}
}
?>