mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1208 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
43f5fe2356
commit
2be28490ce
12 changed files with 87 additions and 208 deletions
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilter
|
||||
* @class counter
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief spamfilter 모듈의 high class
|
||||
* @brief counter 모듈의 high class
|
||||
**/
|
||||
|
||||
class spamfilter extends ModuleObject {
|
||||
class counter extends ModuleObject {
|
||||
|
||||
/**
|
||||
* @brief 설치시 추가 작업이 필요할시 구현
|
||||
|
|
@ -13,14 +13,7 @@
|
|||
function moduleInstall() {
|
||||
// action forward에 등록 (관리자 모드에서 사용하기 위함)
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('spamfilter', 'view', 'dispSpamfilterAdminConfig');
|
||||
$oModuleController->insertActionForward('spamfilter', 'view', 'dispSpamfilterAdminDeniedIPList');
|
||||
$oModuleController->insertActionForward('spamfilter', 'view', 'dispSpamfilterAdminDeniedWordList');
|
||||
//$oModuleController->insertActionForward('spamfilter', 'controller', 'procSpamfilterAdminInsertConfig');
|
||||
//$oModuleController->insertActionForward('spamfilter', 'controller', 'procSpamfilterAdminInsertDeniedIP');
|
||||
//$oModuleController->insertActionForward('spamfilter', 'controller', 'procSpamfilterAdminDeleteDeniedIP');
|
||||
//$oModuleController->insertActionForward('spamfilter', 'controller', 'procSpamfilterAdminInsertDeniedWord');
|
||||
//$oModuleController->insertActionForward('spamfilter', 'controller', 'procSpamfilterAdminDeleteDeniedWord');
|
||||
$oModuleController->insertActionForward('counter', 'view', 'dispCounterAdminIndex');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
|
@ -29,6 +22,12 @@
|
|||
* @brief 설치가 이상이 없는지 체크하는 method
|
||||
**/
|
||||
function moduleIsInstalled() {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 테이블 검사
|
||||
if(!$oDB->isTableExists('counter_log')) return new Object(-1,'fail');
|
||||
if(!$oDB->isTableExists('counter_status ')) return new Object(-1,'fail');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterController
|
||||
* @class counterController
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief spamfilter 모듈의 controller class
|
||||
* @brief counter 모듈의 controller class
|
||||
**/
|
||||
|
||||
class spamfilterController extends spamfilter {
|
||||
class counterController extends counter {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
|
|
@ -14,101 +14,17 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 스팸필터 설정
|
||||
**/
|
||||
function procSpamfilterAdminInsertConfig() {
|
||||
// 기본 정보를 받음
|
||||
$args = Context::gets('interval','limit_count','check_trackback');
|
||||
if($args->check_trackback!='Y') $args->check_trackback = 'N';
|
||||
|
||||
// module Controller 객체 생성하여 입력
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('spamfilter',$args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 금지 IP등록
|
||||
**/
|
||||
function procSpamfilterAdminInsertDeniedIP() {
|
||||
$ipaddress = Context::get('ipaddress');
|
||||
return $this->insertIP($ipaddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 금지 IP삭제
|
||||
**/
|
||||
function procSpamfilterAdminDeleteDeniedIP() {
|
||||
$ipaddress = Context::get('ipaddress');
|
||||
return $this->deleteIP($ipaddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 금지 Word등록
|
||||
**/
|
||||
function procSpamfilterAdminInsertDeniedWord() {
|
||||
$word = Context::get('word');
|
||||
return $this->insertWord($word);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 금지 Word삭제
|
||||
**/
|
||||
function procSpamfilterAdminDeleteDeniedWord() {
|
||||
$word = Context::get('word');
|
||||
return $this->deleteWord($word);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief IP 등록
|
||||
* 등록된 IP는 스패머로 간주
|
||||
**/
|
||||
function insertIP($ipaddress) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
return executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief IP 제거
|
||||
* 스패머로 등록된 IP를 제거
|
||||
**/
|
||||
function deleteIP($ipaddress) {
|
||||
if(!$ipaddress) return;
|
||||
|
||||
$args->ipaddress = $ipaddress;
|
||||
return executeQuery('spamfilter.deleteDeniedIP', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 스팸단어 등록
|
||||
* 등록된 단어가 포함된 글은 스팸글로 간주
|
||||
**/
|
||||
function insertWord($word) {
|
||||
if(!$word) return;
|
||||
|
||||
$args->word = $word;
|
||||
return executeQuery('spamfilter.insertDeniedWord', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 스팸단어 제거
|
||||
* 스팸 단어로 등록된 단어 제거
|
||||
**/
|
||||
function deleteWord($word) {
|
||||
if(!$word) return;
|
||||
|
||||
$args->word = $word;
|
||||
return executeQuery('spamfilter.deleteDeniedWord', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 로그 등록
|
||||
* 현 접속 IP를 로그에 등록, 로그의 간격이 특정 시간 이내일 경우 도배로 간주하여
|
||||
* 스패머로 등록할 수 있음
|
||||
* @brief 로그 등록
|
||||
**/
|
||||
function insertLog() {
|
||||
$output = executeQuery('spamfilter.insertLog');
|
||||
return $output;
|
||||
return executeQuery('counter.insertCounterLog');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 현황 등록
|
||||
**/
|
||||
function insertStatus() {
|
||||
return executeQuery('counter.insertCounterStatus');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterModel
|
||||
* @class counterModel
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief spamfilter 모듈의 Model class
|
||||
* @brief counter 모듈의 Model class
|
||||
**/
|
||||
|
||||
class spamfilterModel extends spamfilter {
|
||||
class counterModel extends counter {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
|
|
@ -14,60 +14,21 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 스팸필터 모듈의 사용자 설정 값 return
|
||||
* @brief 로그 검사
|
||||
**/
|
||||
function getConfig() {
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$oModuleModel = &getModel('module');
|
||||
return $oModuleModel->getModuleConfig('spamfilter');
|
||||
function isLogged() {
|
||||
$output = executeQuery('counter.getCounterLog');
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 등록된 금지 IP의 목록을 return
|
||||
* @brief 특정 일의 접속 통계를 가져옴
|
||||
**/
|
||||
function getDeniedIPList() {
|
||||
$args->sort_index = "regdate";
|
||||
$args->page = Context::get('page')?Context::get('page'):1;
|
||||
$output = executeQuery('spamfilter.getDeniedIPList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
function getStatus($regdate) {
|
||||
$args->regdate = $regdate;
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 인자로 넘겨진 ipaddress가 금지 ip인지 체크하여 return
|
||||
**/
|
||||
function isDeniedIP($ipaddress) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
$output = executeQuery('spamfilter.isDeniedIP', $args);
|
||||
if($output->data->count>0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 등록된 금지 Word 의 목록을 return
|
||||
**/
|
||||
function getDeniedWordList() {
|
||||
$args->sort_index = "regdate";
|
||||
$output = executeQuery('spamfilter.getDeniedWordList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 지정된 IPaddress의 특정 시간대 내의 로그 수를 return
|
||||
**/
|
||||
function getLogCount($time = 60, $ipaddress='') {
|
||||
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$args->ipaddress = $ipaddress;
|
||||
$args->regdate = date("YmdHis", time()-$time);
|
||||
$output = executeQuery('spamfilter.getLogCount', $args);
|
||||
$count = $output->data->count;
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterView
|
||||
* @class counterView
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief spamfilter 모듈의 View class
|
||||
* @brief counter 모듈의 View class
|
||||
**/
|
||||
|
||||
class spamfilterView extends spamfilter {
|
||||
class counterView extends counter {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
|
|
@ -16,44 +16,10 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 스팸필터의 설정 화면
|
||||
* @brief 관리자 페이지 초기화면
|
||||
**/
|
||||
function dispSpamfilterAdminConfig() {
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('spamfilter');
|
||||
Context::set('config',$config);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
$this->setTemplateFile('index');
|
||||
function dispCounterAdminIndex() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 금지 목록 출력
|
||||
**/
|
||||
function dispSpamfilterAdminDeniedIPList() {
|
||||
// 등록된 금지 IP 목록을 가져옴
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$ip_list = $oSpamFilterModel->getDeniedIPList();
|
||||
|
||||
Context::set('ip_list', $ip_list);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
$this->setTemplateFile('denied_ip_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 금지 목록 출력
|
||||
**/
|
||||
function dispSpamfilterAdminDeniedWordList() {
|
||||
// 등록된 금지 Word 목록을 가져옴
|
||||
$oSpamFilterModel = &getModel('spamfilter');
|
||||
$word_list = $oSpamFilterModel->getDeniedWordList();
|
||||
|
||||
Context::set('word_list', $word_list);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
$this->setTemplateFile('denied_word_list');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<table name="counter_log">
|
||||
<column name="regdate" type="date" index="idx_counter_log" />
|
||||
<column name="ipaddress" type="varchar" size="250" notnull="notnull" index="idx_counter_log" />
|
||||
<column name="user_agent" type="user_agent" size="250" />
|
||||
<column name="user_agent" type="varchar" size="250" />
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue