From 3ed4516b8acfe5f0e2591c621c9f77c0dd2b397c Mon Sep 17 00:00:00 2001 From: zero Date: Wed, 18 Apr 2007 01:30:43 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1200 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/counter/conf/info.xml | 8 ++ modules/counter/conf/module.xml | 7 ++ modules/counter/lang/ko.lang.php | 8 ++ modules/counter/queries/deleteDeniedIP.xml | 8 ++ modules/counter/queries/deleteDeniedWord.xml | 8 ++ modules/counter/queries/getDeniedIPList.xml | 11 ++ modules/counter/queries/getDeniedWordList.xml | 11 ++ modules/counter/queries/getLogCount.xml | 12 ++ modules/counter/queries/insertDeniedIP.xml | 9 ++ modules/counter/queries/insertDeniedWord.xml | 9 ++ modules/counter/queries/insertLog.xml | 10 ++ modules/counter/queries/isDeniedIP.xml | 11 ++ .../counter/schemas/spamfilter_denied_ip.xml | 4 + .../schemas/spamfilter_denied_word.xml | 4 + modules/counter/schemas/spamfilter_log.xml | 5 + modules/counter/spamfilter.class.php | 43 +++++++ modules/counter/spamfilter.controller.php | 115 ++++++++++++++++++ modules/counter/spamfilter.model.php | 73 +++++++++++ modules/counter/spamfilter.view.php | 59 +++++++++ modules/counter/tpl/denied_ip_list.html | 49 ++++++++ modules/counter/tpl/denied_word_list.html | 50 ++++++++ .../counter/tpl/filter/delete_denied_ip.xml | 7 ++ .../counter/tpl/filter/delete_denied_word.xml | 7 ++ modules/counter/tpl/filter/insert_config.xml | 7 ++ .../counter/tpl/filter/insert_denied_ip.xml | 12 ++ .../counter/tpl/filter/insert_denied_word.xml | 12 ++ modules/counter/tpl/header.html | 7 ++ modules/counter/tpl/index.html | 35 ++++++ modules/counter/tpl/js/spamfilter_admin.js | 17 +++ 29 files changed, 618 insertions(+) create mode 100644 modules/counter/conf/info.xml create mode 100644 modules/counter/conf/module.xml create mode 100644 modules/counter/lang/ko.lang.php create mode 100644 modules/counter/queries/deleteDeniedIP.xml create mode 100644 modules/counter/queries/deleteDeniedWord.xml create mode 100644 modules/counter/queries/getDeniedIPList.xml create mode 100644 modules/counter/queries/getDeniedWordList.xml create mode 100644 modules/counter/queries/getLogCount.xml create mode 100644 modules/counter/queries/insertDeniedIP.xml create mode 100644 modules/counter/queries/insertDeniedWord.xml create mode 100644 modules/counter/queries/insertLog.xml create mode 100644 modules/counter/queries/isDeniedIP.xml create mode 100644 modules/counter/schemas/spamfilter_denied_ip.xml create mode 100644 modules/counter/schemas/spamfilter_denied_word.xml create mode 100644 modules/counter/schemas/spamfilter_log.xml create mode 100644 modules/counter/spamfilter.class.php create mode 100644 modules/counter/spamfilter.controller.php create mode 100644 modules/counter/spamfilter.model.php create mode 100644 modules/counter/spamfilter.view.php create mode 100644 modules/counter/tpl/denied_ip_list.html create mode 100644 modules/counter/tpl/denied_word_list.html create mode 100644 modules/counter/tpl/filter/delete_denied_ip.xml create mode 100644 modules/counter/tpl/filter/delete_denied_word.xml create mode 100644 modules/counter/tpl/filter/insert_config.xml create mode 100644 modules/counter/tpl/filter/insert_denied_ip.xml create mode 100644 modules/counter/tpl/filter/insert_denied_word.xml create mode 100644 modules/counter/tpl/header.html create mode 100644 modules/counter/tpl/index.html create mode 100644 modules/counter/tpl/js/spamfilter_admin.js diff --git a/modules/counter/conf/info.xml b/modules/counter/conf/info.xml new file mode 100644 index 000000000..15a7dc3b2 --- /dev/null +++ b/modules/counter/conf/info.xml @@ -0,0 +1,8 @@ + + + 기본 카운터 + + 제로 + 기본 접속 통계 프로그램입니다. + + diff --git a/modules/counter/conf/module.xml b/modules/counter/conf/module.xml new file mode 100644 index 000000000..019051af7 --- /dev/null +++ b/modules/counter/conf/module.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/modules/counter/lang/ko.lang.php b/modules/counter/lang/ko.lang.php new file mode 100644 index 000000000..8850064da --- /dev/null +++ b/modules/counter/lang/ko.lang.php @@ -0,0 +1,8 @@ + + * @brief 한국어 언어팩 (기본적인 내용만 수록) + **/ + +?> diff --git a/modules/counter/queries/deleteDeniedIP.xml b/modules/counter/queries/deleteDeniedIP.xml new file mode 100644 index 000000000..55171ca25 --- /dev/null +++ b/modules/counter/queries/deleteDeniedIP.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/modules/counter/queries/deleteDeniedWord.xml b/modules/counter/queries/deleteDeniedWord.xml new file mode 100644 index 000000000..b20002cf1 --- /dev/null +++ b/modules/counter/queries/deleteDeniedWord.xml @@ -0,0 +1,8 @@ + + +
+ + + + + diff --git a/modules/counter/queries/getDeniedIPList.xml b/modules/counter/queries/getDeniedIPList.xml new file mode 100644 index 000000000..30d9a3575 --- /dev/null +++ b/modules/counter/queries/getDeniedIPList.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/counter/queries/getDeniedWordList.xml b/modules/counter/queries/getDeniedWordList.xml new file mode 100644 index 000000000..b9afe4fb6 --- /dev/null +++ b/modules/counter/queries/getDeniedWordList.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/counter/queries/getLogCount.xml b/modules/counter/queries/getLogCount.xml new file mode 100644 index 000000000..ec1b4bfad --- /dev/null +++ b/modules/counter/queries/getLogCount.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/counter/queries/insertDeniedIP.xml b/modules/counter/queries/insertDeniedIP.xml new file mode 100644 index 000000000..6fcdf5a7a --- /dev/null +++ b/modules/counter/queries/insertDeniedIP.xml @@ -0,0 +1,9 @@ + + +
+ + + + + + diff --git a/modules/counter/queries/insertDeniedWord.xml b/modules/counter/queries/insertDeniedWord.xml new file mode 100644 index 000000000..0638bbff6 --- /dev/null +++ b/modules/counter/queries/insertDeniedWord.xml @@ -0,0 +1,9 @@ + + +
+ + + + + + diff --git a/modules/counter/queries/insertLog.xml b/modules/counter/queries/insertLog.xml new file mode 100644 index 000000000..e6a684fe1 --- /dev/null +++ b/modules/counter/queries/insertLog.xml @@ -0,0 +1,10 @@ + + +
+ + + + + + + diff --git a/modules/counter/queries/isDeniedIP.xml b/modules/counter/queries/isDeniedIP.xml new file mode 100644 index 000000000..272537e10 --- /dev/null +++ b/modules/counter/queries/isDeniedIP.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/counter/schemas/spamfilter_denied_ip.xml b/modules/counter/schemas/spamfilter_denied_ip.xml new file mode 100644 index 000000000..f19b3e87e --- /dev/null +++ b/modules/counter/schemas/spamfilter_denied_ip.xml @@ -0,0 +1,4 @@ +
+ + +
diff --git a/modules/counter/schemas/spamfilter_denied_word.xml b/modules/counter/schemas/spamfilter_denied_word.xml new file mode 100644 index 000000000..da9b8d9a3 --- /dev/null +++ b/modules/counter/schemas/spamfilter_denied_word.xml @@ -0,0 +1,4 @@ + + + +
diff --git a/modules/counter/schemas/spamfilter_log.xml b/modules/counter/schemas/spamfilter_log.xml new file mode 100644 index 000000000..4c4e7f18a --- /dev/null +++ b/modules/counter/schemas/spamfilter_log.xml @@ -0,0 +1,5 @@ + + + + +
diff --git a/modules/counter/spamfilter.class.php b/modules/counter/spamfilter.class.php new file mode 100644 index 000000000..480a7b64d --- /dev/null +++ b/modules/counter/spamfilter.class.php @@ -0,0 +1,43 @@ +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'); + + return new Object(); + } + + /** + * @brief 설치가 이상이 없는지 체크하는 method + **/ + function moduleIsInstalled() { + return new Object(); + } + + /** + * @brief 업데이트 실행 + **/ + function moduleUpdate() { + return new Object(); + } + + } +?> diff --git a/modules/counter/spamfilter.controller.php b/modules/counter/spamfilter.controller.php new file mode 100644 index 000000000..82345d792 --- /dev/null +++ b/modules/counter/spamfilter.controller.php @@ -0,0 +1,115 @@ +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를 로그에 등록, 로그의 간격이 특정 시간 이내일 경우 도배로 간주하여 + * 스패머로 등록할 수 있음 + **/ + function insertLog() { + $output = executeQuery('spamfilter.insertLog'); + return $output; + } + + } +?> diff --git a/modules/counter/spamfilter.model.php b/modules/counter/spamfilter.model.php new file mode 100644 index 000000000..97dd2a65f --- /dev/null +++ b/modules/counter/spamfilter.model.php @@ -0,0 +1,73 @@ +getModuleConfig('spamfilter'); + } + + /** + * @brief 등록된 금지 IP의 목록을 return + **/ + 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); + 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; + } + + + } +?> diff --git a/modules/counter/spamfilter.view.php b/modules/counter/spamfilter.view.php new file mode 100644 index 000000000..80bd34005 --- /dev/null +++ b/modules/counter/spamfilter.view.php @@ -0,0 +1,59 @@ +setTemplatePath($this->module_path.'tpl'); + } + + /** + * @brief 스팸필터의 설정 화면 + **/ + function dispSpamfilterAdminConfig() { + // 설정 정보를 받아옴 (module model 객체를 이용) + $oModuleModel = &getModel('module'); + $config = $oModuleModel->getModuleConfig('spamfilter'); + Context::set('config',$config); + + // 템플릿 파일 지정 + $this->setTemplateFile('index'); + } + + /** + * @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'); + } + } +?> diff --git a/modules/counter/tpl/denied_ip_list.html b/modules/counter/tpl/denied_ip_list.html new file mode 100644 index 000000000..f9e1c9193 --- /dev/null +++ b/modules/counter/tpl/denied_ip_list.html @@ -0,0 +1,49 @@ + + + + + + +
+ {$lang->total_count} : {count($ip_list)} +
+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + +
{$lang->no}{$lang->ipaddress}{$lang->regdate}{$lang->cmd_delete}
{count($ip_list)-$no}{$val->ipaddress}{zdate($val->regdate,"Y-m-d")}{$lang->cmd_delete}
+
+ + +
+
+
+ {$lang->denied_ip} + + +
+
+ {$lang->about_denied_ip} +
+
+
+ diff --git a/modules/counter/tpl/denied_word_list.html b/modules/counter/tpl/denied_word_list.html new file mode 100644 index 000000000..6b1258e5c --- /dev/null +++ b/modules/counter/tpl/denied_word_list.html @@ -0,0 +1,50 @@ + + + + + + +
+ {$lang->total_count} : {count($word_list)} +
+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + +
{$lang->no}{$lang->word}{$lang->regdate}{$lang->cmd_delete}
{count($word_list)-$no}{$val->word}{zdate($val->regdate,"Y-m-d")}{$lang->cmd_delete}
+
+ + +
+
+
+ {$lang->word} + + +
+
+ {$lang->about_denied_word} +
+
+
+ + diff --git a/modules/counter/tpl/filter/delete_denied_ip.xml b/modules/counter/tpl/filter/delete_denied_ip.xml new file mode 100644 index 000000000..199e2ae87 --- /dev/null +++ b/modules/counter/tpl/filter/delete_denied_ip.xml @@ -0,0 +1,7 @@ + +
+ + + + + diff --git a/modules/counter/tpl/filter/delete_denied_word.xml b/modules/counter/tpl/filter/delete_denied_word.xml new file mode 100644 index 000000000..6502e5fa8 --- /dev/null +++ b/modules/counter/tpl/filter/delete_denied_word.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/modules/counter/tpl/filter/insert_config.xml b/modules/counter/tpl/filter/insert_config.xml new file mode 100644 index 000000000..628f08995 --- /dev/null +++ b/modules/counter/tpl/filter/insert_config.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/modules/counter/tpl/filter/insert_denied_ip.xml b/modules/counter/tpl/filter/insert_denied_ip.xml new file mode 100644 index 000000000..96470c0d4 --- /dev/null +++ b/modules/counter/tpl/filter/insert_denied_ip.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + +
diff --git a/modules/counter/tpl/filter/insert_denied_word.xml b/modules/counter/tpl/filter/insert_denied_word.xml new file mode 100644 index 000000000..b6067f9c8 --- /dev/null +++ b/modules/counter/tpl/filter/insert_denied_word.xml @@ -0,0 +1,12 @@ + +
+ + + + + + + + + +
diff --git a/modules/counter/tpl/header.html b/modules/counter/tpl/header.html new file mode 100644 index 000000000..c8982c6f7 --- /dev/null +++ b/modules/counter/tpl/header.html @@ -0,0 +1,7 @@ + + +
+ style="font-weight:bold">[{$lang->cmd_module_config}] + style="font-weight:bold">[{$lang->cmd_denied_ip}] + style="font-weight:bold">[{$lang->cmd_denied_word}] +
diff --git a/modules/counter/tpl/index.html b/modules/counter/tpl/index.html new file mode 100644 index 000000000..b39411807 --- /dev/null +++ b/modules/counter/tpl/index.html @@ -0,0 +1,35 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->interval} {$lang->unit_sec}
{$lang->about_interval}
{$lang->limit_count}
{$lang->about_limit_count}
{$lang->check_trackback}check_trackback=='Y')-->checked="true" />
{$lang->about_check_trackback}
+ + +
+
diff --git a/modules/counter/tpl/js/spamfilter_admin.js b/modules/counter/tpl/js/spamfilter_admin.js new file mode 100644 index 000000000..46d48d8b5 --- /dev/null +++ b/modules/counter/tpl/js/spamfilter_admin.js @@ -0,0 +1,17 @@ +/** + * @brief 금지 IP 삭제 + **/ +function doDeleteDeniedIP(ipaddress) { + var fo_obj = xGetElementById('fo_denied_ip'); + fo_obj.ipaddress.value = ipaddress; + procFilter(fo_obj, delete_denied_ip); +} + +/** + * @brief 금지 단어 삭제 + **/ +function doDeleteDeniedWord(word) { + var fo_obj = xGetElementById('fo_denied_word'); + fo_obj.word.value = word; + procFilter(fo_obj, delete_denied_word); +}