/** * @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'); } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // 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; // Arrange variables and then execute a query if (!$args->module_srl) { $args->module_srl = getNextSequence(); } // default value $args->is_skin_fix = !$args->is_skin_fix ? 'N' : 'Y'; // 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 $oDB->commit(); $output->add('module_srl', $args->module_srl); return $output; }
/** * @brief 모듈 객체를 생성함 **/ function &getModuleInstance($module, $type = 'view', $kind = '') { $class_path = ModuleHandler::getModulePath($module); if (!is_dir(_XE_PATH_ . $class_path)) { return NULL; } if (__DEBUG__ == 3) { $start_time = getMicroTime(); } if ($kind != 'admin') { $kind = 'svc'; } // global 변수에 미리 생성해 둔 객체가 없으면 새로 생성 if (!$GLOBALS['_loaded_module'][$module][$type][$kind]) { /** * 모듈의 위치를 파악 **/ // 상위 클래스명 구함 if (!class_exists($module)) { $high_class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module); if (!file_exists($high_class_file)) { return NULL; } require_once $high_class_file; } // 객체의 이름을 구함 switch ($type) { case 'controller': if ($kind == 'admin') { $instance_name = sprintf("%sAdmin%s", $module, "Controller"); $class_file = sprintf('%s%s%s.admin.%s.php', _XE_PATH_, $class_path, $module, $type); } else { $instance_name = sprintf("%s%s", $module, "Controller"); $class_file = sprintf('%s%s%s.%s.php', _XE_PATH_, $class_path, $module, $type); } break; case 'model': if ($kind == 'admin') { $instance_name = sprintf("%sAdmin%s", $module, "Model"); $class_file = sprintf('%s%s%s.admin.%s.php', _XE_PATH_, $class_path, $module, $type); } else { $instance_name = sprintf("%s%s", $module, "Model"); $class_file = sprintf('%s%s%s.%s.php', _XE_PATH_, $class_path, $module, $type); } break; case 'api': $instance_name = sprintf("%s%s", $module, "API"); $class_file = sprintf('%s%s%s.api.php', _XE_PATH_, $class_path, $module); break; case 'wap': $instance_name = sprintf("%s%s", $module, "WAP"); $class_file = sprintf('%s%s%s.wap.php', _XE_PATH_, $class_path, $module); break; case 'smartphone': $instance_name = sprintf("%s%s", $module, "SPhone"); $class_file = sprintf('%s%s%s.smartphone.php', _XE_PATH_, $class_path, $module); break; case 'class': $instance_name = $module; $class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module); break; default: $type = 'view'; if ($kind == 'admin') { $instance_name = sprintf("%sAdmin%s", $module, "View"); $class_file = sprintf('%s%s%s.admin.view.php', _XE_PATH_, $class_path, $module, $type); } else { $instance_name = sprintf("%s%s", $module, "View"); $class_file = sprintf('%s%s%s.view.php', _XE_PATH_, $class_path, $module, $type); } break; } // 클래스 파일의 이름을 구함 if (!file_exists($class_file)) { return NULL; } // eval로 객체 생성 require_once $class_file; $eval_str = sprintf('$oModule = new %s();', $instance_name); @eval($eval_str); if (!is_object($oModule)) { return NULL; } // 해당 위치에 속한 lang 파일을 읽음 Context::loadLang($class_path . 'lang'); // 생성된 객체에 자신이 호출된 위치를 세팅해줌 $oModule->setModule($module); $oModule->setModulePath($class_path); // 요청된 module에 constructor가 있으면 실행 if (!isset($GLOBALS['_called_constructor'][$instance_name])) { $GLOBALS['_called_constructor'][$instance_name] = true; if (@method_exists($oModule, $instance_name)) { $oModule->{$instance_name}(); } } // GLOBALS 변수에 생성된 객체 저장 $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; } if (__DEBUG__ == 3) { $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; } // 객체 리턴 return $GLOBALS['_loaded_module'][$module][$type][$kind]; }
/** * Install module * * Call module's moduleInstall(), moduleUpdate() and create tables. * * @return void */ function installModule() { $path = $this->package->path; if ($path != ".") { $path_array = explode("/", $path); $target_name = array_pop($path_array); $type = substr(array_pop($path_array), 0, -1); } if ($type == "module") { $oModuleModel = getModel('module'); $oInstallController = getController('install'); $module_path = ModuleHandler::getModulePath($target_name); if ($oModuleModel->checkNeedInstall($target_name)) { $oInstallController->installModule($target_name, $module_path); } if ($oModuleModel->checkNeedUpdate($target_name)) { $oModule = getModule($target_name, 'class'); if (method_exists($oModule, 'moduleUpdate')) { $oModule->moduleUpdate(); } } } }
/** * get installed menu type api */ function getMenuAdminInstalledMenuType() { $oModuleModel = getModel('module'); $oAutoinstallModel = getModel('autoinstall'); $this->add('menu_types', $this->getModuleListInSitemap(0)); $_allModules = FileHandler::readDir('./modules', '/^([a-zA-Z0-9_-]+)$/'); sort($_allModules); $allModules = array(); Context::loadLang('modules/page/lang'); foreach ($_allModules as $module_name) { $module = $oModuleModel->getModuleInfoXml($module_name); if (!isset($module)) { continue; } $defaultSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'P'); $defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M'); $skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin); $mobileSkinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultMobileSkin, 'm.skins'); $module->defaultSkin = new stdClass(); $module->defaultSkin->skin = $defaultSkin; $module->defaultSkin->title = $skinInfo->title ? $skinInfo->title : $defaultSkin; $module->defaultMobileSkin = new stdClass(); $module->defaultMobileSkin->skin = $defaultMobileSkin; $module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin; $module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/' . $module_name); $module->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $module->package_srl; if ($module_name == 'page') { $pageTypeName = Context::getLang('page_type_name'); $module->title = $pageTypeName['ARTICLE']; $allModules['ARTICLE'] = $module; $wModuleInfo = clone $module; unset($wModuleInfo->default_skin, $wModuleInfo->default_mskin); $wModuleInfo->title = $pageTypeName['WIDGET']; $wModuleInfo->no_skin = 'Y'; $allModules['WIDGET'] = $wModuleInfo; $oModuleInfo = clone $module; unset($oModuleInfo->default_skin, $oModuleInfo->default_mskin); $oModuleInfo->title = $pageTypeName['OUTSIDE']; $oModuleInfo->no_skin = 'Y'; $allModules['OUTSIDE'] = $oModuleInfo; } else { $allModules[$module_name] = $module; } } $this->add('all_modules', $allModules); }
/** * @brief Insert module */ function insertModule($args) { if (isset($args->isMenuCreate)) { $isMenuCreate = $args->isMenuCreate; } else { $isMenuCreate = TRUE; } $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'); } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // Get colorset from the skin information $module_path = ModuleHandler::getModulePath($args->module); $skin_info = $oModuleModel->loadSkinInfo($module_path, $args->skin); $skin_vars = new stdClass(); $skin_vars->colorset = $skin_info->colorset[0]->name; // Arrange variables and then execute a query if (!$args->module_srl) { $args->module_srl = getNextSequence(); } // default value if ($args->skin == '/USE_DEFAULT/') { $args->is_skin_fix = 'N'; } else { if (isset($args->is_skin_fix)) { $args->is_skin_fix = $args->is_skin_fix != 'Y' ? 'N' : 'Y'; } else { $args->is_skin_fix = 'Y'; } } if ($args->mskin == '/USE_DEFAULT/') { $args->is_mskin_fix = 'N'; } else { if (isset($args->is_mskin_fix)) { $args->is_mskin_fix = $args->is_mskin_fix != 'Y' ? 'N' : 'Y'; } else { $args->is_mskin_fix = 'Y'; } } unset($output); $args->browser_title = strip_tags($args->browser_title); if ($isMenuCreate === TRUE) { $menuArgs = new stdClass(); $menuArgs->menu_srl = $args->menu_srl; $menuOutput = executeQuery('menu.getMenu', $menuArgs); // if menu is not created, create menu also. and does not supported that in virtual site. if (!$menuOutput->data && !$args->site_srl) { $oMenuAdminModel = getAdminModel('menu'); $oMenuAdminController = getAdminController('menu'); $menuSrl = $oMenuAdminController->getUnlinkedMenu(); $menuArgs->menu_srl = $menuSrl; $menuArgs->menu_item_srl = getNextSequence(); $menuArgs->parent_srl = 0; $menuArgs->open_window = 'N'; $menuArgs->url = $args->mid; $menuArgs->expand = 'N'; $menuArgs->is_shortcut = 'N'; $menuArgs->name = $args->browser_title; $menuArgs->listorder = $args->menu_item_srl * -1; $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); if (!$menuItemOutput->toBool()) { $oDB->rollback(); return $menuItemOutput; } $oMenuAdminController->makeXmlFile($menuSrl); } } // Insert a module $args->menu_srl = $menuArgs->menu_srl; $output = executeQuery('module.insertModule', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // Insert module extra vars $this->insertModuleExtraVars($args->module_srl, $extra_vars); // commit $oDB->commit(); Rhymix\Framework\Cache::clearGroup('site_and_module'); $output->add('module_srl', $args->module_srl); return $output; }
/** * It creates a module instance * @param string $module module name * @param string $type instance type, (e.g., view, controller, model) * @param string $kind admin or svc * @return ModuleObject module instance (if failed it returns null) * @remarks if there exists a module instance created before, returns it. **/ function &getModuleInstance($module, $type = 'view', $kind = '') { if (__DEBUG__ == 3) { $start_time = getMicroTime(); } $kind = strtolower($kind); $type = strtolower($type); $kinds = array('svc' => 1, 'admin' => 1); if (!isset($kinds[$kind])) { $kind = 'svc'; } $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) { $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; } // if there is no instance of the module in global variable, create a new one if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) { $parent_module = $module; $class_path = ModuleHandler::getModulePath($module); if (!is_dir(FileHandler::getRealPath($class_path))) { return NULL; } // Get base class name and load the file contains it if (!class_exists($module)) { $high_class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module); if (!file_exists($high_class_file)) { return NULL; } require_once $high_class_file; } // Get the object's name $types = explode(' ', 'view controller model api wap mobile class'); if (!in_array($type, $types)) { $type = $types[0]; } if ($type == 'class') { $instance_name = '%s'; $class_file = '%s%s.%s.php'; } elseif ($kind == 'admin' && array_search($type, $types) < 3) { $instance_name = '%sAdmin%s'; $class_file = '%s%s.admin.%s.php'; } else { $instance_name = '%s%s'; $class_file = '%s%s.%s.php'; } $instance_name = sprintf($instance_name, $module, ucfirst($type)); $class_file = sprintf($class_file, $class_path, $module, $type); $class_file = FileHandler::getRealPath($class_file); // Get the name of the class file if (!is_readable($class_file)) { return NULL; } // Create an instance with eval function require_once $class_file; if (!class_exists($instance_name)) { return NULL; } $tmp_fn = create_function('', "return new {$instance_name}();"); $oModule = $tmp_fn(); if (!is_object($oModule)) { return NULL; } // Load language files for the class Context::loadLang($class_path . 'lang'); if ($extend_module) { Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); } // Set variables to the instance $oModule->setModule($module); $oModule->setModulePath($class_path); // If the module has a constructor, run it. if (!isset($GLOBALS['_called_constructor'][$instance_name])) { $GLOBALS['_called_constructor'][$instance_name] = true; if (@method_exists($oModule, $instance_name)) { $oModule->{$instance_name}(); } } // Store the created instance into GLOBALS variable $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; } if (__DEBUG__ == 3) { $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; } // return the instance return $GLOBALS['_loaded_module'][$module][$type][$kind]; }
function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName) { $classPath = ModuleHandler::getModulePath($module); $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); $highClassFile = FileHandler::getRealPath($highClassFile); $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); if (!in_array($type, $types)) { $type = $types[0]; } if ($type == 'class') { $instanceName = '%s'; $classFile = '%s%s.%s.php'; } elseif ($kind == 'admin' && array_search($type, $types) < 3) { $instanceName = '%sAdmin%s'; $classFile = '%s%s.admin.%s.php'; } else { $instanceName = '%s%s'; $classFile = '%s%s.%s.php'; } $instanceName = sprintf($instanceName, $module, ucfirst($type)); $classFile = FileHandler::getRealPath(sprintf($classFile, $classPath, $module, $type)); }
/** * @brief Return ruleset cache file path * @param module, act */ function getValidatorFilePath($module, $ruleset, $mid = null) { // load dynamic ruleset xml file if (strpos($ruleset, '@') !== false) { $rulsetFile = str_replace('@', '', $ruleset); $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); return FileHandler::getRealPath($xml_file); } else { if (strpos($ruleset, '#') !== false) { $rulsetFile = str_replace('#', '', $ruleset) . '.' . $mid; $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); if (is_readable($xml_file)) { return FileHandler::getRealPath($xml_file); } else { $ruleset = str_replace('#', '', $ruleset); } } } // Get a path of the requested module. Return if not exists. $class_path = ModuleHandler::getModulePath($module); if (!$class_path) { return; } // Check if module.xml exists in the path. Return if not exist $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); if (!file_exists($xml_file)) { return; } return $xml_file; }
/** * It creates a module instance * @param string $module module name * @param string $type instance type, (e.g., view, controller, model) * @param string $kind admin or svc * @return ModuleObject module instance (if failed it returns null) * @remarks if there exists a module instance created before, returns it. * */ public static function getModuleInstance($module, $type = 'view', $kind = '') { if (__DEBUG__ == 3) { $start_time = microtime(true); } $parent_module = $module; $kind = strtolower($kind); $type = strtolower($type); $kinds = array('svc' => 1, 'admin' => 1); if (!isset($kinds[$kind])) { $kind = 'svc'; } $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) { $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; } // if there is no instance of the module in global variable, create a new one if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) { self::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) { $module = $parent_module; self::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); } // Check if the base class and instance class exist if (!class_exists($module, true)) { return NULL; } if (!class_exists($instance_name, true)) { return NULL; } // Create an instance $oModule = new $instance_name(); if (!is_object($oModule)) { return NULL; } // Load language files for the class if ($module !== 'module') { Context::loadLang($class_path . 'lang'); } if ($extend_module) { Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); } // Set variables to the instance $oModule->setModule($module); $oModule->setModulePath($class_path); // Store the created instance into GLOBALS variable $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; } if (__DEBUG__ == 3) { $GLOBALS['__elapsed_class_load__'] += microtime(true) - $start_time; } // return the instance return $GLOBALS['_loaded_module'][$module][$type][$kind]; }
/** * @brief 정리해야 할 테이블 목록 반환 * @return array */ function getTableToBeArranged() { $oDB = DB::getInstance(); // 설치되어 있는 모듈 목록 $module_list = $this->getModuleList(); // DB 상의 테이블 목록 $table_list = $this->getTableList(); $oAddonAdminModel = getAdminModel('addon'); $addon_list = $oAddonAdminModel->getAddonList(); // 실제 사용하고 있는 테이블 목록 $valid_table_list = array(); foreach ($module_list as $module_name) { $module_path = ModuleHandler::getModulePath($module_name); $schemas_path = $module_path . 'schemas'; if (file_exists(FileHandler::getRealPath($schemas_path))) { $table_files = FileHandler::readDir($schemas_path, '/(\\.xml)$/'); foreach ($table_files as $table_file) { list($table_name) = explode('.', $table_file); if ($oDB->isTableExists($table_name)) { $valid_table_list[] = $table_name; } } } } foreach ($addon_list as $val) { $addon_path = $oAddonAdminModel->getAddonPath($val->addon_name); $a_schemas_path = $addon_path . 'schemas'; if (file_exists(FileHandler::getRealPath($a_schemas_path))) { $addon_table_files = FileHandler::readDir($a_schemas_path, '/(\\.xml)$/'); foreach ($addon_table_files as $a_table_file) { list($a_table_name) = explode('.', $a_table_file); if ($oDB->isTableExists($a_table_name)) { $valid_table_list[] = $a_table_name; } } } } // 정리해야 할 테이블 목록 $arrange_table_list = array(); foreach ($table_list as $table_info) { $table_info->to_be_deleted = !in_array(substr($table_info->name, strlen($oDB->prefix)), $valid_table_list); $table_info->to_be_repaired = !!$table_info->overhead; if ($table_info->to_be_deleted || $table_info->to_be_repaired) { $arrange_table_list[] = $table_info; } } return $arrange_table_list; }
/** * Restore content object * @return void|Object */ function procTrashAdminRestore() { global $lang; $trashSrlList = Context::get('cart'); if (is_array($trashSrlList)) { // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // eache restore method call in each classfile foreach ($trashSrlList as $key => $value) { $oTrashModel =& getModel('trash'); $output = $oTrashModel->getTrash($value); if (!$output->toBool()) { return new Object(-1, $output->message); } //class file check $classPath = ModuleHandler::getModulePath($output->data->getOriginModule()); if (!is_dir(FileHandler::getRealPath($classPath))) { return new Object(-1, 'not exist restore module directory'); } $classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule()); $classFile = FileHandler::getRealPath($classFile); if (!file_exists($classFile)) { return new Object(-1, 'not exist restore module class file'); } $oAdminController =& getAdminController($output->data->getOriginModule()); if (!method_exists($oAdminController, 'restoreTrash')) { return new Object(-1, 'not exist restore method in module class file'); } $originObject = unserialize($output->data->getSerializedObject()); $output = $oAdminController->restoreTrash($originObject); if (!$output->toBool()) { $oDB->rollback(); return new Object(-1, $output->message); } } // restore object delete in trash box if (!$this->_emptyTrash($trashSrlList)) { $oDB->rollback(); return new Object(-1, $lang->fail_empty); } $oDB->commit(); } $this->setMessage('success_restore', 'info'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrashAdminList'); $this->setRedirectUrl($returnUrl); }
/** * display member insert form * @return void */ function dispCympuserAdminMemberInsert() { // retrieve extend form $oMemberModel = getModel('member'); $oCympuserAdminModel = getAdminModel('cympuser'); $oElearning = getClass('elearning'); $oNstore = getClass('nstore'); $oEpay = getClass('epay'); $oMember = getClass('member'); // if member_srl exists, set memberInfo $member_srl = Context::get('member_srl'); if ($member_srl) { $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl); $memberInfo = $this->memberInfo; $args->member_srl = $member_srl; // if elearning module is installed if ($oElearning) { $page = Context::get('class_page'); $query = 'elearning.getMyClasses'; $output = executeQueryArray($query, $args); if (!$output->toBool()) { return $output; } Context::set('is_elearning_exists', 'Y'); Context::set('class_list', $output->data); unset($args); } // if nstore module is installed if ($oNstore) { $oNstorePath = ModuleHandler::getModulePath('nstore'); $args->member_srl = $member_srl; $order_status = Context::get('order_status'); $args->order_status = $order_status; $args->page = Context::get('textbook_page'); $args->list_count = 5; $query = 'nstore.getOrderListByStatus'; $output = executeQueryArray($query, $args); if (!$output->toBool()) { return $output; } $member_config = $oMemberModel->getMemberConfig(); $memberIdentifiers = array('user_id' => 'user_id', 'user_name' => 'user_name', 'nick_name' => 'nick_name'); $usedIdentifiers = array(); if (is_array($member_config->signupForm)) { foreach ($member_config->signupForm as $signupItem) { if (!count($memberIdentifiers)) { break; } if (in_array($signupItem->name, $memberIdentifiers) && ($signupItem->required || $signupItem->isUse)) { unset($memberIdentifiers[$signupItem->name]); $usedIdentifiers[$signupItem->name] = $lang->{$signupItem->name}; } } } Context::set('order_list', $output->data); Context::set('is_nstore_exists', 'Y'); Context::set('list', $order_list); Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('textbook_page', $output->page); Context::set('textbook_page_navigation', $output->page_navigation); Context::set('delivery_companies', $oNstore->delivery_companies); Context::set('order_status', $oNstore->getOrderStatus()); Context::set('delivery_inquiry_urls', $oNstore->delivery_inquiry_urls); Context::set('usedIdentifiers', $usedIdentifiers); unset($args); } // if epay module is installed if ($oEpay) { // transactions $args->member_srl = $member_srl; $args->page = Context::get('epay_page'); $args->list_count = 5; if (Context::get('search_key')) { $search_key = Context::get('search_key'); $search_value = Context::get('search_value'); $args->{$search_key} = $search_value; } $output = executeQueryArray('epay.getTransactionByMemberSrl', $args); if (!$output->toBool()) { return $output; } $epay_list = $output->data; Context::set('epay_list', $epay_list); Context::set('is_epay_exists', 'Y'); Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('epay_page', $output->page); Context::set('epay_page_navigation', $output->page_navigation); } if (!$output->toBool()) { return $output; } if (!$this->memberInfo) { Context::set('member_srl', ''); } else { Context::set('member_srl', $member_srl); Context::set('member_info', $this->memberInfo); } } if (isset($memberInfo)) { $member_srl = $this->memberInfo->member_srl; $signature = $oMemberModel->getSignature($member_srl); $memberInfo->signature = $signature; } Context::set('member_info', $memberInfo); // get an editor for the signature if ($memberInfo->member_srl) { $oEditorModel = getModel('editor'); $option = new stdClass(); $option->primary_key_name = 'member_srl'; $option->content_key_name = 'signature'; $option->allow_fileupload = false; $option->enable_autosave = false; $option->enable_default_component = true; $option->enable_component = false; $option->resizable = false; $option->height = 200; $editor = $oEditorModel->getEditor($member_srl, $option); Context::set('editor', $editor); } $formTags = $this->_getMemberInputTag($memberInfo, true); Context::set('formTags', $formTags); $member_config = $this->memberConfig; global $lang; $identifierForm = new stdClass(); $identifierForm->title = $lang->{$member_config->identifier}; $identifierForm->name = $member_config->identifier; $identifierForm->value = $memberInfo->{$member_config->identifier}; Context::set('identifierForm', $identifierForm); $this->setTemplateFile('member_info'); }
/** * @brief 모듈 입력 **/ function insertModule($args) { $output = $this->arrangeModuleInfo($args, $extra_vars); if (!$output->toBool()) { return $output; } // 이미 존재하는 모듈 이름인지 체크 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'); } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // 선택된 스킨정보에서 colorset을 구함 $module_path = ModuleHandler::getModulePath($args->module); $skin_info = $oModuleModel->loadSkinInfo($module_path, $args->skin); $skin_vars->colorset = $skin_info->colorset[0]->name; // 변수 정리후 query 실행 if (!$args->module_srl) { $args->module_srl = getNextSequence(); } // 모듈 등록 $output = executeQuery('module.insertModule', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // 모듈 추가 변수 등록 $this->insertModuleExtraVars($args->module_srl, $extra_vars); // commit $oDB->commit(); $output->add('module_srl', $args->module_srl); return $output; }
/** * @brief 모듈의 종류와 정보를 구함 **/ function getModuleList() { // DB 객체 생성 $oDB =& DB::getInstance(); // 다운받은 모듈과 설치된 모듈의 목록을 구함 $searched_list = FileHandler::readDir('./modules'); sort($searched_list); $searched_count = count($searched_list); if (!$searched_count) { return; } for ($i = 0; $i < $searched_count; $i++) { // 모듈의 이름 $module_name = $searched_list[$i]; $path = ModuleHandler::getModulePath($module_name); // schemas내의 테이블 생성 xml파일수를 구함 $tmp_files = FileHandler::readDir($path . "schemas", '/(\\.xml)$/'); $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 = $this->getModuleInfoXml($module_name); unset($obj); $info->module = $module_name; $info->category = $info->category; $info->created_table_count = $created_table_count; $info->table_count = $table_count; $info->path = $path; $info->admin_index_act = $info->admin_index_act; // 설치 유무 체크 (설치는 DB의 설치만 관리) if ($table_count > $created_table_count) { $info->need_install = true; } else { $info->need_install = false; } // 각 모듈의 module.class.php로 upgrade 유무 체크 $oDummy = null; $oDummy =& getModule($module_name, 'class'); if ($oDummy) { $info->need_update = $oDummy->checkUpdate(); } $list[] = $info; } return $list; }
require_once 'system/include/app_init.inc'; /* * app common library, loaded after security check */ require_once SERVICE_ROOT . '/class.langHandler.php'; require_once PRODUCT_LIB_ROOT . '/common.php'; require_once PRODUCT_LIB_ROOT . '/class.moduleHandler.php'; /* * parse request & check module */ $MOD_ID = empty($MOD_ID) ? 'home' : $MOD_ID; if (!ModuleHandler::isModuleExists($MOD_ID)) { //redirect to home page if login already, or redirect to login page header('location: ' . WEB_ROOT); exit; } if (strcmp('login', $MOD_ID) != 0) { WebSession::put(PRODUCT_ID, 'last_mod_id', $MOD_ID); } /* * prepare page level variables * * please use $GLOBALS['MOD_ID'], $GLOBALS['MOD_LANG']... * to get the variables whitin module programs. */ $MOD_LANG = new WebLangHandler(ModuleHandler::getLangModuleName($MOD_ID), WEB_LANG, PRODUCT_LANG_ROOT); /* * call module controller */ require_once ModuleHandler::getModulePath($MOD_ID, PRODUCT_MODULES_ROOT);