mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-13 16:34:52 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@50 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6d33930737
commit
246b649379
19 changed files with 0 additions and 0 deletions
4
modules/module/conf/action.xml
Normal file
4
modules/module/conf/action.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispContent" manage_action="">
|
||||
<action name="dispContent" type="view" grant="" />
|
||||
</module>
|
||||
11
modules/module/conf/info.xml
Normal file
11
modules/module/conf/info.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module version="0.1">
|
||||
<title xml:lang="ko">모듈 관리</title>
|
||||
<title xml:lang="en">module management</title>
|
||||
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
|
||||
<name xml:lang="ko">제로</name>
|
||||
<name xml:lang="en">zero</name>
|
||||
<description xml:lang="ko">모듈 관리 모듈</description>
|
||||
<description xml:lang="en">module management</description>
|
||||
</author>
|
||||
<module>
|
||||
13
modules/module/lang/ko.lang.php
Normal file
13
modules/module/lang/ko.lang.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* @file ko.lang.php
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 한국어 언어팩
|
||||
**/
|
||||
|
||||
$lang->module_name = "모듈 이름";
|
||||
$lang->module_table_count = "테이블수";
|
||||
$lang->module_date = "제작일";
|
||||
$lang->module_installed_path = "설치경로";
|
||||
$lang->module_version = "버전";
|
||||
?>
|
||||
459
modules/module/module_manager.controller.php
Normal file
459
modules/module/module_manager.controller.php
Normal file
|
|
@ -0,0 +1,459 @@
|
|||
<?php
|
||||
/**
|
||||
* @file : modules/module/module_manager.module.php
|
||||
* @author : zero <zero@nzeo.com>
|
||||
* @desc : 기본 모듈중의 하나
|
||||
* Module class에서 상속을 받아서 사용
|
||||
* 모듈과 관련된 method들이 존재
|
||||
**/
|
||||
|
||||
class module_manager extends Module {
|
||||
|
||||
/**
|
||||
* 모듈의 정보
|
||||
**/
|
||||
var $cur_version = "20070130_0.01";
|
||||
|
||||
/**
|
||||
* 기본 action 지정
|
||||
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
|
||||
**/
|
||||
var $default_act = '';
|
||||
|
||||
/**
|
||||
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
|
||||
* css/js파일의 load라든지 lang파일 load등을 미리 선언
|
||||
*
|
||||
* Init() => 공통
|
||||
* dispInit() => disp시에
|
||||
* procInit() => proc시에
|
||||
*
|
||||
* $this->module_path는 현재 이 모듈파일의 위치를 나타낸다
|
||||
* (ex: $this->module_path = "./modules/module/";
|
||||
**/
|
||||
|
||||
// 초기화
|
||||
function init() {/*{{{*/
|
||||
Context::loadLang($this->module_path.'lang');
|
||||
}/*}}}*/
|
||||
|
||||
// disp 초기화
|
||||
function dispInit() {/*{{{*/
|
||||
return true;
|
||||
}/*}}}*/
|
||||
|
||||
// proc 초기화
|
||||
function procInit() {/*{{{*/
|
||||
return true;
|
||||
}/*}}}*/
|
||||
|
||||
/**
|
||||
* 여기서부터는 action의 구현
|
||||
* request parameter의 경우 각 method의 첫번째 인자로 넘어온다
|
||||
*
|
||||
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
|
||||
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
|
||||
*
|
||||
* 변수의 사용은 Context::get('이름')으로 얻어오면 된다
|
||||
**/
|
||||
|
||||
/**
|
||||
* 여기서부터는 관련 lib...
|
||||
**/
|
||||
// public string getModuleInfoByDocument($document_srl)/*{{{*/
|
||||
// $document_srl로 모듈정보를 구함
|
||||
function getModuleInfoByDocument($document_srl) {
|
||||
$oDB = &DB::getInstance();
|
||||
$args->document_srl = $document_srl;
|
||||
$output = $oDB->executeQuery('module_manager.getModuleInfoByDocument', $args);
|
||||
// extra_vars의 정리
|
||||
$module_info = module_manager::extractExtraVar($output->data);
|
||||
return $module_info;
|
||||
}/*}}}*/
|
||||
|
||||
// public object getModuleInfo($mid='')/*{{{*/
|
||||
// $mid의 정보를 load, mid값이 없다면 기본 mid 정보를 읽음
|
||||
function getModuleInfo($mid='') {
|
||||
// DB에서 가져옴
|
||||
$oDB = &DB::getInstance();
|
||||
if($mid) {
|
||||
$args->mid = $mid;
|
||||
$output = $oDB->executeQuery('module_manager.getMidInfo', $args);
|
||||
}
|
||||
if(!$output->data) $output = $oDB->executeQuery('module_manager.getDefaultMidInfo');
|
||||
return module_manager::arrangeModuleInfo($output->data);
|
||||
}/*}}}*/
|
||||
|
||||
// public object getModuleInfoByModuleSrl($module_srl='')/*{{{*/
|
||||
// $modulr_srl로 모듈의 정보를 읽음
|
||||
function getModuleInfoByModuleSrl($module_srl='') {
|
||||
$oDB = &DB::getInstance();
|
||||
$args->module_srl = $module_srl;
|
||||
$output = $oDB->executeQuery('module_manager.getMidInfo', $args);
|
||||
if(!$output->data) return;
|
||||
return module_manager::arrangeModuleInfo($output->data);
|
||||
}/*}}}*/
|
||||
|
||||
// public object arrangeModuleInfo($source_module_info)/*{{{*/
|
||||
// grant, extraVar등의 정리
|
||||
function arrangeModuleInfo($source_module_info) {
|
||||
if(!$source_module_info) return;
|
||||
|
||||
// serialize되어 있는 변수들 추출
|
||||
$extra_vars = $source_module_info->extra_vars;
|
||||
$grant = $source_module_info->grant;
|
||||
//$admin_id = $source_module_info->admin_id;
|
||||
|
||||
unset($source_module_info->extra_vars);
|
||||
unset($source_module_info->grant);
|
||||
//unset($source_module_info->admin_id);
|
||||
|
||||
$module_info = clone($source_module_info);
|
||||
|
||||
// extra_vars의 정리
|
||||
if($extra_vars) {
|
||||
$extra_vars = unserialize($extra_vars);
|
||||
foreach($extra_vars as $key => $val) if(!$module_info->{$key}) $module_info->{$key} = $val;
|
||||
}
|
||||
|
||||
// 권한의 정리
|
||||
if($grant) $module_info->grant = unserialize($grant);
|
||||
|
||||
// 관리자 아이디의 정리
|
||||
if($module_info->admin_id) {
|
||||
$module_info->admin_id = explode(',',$module_info->admin_id);
|
||||
}
|
||||
|
||||
return $module_info;
|
||||
}/*}}}*/
|
||||
|
||||
// public object getModuleObject($module)/*{{{*/
|
||||
// module을 찾아서 instance를 생성하여 return
|
||||
function getModuleObject($module) {
|
||||
// 요청받은 모듈이 있는지 확인
|
||||
$module = strtolower($module);
|
||||
|
||||
// global 변수에 저장한 객체가 있으면 그걸 return
|
||||
if($GLOBALS['_loaded_module'][$module]) return $GLOBALS['_loaded_module'][$module];
|
||||
|
||||
$class_path = sprintf('./modules/%s/', $module);
|
||||
if(!is_dir($class_path)) $class_path = sprintf('./classs/modules/%s/', $module);
|
||||
if(!is_dir($class_path)) return NULL;
|
||||
|
||||
$class_file = $class_path.$module.'.module.php';
|
||||
if(!file_exists($class_file)) return NULL;
|
||||
|
||||
// 새로 객체 생성
|
||||
require_once($class_file);
|
||||
$eval_str = sprintf('$oModule = new %s();', $module);
|
||||
eval($eval_str);
|
||||
$oModule->setModulePath($class_path);
|
||||
|
||||
// 언어파일 읽기
|
||||
Context::loadLang($class_path.'lang');
|
||||
|
||||
$GLOBALS['_loaded_module'][$module] = $oModule;
|
||||
|
||||
// 객체 리턴
|
||||
return $oModule;
|
||||
}/*}}}*/
|
||||
|
||||
// public object getAdminModuleObject($module)/*{{{*/
|
||||
// module의 관리자를 찾아서 instance를 생성하여 return
|
||||
function getAdminModuleObject($module) {
|
||||
// 요청받은 모듈이 있는지 확인
|
||||
$module = strtolower($module);
|
||||
|
||||
// global 변수에 저장한 객체가 있으면 그걸 return
|
||||
if($GLOBALS['_loaded_admin_module'][$module]) return $GLOBALS['_loaded_admin_module'][$module];
|
||||
|
||||
$class_path = sprintf('./modules/%s/', $module);
|
||||
if(!is_dir($class_path)) $class_path = sprintf('./classs/modules/%s/', $module);
|
||||
if(!is_dir($class_path)) return NULL;
|
||||
|
||||
$class_file = $class_path.$module.'.admin.php';
|
||||
if(!file_exists($class_file)) return NULL;
|
||||
|
||||
// 새로 객체 생성
|
||||
require_once($class_file);
|
||||
$eval_str = sprintf('$oModule = new %s_admin();', $module);
|
||||
eval($eval_str);
|
||||
$oModule->setModulePath($class_path);
|
||||
$oModule->init();
|
||||
|
||||
$template_path = sprintf("%sadmin/", $class_path);
|
||||
$oModule->setTemplatePath($template_path);
|
||||
|
||||
// 언어파일 읽기
|
||||
Context::loadLang($class_path.'lang');
|
||||
|
||||
// global 변수에 객체 저장
|
||||
$GLOBALS['_loaded_admin_module'][$module] = $oModule;
|
||||
|
||||
return $oModule;
|
||||
}/*}}}*/
|
||||
|
||||
// public object makeDefaultModule() /*{{{*/
|
||||
// 설치시 기본 모듈을 생성
|
||||
function makeDefaultModule() {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 설치된 기본 모듈이 있는지 확인
|
||||
$output = $oDB->executeQuery('module_manager.getDefaultMidInfo');
|
||||
if($output->data) return;
|
||||
|
||||
// 기본 모듈 입력
|
||||
$args->mid = 'board';
|
||||
$args->browser_title = '테스트 모듈';
|
||||
$args->is_default = 'Y';
|
||||
$args->module = 'board';
|
||||
$args->skin = 'default';
|
||||
|
||||
$extra_vars->colorset = 'normal';
|
||||
$args->extra_vars = serialize($extra_vars);
|
||||
|
||||
return $this->insertModule($args);
|
||||
}/*}}}*/
|
||||
|
||||
// public object insertModule($args)/*{{{*/
|
||||
// 모듈 입력
|
||||
function insertModule($args) {
|
||||
// 등록하려는 모듈의 path를 구함
|
||||
$oModule = getModule($args->module);
|
||||
|
||||
// 선택된 스킨정보에서 colorset을 구함
|
||||
$skin_info = $this->loadSkinInfo($oModule->module_path, $args->skin);
|
||||
$extra_vars->colorset = $skin_info->colorset[0]->name;
|
||||
|
||||
// db에 입력
|
||||
$oDB = &DB::getInstance();
|
||||
$args->module_srl = $oDB->getNextSequence();
|
||||
$args->extra_vars = serialize($extra_vars);
|
||||
$output = $oDB->executeQuery('module_manager.insertModule', $args);
|
||||
$output->add('module_srl',$args->module_srl);
|
||||
return $output;
|
||||
}/*}}}*/
|
||||
|
||||
// public object updateModule($args)/*{{{*/
|
||||
// 모듈 입력
|
||||
function updateModule($args) {
|
||||
$oDB = &DB::getInstance();
|
||||
$output = $oDB->executeQuery('module_manager.updateModule', $args);
|
||||
$output->add('module_srl',$args->module_srl);
|
||||
return $output;
|
||||
}/*}}}*/
|
||||
|
||||
// public object updateModuleExtraVars($args)/*{{{*/
|
||||
// 모듈 입력
|
||||
function updateModuleExtraVars($module_srl, $extra_vars) {
|
||||
$oDB = &DB::getInstance();
|
||||
$args->module_srl = $module_srl;
|
||||
$args->extra_vars = $extra_vars;
|
||||
$output = $oDB->executeQuery('module_manager.updateModuleExtraVars', $args);
|
||||
return $output;
|
||||
}/*}}}*/
|
||||
|
||||
// public object updateModuleGrant($module_srl, $grant)/*{{{*/
|
||||
// 모듈 입력
|
||||
function updateModuleGrant($module_srl, $grant) {
|
||||
$oDB = &DB::getInstance();
|
||||
$args->module_srl = $module_srl;
|
||||
$args->grant = $grant;
|
||||
$output = $oDB->executeQuery('module_manager.updateModuleGrant', $args);
|
||||
return $output;
|
||||
}/*}}}*/
|
||||
|
||||
// public object deleteModule($module_srl)/*{{{*/
|
||||
// 모듈 입력
|
||||
function deleteModule($module_srl) {
|
||||
$oDB = &DB::getInstance();
|
||||
$oDocument = getModule('document');
|
||||
|
||||
// addon 삭제
|
||||
// plugin 삭제
|
||||
|
||||
// document 삭제
|
||||
$output = $oDocument->deleteModuleDocument($module_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// category 삭제
|
||||
$output = $oDocument->deleteModuleCategory($module_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// trackbacks 삭제
|
||||
$oTrackback = getModule('trackback');
|
||||
$output = $oTrackback->deleteModuleTrackbacks($module_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// comments 삭제
|
||||
$oComment = getModule('comment');
|
||||
$output = $oComment->deleteModuleComments($module_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// tags 삭제
|
||||
$oTag = getModule('tag');
|
||||
$output = $oTag->deleteModuleTags($module_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// files 삭제
|
||||
$output = $oDocument->deleteModuleFiles($module_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// module 정보 삭제
|
||||
$args->module_srl = $module_srl;
|
||||
$output = $oDB->executeQuery('module_manager.deleteModule', $args);
|
||||
|
||||
return $output;
|
||||
}/*}}}*/
|
||||
|
||||
// public object clearDefaultModule() /*{{{*/
|
||||
// 모든 모듈의 is_default='N'로 세팅
|
||||
function clearDefaultModule() {
|
||||
$oDB = &DB::getInstance();
|
||||
return $oDB->executeQuery('module_manager.clearDefaultModule');
|
||||
}/*}}}*/
|
||||
|
||||
// public object getAdminModuleList() /*{{{*/
|
||||
// 관리자 모듈 목록을 가져옴
|
||||
function getAdminModuleList() {
|
||||
// 다운받은 모듈과 설치된 모듈의 목록을 구함
|
||||
$downloaded_list = FileHandler::readDir('./files/modules');
|
||||
$installed_list = FileHandler::readDir('./modules');
|
||||
|
||||
// 찾아진 모듈목록에서 admin은 제외시킴
|
||||
$searched_list = array_merge($downloaded_list, $installed_list);
|
||||
if(!count($searched_list)) return;
|
||||
|
||||
for($i=0;$i<count($searched_list);$i++) {
|
||||
$module_name = $searched_list[$i];
|
||||
$path = sprintf("./files/modules/%s/", $module_name);
|
||||
$file = sprintf("%s%s.admin.php",$path, $module_name);
|
||||
if(!file_exists($file)) {
|
||||
$path = sprintf("./modules/%s/", $module_name);
|
||||
$file = sprintf("%s%s.admin.php",$path, $module_name);
|
||||
}
|
||||
if(!file_exists($file)) continue;
|
||||
|
||||
$module_info = module_manager::loadModuleXml($path);
|
||||
$list[$module_name] = $module_info->title;
|
||||
}
|
||||
if($list) asort($list);
|
||||
return $list;
|
||||
}/*}}}*/
|
||||
|
||||
function loadModuleXml($module_path) {/*{{{*/
|
||||
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
|
||||
$xml_file = sprintf("%s/module.xml", $module_path);
|
||||
if(!file_exists($xml_file)) return;
|
||||
$oXmlParser = new XmlParser();
|
||||
$xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
||||
|
||||
// 스킨 정보를 이용 변수 정리
|
||||
if(!$xml_obj) return;
|
||||
|
||||
// 스킨이름
|
||||
$info->title = $xml_obj->title->body;
|
||||
|
||||
// 작성자 정보
|
||||
$module_info->title = $xml_obj->title->body;
|
||||
$module_info->version = $xml_obj->attrs->version;
|
||||
$module_info->author->name = $xml_obj->author->name->body;
|
||||
$module_info->author->email_address = $xml_obj->author->attrs->email_address;
|
||||
$module_info->author->homepage = $xml_obj->author->attrs->link;
|
||||
$module_info->author->date = $xml_obj->author->attrs->date;
|
||||
$module_info->author->description = $xml_obj->author->description->body;
|
||||
|
||||
// history
|
||||
if(!is_array($xml_obj->history->author)) $history[] = $xml_obj->history->author;
|
||||
else $history = $xml_obj->history->author;
|
||||
foreach($history as $item) {
|
||||
unset($obj);
|
||||
$obj->name = $item->name->body;
|
||||
$obj->email_address = $item->attrs->email_address;
|
||||
$obj->homepage = $item->attrs->link;
|
||||
$obj->date = $item->attrs->date;
|
||||
$obj->description = $item->description->body;
|
||||
$module_info->history[] = $obj;
|
||||
}
|
||||
|
||||
return $module_info;
|
||||
}/*}}}*/
|
||||
|
||||
function getSkins($module_path) {/*{{{*/
|
||||
$skins_path = sprintf("%s/skins/", $module_path);
|
||||
$list = FileHandler::readDir($skins_path);
|
||||
return $list;
|
||||
}/*}}}*/
|
||||
|
||||
function loadSkinInfo($module_path, $skin) {/*{{{*/
|
||||
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
|
||||
$skin_xml_file = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
|
||||
if(!file_exists($skin_xml_file)) return;
|
||||
$oXmlParser = new XmlParser();
|
||||
$xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
|
||||
|
||||
// 스킨 정보를 이용 변수 정리
|
||||
if(!$xml_obj) return;
|
||||
|
||||
// 스킨이름
|
||||
$skin_info->title = $xml_obj->title->body;
|
||||
|
||||
// 작성자 정보
|
||||
$skin_info->maker->name = $xml_obj->maker->name->body;
|
||||
$skin_info->maker->email_address = $xml_obj->maker->attrs->email_address;
|
||||
$skin_info->maker->homepage = $xml_obj->maker->attrs->link;
|
||||
$skin_info->maker->date = $xml_obj->maker->attrs->date;
|
||||
$skin_info->maker->description = $xml_obj->maker->description->body;
|
||||
|
||||
// colorset
|
||||
if(!is_array($xml_obj->colorset->color)) $colorset[] = $xml_obj->colorset->color;
|
||||
else $colorset = $xml_obj->colorset->color;
|
||||
foreach($colorset as $color) {
|
||||
$name = $color->attrs->name;
|
||||
$title = $color->title->body;
|
||||
$screenshot = $color->attrs->src;
|
||||
if($screenshot && file_exists($screenshot)) $screenshot = sprintf("%sskins/%s/%s",$module_path,$skin,$screenshot);
|
||||
else $screenshot = "";
|
||||
|
||||
unset($obj);
|
||||
$obj->name = $name;
|
||||
$obj->title = $title;
|
||||
$obj->screenshot = $screenshot;
|
||||
$skin_info->colorset[] = $obj;
|
||||
}
|
||||
|
||||
// 스킨에서 사용되는 변수들
|
||||
if(!is_array($xml_obj->extra_vars->var)) $extra_vars[] = $xml_obj->extra_vars->var;
|
||||
else $extra_vars = $xml_obj->extra_vars->var;
|
||||
foreach($extra_vars as $var) {
|
||||
$name = $var->attrs->name;
|
||||
$type = $var->attrs->type;
|
||||
$title = $var->title->body;
|
||||
$description = $var->description->body;
|
||||
if($var->default) {
|
||||
unset($default);
|
||||
if(is_array($var->default)) {
|
||||
for($i=0;$i<count($var->default);$i++) $default[] = $var->default[$i]->body;
|
||||
} else {
|
||||
$default = $var->default->body;
|
||||
}
|
||||
}
|
||||
$width = $var->attrs->width;
|
||||
$height = $var->attrs->height;
|
||||
|
||||
unset($obj);
|
||||
$obj->title = $title;
|
||||
$obj->description = $description;
|
||||
$obj->name = $name;
|
||||
$obj->type = $type;
|
||||
$obj->default = $default;
|
||||
$obj->width = $width;
|
||||
$obj->height = $height;
|
||||
|
||||
$skin_info->extra_vars[] = $obj;
|
||||
}
|
||||
|
||||
return $skin_info;
|
||||
}/*}}}*/
|
||||
}
|
||||
?>
|
||||
8
modules/module/module_manager.model.php
Normal file
8
modules/module/module_manager.model.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* @class module_manager
|
||||
* @author : zero <zero@nzeo.com>
|
||||
* @desc : 기본 모듈중의 하나
|
||||
* Module class에서 상속을 받아서 사용
|
||||
* 모듈과 관련된 method들이 존재
|
||||
**/
|
||||
119
modules/module/module_manager.view.php
Normal file
119
modules/module/module_manager.view.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
/**
|
||||
* @file : modules/module_manager/module_manager.admin.php
|
||||
* @author : zero <zero@nzeo.com>
|
||||
* @desc : module_manager의 관리자 파일
|
||||
* Module class에서 상속을 받아서 사용
|
||||
* action 의 경우 disp/proc 2가지만 존재하며 이는 action명세서에
|
||||
* 미리 기록을 하여야 함
|
||||
**/
|
||||
|
||||
class module_manager_admin extends Module {
|
||||
|
||||
/**
|
||||
* 기본 action 지정
|
||||
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
|
||||
**/
|
||||
var $default_act = 'dispContent';
|
||||
|
||||
/**
|
||||
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
|
||||
* css/js파일의 load라든지 lang파일 load등을 미리 선언
|
||||
*
|
||||
* Init() => 공통
|
||||
* dispInit() => disp시에
|
||||
* procInit() => proc시에
|
||||
*
|
||||
* $this->module_path는 현재 이 모듈파일의 위치를 나타낸다
|
||||
* (ex: $this->module_path = "./modules/system_install/";
|
||||
**/
|
||||
|
||||
// 초기화
|
||||
function init() {/*{{{*/
|
||||
|
||||
// 기본 정보를 읽음
|
||||
Context::loadLang($this->module_path.'lang');
|
||||
}/*}}}*/
|
||||
|
||||
// disp 초기화
|
||||
function dispInit() {/*{{{*/
|
||||
return true;
|
||||
}/*}}}*/
|
||||
|
||||
// proc 초기화
|
||||
function procInit() {/*{{{*/
|
||||
return true;
|
||||
}/*}}}*/
|
||||
|
||||
/**
|
||||
* 여기서부터는 action의 구현
|
||||
* request parameter의 경우 각 method의 첫번째 인자로 넘어온다
|
||||
*
|
||||
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
|
||||
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
|
||||
**/
|
||||
|
||||
// 출력 부분
|
||||
function dispContent() {/*{{{*/
|
||||
// 등록된 모듈의 목록을 구해옴
|
||||
$installed_module_list = $this->getModulesInfo();
|
||||
Context::set('installed_module_list', $installed_module_list);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
$this->setTemplateFile('index');
|
||||
}/*}}}*/
|
||||
|
||||
// 실행 부분
|
||||
|
||||
/**
|
||||
* 여기부터는 이 모듈과 관련된 라이브러리 개념의 method들
|
||||
**/
|
||||
function getModulesInfo() {/*{{{*/
|
||||
// DB 객체 생성
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 다운받은 모듈과 설치된 모듈의 목록을 구함
|
||||
$downloaded_list = FileHandler::readDir('./files/modules');
|
||||
$installed_list = FileHandler::readDir('./modules');
|
||||
|
||||
// 찾아진 모듈목록에서 admin은 제외시킴
|
||||
$searched_list = array_merge($downloaded_list, $installed_list);
|
||||
if(!count($searched_list)) return;
|
||||
|
||||
for($i=0;$i<count($searched_list);$i++) {
|
||||
|
||||
// 모듈의 이름
|
||||
$module_name = $searched_list[$i];
|
||||
|
||||
// 모듈의 경로 (files/modules가 우선)
|
||||
$path = sprintf("./files/modules/%s/", $module_name);
|
||||
if(!is_dir(!$path)) $path = sprintf("./modules/%s/", $module_name);
|
||||
if(!is_dir($path)) continue;
|
||||
|
||||
// schemas내의 테이블 생성 xml파일수를 구함
|
||||
$tmp_files = FileHandler::readDir($path."schemas");
|
||||
$table_count = count($tmp_files);
|
||||
|
||||
// 테이블이 설치되어 있는지 체크
|
||||
$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 ++;
|
||||
}
|
||||
|
||||
// 해당 모듈의 정보를 구함
|
||||
$info = module_manager::loadModuleXml($path);
|
||||
unset($obj);
|
||||
|
||||
$info->module = $module_name;
|
||||
$info->created_table_count = $created_table_count;
|
||||
$info->table_count = $table_count;
|
||||
$info->path = $path;
|
||||
|
||||
$list[] = $info;
|
||||
}
|
||||
return $list;
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
?>
|
||||
8
modules/module/queries/clearDefaultModule.xml
Normal file
8
modules/module/queries/clearDefaultModule.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<query id="clearDefaultModule" action="update">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="is_default" var="is_default" default="N" />
|
||||
</columns>
|
||||
</query>
|
||||
8
modules/module/queries/deleteModule.xml
Normal file
8
modules/module/queries/deleteModule.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<query id="deleteModule" action="delete">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
11
modules/module/queries/getDefaultMidInfo.xml
Normal file
11
modules/module/queries/getDefaultMidInfo.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="getDefaultMidInfo" action="select">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="is_default" default="Y" />
|
||||
</conditions>
|
||||
</query>
|
||||
12
modules/module/queries/getMidInfo.xml
Normal file
12
modules/module/queries/getMidInfo.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="getMidInfo" action="select">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="mid" var="mid" />
|
||||
<condition operation="equal" column="module_srl" var="module_srl" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
24
modules/module/queries/getModuleInfoByDocument.xml
Normal file
24
modules/module/queries/getModuleInfoByDocument.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<query id="getModuleInfoByDocument" action="select">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
<table name="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="modules.module_srl" alias="module_srl" />
|
||||
<column name="modules.mid" alias="mid" />
|
||||
<column name="modules.browser_title" alias="browser_title" />
|
||||
<column name="modules.description" alias="description" />
|
||||
<column name="modules.module" alias="module" />
|
||||
<column name="modules.is_default" alias="is_default" />
|
||||
<column name="modules.menu_srl" alias="menu_srl" />
|
||||
<column name="modules.config" alias="config" />
|
||||
<column name="modules.layout_file" alias="layout_file" />
|
||||
<column name="modules.header_text" alias="header_text" />
|
||||
<column name="modules.footer_text" alias="footer_text" />
|
||||
<column name="modules.regdate" alias="regdate" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="documents.document_srl" var="document_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="modules.module_srl" var="documents.module_srl" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
22
modules/module/queries/insertModule.xml
Normal file
22
modules/module/queries/insertModule.xml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<query id="insertModule" action="insert">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="module_srl" default="module_srl" notnull="notnull" />
|
||||
<column name="mid" var="mid" notnull="notnull" minlength="1" maxlength="40" />
|
||||
<column name="skin" var="skin" notnull="notnull" minlength="1" maxlength="250" />
|
||||
<column name="use_category" var="use_category" default="N" />
|
||||
<column name="browser_title" var="browser_title" notnull="notnull" minlength="1" maxlength="250" />
|
||||
<column name="description" var="description" />
|
||||
<column name="module" var="module" notnull="notnull" maxlength="80"/>
|
||||
<column name="is_default" var="is_default" default="N" notnull="notnull" />
|
||||
<column name="menu_srl" var="menu_srl" filter="number" />
|
||||
<column name="extra_vars" var="extra_vars" />
|
||||
<column name="layout_file" var="layout_file" maxlength="250" />
|
||||
<column name="admin_id" var="admin_id" maxlength="80" />
|
||||
<column name="header_text" var="header_text" />
|
||||
<column name="footer_text" var="footer_text" />
|
||||
<column name="regdate" default="curdate()" />
|
||||
</columns>
|
||||
</query>
|
||||
23
modules/module/queries/updateModule.xml
Normal file
23
modules/module/queries/updateModule.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<query id="updateModule" action="update">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="mid" var="mid" notnull="notnull" minlength="1" maxlength="40"/>
|
||||
<column name="skin" var="skin" notnull="notnull" minlength="1" maxlength="250" />
|
||||
<column name="use_category" var="use_category" default="N" />
|
||||
<column name="browser_title" var="browser_title" notnull="notnull" minlength="1" maxlength="250" />
|
||||
<column name="description" var="description" />
|
||||
<column name="module" var="module" notnull="notnull" maxlength="80"/>
|
||||
<column name="is_default" var="is_default" default="N" notnull="notnull" />
|
||||
<column name="menu_srl" var="menu_srl" filter="number" />
|
||||
<column name="extra_vars" var="extra_vars" />
|
||||
<column name="layout_file" var="layout_file" maxlength="250" />
|
||||
<column name="admin_id" var="admin_id" maxlength="80" />
|
||||
<column name="header_text" var="header_text" />
|
||||
<column name="footer_text" var="footer_text" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull"/>
|
||||
</conditions>
|
||||
</query>
|
||||
11
modules/module/queries/updateModuleExtraVars.xml
Normal file
11
modules/module/queries/updateModuleExtraVars.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="updateModuleExtraVars" action="update">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="extra_vars" var="extra_vars" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull"/>
|
||||
</conditions>
|
||||
</query>
|
||||
11
modules/module/queries/updateModuleGrant.xml
Normal file
11
modules/module/queries/updateModuleGrant.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="updateModuleGrant" action="update">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="grant" var="grant" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull"/>
|
||||
</conditions>
|
||||
</query>
|
||||
9
modules/module/schemas/module_addon.xml
Normal file
9
modules/module/schemas/module_addon.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<table name="module_addon">
|
||||
<column name="module_addon_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="module_srl" type="number" size="11" notnull="notnull" index="idx_module_srl" />
|
||||
<column name="addon" type="varchar" size="80" notnull="notnull" />
|
||||
<column name="act" type="varchar" size="40" notnull="notnull" />
|
||||
<column name="mode" type="varchar" size="6" notnull="notnull" default="before" />
|
||||
<column name="config" type="text" />
|
||||
<column name="regdate" type="date" />
|
||||
</table>
|
||||
7
modules/module/schemas/module_plugin.xml
Normal file
7
modules/module/schemas/module_plugin.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<table name="module_plugin">
|
||||
<column name="module_plugin_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="module_srl" type="number" size="11" notnull="notnull" index="idx_module_srl" />
|
||||
<column name="plugin" type="varchar" size="80" notnull="notnull" />
|
||||
<column name="config" type="text" />
|
||||
<column name="regdate" type="date" />
|
||||
</table>
|
||||
18
modules/module/schemas/modules.xml
Normal file
18
modules/module/schemas/modules.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<table name="modules">
|
||||
<column name="module_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="mid" type="varchar" size="40" notnull="notnull" unique="unique_mid"/>
|
||||
<column name="skin" type="varchar" size="250" notnull="notnull" />
|
||||
<column name="browser_title" type="varchar" size="250" notnull="notnull"/>
|
||||
<column name="description" type="text" size="250" />
|
||||
<column name="module" type="varchar" size="80" notnull="notnull" />
|
||||
<column name="is_default" type="char" size="1" notnull="notnull" default="N" />
|
||||
<column name="menu_srl" type="number" size="11" default="0"/>
|
||||
<column name="use_category" type="char" size="1" default="N"/>
|
||||
<column name="extra_vars" type="text" />
|
||||
<column name="layout_file" type="varchar" size="250" />
|
||||
<column name="grant" type="text" />
|
||||
<column name="admin_id" type="text" />
|
||||
<column name="header_text" type="text" />
|
||||
<column name="footer_text" type="text" />
|
||||
<column name="regdate" type="date" />
|
||||
</table>
|
||||
21
modules/module/tpl.admin/index.html
Normal file
21
modules/module/tpl.admin/index.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th>{$lang->no}</th>
|
||||
<th>{$lang->module_name}</th>
|
||||
<th>{$lang->module_version}</th>
|
||||
<th>{$lang->module_table_count}</th>
|
||||
<th>{$lang->module_installed_path}</th>
|
||||
<th>{$lang->author}</th>
|
||||
</tr>
|
||||
<!--@foreach($installed_module_list as $no => $module_obj)-->
|
||||
<tr>
|
||||
<td>{$no+1}</td>
|
||||
<td>{$module_obj->title}</td>
|
||||
<td>{$module_obj->version}</td>
|
||||
<td>{$module_obj->created_table_count} / {$module_obj->table_count}</td>
|
||||
<td>{$module_obj->path}</td>
|
||||
<td><a href="mailto:{$module_obj->author->email_address}">{$module_obj->author->name}</a></td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
</table>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue