From 0fddaf252fb712ec40f9dbc1564e5d07074f77a9 Mon Sep 17 00:00:00 2001 From: zero Date: Thu, 17 Jul 2008 03:30:49 +0000 Subject: [PATCH] =?UTF-8?q?tool=20=EA=B8=B0=EB=8A=A5=EC=9D=84=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0=ED=95=98=EC=97=AC=20=EC=A0=84=EC=B2=B4=20tool?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD(=EC=A3=BC=EC=86=8C/tools=20?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=91=EC=86=8D=ED=95=98=EC=97=AC=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D).=20=EB=B9=88=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4378 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .htaccess | 6 +- tools/blank_cleaner/blank_cleaner.php | 16 +++ tools/blank_cleaner/lang/ko.lang.php | 3 + tools/cache_cleaner/cache_cleaner.php | 17 +++ tools/cache_cleaner/form.html | 32 ------ tools/cache_cleaner/index.php | 58 ----------- tools/cache_cleaner/style.css | 10 -- tools/validator/index.php | 135 ------------------------ tools/validator/lang/ko.lang.php | 1 + tools/validator/style.css | 15 +-- tools/validator/validator.html | 143 ++++++++++---------------- tools/validator/validator.php | 100 ++++++++++++++++++ 12 files changed, 196 insertions(+), 340 deletions(-) create mode 100644 tools/blank_cleaner/blank_cleaner.php create mode 100644 tools/blank_cleaner/lang/ko.lang.php create mode 100644 tools/cache_cleaner/cache_cleaner.php delete mode 100644 tools/cache_cleaner/form.html delete mode 100644 tools/cache_cleaner/index.php delete mode 100644 tools/cache_cleaner/style.css delete mode 100644 tools/validator/index.php create mode 100644 tools/validator/validator.php diff --git a/.htaccess b/.htaccess index 89fcec0fc..a17e471ff 100644 --- a/.htaccess +++ b/.htaccess @@ -12,7 +12,11 @@ RewriteRule ^(.+)/common/tpl/(.*) ./common/tpl/$2 [L] RewriteRule ^(.+)/widgets/(.*) ./widgets/$2 [L] RewriteRule ^(.+)/layouts/(.*) ./layouts/$2 [L] RewriteRule ^(.+)/addons/(.*) ./addons/$2 [L] -RewriteRule ^(.+)/tools/(.*) ./tools/$2 [L] + +# tools +RewriteRule ^tools/([a-zA-Z0-9_]+)$ ./tools/$1 [L] +RewriteRule ^tools/$ ./tools/index.php [L] +RewriteRule ^tools$ ./tools/index.php [L] # page RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)page$ ./index.php?mid=$1&page=$2 [L] diff --git a/tools/blank_cleaner/blank_cleaner.php b/tools/blank_cleaner/blank_cleaner.php new file mode 100644 index 000000000..8b39a6034 --- /dev/null +++ b/tools/blank_cleaner/blank_cleaner.php @@ -0,0 +1,16 @@ + + * @brief 첨부파일 디렉토리의 빈 디렉토리 삭제 + **/ + + // 인증이 되지 않은 접근이면 종료 + if(!defined('__XE_TOOL_AUTH__') || !__XE_TOOL_AUTH__) exit(); + + // 캐시 파일 제거 + FileHandler::removeBlankDir(_XE_PATH_.'files'); + $output = Context::getLang('success_deleted'); + + Context::set('output', $output); +?> diff --git a/tools/blank_cleaner/lang/ko.lang.php b/tools/blank_cleaner/lang/ko.lang.php new file mode 100644 index 000000000..ba0cdd512 --- /dev/null +++ b/tools/blank_cleaner/lang/ko.lang.php @@ -0,0 +1,3 @@ +blank_cleaner = '빈디렉토리 삭제'; +?> diff --git a/tools/cache_cleaner/cache_cleaner.php b/tools/cache_cleaner/cache_cleaner.php new file mode 100644 index 000000000..e6fba631a --- /dev/null +++ b/tools/cache_cleaner/cache_cleaner.php @@ -0,0 +1,17 @@ + + * @brief XE 캐시파일 및 불필요한 파일 정리 + **/ + + // 인증이 되지 않은 접근이면 종료 + if(!defined('__XE_TOOL_AUTH__') || !__XE_TOOL_AUTH__) exit(); + + // 캐시 파일 제거 + $oAdminController = &getAdminController('admin'); + $oAdminController->procAdminRecompileCacheFile(); + $output = Context::getLang('success_reset'); + + Context::set('output', $output); +?> diff --git a/tools/cache_cleaner/form.html b/tools/cache_cleaner/form.html deleted file mode 100644 index 5a4ff3a1b..000000000 --- a/tools/cache_cleaner/form.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - XE Cache Cleaner - - - - -

