mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 07:11:42 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@119 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a347783ce9
commit
f0edc7f054
16 changed files with 156 additions and 66 deletions
|
|
@ -87,6 +87,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DB및 기타 자원들의 close
|
||||
**/
|
||||
function close() {
|
||||
// DB close
|
||||
$oDB = &DB::getInstance();
|
||||
if($oDB) $oDB->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DB 정보를 설정하고 DB Type과 DB 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -128,7 +128,8 @@
|
|||
if($GLOBALS['__db_elapsed_time__']) $buff .= sprintf("\tDB queries elapsed time\t\t: %0.5f sec\n", $GLOBALS['__db_elapsed_time__']);
|
||||
$buff .= sprintf("\tclass file load elapsed time \t: %0.5f sec\n", __RequireClassEndTime__-__RequireClassStartTime__);
|
||||
$buff .= sprintf("\tTemplate compile elapsed time\t: %0.5f sec\n", $GLOBALS['__template_elapsed__']);
|
||||
$buff .= sprintf("\tPHP elapsed time \t\t: %0.5f sec\n", $end-__StartTime__-$GLOBALS['__template_elapsed__']-$GLOBALS['__db_elapsed_time__']-(__RequireClassEndTime__-__RequireClassStartTime__));
|
||||
$buff .= sprintf("\tXmlParse compile elapsed time\t: %0.5f sec\n", $GLOBALS['__xmlparse_elapsed__']);
|
||||
$buff .= sprintf("\tPHP elapsed time \t\t: %0.5f sec\n", $end-__StartTime__-$GLOBALS['__template_elapsed__']-$GLOBALS['__xmlparse_elapsed__']-$GLOBALS['__db_elapsed_time__']-(__RequireClassEndTime__-__RequireClassStartTime__));
|
||||
$buff .= sprintf("\tTotal elapsed time \t\t: %0.5f sec", $end-__StartTime__);
|
||||
|
||||
debugPrint($buff, false);
|
||||
|
|
|
|||
|
|
@ -57,14 +57,14 @@
|
|||
}
|
||||
|
||||
// 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴
|
||||
$action_info = $oModuleModel->getActionInfo($module);
|
||||
$xml_info = $oModuleModel->getModuleXmlInfo($module);
|
||||
|
||||
// 현재 요청된 act가 있으면 $action_info에서 type을 찾음, 없다면 기본 action을 이용
|
||||
if(!$act || !$action_info->{$act}) $act = $action_info->default_action;
|
||||
// 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용
|
||||
if(!$act || !$xml_info->{$act}) $act = $xml_info->default_action;
|
||||
|
||||
// type, grant 값 구함
|
||||
$type = $action_info->{$act}->type;
|
||||
$grant = $action_info->{$act}->grant;
|
||||
$type = $xml_info->action->{$act}->type;
|
||||
$grant = $xml_info->action->{$act}->grant;
|
||||
|
||||
// act값을 Context에 세팅
|
||||
Context::set('act', $act, true);
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
$oModule = &$this->getModuleInstance($module, $type);
|
||||
|
||||
// 모듈 정보 세팅
|
||||
$oModule->setModuleInfo($module_info);
|
||||
$oModule->setModuleInfo($module_info, $xml_info);
|
||||
|
||||
if(!is_object($oModule)) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@
|
|||
/**
|
||||
* @brief 모듈의 정보 세팅
|
||||
**/
|
||||
function setModuleInfo($module_info) {
|
||||
function setModuleInfo($module_info, $xml_info) {
|
||||
|
||||
// 기본 변수 설정
|
||||
$this->mid = $module_info->mid;
|
||||
$this->module = $module_info->module;
|
||||
|
|
@ -63,29 +64,43 @@
|
|||
}
|
||||
|
||||
// 권한 설정
|
||||
if($this->grant_list) {
|
||||
foreach($this->grant_list as $grant_name) {
|
||||
if($xml_info->grant) {
|
||||
foreach($xml_info->grant as $grant_name => $grant_item) {
|
||||
$title = $grant_item->title;
|
||||
$default = $grant_item->default;
|
||||
|
||||
$grant->{$grant_name} = false;
|
||||
|
||||
if($grant->is_admin || !$this->module_info->grant[$grant_name]) {
|
||||
if($grant->is_admin) {
|
||||
$grant->{$grant_name} = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(count($user_group)) {
|
||||
foreach($user_group as $group_srl) {
|
||||
if(in_array($group_srl, $this->module_info->grant[$grant_name])) {
|
||||
if(in_array($group_srl, $this->module_info->grants[$grant_name])) {
|
||||
$grant->{$grant_name} = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch($default) {
|
||||
case 'guest' :
|
||||
$grant->{$grant_name} = true;
|
||||
break;
|
||||
case 'member' :
|
||||
if($is_logged) $grant->{$grant_name} = true;
|
||||
break;
|
||||
case 'root' :
|
||||
if($grant->is_admin) $grant->{$grant_name} = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 권한변수 설정
|
||||
$this->grant = $grant;
|
||||
Context::set('grant',$this->grant);
|
||||
|
||||
// 모듈의 init method 실행
|
||||
$this->init();
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@
|
|||
* @brief xml 파싱
|
||||
**/
|
||||
function parse($input = '') {
|
||||
// 디버그를 위한 컴파일 시작 시간 저장
|
||||
if(__DEBUG__) $start = getMicroTime();
|
||||
|
||||
$this->lang = Context::getLangType();
|
||||
|
||||
$this->input = $input?$input:$GLOBALS['HTTP_RAW_POST_DATA'];
|
||||
|
|
@ -68,7 +71,16 @@
|
|||
xml_parser_free($this->oParser);
|
||||
|
||||
if(!count($this->output)) return;
|
||||
return array_shift($this->output);
|
||||
|
||||
$output = array_shift($this->output);
|
||||
|
||||
// 디버그를 위한 컴파일 시작 시간 저장
|
||||
if(__DEBUG__) {
|
||||
$parsing_elapsed = getMicroTime() - $start;
|
||||
$GLOBALS['__xmlparse_elapsed__'] += $parsing_elapsed;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -51,4 +51,9 @@
|
|||
**/
|
||||
$oDisplayHandler = new DisplayHandler();
|
||||
$oDisplayHandler->printContent($oModule);
|
||||
|
||||
/**
|
||||
* @brief Context::close()를 통해서 DB및 기타 사용된 자원들의 처리
|
||||
**/
|
||||
$oContext->close();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispAdminIndex" manage_action="">
|
||||
<action name="dispAdminIndex" type="view" grant="" />
|
||||
<actions>
|
||||
<action name="dispAdminIndex" type="view" grant="root" />
|
||||
<actions>
|
||||
</module>
|
||||
|
|
@ -14,14 +14,6 @@
|
|||
var $page_count = 10; ///< 페이지의 수
|
||||
var $category_list = NULL; ///< 카테고리 목록
|
||||
|
||||
var $grant_list = array(
|
||||
'list',
|
||||
'view',
|
||||
'write_document',
|
||||
'write_comment',
|
||||
'fileupload',
|
||||
); ///< 권한의 종류를 미리 설정
|
||||
|
||||
var $editor = 'default'; ///< 에디터 종류
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispContent" manage_action="dispAdminContent">
|
||||
<action name="dispContent" type="view" grant="" />
|
||||
<action name="dispWrite" type="view" grant="" />
|
||||
<action name="dispDelete" type="view" grant="" />
|
||||
<action name="dispCommentReply" type="view" grant="" />
|
||||
<action name="dispCommentModify" type="view" grant="" />
|
||||
<action name="dispCommentDelete" type="view" grant="" />
|
||||
<action name="dispTrackbackDelete" type="view" grant="" />
|
||||
<action name="dispLogin" type="view" grant="" />
|
||||
<action name="dispLogout" type="view" grant="" />
|
||||
<action name="dispMessage" type="view" grant="" />
|
||||
<action name="dispRss" type="view" grant="" />
|
||||
<action name="dispAdminContent" type="view" grant="admin" />
|
||||
<action name="dispAdminBoardInfo" type="view" grant="admin" />
|
||||
<action name="dispAdminInsertBoard" type="view" grant="admin" />
|
||||
<action name="dispAdminDeleteBoard" type="view" grant="admin" />
|
||||
<action name="dispAdminSkinInfo" type="view" grant="admin" />
|
||||
<action name="dispAdminCategoryInfo" type="view" grant="admin" />
|
||||
<action name="dispAdminGrantInfo" type="view" grant="admin" />
|
||||
</module>
|
||||
49
modules/board/conf/module.xml
Normal file
49
modules/board/conf/module.xml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispContent" manage_action="dispAdminContent">
|
||||
<grants>
|
||||
<grant name="list" default="guest">
|
||||
<title xml:lang="ko">목록</title>
|
||||
<title xml:lang="en">list</title>
|
||||
</grant>
|
||||
<grant name="view" default="guest">
|
||||
<title xml:lang="ko">열람</title>
|
||||
<title xml:lang="en">view</title>
|
||||
</grant>
|
||||
<grant name="write_document" default="guest">
|
||||
<title xml:lang="ko">글 작성</title>
|
||||
<title xml:lang="en">write document</title>
|
||||
</grant>
|
||||
<grant name="write_comment" default="guest">
|
||||
<title xml:lang="ko">댓글 작성</title>
|
||||
<title xml:lang="en">write comment</title>
|
||||
</grant>
|
||||
<grant name="fileupload" default="guest">
|
||||
<title xml:lang="ko">파일 첨부</title>
|
||||
<title xml:lang="en">file upload</title>
|
||||
</grant>
|
||||
<grant name="management" default="root">
|
||||
<title xml:lang="ko">관리</title>
|
||||
<title xml:lang="en">management</title>
|
||||
</grant>
|
||||
</grants>
|
||||
<actions>
|
||||
<action name="dispContent" type="view" />
|
||||
<action name="dispWrite" type="view" />
|
||||
<action name="dispDelete" type="view" />
|
||||
<action name="dispCommentReply" type="view" />
|
||||
<action name="dispCommentModify" type="view" />
|
||||
<action name="dispCommentDelete" type="view" />
|
||||
<action name="dispTrackbackDelete" type="view" />
|
||||
<action name="dispLogin" type="view" />
|
||||
<action name="dispLogout" type="view" />
|
||||
<action name="dispMessage" type="view" />
|
||||
<action name="dispRss" type="view" />
|
||||
<action name="dispAdminContent" type="view" grant="root" />
|
||||
<action name="dispAdminBoardInfo" type="view" grant="root" />
|
||||
<action name="dispAdminInsertBoard" type="view" grant="root" />
|
||||
<action name="dispAdminDeleteBoard" type="view" grant="root" />
|
||||
<action name="dispAdminSkinInfo" type="view" grant="root" />
|
||||
<action name="dispAdminCategoryInfo" type="view" grant="root" />
|
||||
<action name="dispAdminGrantInfo" type="view" grant="root" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispIntroduce" manage_action="">
|
||||
<action name="dispIntroduce" type="view" grant="" />
|
||||
<action name="dispInstallForm" type="view" grant="" />
|
||||
<action name="procInstall" type="controller" grant="" />
|
||||
</module>
|
||||
9
modules/install/conf/module.xml
Normal file
9
modules/install/conf/module.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispIntroduce">
|
||||
<grants />
|
||||
<actions>
|
||||
<action name="dispIntroduce" type="view" grant="guest" />
|
||||
<action name="dispInstallForm" type="view" grant="guest" />
|
||||
<action name="procInstall" type="controller" grant="guest" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module version="0.1">
|
||||
<action name="viewIntroduce" type="view" default="true" />
|
||||
<action name="viewDBInfoForm" type="view" />
|
||||
<action name="doInstall" type="controller" />
|
||||
</module>
|
||||
8
modules/member/conf/module.xml
Normal file
8
modules/member/conf/module.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module version="0.1" default_action="viewIntroduce" >
|
||||
<actions>
|
||||
<action name="viewIntroduce" type="view" />
|
||||
<action name="viewDBInfoForm" type="view" />
|
||||
<action name="doInstall" type="controller" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispContent" manage_action="">
|
||||
<action name="dispContent" type="view" grant="" />
|
||||
<actions>
|
||||
<action name="dispContent" type="view" grant="guest" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
@ -14,30 +14,49 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief module의 conf/action.xml 을 통해 act값에 해당하는 action type을 return
|
||||
* @brief module의 conf/module.xml 을 통해 grant(권한) 및 action 데이터를 return
|
||||
**/
|
||||
function getActionInfo($module) {
|
||||
function getModuleXmlInfo($module) {
|
||||
$class_path = ModuleHandler::getModulePath($module);
|
||||
if(!$class_path) return;
|
||||
|
||||
$action_xml_file = sprintf("%sconf/action.xml", $class_path);
|
||||
$action_xml_file = sprintf("%sconf/module.xml", $class_path);
|
||||
if(!file_exists($action_xml_file)) return;
|
||||
|
||||
$xml_obj = XmlParser::loadXmlFile($action_xml_file);
|
||||
if(!count($xml_obj->module)) return;
|
||||
|
||||
$output->default_action = $xml_obj->module->attrs->default_action;
|
||||
$output->manage_action = $xml_obj->module->attrs->manage_action;
|
||||
$output->default_action = $xml_obj->module->attrs->default_action; ///< 별도의 action이 지정되지 않으면 호출될 action
|
||||
$output->manage_action = $xml_obj->module->attrs->manage_action; ///< 관리자용으로 사용될 기본 action
|
||||
|
||||
if(is_array($xml_obj->module->action)) $action_list = $xml_obj->module->action;
|
||||
else $action_list[] = $xml_obj->module->action;
|
||||
$grants = $xml_obj->module->grants->grant; ///< 권한 정보 (없는 경우도 있음)
|
||||
$actions = $xml_obj->module->actions->action; ///< action list (필수)
|
||||
|
||||
// 권한 정보의 정리
|
||||
if(is_array($grants)) $grant_list = $grants;
|
||||
else $grant_list[] = $grants;
|
||||
|
||||
foreach($grant_list as $grant) {
|
||||
$name = $grant->attrs->name;
|
||||
$default = $grant->attrs->default;
|
||||
$title = $grant->title->body;
|
||||
if(!$default) $default = 'guest';
|
||||
|
||||
$output->grant->{$name}->title = $title;
|
||||
$output->grant->{$name}->default = $default;
|
||||
}
|
||||
|
||||
// actions 정리
|
||||
if(is_array($actions)) $action_list = $actions;
|
||||
else $action_list[] = $actions;
|
||||
|
||||
foreach($action_list as $action) {
|
||||
$name = $action->attrs->name;
|
||||
$type = $action->attrs->type;
|
||||
$grant = $action->attrs->grant;
|
||||
$output->{$name}->type = $type;
|
||||
$output->{$name}->grant = $grant;
|
||||
if(!$grant) $grant = 'guest';
|
||||
$output->action->{$name}->type = $type;
|
||||
$output->action->{$name}->grant = $grant;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue