english comments added

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-04-06 16:48:06 +00:00
parent 693e215bc1
commit 4d272994dd
219 changed files with 6407 additions and 8705 deletions

View file

@ -2,38 +2,35 @@
/**
* @class opageAdminController
* @author NHN (developers@xpressengine.com)
* @brief opage 모듈의 admin controller class
* @brief admin controller class of the opage module
**/
class opageAdminController extends opage {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 외부페이지 추가
* @brief Add an external page
**/
function procOpageAdminInsert() {
// module 모듈의 model/controller 객체 생성
// Create model/controller object of the module module
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
// 게시판 모듈의 정보 설정
// Set board module
$args = Context::getRequestVars();
$args->module = 'opage';
$args->mid = $args->opage_name;
unset($args->opage_name);
// module_srl이 넘어오면 원 모듈이 있는지 확인
// Check if an original module exists by using module_srl
if($args->module_srl) {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
}
// module_srl의 값에 따라 insert/update
// Insert/update depending on module_srl
if(!$args->module_srl) {
$args->module_srl = getNextSequence();
$output = $oModuleController->insertModule($args);
@ -41,27 +38,24 @@
} else {
$output = $oModuleController->updateModule($args);
$msg_code = 'success_updated';
// 캐시 파일 삭제
// Delete cache files
$cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl);
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
}
if(!$output->toBool()) return $output;
// 등록 성공후 return될 메세지 정리
// Messages to output when successfully registered
$this->add("module_srl", $output->get('module_srl'));
$this->add("opage", Context::get('opage'));
$this->setMessage($msg_code);
}
/**
* @brief 외부페이지 삭제
* @brief Delete an external page
**/
function procOpageAdminDelete() {
$module_srl = Context::get('module_srl');
// 원본을 구해온다
// Get an original
$oModuleController = &getController('module');
$output = $oModuleController->deleteModule($module_srl);
if(!$output->toBool()) return $output;
@ -72,10 +66,10 @@
}
/**
* @brief 외부페이지 기본 정보의 추가
* @brief Add information of an external page
**/
function procOpageAdminInsertConfig() {
// 기본 정보를 받음
// Get the basic info
$args = Context::gets('test');
}

View file

@ -2,7 +2,7 @@
/**
* @class opageAdminView
* @author NHN (developers@xpressengine.com)
* @brief opage 모듈의 admin view 클래스
* @brief admin view clas of the opage module
**/
class opageAdminView extends opage {
@ -12,25 +12,22 @@
var $page_count = 10;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
// Pre-check if module_srl exists. Set module_info if exists
$module_srl = Context::get('module_srl');
// module model 객체 생성
// Create module model object
$oModuleModel = &getModel('module');
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
// 템플릿 경로 구함 (opage의 경우 tpl에 관리자용 템플릿 모아놓음)
// Get a template path (admin templates are collected on the tpl for opage)
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 외부페이지 관리 목록 보여줌
* @brief Display a list of external pages
**/
function dispOpageAdminContent() {
$args->sort_index = "module_srl";
@ -39,35 +36,30 @@
$args->page_count = 10;
$args->s_module_category_srl = Context::get('module_category_srl');
$output = executeQuery('opage.getOpageList', $args);
// 템플릿에 쓰기 위해서 context::set
// context setting to use a template
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('opage_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('index');
}
/**
* @brief 외부페이지 추가 출력
* @brief Form to add an external page
**/
function dispOpageAdminInsert() {
// 권한 그룹의 목록을 가져온다
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// module.xml에서 권한 관련 목록을 구해옴
// Get a list of permissions from the module.xml
$grant_list = $this->xml_info->grant;
Context::set('grant_list', $grant_list);
// GET parameter에서 module_srl을 가져옴
// Get module_srl
$module_srl = Context::get('module_srl');
// module_srl이 있으면 해당 모듈의 정보를 구해서 세팅
// Get and set module information if module_srl exists
if($module_srl) {
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
@ -77,22 +69,20 @@
unset($module_srl);
}
}
// 레이아웃 목록을 구해옴
// Get a layout list
$oLayoutModel = &getModel('layout');
$layout_list = $oLayoutModel->getLayoutList();
Context::set('layout_list', $layout_list);
$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
Context::set('mlayout_list', $mobile_layout_list);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('opage_insert');
}
/**
* @brief 외부페이지 삭제 화면 출력
* @brief Screen to delete an external page
**/
function dispOpageAdminDelete() {
$module_srl = Context::get('module_srl');
@ -101,21 +91,18 @@
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
Context::set('module_info',$module_info);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('opage_delete');
}
/**
* @brief 권한 목록 출력
* @brief Display a list of permissions
**/
function dispOpageAdminGrantInfo() {
// GET parameter에서 module_srl을 가져옴
// Get module_srl
$module_srl = Context::get('module_srl');
// module_srl이 있으면 해당 모듈의 정보를 구해서 세팅
// Get and set module information if module_srl exists
if($module_srl) {
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
@ -127,8 +114,7 @@
}
$this->module_info = $module_info;
// 공통 모듈 권한 설정 페이지 호출
// Call a page to set permission for common module
$oModuleAdminModel = &getAdminModel('module');
$grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
Context::set('grant_content', $grant_content);

View file

@ -2,43 +2,43 @@
/**
* @class opage
* @author NHN (developers@xpressengine.com)
* @brief opage 모듈의 high class
* @brief high class of opage module
**/
class opage extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// opage 에서 사용할 cache디렉토리 생성
// Create cache directory to use in the opage
FileHandler::makeDir('./files/cache/opage');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
// cache 디렉토리가 없으면 바로 디렉토리 생성
// Create a directory ditectly if no cache directory exists
if(!is_dir('./files/cache/opage')) FileHandler::makeDir('./files/cache/opage');
return false;
}
/**
* @brief 업데이트 실행
* @brief Update
**/
function moduleUpdate() {
return new Object(0, 'success_updated');
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 외부 페이지 캐시 파일 삭제
// Remove cache file for external pages
FileHandler::removeFilesInDir("./files/cache/opage");
}
}