XE Cache Cleaner

-
- - -
{$msg}
- - -
- - - - - - - - - - - -
- - diff --git a/tools/cache_cleaner/index.php b/tools/cache_cleaner/index.php deleted file mode 100644 index fcad6ea92..000000000 --- a/tools/cache_cleaner/index.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @brief XE 캐시파일 및 불필요한 파일 정리 - **/ - - /** - * @brief 기본적인 상수 선언, 웹에서 직접 호출되는 것을 막기 위해 체크하는 상수 선언 - **/ - define('__ZBXE__', true); - - /** - * @brief 필요한 설정 파일들을 include - **/ - require_once('../../config/config.inc.php'); - - // id/ password 구함 - $id = $_POST['id']; - $pw = $_POST['pw']; - - // 저장되어 있는 비밀번호와 비교 - $oContext = &Context::getInstance(); - $oContext->init(); - $db_info = $oContext->getDBInfo(); - - // install 모듈의 언어파일을 로드 - Context::loadLang(_XE_PATH_.'modules/install/lang'); - - // 설치가 되어 있지 않을 경우 - if(!Context::isInstalled()) { - - $msg = Context::getLang('msg_db_not_setted'); - - // 인증 정보가 없을 경우 - } elseif(!isset($id) || !isset($pw)) { - - - // 입력된 정보와 저장된 정보 비교 - } else if($id !== $db_info->db_userid || $pw !== $db_info->db_password) { - - if($id !== $db_info->db_userid) $msg = sprintf($lang->filter->equalto, Context::getLang('user_id')); - else $msg = sprintf($lang->filter->equalto, Context::getLang('password')); - - // 캐시 파일 제거 - } else if($id === $db_info->db_userid && $pw === $db_info->db_password) { - - $oAdminController = &getAdminController('admin'); - $oAdminController->procAdminRecompileCacheFile(); - $msg = Context::getLang('success_reset'); - - } - - Context::set('msg', $msg); - - $oTemplate = &TemplateHandler::getInstance(); - print $oTemplate->compile('./tools/cache_cleaner/','form'); -?> diff --git a/tools/cache_cleaner/style.css b/tools/cache_cleaner/style.css deleted file mode 100644 index 228b7fd70..000000000 --- a/tools/cache_cleaner/style.css +++ /dev/null @@ -1,10 +0,0 @@ -h1 { font-size:1.5em; font-family:tahoma; margin:0; padding:0; } -hr { border:none; border-top:1px solid #555555; border-bottom:1px solid #888888; margin:0; margin-bottom:10px; padding:0; } -blockquote { border:1px solid red; color:red; width:280px; margin:0 0 10px 0; padding:10px;} - -code { display:block; clear:both; margin-bottom:10px;} -code label { float:left; display:block; width:150px; } -code input { display:block; width:150px; border:1px solid #AAAAAA; } - -input.submit { width:300px; border:1px solid #AAAAAA;} - diff --git a/tools/validator/index.php b/tools/validator/index.php deleted file mode 100644 index 1d8081950..000000000 --- a/tools/validator/index.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @brief 현재 설치된 버전에 해당하는 XE 파일 비교 - **/ - - /** - * @brief 기본적인 상수 선언, 웹에서 직접 호출되는 것을 막기 위해 체크하는 상수 선언 - **/ - define('__ZBXE__', true); - - /** - * @brief 필요한 설정 파일들을 include - **/ - require_once('../../config/config.inc.php'); - - // id/ password 구함 - $id = $_POST['id']; - $pw = $_POST['pw']; - - // 저장되어 있는 비밀번호와 비교 - $oContext = &Context::getInstance(); - $oContext->init(); - $db_info = $oContext->getDBInfo(); - - // install 모듈의 언어파일을 로드 - Context::loadLang(_XE_PATH_.'modules/install/lang'); - Context::loadLang(_XE_PATH_.'modules/admin/lang'); - Context::loadLang(_XE_PATH_.'tools/validator/lang'); - - // 설치가 되어 있지 않을 경우 - if(!Context::isInstalled()) { - - $msg = Context::getLang('msg_db_not_setted'); - - // 인증 정보가 없을 경우 - } elseif(!isset($id) || !isset($pw)) { - - - // 입력된 정보와 저장된 정보 비교 - } else if($id !== $db_info->db_userid || $pw !== $db_info->db_password) { - - if($id !== $db_info->db_userid) $msg = sprintf($lang->filter->equalto, Context::getLang('user_id')); - else $msg = sprintf($lang->filter->equalto, Context::getLang('password')); - - // 출력 - } else if($id === $db_info->db_userid && $pw === $db_info->db_password) { - - // 현재 버전을 구함 - $ver = __ZBXE_VERSION__; - - // 현재 버전에 맞는 배포 정보를 구함 - $header = "GET /validatorLogs/{$ver}.log HTTP/1.0\r\nHost: news.zeroboard.com\r\n\r\n"; - $is_started = false; - $f = fsockopen('news.zeroboard.com', 80); - fputs($f, $header); - while($buff = fgets($f, 1024)) { - if(!trim($buff)) $is_started = true; - if($is_started && trim($buff)) { - $buff = trim($buff); - $pos = strpos($buff,','); - $size = (int)substr($buff,0,$pos); - $filename = substr($buff,$pos+1); - if($filename && $size) $source[$filename] = $size; - } - } - fclose($f); - - if(!count($source)) $msg = Context::getLang('msg_cannot_get_source_files'); - else { - - // 현재 설치된 디렉토리와 비교 - $avoid_path = array(_XE_PATH_.'files'); - getFiles(_XE_PATH_, _XE_PATH_, $avoid_path, $target); - if(!count($target)) $msg = Context::getLang('msg_cannot_get_target_files'); - else { - // 파일 수를 지정 - Context::set('source_cnt', count($source)); - Context::set('target_cnt', count($target)); - - // 최신 버전 정보 구함 - $oAdminView = &getAdminView('admin'); - $oAdminView->dispAdminIndex(); - - // 누락된 파일 구함 - $leaveouts = array(); - foreach($source as $key => $val) { - if(!isset($target[$key])) $leaveouts[] = $key; - } - Context::set('leaveouts', $leaveouts); - - // 수정된 파일 구함 - $modified = array(); - foreach($source as $key => $val) { - if(isset($target[$key]) && $val!=$target[$key]) $modified[] = $key; - } - Context::set('modified', $modified); - - // 추가된 파일 구함 - $added = array(); - foreach($target as $key => $val) { - if(!isset($source[$key])) $added[] = $key; - } - Context::set('added', $added); - } - } - } - - Context::set('msg', $msg); - - $oTemplate = &TemplateHandler::getInstance(); - print $oTemplate->compile('./tools/validator/','validator'); - - // recursive하게 돌면서 파일 정보 수집 - function getFiles($path, $base_path, $avoid_path, &$buff) { - if(substr($path,-1)=='/') $path = substr($path,0,-1); - if(substr($base_path,-1)=='/') $base_path = substr($base_path,0,-1); - if(in_array($path, $avoid_path)) return; - - $oDir = dir($path); - while($item = $oDir->read()) { - if(substr($item,0,1)=='.' && $item != '.htaccess' ) continue; - $new_path = $path.'/'.$item; - if(!is_dir($new_path)) { - $filesize = filesize($new_path); - $filename = substr($new_path, strlen($base_path)+1); - $buff[$filename] = $filesize; - } else { - getFiles($new_path, $base_path, $avoid_path, $buff); - } - } - $oDir->close(); - } -?> diff --git a/tools/validator/lang/ko.lang.php b/tools/validator/lang/ko.lang.php index 9abd02b6f..68d57576f 100644 --- a/tools/validator/lang/ko.lang.php +++ b/tools/validator/lang/ko.lang.php @@ -1,4 +1,5 @@ validator = '설치파일 검증'; $lang->msg_cannot_get_source_files = '원본 파일을 다운로드 하지 못했습니다'; $lang->msg_cannot_get_target_files = '설치된 대상 파일의 목록을 구하지 못했습니다'; diff --git a/tools/validator/style.css b/tools/validator/style.css index 68e48c237..1c6cfc00a 100644 --- a/tools/validator/style.css +++ b/tools/validator/style.css @@ -1,18 +1,5 @@ -h1 { font-size:1.5em; font-family:tahoma; margin:0; padding:0; } -hr { border:none; border-top:1px solid #555555; border-bottom:1px solid #888888; margin:0; margin-bottom:10px; padding:0; } -blockquote { border:1px solid red; color:red; width:280px; margin:0 0 10px 0; padding:10px;} - -code { display:block; clear:both; margin-bottom:10px;} -code label { float:left; display:block; width:150px; } -code input { display:block; width:150px; border:1px solid #AAAAAA; } - -input.submit { width:300px; border:1px solid #AAAAAA;} - -div.back { font-size:9pt; text-align:right; margin-bottom:10px; } -div.back a { text-decoration:none; color:#888888; } - table { width:100%; border:none; font-size:9pt; background-color:#CCCCCC; } table thead th { background-color:#EFEFEF; padding:3px 0 3px 0; } table tbody th { background-color:#F3F3F3; vertical-align:top; color:#888888; padding:3px 0 3px 0; } -table tbody td { background-color:#FFFFFF; font-family:verdana; padding:3px; } +table tbody td { font-weight:normal; background-color:#FFFFFF; font-family:verdana; padding:3px; } diff --git a/tools/validator/validator.html b/tools/validator/validator.html index 05c6877d8..2bc97beb2 100644 --- a/tools/validator/validator.html +++ b/tools/validator/validator.html @@ -1,92 +1,55 @@ - - - - - - XE Cache Cleaner - - - - -

XE File Validator

-
- - -
{$msg}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 {$lang->source_files}{$lang->target_files}
{$lang->current_version}{__ZBXE_VERSION__}
{$lang->released_version}{$released_version}
{$lang->current_path}{_XE_PATH_}
{$lang->files_count}{$source_cnt}{$target_cnt}
{$lang->leaveout_files} ({count($leaveouts)}) + + {$val}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 {$lang->source_files}{$lang->target_files}
{$lang->current_version}{__ZBXE_VERSION__}
{$lang->released_version}{$released_version}
{$lang->current_path}{_XE_PATH_}
{$lang->files_count}{$source_cnt}{$target_cnt}
{$lang->leaveout_files} ({count($leaveouts)}) - - {$val}
- -
{$lang->modified_files} ({count($modified)})  - - {$val}
- -
{$lang->additional_files} ({count($added)})  - - {$val}
- -
- -
- - - - - - - - - - - -
+
{$lang->modified_files} ({count($modified)})  + + {$val}
- - +
{$lang->additional_files} ({count($added)})  + + {$val}
+ +
diff --git a/tools/validator/validator.php b/tools/validator/validator.php new file mode 100644 index 000000000..64463b10c --- /dev/null +++ b/tools/validator/validator.php @@ -0,0 +1,100 @@ + + * @brief 현재 설치된 버전에 해당하는 XE 파일 비교 + **/ + + // 인증이 되지 않은 접근이면 종료 + if(!defined('__XE_TOOL_AUTH__') || !__XE_TOOL_AUTH__) exit(); + + // 언어파일을 로드 + Context::loadLang(_XE_PATH_.'modules/admin/lang'); + + // 현재 버전을 구함 + $ver = __ZBXE_VERSION__; + + // 현재 버전에 맞는 배포 정보를 구함 + $header = "GET /validatorLogs/{$ver}.log HTTP/1.0\r\nHost: news.zeroboard.com\r\n\r\n"; + $is_started = false; + $f = fsockopen('news.zeroboard.com', 80); + fputs($f, $header); + while($buff = fgets($f, 1024)) { + if(!trim($buff)) $is_started = true; + if($is_started && trim($buff)) { + $buff = trim($buff); + $pos = strpos($buff,','); + $size = (int)substr($buff,0,$pos); + $filename = substr($buff,$pos+1); + if($filename && $size) $source[$filename] = $size; + } + } + fclose($f); + + if(!count($source)) $output = Context::getLang('msg_cannot_get_source_files'); + else { + // 현재 설치된 디렉토리와 비교 + $avoid_path = array(_XE_PATH_.'files'); + getFiles(_XE_PATH_, _XE_PATH_, $avoid_path, $target); + if(!count($target)) $output = Context::getLang('msg_cannot_get_target_files'); + else { + // 파일 수를 지정 + Context::set('source_cnt', count($source)); + Context::set('target_cnt', count($target)); + + // 최신 버전 정보 구함 + $oAdminView = &getAdminView('admin'); + $oAdminView->dispAdminIndex(); + + // 누락된 파일 구함 + $leaveouts = array(); + foreach($source as $key => $val) { + if(!isset($target[$key])) $leaveouts[] = $key; + } + Context::set('leaveouts', $leaveouts); + + // 수정된 파일 구함 + $modified = array(); + foreach($source as $key => $val) { + if(isset($target[$key]) && $val!=$target[$key]) $modified[] = $key; + } + Context::set('modified', $modified); + + // 추가된 파일 구함 + $added = array(); + foreach($target as $key => $val) { + if(!isset($source[$key])) $added[] = $key; + } + Context::set('added', $added); + + // CSS 지정 + Context::addCssFile('./validator/style.css', false); + + // 결과물을 구함 + $oTemplate = &TemplateHandler::getInstance(); + $output = $oTemplate->compile('./tools/validator/','validator'); + } + } + Context::set('output', $output); + + // recursive하게 돌면서 파일 정보 수집 + function getFiles($path, $base_path, $avoid_path, &$buff) { + if(substr($path,-1)=='/') $path = substr($path,0,-1); + if(substr($base_path,-1)=='/') $base_path = substr($base_path,0,-1); + if(in_array($path, $avoid_path)) return; + + $oDir = dir($path); + while($item = $oDir->read()) { + if(substr($item,0,1)=='.' && $item != '.htaccess' ) continue; + $new_path = $path.'/'.$item; + if(!is_dir($new_path)) { + $filesize = filesize($new_path); + $filename = substr($new_path, strlen($base_path)+1); + $buff[$filename] = $filesize; + } else { + getFiles($new_path, $base_path, $avoid_path, $buff); + } + } + $oDir->close(); + } +?>