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,19 +2,19 @@
/**
* @class moduleAdminController
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 admin controller class
* @brief admin controller class of the module module
**/
class moduleAdminController extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 모듈 카테고리 추가
* @brief Add the module category
**/
function procModuleAdminInsertCategory() {
$args->title = Context::get('title');
@ -25,7 +25,7 @@
}
/**
* @brief 카테고리의 내용 수정
* @brief Update category
**/
function procModuleAdminUpdateCategory() {
$mode = Context::get('mode');
@ -46,7 +46,7 @@
}
/**
* @brief 모듈 카테고리의 제목 변경
* @brief Change the title of the module category
**/
function doUpdateModuleCategory() {
$args->title = Context::get('title');
@ -55,7 +55,7 @@
}
/**
* @brief 모듈 카테고리 삭제
* @brief Delete the module category
**/
function doDeleteModuleCategory() {
$args->module_category_srl = Context::get('module_category_srl');
@ -63,14 +63,13 @@
}
/**
* @brief 모듈 복사
* @brief Copy Module
**/
function procModuleAdminCopyModule() {
// 복사하려는 대상 모듈의 정보를 구함
// Get information of the target module to copy
$module_srl = Context::get('module_srl');
if(!$module_srl) return;
// 새로 생성하려는 모듈들의 이름/브라우저 제목을 구함
// Get module name to create and browser title
$clones = array();
$args = Context::getAll();
for($i=1;$i<=10;$i++) {
@ -86,11 +85,9 @@
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 모듈 정보 가져옴
// Get module information
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
// 권한 정보 가져옴
// Get permission information
$module_args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $module_args);
$grant = array();
@ -101,8 +98,7 @@
$oDB = &DB::getInstance();
$oDB->begin();
// 모듈 복사
// Copy a module
foreach($clones as $mid => $browser_title) {
$clone_args = null;
$clone_args = clone($module_info);
@ -111,12 +107,10 @@
$clone_args->mid = $mid;
$clone_args->browser_title = $browser_title;
$clone_args->is_default = 'N';
// 모듈 생성
// Create a module
$output = $oModuleController->insertModule($clone_args);
$module_srl = $output->get('module_srl');
// 권한 정보 등록
// Grant module permissions
if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant);
}
@ -125,20 +119,17 @@
}
/**
* @brief 모듈 권한 저장
* @brief Save the module permissions
**/
function procModuleAdminInsertGrant() {
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
// 모듈 번호 구함
// Get module_srl
$module_srl = Context::get('module_srl');
// 해당 모듈의 정보를 구함
// Get information of the module
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) return new Object(-1,'msg_invalid_request');
// 관리자 아이디 등록
// Register Admin ID
$oModuleController->deleteAdminId($module_srl);
$admin_member = Context::get('admin_member');
if($admin_member) {
@ -150,8 +141,7 @@
}
}
// 권한 정리
// List permissions
$xml_info = $oModuleModel->getModuleActionXML($module_info->module);
$grant_list = $xml_info->grant;
@ -160,15 +150,13 @@
$grant_list->manager->default = 'manager';
foreach($grant_list as $grant_name => $grant_info) {
// default값을 구함
// Get the default value
$default = Context::get($grant_name.'_default');
// -1 = 로그인 사용자만, -2 = 사이트 가입자만, 0 = 모든 사용자
// -1 = Log-in user only, -2 = site members only, 0 = all users
if(strlen($default)){
$grant->{$grant_name}[] = $default;
continue;
// 특정 그룹 사용자
// users in a particular group
} else {
$group_srls = Context::get($grant_name);
if($group_srls) {
@ -182,12 +170,11 @@
$grant->{$group_srls} = array();
}
// DB에 저장
// Stored in the DB
$args->module_srl = $module_srl;
$output = executeQuery('module.deleteModuleGrants', $args);
if(!$output->toBool()) return $output;
// DB에 권한 저장
// Permissions stored in the DB
foreach($grant as $grant_name => $group_srls) {
foreach($group_srls as $key => $val) {
$args = null;
@ -202,84 +189,74 @@
}
/**
* @brief 스킨 정보 업데이트
* @brief Updating Skins
**/
function procModuleAdminUpdateSkinInfo() {
// module_srl에 해당하는 정보들을 가져오기
// Get information of the module_srl
$module_srl = Context::get('module_srl');
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if($module_info->module_srl) {
$skin = $module_info->skin;
// 스킨의 정보를 구해옴 (extra_vars를 체크하기 위해서)
// Get skin information (to check extra_vars)
$module_path = './modules/'.$module_info->module;
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
// 입력받은 변수들을 체크 (mo, act, module_srl, page등 기본적인 변수들 없앰)
// Check received variables (unset such variables as act, module_srl, page, mid, module)
$obj = Context::getRequestVars();
unset($obj->act);
unset($obj->module_srl);
unset($obj->page);
unset($obj->mid);
unset($obj->module);
// 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌
// Separately handle if a type of extra_vars is an image in the original skin_info
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
if($vars->type!='image') continue;
$image_obj = $obj->{$vars->name};
// 삭제 요청에 대한 변수를 구함
// Get a variable to delete
$del_var = $obj->{"del_".$vars->name};
unset($obj->{"del_".$vars->name});
if($del_var == 'Y') {
FileHandler::removeFile($skin_vars[$vars->name]->value);
continue;
}
// 업로드 되지 않았다면 이전 데이터를 그대로 사용
// Use the previous data if not uploaded
if(!$image_obj['tmp_name']) {
$obj->{$vars->name} = $skin_vars[$vars->name]->value;
continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
// Ignore if the file is not successfully uploaded
if(!is_uploaded_file($image_obj['tmp_name'])) {
unset($obj->{$vars->name});
continue;
}
// 이미지 파일이 아니어도 무시
// Ignore if the file is not an image
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
unset($obj->{$vars->name});
continue;
}
// 경로를 정해서 업로드
// Upload the file to a path
$path = sprintf("./files/attach/images/%s/", $module_srl);
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) return false;
$filename = $path.$image_obj['name'];
// 파일 이동
// Move the file
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
unset($obj->{$vars->name});
continue;
}
// 정상 파일 업로드
// Upload the file
FileHandler::removeFile($skin_vars[$vars->name]->value);
// 변수를 바꿈
// Change a variable
unset($obj->{$vars->name});
$obj->{$vars->name} = $filename;
}
}
// 해당 모듈의 전체 스킨 불러와서 이미지는 제거
// Load the entire skin of the module and then remove the image
/*
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
@ -291,8 +268,7 @@
*/
$oModuleController = &getController('module');
$oModuleController->deleteModuleSkinVars($module_srl);
// 등록
// Register
$oModuleController->insertModuleSkinVars($module_srl, $obj);
}
@ -303,7 +279,7 @@
}
/**
* @brief 모듈 일괄 정리
* @brief List module information
**/
function procModuleAdminModuleSetup() {
$vars = Context::getRequestVars();
@ -330,7 +306,7 @@
}
/**
* @brief 모듈 권한 일괄 정리
* @brief List permissions of the module
**/
function procModuleAdminModuleGrantSetup() {
$module_srls = Context::get('module_srls');
@ -350,15 +326,13 @@
$grant_list->manager->default = 'manager';
foreach($grant_list as $grant_name => $grant_info) {
// default값을 구함
// Get the default value
$default = Context::get($grant_name.'_default');
// -1 = 로그인 사용자만, 0 = 모든 사용자
// -1 = Sign only, 0 = all users
if(strlen($default)){
$grant->{$grant_name}[] = $default;
continue;
// 특정 그룹 사용자
// Users in a particular group
} else {
$group_srls = Context::get($grant_name);
if($group_srls) {
@ -373,14 +347,13 @@
}
// DB에 저장
// Stored in the DB
foreach($modules as $module_srl) {
$args = null;
$args->module_srl = $module_srl;
$output = executeQuery('module.deleteModuleGrants', $args);
if(!$output->toBool()) continue;
// DB에 권한 저장
// Permissions stored in the DB
foreach($grant as $grant_name => $group_srls) {
foreach($group_srls as $key => $val) {
$args = null;
@ -396,24 +369,21 @@
}
/**
* @brief 언어 추가/ 업데이트
* @brief Add/Update language
**/
function procModuleAdminInsertLang() {
// 언어코드명 가져옴
// Get language code
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->name = str_replace(' ','_',Context::get('lang_code'));
if(!$args->name) return new Object(-1,'msg_invalid_request');
// 언어코드가 있는지 조사
// Check whether a language code exists
$output = executeQueryArray('module.getLang', $args);
if(!$output->toBool()) return $output;
// 있으면 업데이트를 위해 기존 값들을 지움
// If exists, clear the old values for updating
if($output->data) $output = executeQuery('module.deleteLang', $args);
if(!$output->toBool()) return $output;
// 입력
// Enter
$lang_supported = Context::get('lang_supported');
foreach($lang_supported as $key => $val) {
$args->lang_code = $key;
@ -431,10 +401,10 @@
}
/**
* @brief 언어 제거
* @brief Remove language
**/
function procModuleAdminDeleteLang() {
// 언어코드명 가져옴
// Get language code
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->name = str_replace(' ','_',Context::get('name'));
@ -446,10 +416,10 @@
}
/**
* @brief 사용자 정이 언어코드 파일 저장
* @brief Save the file of user-defined language code
**/
function makeCacheDefinedLangCode($site_srl = 0) {
// 현재 사이트의 언어파일 가져오기
// Get the language file of the current site
if(!$site_srl) {
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
@ -458,8 +428,7 @@
}
$output = executeQueryArray('module.getLang', $args);
if(!$output->toBool() || !$output->data) return;
// 캐시 디렉토리 설정
// Set the cache directory
$cache_path = _XE_PATH_.'files/cache/lang_defined/';
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);

View file

@ -3,20 +3,20 @@
* @class moduleAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief module 모듈의 AdminModel class
* @brief AdminModel class of the "module" module
**/
class moduleAdminModel extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief module_srl (,콤마로 연결된) 대상 모듈들의 목록을 return)
* 모듈 선택기(ModuleSelector)에서 사용됨
* @brief Return a list of target modules by using module_srls separated by comma(,)
* Used in the ModuleSelector
**/
function getModuleAdminModuleList() {
$args->module_srls = Context::get('module_srls');
@ -47,15 +47,14 @@
}
/**
* @brief 공통 :: 모듈의 모듈 권한 출력 페이지
* 모듈의 모듈 권한 출력은 모든 모듈에서 module instance를 이용할때 사용할 있음
* @brief Common:: module's permission displaying page in the module
* Available when using module instance in all the modules
**/
function getModuleGrantHTML($module_srl, $source_grant_list) {
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
// access, manager 권한은 가상 권한으로 설정
// Grant virtual permission for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list)) {
@ -68,8 +67,7 @@
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// 현재 모듈에 설정된 권한 그룹을 가져옴
// Get a permission group granted to the current module
$default_grant = array();
$args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $args);
@ -87,22 +85,20 @@
Context::set('selected_group', $selected_group);
Context::set('default_grant', $default_grant);
Context::set('module_srl', $module_srl);
// 현재 모듈에 설정된 관리자 아이디를 추출
// Extract admin ID set in the current module
$admin_member = $oModuleModel->getAdminId($module_srl);
Context::set('admin_member', $admin_member);
// 그룹을 가져옴
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
// grant 정보를 추출
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'module_grants');
}
/**
* @brief 공통 :: 모듈의 스킨 설정 출력 페이지
* @brief Common:: skin setting page for the module
**/
function getModuleSkinHTML($module_srl) {
$oModuleModel = &getModel('module');
@ -111,11 +107,9 @@
$skin = $module_info->skin;
$module_path = './modules/'.$module_info->module;
// 스킨의 XML 정보를 구함
// Get XML information of the skin
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
// DB에 설정된 스킨 정보를 구함
// Get skin information set in DB
$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
if(count($skin_info->extra_vars)) {
@ -141,8 +135,8 @@
}
/**
* @brief 특정 언어 코드에 대한 값들을 가져오기
* lang_code를 직접 기입하면 해당 언어코드에 대해서만 가져오고 값이 없으면 $name을 그대로 return
* @brief Get values for a particular language code
* Return its corresponding value if lang_code is specified. Otherwise return $name.
**/
function getLangCode($site_srl, $name) {
$lang_supported = Context::get('lang_supported');
@ -176,7 +170,7 @@
}
/**
* @brief 모듈 언어를 ajax로 요청시 return
* @brief Return if the module language in ajax is requested
**/
function getModuleAdminLangCode() {
$name = Context::get('name');

View file

@ -2,103 +2,93 @@
/**
* @class moduleAdminView
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 admin view class
* @brief admin view class of the module module
**/
class moduleAdminView extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// template path 지정
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 모듈 관리자 페이지
* @brief Module admin page
**/
function dispModuleAdminContent() {
$this->dispModuleAdminList();
}
/**
* @brief 모듈 목록 출력
* @brief Display a lost of modules
**/
function dispModuleAdminList() {
// 모듈 목록을 구해서
// Obtain a list of modules
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
Context::set('module_list', $module_list);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_list');
}
/**
* @brief 모듈의 상세 정보(conf/info.xml) 팝업 출력
* @brief Pop-up details of the module (conf/info.xml)
**/
function dispModuleAdminInfo() {
// 모듈 목록을 구해서
// Obtain a list of modules
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module'));
Context::set('module_info', $module_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_info');
}
/**
* @brief 모듈 카테고리 목록
* @brief Module Categories
**/
function dispModuleAdminCategory() {
$module_category_srl = Context::get('module_category_srl');
// 모듈 목록을 구해서
// Obtain a list of modules
$oModuleModel = &getModel('module');
// 선택된 카테고리가 있으면 해당 카테고리의 정보 수정 페이지로
// Display the category page if a category is selected
if($module_category_srl) {
$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
Context::set('selected_category', $selected_category);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('category_update_form');
// 아니면 전체 목록
// If not selected, display a list of categories
} else {
$category_list = $oModuleModel->getModuleCategories();
Context::set('category_list', $category_list);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('category_list');
}
}
/**
* @brief 모듈 복사 기능
* @brief Feature to copy module
**/
function dispModuleAdminCopyModule() {
// 복사하려는 대상 모듈을 구함
// Get a target module to copy
$module_srl = Context::get('module_srl');
// 해당 모듈의 정보를 구함
// Get information of the module
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
Context::set('module_info', $module_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('copy_module');
}
/**
* @brief 모듈 기본 설정 일괄 적용
* @brief Applying the default settings to all modules
**/
function dispModuleAdminModuleSetup() {
$module_srls = Context::get('module_srls');
@ -108,54 +98,45 @@
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0]);
// 모듈의 스킨 목록을 구함
// Get a skin list of the module
$skin_list = $oModuleModel->getSkins('./modules/'.$module_info->module);
Context::set('skin_list',$skin_list);
// 레이아웃 목록을 구해옴
// Get a layout list
$oLayoutMode = &getModel('layout');
$layout_list = $oLayoutMode->getLayoutList();
Context::set('layout_list', $layout_list);
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_setup');
}
/**
* @brief 모듈 추가 설정 일괄 적용
* @brief Apply module addition settings to all modules
**/
function dispModuleAdminModuleAdditionSetup() {
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
// content는 다른 모듈에서 call by reference로 받아오기에 미리 변수 선언만 해 놓음
// pre-define variables because you can get contents from other module (call by reference)
$content = '';
// 추가 설정을 위한 트리거 호출
// 게시판 모듈이지만 차후 다른 모듈에서의 사용도 고려하여 trigger 이름을 공용으로 사용할 수 있도록 하였음
// Call a trigger for additional settings
// Considering uses in the other modules, trigger name cen be publicly used
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_addition_setup');
}
/**
* @brief 모듈 권한 설정 일괄 적용
* @brief Applying module permission settings to all modules
**/
function dispModuleAdminModuleGrantSetup() {
$module_srls = Context::get('module_srls');
@ -167,8 +148,7 @@
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0]);
$xml_info = $oModuleModel->getModuleActionXml($module_info->module);
$source_grant_list = $xml_info->grant;
// access, manager 권한은 가상 권한으로 설정
// Grant virtual permissions for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list)) {
@ -181,42 +161,36 @@
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// 그룹을 가져옴
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_grant_setup');
}
/**
* @brief 언어 코드
* @brief Language codes
**/
function dispModuleAdminLangcode() {
// 현재 사이트의 언어파일 가져오기
// Get the language file of the current site
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->sort_index = 'name';
$args->order_type = 'asc';
$output = executeQueryArray('module.getLangList', $args);
Context::set('lang_list', $output->data);
// 현재 선택된 언어 가져오기
// Get the currently selected language
$name = Context::get('name');
if($name) {
$oModuleAdminModel = &getAdminModel('module');
Context::set('selected_lang', $oModuleAdminModel->getLangCode($args->site_srl,'$user_lang->'.$name));
}
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_langcode');
}

View file

@ -2,27 +2,25 @@
/**
* @class module
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 high class
* @brief high class of the module module
**/
class module extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
$oDB = &DB::getInstance();
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true);
$oDB->addIndex('sites','unique_domain',array('domain'),true);
// module 모듈에서 사용할 디렉토리 생성
// Create a directory to use in the module module
FileHandler::makeDir('./files/cache/module_info');
FileHandler::makeDir('./files/cache/triggers');
// sites 테이블에 기본 사이트 정보 입력
// Insert site information into the sites table
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if(!$output->data || !$output->data->index_module_srl) {
@ -43,34 +41,28 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
// 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가
// 2008. 10. 27 Add multi-index in the table, the module_part_config
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
// 2008. 11. 13 modules 의 mid를 unique를 없애고 site_srl을 추가 후에 site_srl + mid unique index
// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
// 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트
// Move permissions/skin information of all modules to the table, grants.
if($oDB->isColumnExists('modules', 'grants')) return true;
// 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트
// Move permissions/skin information of all modules to the table, grants.
if(!$oDB->isColumnExists('sites', 'default_language')) return true;
// extra_vars* 컬럼 제거
// Delete extra_vars* column
for($i=1;$i<=20;$i++) {
if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
}
// sites 테이블에 기본 사이트 정보 입력
// Insert site information to the table, sites
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if(!$output->data) return true;
// sites 테이블에서 도메인이 인덱스로 걸린경우
// If domain index is defined on the table, sites
if($oDB->isIndexExists('sites', 'idx_domain')) return true;
if(!$oDB->isIndexExists('sites','unique_domain')) return true;
@ -83,12 +75,11 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
// 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가하고 기존에 module_config에 몰려 있던 모든 정보를 재점검
// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
@ -140,43 +131,35 @@
}
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
}
// 2008. 11. 13 modules 의 mid를 unique를 없애고 site_srl을 추가 후에 site_srl + mid unique index
// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
if(!$oDB->isIndexExists('modules',"idx_site_mid")) {
$oDB->dropIndex("modules","unique_mid",true);
$oDB->addColumn('modules','site_srl','number',11,0,true);
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
}
// document 확장변수의 확장을 위한 처리
// document extra vars
if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
// 모든 모듈의 권한, 스킨정보, 확장정보, 관리자 아이디를 grants 테이블로 이전시키는 업데이트
// Move permission, skin info, extection info, admin ID of all modules to the table, grants
if($oDB->isColumnExists('modules', 'grants')) {
$oModuleController = &getController('module');
$oDocumentController = &getController('document');
// 현재 시스템 언어 코드값을 가져옴
// Get a value of the current system language code
$lang_code = Context::getLangType();
// 모든 모듈의 module_info를 가져옴
// Get module_info of all modules
$output = executeQueryArray('module.getModuleInfos');
if(count($output->data)) {
foreach($output->data as $module_info) {
// 모듈들의 권한/ 확장변수(게시글 확장 포함)/ 스킨 변수/ 최고관리권한 정보 분리
// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
$module_srl = trim($module_info->module_srl);
// 권한 등록
// grant an authority
$grants = unserialize($module_info->grants);
if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
// 스킨 변수 등록
// Insert skin vars
$skin_vars = unserialize($module_info->skin_vars);
if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
// 최고 관리자 아이디 등록
// Insert super admin's ID
$admin_id = trim($module_info->admin_id);
if($admin_id && $admin_id != 'Array') {
$admin_ids = explode(',',$admin_id);
@ -186,8 +169,7 @@
}
}
}
// 모듈별 추가 설정 저장 (기본 modules에 없던 컬럼 데이터)
// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
$extra_vars = unserialize($module_info->extra_vars);
$document_extra_keys = null;
if($extra_vars->extra_vars && count($extra_vars->extra_vars)) {
@ -197,9 +179,9 @@
if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
/**
* 게시글 확장변수 이동 (documents모듈에서 해야 하지만 modules 테이블의 추가 변수들이 정리되기에 여기서 )
* Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
**/
// 플래닛모듈의 경우 직접 추가 변수 입력
// Insert extra vars if planet module is
if($module_info->module == 'planet') {
if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
$planet_extra_keys->name = 'postscript';
@ -210,22 +192,19 @@
$planet_extra_keys->desc = '';
$document_extra_keys[20] = $planet_extra_keys;
}
// 게시글 확장변수 키 등록
// Register keys for document extra vars
if(count($document_extra_keys)) {
foreach($document_extra_keys as $var_idx => $val) {
$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
}
// 2009-04-14 #17923809 게시물 100개의 확장 변수만 이전되는 문제점 수정
// 2009-04-14 Fixed a bug that only 100 extra vars are moved
$oDocumentModel = &getModel('document');
$total_count = $oDocumentModel->getDocumentCount($module_srl);
if ($total_count > 0) {
$per_page = 100;
$total_pages = (int) (($total_count - 1) / $per_page) + 1;
// 확장변수가 존재하면 확장변수 가져오기
// Get extra vars if exist
$doc_args = null;
$doc_args->module_srl = $module_srl;
$doc_args->list_count = $per_page;
@ -248,8 +227,7 @@
} // for total_pages
} // if count
}
// 해당 모듈들의 추가 변수들 제거
// Additional variables of the module, remove
$module_info->grant = null;
$module_info->extra_vars = null;
$module_info->skin_vars = null;
@ -257,30 +235,26 @@
executeQuery('module.updateModule', $module_info);
}
}
// 각종 column drop
// Various column drop
$oDB->dropColumn('modules','grants');
$oDB->dropColumn('modules','admin_id');
$oDB->dropColumn('modules','skin_vars');
$oDB->dropColumn('modules','extra_vars');
}
// 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트
// Rights of all modules/skins transferring the information into a table Update grants
if(!$oDB->isColumnExists('sites', 'default_language')) {
$oDB->addColumn('sites','default_language','varchar',255,0,false);
}
// extra_vars* 컬럼 제거
// extra_vars * Remove Column
for($i=1;$i<=20;$i++) {
if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
$oDB->dropColumn('documents','extra_vars'.$i);
}
// sites 테이블에 기본 사이트 정보 입력
// Enter the main site information sites on the table
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if(!$output->data) {
// 기본 mid, 언어 구함
// Basic mid, language Wanted
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
$db_info = Context::getDBInfo();
$domain = Context::getDefaultUrl();
@ -348,19 +322,16 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 모듈 정보 캐시 파일 모두 삭제
// Delete all cache files, the module information
FileHandler::removeFilesInDir("./files/cache/module_info");
// 트리거 정보가 있는 파일 모두 삭제
// Delete all the files that trigger information
FileHandler::removeFilesInDir("./files/cache/triggers");
// DB캐시 파일을 모두 삭제
// DB cache, delete all the files
FileHandler::removeFilesInDir("./files/cache/db");
// 기타 캐시 삭제
// Other Cache
FileHandler::removeDir("./files/cache/tmp");
}
}

View file

@ -2,21 +2,21 @@
/**
* @class moduleController
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 controller class
* @brief controller class of the module module
**/
class moduleController extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief action forward 추가
* action foward는 등록된 action이 요청된 모듈에 없을 경우 찾아서 포워딩을 하는 구조이다
* 모듈의 설치시에 사용된다.
* @brief Add action forward
* Action forward finds and forwards if an action is not in the requested module
* This is used when installing a module
**/
function insertActionForward($module, $type, $act) {
$args->module = $module;
@ -28,7 +28,7 @@
}
/**
* @brief action forward 삭제
* @brief Delete action forward
**/
function deleteActionForward($module, $type, $act) {
$args->module = $module;
@ -40,8 +40,8 @@
}
/**
* @brief module trigger 추가
* module triggertrigger 대상이 등록된 대상을 호출하는 방법이다.
* @brief Add module trigger
* module trigger is to call a trigger to a target module
*
**/
function insertTrigger($trigger_name, $module, $type, $called_method, $called_position) {
@ -52,15 +52,14 @@
$args->called_position = $called_position;
$output = executeQuery('module.insertTrigger', $args);
// 트리거 정보가 있는 파일 모두 삭제
// Delete all the files which contain trigger information
FileHandler::removeFilesInDir("./files/cache/triggers");
return $output;
}
/**
* @brief module trigger 삭제
* @brief Delete module trigger
*
**/
function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position) {
@ -71,15 +70,14 @@
$args->called_position = $called_position;
$output = executeQuery('module.deleteTrigger', $args);
// 트리거 캐시 삭제
// Remove the trigger cache
FileHandler::removeFilesInDir('./files/cache/triggers');
return $output;
}
/**
* @brief module extend 추가
* @brief Add module extend
*
**/
function insertModuleExtend($parent_module, $extend_module, $type, $kind=''){
@ -103,7 +101,7 @@
}
/**
* @brief module extend 삭제
* @brief Delete module extend
*
**/
function deleteModuleExtend($parent_module, $extend_module, $type, $kind=''){
@ -121,8 +119,8 @@
}
/**
* @brief 특정 모듈의 설정 입력
* board, member등 특정 모듈의 global config 관리용
* @brief Enter a specific set of modules
* In order to manage global configurations of modules such as board, member and so on
**/
function insertModuleConfig($module, $config) {
$args->module = $module;
@ -136,8 +134,8 @@
}
/**
* @brief 특정 mid의 모듈 설정 정보 저장
* mid의 모듈 의존적인 설정을 관리
* @brief Save module configurations of the mid
* Manage mid configurations depending on module
**/
function insertModulePartConfig($module, $module_srl, $config) {
$args->module = $module;
@ -152,7 +150,7 @@
}
/**
* @brief virtual site 생성
* @brief create virtual site
**/
function insertSite($domain, $index_module_srl) {
if(isSiteID($domain)) {
@ -177,7 +175,7 @@
}
/**
* @brief virtual site 수정
* @brief modify virtual site
**/
function updateSite($args) {
$oModuleModel = &getModel('module');
@ -197,18 +195,16 @@
}
/**
* @brief 모듈 정보 정리
* @brief Arrange module information
**/
function arrangeModuleInfo(&$args, &$extra_vars) {
// 불필요한 내용 제거
// Remove unnecessary information
unset($args->body);
unset($args->act);
unset($args->page);
// mid값 검사
// Test mid value
if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
// 변수를 검사 (modules의 기본 변수와 그렇지 않은 변수로 분리)
// Test variables (separate basic vars and other vars in modules)
$extra_vars = clone($args);
unset($extra_vars->module_srl);
unset($extra_vars->module);
@ -235,13 +231,12 @@
}
/**
* @brief 모듈 입력
* @brief Insert module
**/
function insertModule($args) {
$output = $this->arrangeModuleInfo($args, $extra_vars);
if(!$output->toBool()) return $output;
// 이미 존재하는 모듈 이름인지 체크
// Check whether the module name already exists
if(!$args->site_srl) $args->site_srl = 0;
$oModuleModel = &getModel('module');
if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
@ -249,23 +244,19 @@
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 선택된 스킨정보에서 colorset을 구함
// Get colorset from the skin information
$module_path = ModuleHandler::getModulePath($args->module);
$skin_info = $oModuleModel->loadSkinInfo($module_path, $args->skin);
$skin_vars->colorset = $skin_info->colorset[0]->name;
// 변수 정리후 query 실행
// Arrange variables and then execute a query
if(!$args->module_srl) $args->module_srl = getNextSequence();
// 모듈 등록
// Insert a module
$output = executeQuery('module.insertModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 모듈 추가 변수 등록
// Insert module extra vars
$this->insertModuleExtraVars($args->module_srl, $extra_vars);
// commit
@ -276,7 +267,7 @@
}
/**
* @brief 모듈의 정보를 수정
* @brief Modify module information
**/
function updateModule($args) {
$output = $this->arrangeModuleInfo($args, $extra_vars);
@ -303,8 +294,7 @@
$oDB->rollback();
return $output;
}
// 모듈 추가 변수 등록
// Insert module extra vars
$this->insertModuleExtraVars($args->module_srl, $extra_vars);
$oDB->commit();
@ -314,7 +304,7 @@
}
/**
* @brief 모듈의 가상사이트 변경
* @brief Change the module's virtual site
**/
function updateModuleSite($module_srl, $site_srl, $layout_srl = 0) {
$args->module_srl = $module_srl;
@ -324,14 +314,13 @@
}
/**
* @brief 모듈을 삭제
* @brief Delete module
*
* 모듈 삭제시는 관련 정보들을 모두 삭제 시도한다.
* Attempt to delete all related information when deleting a module.
**/
function deleteModule($module_srl) {
if(!$module_srl) return new Object(-1,'msg_invalid_request');
// trigger 호출 (before)
// Call a trigger (before)
$trigger_obj->module_srl = $module_srl;
$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
if(!$output->toBool()) return $output;
@ -341,27 +330,21 @@
$oDB->begin();
$args->module_srl = $module_srl;
// module 정보를 DB에서 삭제
// Delete module information from the DB
$output = executeQuery('module.deleteModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 권한 정보 삭제
// Delete permission information
$this->deleteModuleGrants($module_srl);
// 스킨 정보 삭제
// Remove skin information
$this->deleteModuleSkinVars($module_srl);
// 모듈 추가 변수 삭제
// Delete module extra vars
$this->deleteModuleExtraVars($module_srl);
// 모듈 관리자 제거
// Remove the module manager
$this->deleteAdminId($module_srl);
// trigger 호출 (after)
// Call a trigger (after)
if($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
if(!$trigger_output->toBool()) {
@ -377,10 +360,10 @@
}
/**
* @brief 모듈의 기타 정보를 변경
* @brief Change other information of the module
**/
function updateModuleSkinVars($module_srl, $skin_vars) {
// skin_vars 정보 세팅
// skin_vars setting
$args->module_srl = $module_srl;
$args->skin_vars = $skin_vars;
$output = executeQuery('module.updateModuleSkinVars', $args);
@ -390,7 +373,7 @@
}
/**
* @brief 모든 모듈의 is_default값을 N 으로 세팅 (기본 모듈 해제)
* @brief Set is_default as N in all modules(the default module is disabled)
**/
function clearDefaultModule() {
$output = executeQuery('module.clearDefaultModule');
@ -400,14 +383,14 @@
}
/**
* @brief 지정된 menu_srl에 속한 mid menu_srl 변경
* @brief Update menu_srl of mid which belongs to menu_srl
**/
function updateModuleMenu($args) {
return executeQuery('module.updateModuleMenu', $args);
}
/**
* @brief 지정된 menu_srl에 속한 mid layout_srl을 변경
* @brief Update layout_srl of mid which belongs to menu_srl
**/
function updateModuleLayout($layout_srl, $menu_srl_list) {
if(!count($menu_srl_list)) return;
@ -419,15 +402,14 @@
}
/**
* @brief 사이트의 관리를 변경
* @brief Change the site administrator
**/
function insertSiteAdmin($site_srl, $arr_admins) {
// 사이트 관리자 제거
// Remove the site administrator
$args->site_srl = $site_srl;
$output = executeQuery('module.deleteSiteAdmin', $args);
if(!$output->toBool()) return $output;
// 관리자 대상 멤버 번호를 구함
// Get user id of an administrator
if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
foreach($arr_admins as $key => $user_id) {
if(!trim($user_id)) continue;
@ -450,7 +432,7 @@
}
/**
* @brief 특정 모듈에 관리자 아이디 지정
* @brief Specify the admin ID to a module
**/
function insertAdminId($module_srl, $admin_id) {
$oMemberModel = &getModel('member');
@ -462,7 +444,7 @@
}
/**
* @brief 특정 모듈의 관리자 아이디 제거
* @brief Remove the admin ID from a module
**/
function deleteAdminId($module_srl, $admin_id = '') {
$args->module_srl = $module_srl;
@ -476,7 +458,7 @@
}
/**
* @brief 특정 모듈에 스킨 변수 등록
* @brief Insert skin vars to a module
**/
function insertModuleSkinVars($module_srl, $obj) {
$this->deleteModuleSkinVars($module_srl);
@ -484,10 +466,10 @@
$args->module_srl = $module_srl;
foreach($obj as $key => $val) {
// #17927989 예전 블로그 모듈을 사용하던 게시판의 경우
// 스킨 정보 필드에 메뉴 항목(stdClass)을 저장해놓은 경우가 있어
// 1.2.0 이상 버전으로 업그레이드한 후 모듈 업데이트할 때
// 오류가 발생하는 문제 수정
// #17927989 For an old board which used the old blog module
// it often saved menu item(stdClass) on the skin info column
// When updating the module on XE core 1.2.0 later versions, it occurs an error
// fixed the error
if (is_object($val)) continue;
if (is_array($val)) $val = serialize($val);
@ -499,7 +481,7 @@
}
/**
* @brief 특정 모듈의 스킨 변수 제거
* @brief Remove skin vars of a module
**/
function deleteModuleSkinVars($module_srl) {
$args->module_srl = $module_srl;
@ -507,7 +489,7 @@
}
/**
* @brief 특정 모듈에 확장 변수 등록
* @brief Register extra vars to the module
**/
function insertModuleExtraVars($module_srl, $obj) {
$this->deleteModuleExtraVars($module_srl);
@ -524,7 +506,7 @@
}
/**
* @brief 특정 모듈의 확장 변수 제거
* @brief Remove extra vars from the module
**/
function deleteModuleExtraVars($module_srl) {
$args->module_srl = $module_srl;
@ -532,7 +514,7 @@
}
/**
* @brief 특정 모듈에 권한 등록
* @brief Grant permission to the module
**/
function insertModuleGrants($module_srl, $obj) {
$this->deleteModuleGrants($module_srl);
@ -554,7 +536,7 @@
}
/**
* @brief 특정 모듈의 권한 제거
* @brief Remove permission from the module
**/
function deleteModuleGrants($module_srl) {
$args->module_srl = $module_srl;
@ -562,7 +544,7 @@
}
/**
* @brief 사용자 정의 언어 변경
* @brief Change user-defined language
**/
function replaceDefinedLangCode(&$output) {
$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
@ -586,7 +568,7 @@
/**
* @brief 파일박스에 파일 추가 업데이트
* @brief Add and update a file into the file box
**/
function procModuleFileBoxAdd(){
@ -627,7 +609,7 @@
/**
* @brief 파일박스에 파일 업데이트
* @brief Update a file into the file box
**/
function updateModuleFileBox($vars){
@ -661,7 +643,7 @@
/**
* @brief 파일박스에 파일 추가
* @brief Add a file into the file box
**/
function insertModuleFileBox($vars){
// set module_filebox_srl
@ -694,7 +676,7 @@
/**
* @brief 파일박스에 파일 삭제
* @brief Delete a file from the file box
**/
function procModuleFileBoxDelete(){

View file

@ -2,37 +2,34 @@
/**
* @class moduleModel
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 Model class
* @brief Model class of module module
**/
class moduleModel extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief mid, vid 사용할 있는지 검사
* @brief Check if mid, vid are available
**/
function isIDExists($id, $site_srl = 0) {
if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
// directory 및 rss/atom/api 등 예약어 검사
// directory and rss/atom/api reserved checking, etc.
$dirs = FileHandler::readDir(_XE_PATH_);
$dirs[] = 'rss';
$dirs[] = 'atom';
$dirs[] = 'api';
if(in_array($id, $dirs)) return true;
// mid 검사
// mid test
$args->mid = $id;
$args->site_srl = $site_srl;
$output = executeQuery('module.isExistsModuleName', $args);
if($output->data->count) return true;
// vid 검사 (site_srl이 0일때 즉 가상사이트가 아닌 경우 mid != vid임을 체크)
// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
if(!$site_srl) {
$site_args->domain = $id;
$output = executeQuery('module.isExistsSiteDomain', $site_args);
@ -43,7 +40,7 @@
}
/**
* @brief site 정보를 구함
* @brief Get site information
**/
function getSiteInfo($site_srl) {
$args->site_srl = $site_srl;
@ -58,8 +55,8 @@
}
/**
* @brief document_srl로 모듈의 정보르 구함
* 경우는 캐시파일을 이용할 수가 없음
* @brief Get module information with document_srl
* In this case, it is unable to use the cache file
**/
function getModuleInfoByDocumentSrl($document_srl) {
$args->document_srl = $document_srl;
@ -68,15 +65,14 @@
}
/**
* @brief domain에 따른 기본 mid를 구함
* @brief Get the defaul mid according to the domain
**/
function getDefaultMid() {
$default_url = preg_replace('/\/$/','',Context::getDefaultUrl());
$request_url = preg_replace('/\/$/','',Context::getRequestUri());
$vid = Context::get('vid');
$mid = Context::get('mid');
// 기본 URL이 설정되어 있고 이 기본 URL과 요청 URL이 다르면 가상 사이트 확인
// Check a virtual site if the default URL is already set and is is defferent from a requested URL
if($default_url && $default_url != $request_url) {
$url_info = parse_url($request_url);
$hostname = $url_info['host'];
@ -96,20 +92,17 @@
}
}
}
// 가상 사이트가 아닐 경우 기본 사이트 정보를 구함
// If it is not a virtual site, get a default site information
if(!$output->data) {
$args->site_srl = 0;
$output = executeQuery('module.getSiteInfo', $args);
// 기본 사이트 정보가 없으면 관련된 정보를 갱신
// Update the related informaion if there is no default site info
if(!$output->data) {
// sites 테이블이 없을 경우 생성
// Create a table if sites table doesn't exist
$oDB = &DB::getInstance();
if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
if(!$oDB->isTableExists('sites')) return;
// 기본 mid, 언어 구함
// Get mid, language
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
$db_info = Context::getDBInfo();
$domain = Context::getDefaultUrl();
@ -136,7 +129,7 @@
}
/**
* @brief mid로 모듈의 정보를 구함
* @brief Get module information by mid
**/
function getModuleInfoByMid($mid, $site_srl = 0) {
$args->mid = $mid;
@ -148,10 +141,10 @@
}
/**
* @brief module_srl에 해당하는 모듈의 정보를 구함
* @brief Get module information corresponding to module_srl
**/
function getModuleInfoByModuleSrl($module_srl) {
// 데이터를 가져옴
// Get data
$args->module_srl = $module_srl;
$output = executeQuery('module.getMidInfo', $args);
if(!$output->data) return;
@ -160,10 +153,10 @@
}
/**
* @brief layout_srl에 해당하는 모듈의 정보를 구함
* @brief Get module information corresponding to layout_srl
**/
function getModulesInfoByLayout($layout_srl) {
// 데이터를 가져옴
// Imported data
$args->layout_srl = $layout_srl;
$output = executeQueryArray('module.getModulesByLayout', $args);
@ -177,7 +170,7 @@
}
/**
* @brief 여러개의 module_srl에 해당하는 모듈의 정보를 구함
* @brief Get module information corresponding to multiple module_srls
**/
function getModulesInfo($module_srls) {
if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
@ -188,22 +181,20 @@
}
/**
* @brief 모듈의 기본 정보에 추가 변수 구함
* @brief Add extra vars to the module basic information
**/
function addModuleExtraVars($module_info) {
// 1개 이상의 모듈정보를 요청받아도 처리 가능하도록
// Process although one or more module informaion is requested
if(!is_array($module_info)) $target_module_info = array($module_info);
else $target_module_info = $module_info;
// 모듈 번호를 구함
// Get module_srl
$module_srls = array();
foreach($target_module_info as $key => $val) {
$module_srl = $val->module_srl;
if(!$module_srl) continue;
$module_srls[] = $val->module_srl;
}
// 모듈의 추가정보/ 스킨 정보를 추출
// Extract extra information of the module and skin
$extra_vars = $this->getModuleExtraVars($module_srls);
if(!count($module_srls) || !count($extra_vars)) return $module_info;
@ -219,7 +210,7 @@
}
/**
* @brief DB에 생성된 mid 전체 목록을 구해옴
* @brief Get a complete list of mid, which is created in the DB
**/
function getMidList($args = null) {
$output = executeQuery('module.getMidList', $args);
@ -237,7 +228,7 @@
}
/**
* @brief mid 목록에 대응하는 module_srl을 배열로 return
* @brief Return an array of module_srl corresponding to a mid list
**/
function getModuleSrlByMid($mid) {
if($mid && !is_array($mid)) $mid = explode(',',$mid);
@ -262,7 +253,7 @@
}
/**
* @brief act 값에 의한 forward 값을 구함
* @brief Get forward value by the value of act
**/
function getActionForward($act, $module = "") {
$args->act = $act;
@ -273,7 +264,7 @@
}
/**
* @brief trigger_name에 등록된 모든 목록을 추출
* @brief Get a list of all triggers on the trigger_name
**/
function getTriggers($trigger_name, $called_position) {
$args->trigger_name = $trigger_name;
@ -283,7 +274,7 @@
}
/**
* @brief 특정 trigger_name의 특정 대상을 추출
* @brief Get specific triggers from the trigger_name
**/
function getTrigger($trigger_name, $module, $type, $called_method, $called_position) {
$args->trigger_name = $trigger_name;
@ -296,7 +287,7 @@
}
/**
* @brief 특정 module extend 가져옴
* @brief Get module extend
**/
function getModuleExtend($parent_module, $type, $kind='') {
$key = $parent_module.'.'.$kind.'.'.$type;
@ -311,7 +302,7 @@
}
/**
* @brief 모든 module extend 가져옴
* @brief Get all the module extend
**/
function loadModuleExtends() {
$cache_file = './files/config/module_extend.php';
@ -347,14 +338,13 @@
}
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* @brief Get information from conf/info.xml
**/
function getModuleInfoXml($module) {
// 요청된 모듈의 경로를 구한다. 없으면 return
// Get a path of the requested module. Return if not exists.
$module_path = ModuleHandler::getModulePath($module);
if(!$module_path) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
// Read the xml file for module skin information
$xml_file = sprintf("%s/conf/info.xml", $module_path);
if(!file_exists($xml_file)) return;
@ -363,8 +353,7 @@
$xml_obj = $tmp_xml_obj->module;
if(!$xml_obj) return;
// 모듈 정보
// Module Information
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// module format 0.2
$module_info->title = $xml_obj->title->body;
@ -446,8 +435,7 @@
$author_obj->homepage = $xml_obj->author->attrs->link;
$module_info->author[] = $author_obj;
}
// action 정보를 얻어서 admin_index를 추가
// Add admin_index by using action information
$action_info = $this->getModuleActionXml($module);
$module_info->admin_index_act = $action_info->admin_index_act;
$module_info->default_index_act = $action_info->default_index_act;
@ -457,39 +445,35 @@
}
/**
* @brief module의 conf/module.xml 통해 grant(권한) action 데이터를 return
* module.xml 파일의 경우 파싱하는데 시간이 걸리기에 캐싱을 한다...
* 캐싱을 할때 바로 include 있도록 역시 코드까지 추가하여 캐싱을 한다.
* 이게 퍼포먼스 상으로는 좋은데 어떤 부정적인 결과를 유도할지는 모르겠...
* @brief Return permisson and action data by conf/module.xml in the module
* Cache it because it takes too long to parse module.xml file
* When caching, add codes so to include it directly
* This is apparently good for performance, but not sure about its side-effects
**/
function getModuleActionXml($module) {
// 요청된 모듈의 경로를 구한다. 없으면 return
// Get a path of the requested module. Return if not exists.
$class_path = ModuleHandler::getModulePath($module);
if(!$class_path) return;
// 해당 경로에 module.xml 파일이 있는지 체크한다. 없으면 return
// Check if module.xml exists in the path. Return if not exist
$xml_file = sprintf("%sconf/module.xml", $class_path);
if(!file_exists($xml_file)) return;
// 캐시된 파일이 있는지 확인
// Check if cached file exists
$cache_file = sprintf("./files/cache/module_info/%s.%s.php", $module, Context::getLangType());
// 캐시 파일이 없거나 캐시 파일이 xml 파일보다 오래되었으면 내용 다시 갱신
// Update if no cache file exists or it is older than xml file
if(!file_exists($cache_file) || filemtime($cache_file)<filemtime($xml_file)) {
$buff = ""; ///< 캐시 파일에 쓸 buff 변수 설정
$buff = ""; // /< Set buff variable to use in the cache file
$xml_obj = XmlParser::loadXmlFile($xml_file); ///< xml 파일을 읽어서 xml object로 변환
$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
if(!count($xml_obj->module)) return; ///< xml 내용중에 module 태그가 없다면 오류;;
if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
$grants = $xml_obj->module->grants->grant; ///< 권한 정보 (없는 경우도 있음)
$permissions = $xml_obj->module->permissions->permission; ///< 권한 대행 (없는 경우도 있음)
$actions = $xml_obj->module->actions->action; ///< action list (필수)
$grants = $xml_obj->module->grants->grant; // /< Permission information
$permissions = $xml_obj->module->permissions->permission; // /< Acting permission
$actions = $xml_obj->module->actions->action; // /< Action list (required)
$default_index = $admin_index = '';
// 권한 정보의 정리
// Arrange permission information
if($grants) {
if(is_array($grants)) $grant_list = $grants;
else $grant_list[] = $grants;
@ -506,8 +490,7 @@
$buff .= sprintf('$info->grant->%s->default=\'%s\';', $name, $default);
}
}
// 권한 허용 정리
// Permissions to grant
if($permissions) {
if(is_array($permissions)) $permission_list = $permissions;
else $permission_list[] = $permissions;
@ -521,8 +504,7 @@
$buff .= sprintf('$info->permission->%s = \'%s\';', $action, $target);
}
}
// actions 정리
// actions
if($actions) {
if(is_array($actions)) $action_list = $actions;
else $action_list[] = $actions;
@ -578,8 +560,8 @@
/**
* @brief 주어진 곳의 스킨 목록을 구함
* 스킨과 skin.xml 파일을 분석 정리한 결과를 return
* @brief Get a list of skins for the module
* Return file analysis of skin and skin.xml
**/
function getSkins($path, $dir = 'skins') {
$skin_path = sprintf("%s/%s/", $path, $dir);
@ -600,28 +582,22 @@
}
/**
* @brief 특정 위치의 특정 스킨의 정보를 구해옴
* @brief Get skin information on a specific location
**/
function loadSkinInfo($path, $skin, $dir = 'skins') {
// 모듈의 스킨의 정보 xml 파일을 읽음
// Read xml file having skin information
if(substr($path,-1)!='/') $path .= '/';
$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
if(!file_exists($skin_xml_file)) return;
// XmlParser 객체 생성
// Create XmlParser object
$oXmlParser = new XmlParser();
$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
// 스킨 정보가 없으면 return
// Return if no skin information is
if(!$_xml_obj->skin) return;
$xml_obj = $_xml_obj->skin;
// 스킨이름
// Skin Name
$skin_info->title = $xml_obj->title->body;
// 작성자 정보
// Author information
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// skin format v0.2
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@ -642,8 +618,7 @@
$author_obj->homepage = $author->attrs->link;
$skin_info->author[] = $author_obj;
}
// 확장변수를 정리
// List extra vars
if($xml_obj->extra_vars) {
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
@ -666,8 +641,7 @@
$obj->default = $val->attrs->default;
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
// 'select'type에서 option목록을 구한다.
// Get an option list from 'select'type
if(is_array($val->options)) {
$option_count = count($val->options);
@ -743,8 +717,7 @@
$skin_info->author[0]->name = $xml_obj->maker->name->body;
$skin_info->author[0]->email_address = $xml_obj->maker->attrs->email_address;
$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
// 스킨에서 사용되는 변수들
// Variables used in the skin
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -765,8 +738,7 @@
$type = $var->attrs->type;
$title = $var->title->body;
$description = $var->description->body;
// 'select'type에서 option목록을 구한다.
// Get an option list from 'select'type.
if(is_array($var->default)) {
$option_count = count($var->default);
@ -820,8 +792,7 @@
$skin_info->colorset[] = $obj;
}
}
// 메뉴 종류 (레이아웃을 위한 설정)
// Menu type (settings for layout)
if($xml_obj->menus->menu) {
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
@ -844,7 +815,7 @@
}
/**
* @brief 특정 가상 사이트에 등록된 특정 모듈의 개수를 return
* @brief Return the number of modules which are registered on a virtual site
**/
function getModuleCount($site_srl, $module = null) {
$args->site_srl = $site_srl;
@ -854,8 +825,8 @@
}
/**
* @brief 특정 모듈의 설정 return
* board, member등 특정 모듈의 global config 관리용
* @brief Return module configurations
* Global configuration is used to manage board, member and others
**/
function getModuleConfig($module) {
if(!$GLOBALS['__ModuleConfig__'][$module]) {
@ -868,8 +839,8 @@
}
/**
* @brief 특정 mid의 모듈 설정 정보 return
* mid의 모듈 의존적인 설정을 관리
* @brief Return the module configuration of mid
* Manage mid configurations which depend on module
**/
function getModulePartConfig($module, $module_srl) {
if(!$GLOBALS['__ModulePartConfig__'][$module][$module_srl]) {
@ -883,7 +854,7 @@
}
/**
* @brief mid별 모듈 설정 정보 전체를 구함
* @brief Get all of module configurations for each mid
**/
function getModulePartConfigs($module, $site_srl = 0) {
$args->module = $module;
@ -899,10 +870,10 @@
/**
* @brief 모듈 카테고리의 목록을 구함
* @brief Get a list of module category
**/
function getModuleCategories() {
// 데이터를 DB에서 가져옴
// Get data from the DB
$output = executeQuery('module.getModuleCategories');
if(!$output->toBool()) return $output;
$list = $output->data;
@ -916,10 +887,10 @@
}
/**
* @brief 특정 모듈 카테고리의 내용을 구함
* @brief Get content from the module category
**/
function getModuleCategory($module_category_srl) {
// 데이터를 DB에서 가져옴
// Get data from the DB
$args->module_category_srl = $module_category_srl;
$output = executeQuery('module.getModuleCategory', $args);
if(!$output->toBool()) return $output;
@ -927,22 +898,21 @@
}
/**
* @brief 모듈의 xml 정보만 구함
* @brief Get xml information of the module
**/
function getModulesXmlInfo() {
// 다운받은 모듈과 설치된 모듈의 목록을 구함
// Get a list of downloaded and installed modules
$searched_list = FileHandler::readDir('./modules');
$searched_count = count($searched_list);
if(!$searched_count) return;
sort($searched_list);
for($i=0;$i<$searched_count;$i++) {
// 모듈의 이름
// Module name
$module_name = $searched_list[$i];
$path = ModuleHandler::getModulePath($module_name);
// 해당 모듈의 정보를 구함
// Get information of the module
$info = $this->getModuleInfoXml($module_name);
unset($obj);
@ -966,15 +936,13 @@
{
$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
$table_count = count($tmp_files);
// 테이블이 설치되어 있는지 체크
// Check if the table is created
$created_table_count = 0;
for($j=0;$j<count($tmp_files);$j++) {
list($table_name) = explode(".",$tmp_files[$j]);
if($oDB->isTableExists($table_name)) $created_table_count ++;
}
// 설치 유무 체크 (설치는 DB의 설치만 관리)
// Check if DB is installed
if($table_count > $created_table_count) return true;
else return false;
}
@ -983,7 +951,7 @@
function checkNeedUpdate($module_name)
{
// 각 모듈의 module.class.php로 upgrade 유무 체크
// Check if it is upgraded to module.class.php on each module
$oDummy = &getModule($module_name, 'class');
if($oDummy && method_exists($oDummy, "checkUpdate")) {
return $oDummy->checkUpdate();
@ -992,13 +960,12 @@
}
/**
* @brief 모듈의 종류와 정보를 구함
* @brief Get a type and information of the module
**/
function getModuleList() {
// DB 객체 생성
// Create DB Object
$oDB = &DB::getInstance();
// 다운받은 모듈과 설치된 모듈의 목록을 구함
// Get a list of downloaded and installed modules
$searched_list = FileHandler::readDir('./modules');
sort($searched_list);
@ -1006,23 +973,20 @@
if(!$searched_count) return;
for($i=0;$i<$searched_count;$i++) {
// 모듈의 이름
// module name
$module_name = $searched_list[$i];
$path = ModuleHandler::getModulePath($module_name);
// schemas내의 테이블 생성 xml파일수를 구함
// Get the number of xml files to create a table in schemas
$tmp_files = FileHandler::readDir($path."schemas", '/(\.xml)$/');
$table_count = count($tmp_files);
// 테이블이 설치되어 있는지 체크
// Check if the table is created
$created_table_count = 0;
for($j=0;$j<count($tmp_files);$j++) {
list($table_name) = explode(".",$tmp_files[$j]);
if($oDB->isTableExists($table_name)) $created_table_count ++;
}
// 해당 모듈의 정보를 구함
// Get information of the module
$info = $this->getModuleInfoXml($module_name);
unset($obj);
@ -1032,12 +996,10 @@
$info->table_count = $table_count;
$info->path = $path;
$info->admin_index_act = $info->admin_index_act;
// 설치 유무 체크 (설치는 DB의 설치만 관리)
// Check if DB is installed
if($table_count > $created_table_count) $info->need_install = true;
else $info->need_install = false;
// 각 모듈의 module.class.php로 upgrade 유무 체크
// Check if it is upgraded to module.class.php on each module
$oDummy = null;
$oDummy = &getModule($module_name, 'class');
if($oDummy && method_exists($oDummy, "checkUpdate")) {
@ -1054,9 +1016,9 @@
}
/**
* @brief 특정 module srls를 sites의 domain과 결합
* 아직 XE DBHandler에서 left outer join이 안되어서..
* $output->data[]->module_srl 같은 구조여야
* @brief Combine module_srls with domain of sites
* Because XE DBHandler doesn't support left outer join,
* it should be as same as $Output->data[]->module_srl.
**/
function syncModuleToSite(&$data) {
if(!$data) return;
@ -1087,7 +1049,7 @@
}
/**
* @brief site_module_info 관리자 인지 체크
* @brief Check if it is an administrator of site_module_info
**/
function isSiteAdmin($member_info, $site_srl = null) {
if(!$member_info->member_srl) return false;
@ -1112,7 +1074,7 @@
}
/**
* @brief site의 관리자 정보를 구함
* @brief Get admin information of the site
**/
function getSiteAdmin($site_srl) {
$args->site_srl = $site_srl;
@ -1121,7 +1083,7 @@
}
/**
* @brief 특정 모듈의 관리자 아이디 구함
* @brief Get admin ID of the module
**/
function getAdminId($module_srl) {
$obj->module_srl = $module_srl;
@ -1132,8 +1094,8 @@
}
/**
* @brief 특정 모듈의 추가 변수를 구함
* modules 테이블의 기본 정보 이외의
* @brief Get extra vars of the module
* Extra information, not in the modules table
**/
function getModuleExtraVars($module_srl) {
if(is_array($module_srl)) $module_srl = implode(',',$module_srl);
@ -1150,7 +1112,7 @@
}
/**
* @brief 특정 모듈의 스킨 정보를 구함
* @brief Get skin information of the module
**/
function getModuleSkinVars($module_srl) {
$args->module_srl = $module_srl;
@ -1163,7 +1125,7 @@
}
/**
* @brief 특정 모듈의 스킨 정보를 모듈 정보와 결합
* @brief Combine skin information with module information
**/
function syncSkinInfoToModuleInfo(&$module_info) {
if(!$module_info->module_srl) return;
@ -1179,14 +1141,14 @@
}
/**
* @brief 특정 모듈정보와 XML, 그리고 회원 정보로 권한을 return
* @brief Return permission by using module info, xml info and member info
**/
function getGrant($module_info, $member_info, $xml_info = '') {
if(!$xml_info) {
$module = $module_info->module;
$xml_info = $this->getModuleActionXml($module);
}
// 그룹 권한 설정에 필요한 변수를 세팅
// Set variables to grant group permission
$module_srl = $module_info->module_srl;
$grant_info = $xml_info->grant;
if($member_info->member_srl) {
@ -1195,32 +1157,26 @@
} else {
$group_list = array();
}
// module_srl이 없는 즉 별도의 권한 설정이 안되는 경우
// If module_srl doesn't exist(if unable to set permissions)
if(!$module_srl) {
$grant->access = true;
if($this->isSiteAdmin($member_info)) $grant->access = $grant->is_admin = $grant->manager = true;
else $grant->is_admin = $grant->manager = $member_info->is_admin=='Y'?true:false;
// module_srl이 있는 경우
// If module_srl exists
} else {
// grant 종류를 구함
// Get a type of granted permission
$grant->access = $grant->is_admin = $grant->manager = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info))?true:false;
// 관리자가 아니라 로그인 회원일 경우 이 모듈의 관리자인지 확인
// If a just logged-in member is, check if the member is a module administrator
if(!$grant->manager && $member_info->member_srl) {
$args->module_srl = $module_srl;
$args->member_srl = $member_info->member_srl;
$output = executeQuery('module.getModuleAdmin',$args);
if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = $grant->is_admin = true;
}
// 관리자가 아니면 직접 DB에서 정보를 구해서 권한 설정
// If not an administrator, get information from the DB and grant manager privilege.
if(!$grant->manager) {
$args = null;
// 플래닛인 경우 planet home의 권한 설정을 가져온다
// If planet, get permission settings from the planet home
if ($module_info->module == 'planet') {
$output = executeQueryArray('module.getPlanetGrants', $args);
}
@ -1232,35 +1188,32 @@
$grant_exists = $granted = array();
if($output->data) {
// 1차적으로 권한 대상 이름과 그룹을 정리
// Arrange names and groups who has privileges
foreach($output->data as $val) {
$grant_exists[$val->name] = true;
if($granted[$val->name]) continue;
// 로그인 회원만
// Log-in member only
if($val->group_srl == -1) {
$granted[$val->name] = true;
if($member_info->member_srl) $grant->{$val->name} = true;
// 사이트 가입한 회원만
// Site-joined member only
} elseif($val->group_srl == -2) {
$granted[$val->name] = true;
// 비로그인 회원이면 권한 미부여
// Do not grant any permission for non-logged member
if(!$member_info->member_srl) $grant->{$val->name} = false;
// 로그인 회원
// Log-in member
else {
$site_module_info = Context::get('site_module_info');
// 현재 접속된 사이트 정보가 없으면 권한 부여
// Permission granted if no information of the currently connected site exists
if(!$site_module_info->site_srl) $grant->{$val->name} = true;
// 현재 접속된 사이트의 그룹 정보가 있 으면 권한 미부여
// Permission is not granted if information of the currently connected site exists
elseif(count($group_list)) $grant->{$val->name} = true;
}
// 비로그인 회원 모두
// All of non-logged members
} elseif($val->group_srl == 0) {
$granted[$val->name] = true;
$grant->{$val->name} = true;
// 특정 그룹 대상일 경우
// If a target is a group
} else {
if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) {
$grant->{$val->name} = true;
@ -1269,8 +1222,7 @@
}
}
}
// 가상 그룹인 access에 대해서 별도 처리
// Separate processing for the virtual group access
if(!$grant_exists['access']) $grant->access = true;
if(count($grant_info)) {
foreach($grant_info as $grant_name => $grant_item) {
@ -1297,8 +1249,7 @@
}
}
}
// 관리자일 경우 모든 권한에 대해 true 지정
// Set true to grant all privileges if an administrator is
if($grant->manager) {
$grant->access = true;
if(count($grant_info)) {

View file

@ -2,27 +2,26 @@
/**
* @class moduleView
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 view class
* @brief view class of the module module
**/
class moduleView extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// template path 지정
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 스킨 정보 출력
* @brief Display skin information
**/
function dispModuleSkinInfo() {
$selected_module = Context::get('selected_module');
$skin = Context::get('skin');
// 모듈/스킨 정보를 구함
// Get modules/skin information
$module_path = sprintf("./modules/%s/", $selected_module);
if(!is_dir($module_path)) $this->stop("msg_invalid_request");
@ -38,22 +37,19 @@
}
/**
* @brief 모듈 선택기
* @brief Select a module
**/
function dispModuleSelectList() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
$oModuleModel = &getModel('module');
// virtual site의 개수를 추출
// Extract the number of virtual sites
$output = executeQuery('module.getSiteCount');
$site_count = $output->data->count;
Context::set('site_count', $site_count);
// 사이트 검색어 변수 설정
// Variable setting for site keyword
$site_keyword = Context::get('site_keyword');
// 사이트 검색어가 없으면 현재 가상 사이트의 정보를 설정
// If there is no site keyword, use as information of the current virtual site
$args = null;
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y') {
@ -70,7 +66,7 @@
$args->site_srl = 0;
$module_category_exists = true;
}
// 사이트 검색어가 있으면 해당 사이트(들)의 정보를 추출
// If site keyword exists, extract information from the sites
} else {
$args->site_keyword = $site_keyword;
}
@ -80,8 +76,7 @@
$args->site_srl = (int)$site_module_info->site_srl;
}
//if(is_null($args->site_srl)) $query_id = 'module.getDefaultModules';
// 지정된 사이트(혹은 전체)의 module 목록을 구함
// Get a list of modules at the site
$output = executeQueryArray($query_id, $args);
$category_list = $mid_list = array();
if(count($output->data)) {
@ -110,16 +105,12 @@
Context::set('selected_module', $selected_module);
Context::set('selected_mids', $mid_list[$selected_module]->list);
Context::set('module_category_exists', $module_category_exists);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_selector');
}
// 파일 박스 보기
// See the file box
function dispModuleFileBox(){
$logged_info = Context::get('logged_info');
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
@ -145,8 +136,7 @@
$this->setLayoutFile('popup_layout');
$this->setTemplateFile('filebox_list');
}
// 파일 박스 등록화면
// Screen to add a file box
function dispModuleFileBoxAdd(){
$logged_info = Context::get('logged_info');
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');