View file

@ -2,7 +2,7 @@
/**
* @class documentController
* @author NHN (developers@xpressengine.com)
* @brief document 모듈의 controller 클래스
* @brief controller class of the document module
**/
class opageController extends opage {
@ -10,12 +10,12 @@
var $target_path = '';
/**
* @brief 초기화
* @brief Initialization
**/
function init() { }
/**
* @brief 타이틀 추출
* @brief Extract a title
**/
function getTitle($content) {
preg_match('!<title([^>]*)>(.*?)<\/title>!is', $content, $buff);
@ -23,16 +23,14 @@
}
/**
* @brief header script 추출
* @brief Extract header script
**/
function getHeadScript($content) {
// title 태그 제거
// remove the title tag
$content = preg_replace('!<title([^>]*)>(.*?)<\/title>!is','', $content);
// meta 태그 제거
// Remove meta tags
$content = preg_replace('!<(\/){0,1}meta([^>]*)>!is','', $content);
// <link, <style, <script 등의 정보를 추출
// Extract information such as <link, <style, <script and so on
preg_match_all('!<link([^>]*)>!is', $content, $link_buff);
for($i=0;$i<count($link_buff[0]);$i++) {
$tmp_str = trim($link_buff[0][$i]);
@ -51,21 +49,20 @@
}
/**
* @brief body의 내용을 추출
* @brief Extract the contents of the body
**/
function getBodyScript($content) {
// 내용 추출
// Extract content
preg_match('!<body([^>]*)>(.*?)<\/body>!is', $content, $body_buff);
$body_script = $body_buff[2];
// link, style, script등 제거
// Remove link, style, script, etc.
$body_script = preg_replace('!<link([^>]*)>!is', '', $body_script);
$body_script = preg_replace('!<(style|script)(.*?)<\/(style|script)>!is', '', $body_script);
return $body_script;
}
/**
* @brief 내용에 포함된 src, href의 값을 변경
* @brief Change the value of src, href in the content
**/
function replaceSrc($content, $path) {
$url_info = parse_url($path);

View file

@ -3,19 +3,17 @@ require_once(_XE_PATH_.'modules/opage/opage.view.php');
class opageMobile extends opageView {
function init() {
// 템플릿 경로 구함 (opage의 경우 tpl에 관리자용 템플릿 모아놓음)
// Get a template path (admin templates are collected on the tpl for opage)
$this->setTemplatePath($this->module_path.'tpl');
$oOpageModel = &getModel('opage');
$module_info = $oOpageModel->getOpage($this->module_srl);
Context::set('module_info', $module_info);
// 외부 페이지에서 명시된 외부 페이지 경로/ 캐싱 간격을 를 구함
// Get a path/caching interval on the external page
if($module_info->mpath) $this->path = $module_info->mpath;
else $this->path = $module_info->path;
$this->caching_interval = $module_info->caching_interval;
// 캐시 파일 지정
// Specify the cache file
$this->cache_file = sprintf("./files/cache/opage/%d.m.cache.php", $module_info->module_srl);
}

View file

@ -2,19 +2,19 @@
/**
* @class opageModel
* @author NHN (developers@xpressengine.com)
* @brief opage 모듈의 model 클래스
* @brief model class of the opage module
**/
class opageModel extends opage {
/**
* @brief 초기화
* @brief Initialization
**/
function init() { }
/**
* @brief 특정 외부 페이지의 정보를 return
* 외부 페이지의 경우 기본 모듈의 정보와 설정정보를 함께 다루기 때문에 별도의 model method를 이용하게 한다
* @brief Return information on the external page
* Use a separate model method because external page handles information and configurations of the defaul module either.
**/
function getOpage($module_srl) {
$oModuleModel = &getModel('module');

View file

@ -2,7 +2,7 @@
/**
* @class opageView
* @author NHN (developers@xpressengine.com)
* @brief opage 모듈의 view 클래스
* @brief view class of the opage module
**/
class opageView extends opage {
@ -12,48 +12,42 @@
var $caching_interval;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// 템플릿 경로 구함 (opage의 경우 tpl에 관리자용 템플릿 모아놓음)
// Get a template path (admin templates are collected on the tpl for opage)
$this->setTemplatePath($this->module_path.'tpl');
// 외부 페이지 모듈의 정보를 구함
// Get information of the external page module
$oOpageModel = &getModel('opage');
$module_info = $oOpageModel->getOpage($this->module_srl);
Context::set('module_info', $module_info);
// 외부 페이지에서 명시된 외부 페이지 경로/ 캐싱 간격을 를 구함
// Get a path/caching interval on the external page
$this->path = $module_info->path;
$this->caching_interval = $module_info->caching_interval;
// 캐시 파일 지정
// Specify the cache file
$this->cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl);
}
/**
* @brief 일반 요청시 출력
* @brief Display when receiving a request
**/
function dispOpageIndex() {
// http 인지 내부 파일인지 점검
// check if it is http or internal file
if($this->path) {
if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->caching_interval, $this->cache_file);
else $content = $this->executeFile($this->path, $this->caching_interval, $this->cache_file);
}
Context::set('opage_content', $content);
// 결과 출력 템플릿 지정
// Set a template for result output
$this->setTemplateFile('content');
}
/**
* @brief 외부 http로 요청되는 파일일 경우 파일을 받아와서 저장 return
* @brief Save the file and return if a file is requested by http
**/
function getHtmlPage($path, $caching_interval, $cache_file) {
// 캐시 검사
// Verify cache
if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > time()) {
$content = FileHandler::readFile($cache_file);
@ -64,27 +58,21 @@
$content = FileHandler::readFile($cache_file);
}
// opage controller 생성
// Create opage controller
$oOpageController = &getController('opage');
// 외부 서버의 페이지 일 경우 이미지, css, javascript등의 url을 변경
// change url of image, css, javascript and so on if the page is from external server
$content = $oOpageController->replaceSrc($content, $path);
// 해당 문서를 utf-8로 변경
// Change the document to utf-8 format
$buff->content = $content;
$buff = Context::convertEncoding($buff);
$content = $buff->content;
// title 추출
// Extract a title
$title = $oOpageController->getTitle($content);
if($title) Context::setBrowserTitle($title);
// header script 추출
// Extract header script
$head_script = $oOpageController->getHeadScript($content);
if($head_script) Context::addHtmlHeader($head_script);
// body 내용 추출
// Extract content from the body
$body_script = $oOpageController->getBodyScript($content);
if(!$body_script) $body_script = $content;
@ -92,38 +80,32 @@
}
/**
* @brief 내부 파일일 경우 include하도록 캐시파일을 만들고 처리
* @brief Create a cache file in order to include if it is an internal file
**/
function executeFile($path, $caching_interval, $cache_file) {
// 파일이 없으면 취소
// Cancel if the file doesn't exist
if(!file_exists($path)) return;
// 경로와 파일이름을 구함
// Get a path and filename
$tmp_path = explode('/',$cache_file);
$filename = $tmp_path[count($tmp_path)-1];
$filepath = preg_replace('/'.$filename."$/i","",$cache_file);
// 캐시 검사
// Verify cache
if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time() || filemtime($cache_file)<filemtime($path) ) {
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
// 일단 대상 파일을 읽어서 내용을 구함
// Read a target file and get content
ob_start();
@include($path);
$content = ob_get_clean();
// 상대경로를 절대경로로 변경
// Replace relative path to the absolute path
$path_info = pathinfo($path);
$this->path = str_replace('\\', '/', realpath($path_info['dirname'])).'/';
$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content);
$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content);
FileHandler::writeFile($cache_file, $content);
// include후 결과를 return
// Include and then Return the result
if(!file_exists($cache_file)) return;
// 컴파일 시도
// Attempt to compile
$oTemplate = &TemplateHandler::getInstance();
$script = $oTemplate->compileDirect($filepath, $filename);
@ -143,13 +125,11 @@
function _replacePath($matches) {
$val = trim($matches[3]);
// 외부 또는 /, #, { 로 시작하는 경로라면 그냥 pass
// Pass if the path is external or starts with /, #, { characters
// /=absolute path, #=hash in a page, {=Template syntax
if(preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val)) {
return $matches[0];
// .. 와 같은 경우 대상 경로를 구함
// In case of .. , get a path
} elseif(preg_match('/^\.\./i',$val)) {
$p = Context::pathToUrl($this->path);
return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);