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>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
<action name="dispInstallCheckEnv" type="view" standalone="true" />
|
||||
<action name="dispInstallSelectDB" type="view" standalone="true" />
|
||||
<action name="dispInstallForm" type="view" standalone="true" />
|
||||
|
||||
<action name="procInstall" type="controller" standalone="true" />
|
||||
<action name="procInstallAdminInstall" type="controller" standalone="true" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
**/
|
||||
function init() {
|
||||
// 설치가 되어 있으면 오류
|
||||
if(Context::isInstalled()) return $this->dispMessage('msg_already_installed');
|
||||
if($this->act != 'procInstallAdminInstall' && Context::isInstalled()) return $this->dispMessage('msg_already_installed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,6 +49,18 @@
|
|||
$this->setMessage('msg_install_completed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모듈 설치
|
||||
**/
|
||||
function procInstallAdminInstall() {
|
||||
$module_name = Context::get('module_name');
|
||||
if(!$module_name) return new object(-1, 'invalid_request');
|
||||
|
||||
$this->installModule($module_name, './modules/'.$module_name);
|
||||
|
||||
$this->setMessage('success_installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 인스톨 환경을 체크하여 결과 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@
|
|||
|
||||
$lang->about_database_file = 'Sqlite는 파일에 데이터를 저장합니다. 데이터베이스 파일의 위치를 웹에서 접근할 수 없는 곳으로 하셔야 합니다';
|
||||
|
||||
$lang->success_installed = '설치가 되었습니다';
|
||||
$lang->success_updated = '업데이트가 되었습니다';
|
||||
|
||||
$lang->msg_cannot_proc = '설치 환경이 갖춰지지 않아 요청을 실행할 수가 없습니다';
|
||||
$lang->msg_already_installed = '이미 설치가 되어 있습니다';
|
||||
$lang->msg_dbconnect_failed = "DB접속 오류가 발생하였습니다.\nDB정보를 다시 확인해주세요";
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
$lang->module_category = "모듈 카테고리";
|
||||
$lang->module_info = "모듈 정보";
|
||||
$lang->add_shortcut = "관리자 메뉴에 추가";
|
||||
$lang->module_action = "동작";
|
||||
|
||||
$lang->module_maker = "모듈 제작자";
|
||||
$lang->module_history = "변경 사항 ";
|
||||
|
|
@ -17,6 +18,8 @@
|
|||
$lang->category_title = "카테고리 이름";
|
||||
|
||||
$lang->cmd_add_shortcut = "바로가기 추가";
|
||||
$lang->cmd_install = "설치";
|
||||
$lang->cmd_update = "업데이트";
|
||||
|
||||
$lang->msg_new_module = "모듈 생성";
|
||||
$lang->msg_update_module = "모듈 수정";
|
||||
|
|
|
|||
|
|
@ -491,6 +491,9 @@
|
|||
$info->path = $path;
|
||||
$info->admin_index_act = $info->admin_index_act;
|
||||
|
||||
if($table_count > $created_table_count) $info->is_installed = false;
|
||||
else $info->is_installed = true;
|
||||
|
||||
$list[] = $info;
|
||||
}
|
||||
return $list;
|
||||
|
|
|
|||
|
|
@ -32,3 +32,15 @@ function doAddShortCut(module) {
|
|||
fo_obj.selected_module.value = module;
|
||||
procFilter(fo_obj, insert_shortcut);
|
||||
}
|
||||
|
||||
/* 모듈 설치 */
|
||||
function doInstallModule(module) {
|
||||
var params = new Array();
|
||||
params['module_name'] = module;
|
||||
exec_xml('install','procInstallAdminInstall',params, completeInstallModule);
|
||||
}
|
||||
|
||||
function completeInstallModule(ret_obj) {
|
||||
alert(ret_obj['message']);
|
||||
location.href = location.href;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@
|
|||
<td>{$lang->table_count}</td>
|
||||
<td>{$lang->installed_path}</td>
|
||||
<td>{$lang->module_info}</td>
|
||||
<td>{$lang->module_action}</td>
|
||||
<td>{$lang->add_shortcut}</td>
|
||||
</tr>
|
||||
<!--@foreach($module_list as $key => $val)-->
|
||||
<tr>
|
||||
<td rowspan="2">
|
||||
<td>
|
||||
<!--@if($val->admin_index_act)-->
|
||||
<a href="#" onclick="location.href='{getUrl('act',$val->admin_index_act)}'">{$val->title}</a> <br /> ({$val->module})
|
||||
<a href="#" onclick="location.href='{getUrl('act',$val->admin_index_act)}'">{$val->title}</a> ({$val->module})
|
||||
<!--@else-->
|
||||
{$val->title} <br />
|
||||
({$val->module})
|
||||
{$val->title} ({$val->module})
|
||||
<!--@end-->
|
||||
</td>
|
||||
<td>{$val->version}</td>
|
||||
|
|
@ -42,16 +42,18 @@
|
|||
</td>
|
||||
<td>{$val->path}</td>
|
||||
<td><a href="#" onclick="popopen('{getUrl('','module','module','act','dispModuleAdminInfo','selected_module',$val->module)}','module_info');return false">{$lang->cmd_view}</a></td>
|
||||
<td rowspan="2">
|
||||
<td>
|
||||
<!--@if(!$val->is_installed)-->
|
||||
<a href="#" onclick="doInstallModule('{$val->module}');return false;">{$lang->cmd_install}</a>
|
||||
<!--@elseif($val->need_update)-->
|
||||
<a href="#">{$lang->cmd_update}</a>
|
||||
<!--@end-->
|
||||
</td>
|
||||
<td>
|
||||
<!--@if(!$shortcut_list[$val->module] && $val->admin_index_act )-->
|
||||
<a href="#" onclick="doAddShortCut('{$val->module}');return false;">{$lang->cmd_add_shortcut}</a>
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
{nl2br($val->author->description)}
|
||||
</td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue