function init() { // forbit access if the user is not an administrator if (!$this->grant->manager && !$this->grant->is_admin) { return $this->stop("msg_is_not_administrator"); } // change into administration layout //$this->setTemplatePath('./modules/cympusadmin/tpl'); $this->setLayoutPath('./modules/cympusadmin/tpl'); $this->setLayoutFile(_CYMPUSADMIN_LAYOUT_); Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/'); if ($this->grant->is_admin) { // parse admin menu $oXmlParser = new XmlParser(); $xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_); $admin_menu = cympusadmin::getMenu($xml_obj->menu->item); Context::set('cympusadmin_menu', $admin_menu); } else { $output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu); if (!$output->toBool()) { return $output; } Context::set('cympusadmin_menu', $manager_menu); } $news = getNewsFromAgency(); Context::set('news', $news); Context::set('admin_bar', 'false'); $oModuleModel =& getModel('module'); $module_info = $oModuleModel->getModuleInfoXml('cympusadmin'); Context::set('cympus_modinfo', $module_info); return new Object(); }
/** * @brief getInstance **/ function &getInstance() { static $instance = null; if (!$instance) { $browserType = mobileXE::getBrowserType(); if (!$browserType) { return; } $class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); require_once $class_file; // 모바일 언어설정 로드(쿠키가 안되어 생각해낸 방법...-캐시파일 재생성을 클릭하면 초기화된다..) $this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php'); if ($this->lang) { $lang_supported = Context::get('lang_supported'); $this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang); if (isset($lang_supported[$this->lang])) { Context::setLangType($this->lang); } } Context::loadLang(_XE_PATH_ . 'addons/mobile/lang'); $instance = new wap(); $mobilePage = (int) Context::get('mpage'); if (!$mobilePage) { $mobilePage = 1; } $instance->setMobilePage($mobilePage); } return $instance; }
/** * @brief getInstance */ function &getInstance() { static $instance = null; if (!$instance) { $browserType = mobileXE::getBrowserType(); if (!$browserType) { return; } $class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); require_once $class_file; // Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..) $this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php'); if ($this->lang) { $lang_supported = Context::get('lang_supported'); $this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang); if (isset($lang_supported[$this->lang])) { Context::setLangType($this->lang); } } Context::loadLang(_XE_PATH_ . 'addons/mobile/lang'); $instance = new wap(); $mobilePage = (int) Context::get('mpage'); if (!$mobilePage) { $mobilePage = 1; } $instance->setMobilePage($mobilePage); } return $instance; }
function _compileInfo($skin) { $oSocialxeModel =& getModel('socialxe'); // 언어 로드 Context::loadLang($this->widget_path . 'lang'); // 서비스 목록 $provider_list = $oSocialxeModel->getProviderList(); Context::set('provider_list', $provider_list); // 서비스 로그인 상태 $logged_provider = $oSocialxeModel->loggedProviderList(); $logged_count = count($logged_provider); foreach ($provider_list as $provider) { $provider_is_logged[$provider] = $oSocialxeModel->isLogged($provider); } if (!isset($provider_is_logged)) { $provider_is_logged = array(); } Context::set('provider_is_logged', $provider_is_logged); Context::set('logged_provider', $logged_provider); Context::set('logged_count', $logged_count); // 로그인한 서비스의 닉네임들 foreach ($logged_provider as $provider) { $nick_names[$provider] = $oSocialxeModel->getProviderNickName($provider); } Context::set('nick_names', $nick_names); // 대표 계정 $master_provider = $oSocialxeModel->getMasterProvider(); Context::set('master_provider', $master_provider); // 대표 계정의 프로필 이미지 $profile_image = $oSocialxeModel->getProfileImage(); Context::set('profile_image', $profile_image); // 대표 계정의 닉네임 $nick_name = $oSocialxeModel->getNickName(); Context::set('nick_name', $nick_name); // 부계정 $slave_provider = $oSocialxeModel->getSlaveProvider(); Context::set('slave_provider', $slave_provider); // 부계정의 프로필 이미지 $slave_profile_image = $oSocialxeModel->getSlaveProfileImage(); Context::set('slave_profile_image', $slave_profile_image); // 부계정의 닉네임 $slave_nick_name = $oSocialxeModel->getSlaveNickName(); Context::set('slave_nick_name', $slave_nick_name); // 자동 로그인 키 $auto_login_key = $oSocialxeModel->getAutoLoginKey(); Context::set('auto_login_key', $auto_login_key); // 자동 로그인 키 요청 주소 $auto_login_key_url = $oSocialxeModel->getAutoLoginKeyUrl(); Context::set('auto_login_key_url', $auto_login_key_url); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) $tpl_path = sprintf('%sskins/%s', $this->widget_path, $skin); Context::set('skin', $skin); // 템플릿 파일을 지정 $tpl_file = 'info'; // 템플릿 컴파일 $oTemplate =& TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); }
/** * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method * * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 **/ function transHTML($xml_obj) { // 지정된 옵션을 구함 $ccl_title = $xml_obj->attrs->ccl_title; $ccl_use_mark = $xml_obj->attrs->ccl_use_mark; $ccl_allow_commercial = $xml_obj->attrs->ccl_allow_commercial; $ccl_allow_modification = $xml_obj->attrs->ccl_allow_modification; // 가로/ 세로 크기를 구함 preg_match_all('/(width|height)([^[:digit:]]+)([^;^"^\']*)/i', $xml_obj->attrs->style, $matches); $width = trim($matches[3][0]); if (!$width) { $width = "90%"; } $height = trim($matches[3][1]); if (!$height) { $height = "50"; } // 언어파일을 읽음 Context::loadLang($this->component_path . '/lang'); $default_title = Context::getLang('ccl_default_title'); if (!$ccl_title) { $ccl_title = $default_title; } $default_message = Context::getLang('ccl_default_message'); $option = Context::getLang('ccl_options'); // 영리 이용 체크 if ($ccl_allow_commercial == 'N') { $opt1 = '-nc'; } else { $opt1 = ''; } // 수정 표시 체크 if ($ccl_allow_modification == 'N') { $opt2 = '-nd'; } elseif ($ccl_allow_modification == 'SA') { $opt2 = '-sa'; } else { $opt2 = ''; } // 버전 $version = '/3.0'; // 언어에 따른 설정 $lang_type = Context::getLangType(); if ($lang_type != 'en') { $lang_file = 'deed.' . strtolower($lang_file); } // 마크 이용시 $ccl_image = ''; if ($ccl_use_mark == "Y") { $ccl_image = sprintf(' <a rel="license" href="http://creativecommons.org/licenses/by%s%s%s" onclick="window.open(this.href); return false;"><img src="http://i.creativecommons.org/l/by%s%s%s/88x31.png" alt="Creative Commons License" style="margin-bottom:5px;border:0;" /></a><br />', $opt1, $opt2, $version, $opt1, $opt2, $version); } // 결과물 생성 $text = $ccl_image . sprintf($default_message, $opt1, $opt2, $version, '', $ccl_title, $option['ccl_allow_commercial'][$ccl_allow_commercial], $option['ccl_allow_modification'][$ccl_allow_modification], $version); $style = sprintf('<style type="text/css">.cc_license { clear:both; margin:20px auto 20px auto; padding:8px; width:%s;border:1px solid #c0c0c0; color:#808080; text-align:center; } .cc_license legend { font-weight:bold; } .cc_license a { color:#404040; text-decoration:none; } .cc_license a:hover { text-decoration:underline; </style>', $width); $output = sprintf('%s<fieldset class="cc_license"><legend>%s</legend>%s</fieldset>', $style, $ccl_title, $text); return $output; }
/** * @brief naver map open api에서 주소를 찾는 함수 **/ function search_address() { $address = Context::get('address'); if (!$address) { return new Object(-1, 'msg_not_exists_addr'); } Context::loadLang($this->component_path . "lang"); // 지정된 서버에 요청을 시도한다 $address = urlencode(iconv("UTF-8", "EUC-KR", $address)); $query_string = sprintf('/api/geocode.php?key=%s&query=%s', $this->api_key, $address); $fp = fsockopen('maps.naver.com', 80, $errno, $errstr); if (!$fp) { return new Object(-1, 'msg_fail_to_socket_open'); } fputs($fp, "GET {$query_string} HTTP/1.0\r\n"); fputs($fp, "Host: maps.naver.com\r\n\r\n"); $buff = ''; while (!feof($fp)) { $str = fgets($fp, 1024); if (trim($str) == '') { $start = true; } if ($start) { $buff .= trim($str); } } fclose($fp); $buff = trim(iconv("EUC-KR", "UTF-8", $buff)); $buff = str_replace('<?xml version="1.0" encoding="euc-kr" ?>', '', $buff); $oXmlParser = new XmlParser(); $xml_doc = $oXmlParser->parse($buff); //If a Naver OpenApi Error message exists. if ($xml_doc->error->error_code->body || $xml_doc->error->message->body) { return new Object(-1, 'NAVER OpenAPI Error' . "\n" . 'Code : ' . $xml_doc->error->error_code->body . "\n" . 'Message : ' . $xml_doc->error->message->body); } if ($xml_doc->geocode->total->body == 0) { return new Object(-1, 'msg_no_result'); } $addrs = $xml_doc->geocode->item; if (!is_array($addrs)) { $addrs = array($addrs); } $addrs_count = count($addrs); $address_list = array(); for ($i = 0; $i < $addrs_count; $i++) { $item = $addrs[$i]; $address_list[] = sprintf("%s,%s,%s", $item->point->x->body, $item->point->y->body, $item->address->body); } $this->add("address_list", implode("\n", $address_list)); }
function init($module = null) { // change into administration layout $config = getModel('cympusadmin')->getConfig(); $args = new stdClass(); $args->module = 'cympusadmin'; $module_list = getModel('module')->getModuleSrlList($args); if (!empty($module_list)) { foreach ($module_list as $module_info) { $cympus_module_info = $module_info; } } $module_path = './modules/cympusadmin/'; $template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin); if (!is_dir($template_path) || !$cympus_module_info->skin) { $config->admin_skins = 'default'; $template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin); } if ($module) { $module->setLayoutPath($template_path); $module->setLayoutFile(_CYMPUSADMIN_LAYOUT_); } else { $this->setLayoutPath($template_path); $this->setLayoutFile(_CYMPUSADMIN_LAYOUT_); } Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/'); $logged_info = Context::get('logged_info'); if ($logged_info->is_admin == 'Y') { // parse admin menu $oXmlParser = new XmlParser(); $xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_); $admin_menu = cympusadmin::getMenu($xml_obj->menu->item); Context::set('cympusadmin_menu', $admin_menu); } else { $output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu); if (!$output->toBool()) { return $output; } Context::set('cympusadmin_menu', $manager_menu); } $news = getNewsFromAgency(); Context::set('news', $news); Context::set('admin_bar', 'false'); $oModuleModel = getModel('module'); $module_info = $oModuleModel->getModuleInfoXml('cympusadmin'); Context::set('cympus_modinfo', $module_info); return new Object(); }
/** * Add file list to Object after ftp connect * @return void|Object */ function getAdminFTPList() { Context::loadLang('./modules/autoinstall/lang'); set_time_limit(5); require_once _XE_PATH_ . 'libs/ftp.class.php'; $ftp_info = Context::getRequestVars(); if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) { return new Object(-1, 'msg_ftp_invalid_auth_info'); } $this->pwd = $ftp_info->ftp_root_path; if (!$ftp_info->ftp_host) { $ftp_info->ftp_host = "127.0.0.1"; } if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) { $ftp_info->ftp_port = "21"; } if ($ftp_info->sftp == 'Y') { if (!function_exists(ssh2_sftp)) { return new Object(-1, 'disable_sftp_support'); } return $this->getSFTPList(); } $oFtp = new ftp(); if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { $_list = $oFtp->ftp_rawlist($this->pwd); $oFtp->ftp_quit(); } else { return new Object(-1, 'msg_ftp_invalid_auth_info'); } } $list = array(); if ($_list) { foreach ($_list as $k => $v) { $src = null; $src->data = $v; $res = Context::convertEncoding($src); $v = $res->data; if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) { $list[] = substr(strrchr($v, ' '), 1) . '/'; } } } else { return new Object(-1, 'msg_ftp_no_directory'); } $this->add('list', $list); }
/** * @brief initialization * * board_extend module can be divided into general use and admin use.\n **/ function init() { Context::loadLang(_XE_PATH_ . 'modules/board/lang'); // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅 $module_srl = Context::get('module_srl'); if (!$module_srl && $this->module_srl) { $module_srl = $this->module_srl; Context::set('module_srl', $module_srl); } // module model 객체 생성 $oModuleModel =& getModel('module'); // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음 if ($module_srl) { $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); if (!$module_info) { Context::set('module_srl', ''); $this->act = 'list'; } else { ModuleModel::syncModuleToSite($module_info); $this->module_info = $module_info; Context::set('module_info', $module_info); } } if ($module_info && $module_info->module != 'board') { return $this->stop("msg_invalid_request"); } // 모듈 카테고리 목록을 구함 $module_category = $oModuleModel->getModuleCategories(); Context::set('module_category', $module_category); // 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음) $template_path = sprintf("%stpl/", $this->module_path); $this->setTemplatePath($template_path); // 정렬 옵션을 세팅 foreach ($this->order_target as $key) { $order_target[$key] = Context::getLang($key); } $order_target['list_order'] = Context::getLang('document_srl'); $order_target['update_order'] = Context::getLang('last_update'); Context::set('order_target', $order_target); }
/** * @brief when menu add in sitemap, select module list * this menu showing with trigger * @param int $site_srl * @return array */ function getModuleListInSitemap($site_srl = 0) { $oModuleModel = getModel('module'); $moduleList = array('page'); $output = $oModuleModel->getModuleListByInstance($site_srl); if (is_array($output->data)) { foreach ($output->data as $value) { if ($value->instanceCount > 1) { $moduleList[] = $value->module; } } } // after trigger $output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList); if (!$output->toBool()) { return $output; } $localModuleList = array_unique($moduleList); $oAutoinstallModel = getModel('autoinstall'); // get have instance $remotePackageList = $oAutoinstallModel->getHaveInstance(array('path')); $remoteModuleList = array(); foreach ($remotePackageList as $package) { if (strpos($package->path, './modules/') !== 0) { continue; } $pathInfo = explode('/', $package->path); $remoteModuleList[] = $pathInfo[2]; } // all module list $allModuleList = FileHandler::readDir('./modules', '/^([a-zA-Z0-9_-]+)$/'); // union have instance and all module list $haveInstance = array_intersect($remoteModuleList, $allModuleList); $haveDirectory = array_intersect($localModuleList, $allModuleList); // union $moduleList = array_unique(array_merge($haveDirectory, $haveInstance)); $moduleInfoList = array(); Context::loadLang('modules/page/lang'); if (is_array($moduleList)) { foreach ($moduleList as $value) { $moduleInfo = $oModuleModel->getModuleInfoXml($value); if ($value == 'page') { $pageTypeName = Context::getLang('page_type_name'); $moduleInfo->title = $pageTypeName['ARTICLE']; $moduleInfoList['ARTICLE'] = $moduleInfo; $wModuleInfo = clone $moduleInfo; unset($wModuleInfo->default_skin, $wModuleInfo->default_mskin); $wModuleInfo->title = $pageTypeName['WIDGET']; $wModuleInfo->no_skin = 'Y'; $moduleInfoList['WIDGET'] = $wModuleInfo; $oModuleInfo = clone $moduleInfo; unset($oModuleInfo->default_skin, $oModuleInfo->default_mskin); $oModuleInfo->title = $pageTypeName['OUTSIDE']; $oModuleInfo->no_skin = 'Y'; $moduleInfoList['OUTSIDE'] = $oModuleInfo; } else { $moduleInfoList[$value] = $moduleInfo; } } } return $moduleInfoList; }
<?php if (!defined("__XE__")) { exit; } ?> <!--#Meta:modules/admin/tpl/js/config.js--><?php $__tmp = array('modules/admin/tpl/js/config.js', '', '', ''); Context::loadFile($__tmp); unset($__tmp); Context::loadLang(''); ?> <!--#Meta:modules/session/tpl/js/session.js--><?php $__tmp = array('modules/session/tpl/js/session.js', '', '', ''); Context::loadFile($__tmp); unset($__tmp); ?> <div class="x_page-header"> <h1><?php echo $__Context->lang->menu_gnb_sub['adminConfigurationFtp']; ?> <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_config_ftp" target="_blank"><?php echo $__Context->lang->help; ?> </a></h1> </div> <?php if ($__Context->XE_VALIDATOR_MESSAGE && $__Context->XE_VALIDATOR_ID == 'modules/admin/tpl/config_ftp/1') { ?> <div class="message <?php echo $__Context->XE_VALIDATOR_MESSAGE_TYPE;
<?php /* Copyright (C) NAVER <http://www.navercorp.com> */ /** * @file exchange_content.addon.php * @brief Addon for change content matched pattern's * @author [NAVER](http://www.navercorp.com) (<developers@xpressengine.com) */ if (!defined('__XE__')) { exit; } if ($called_position == "before_display_content") { } if ($called_position == "before_module_proc" && Context::get('download_wanna_reply') != "") { Context::loadLang(_XE_PATH_ . 'addons/download_wanna_reply/lang'); $oModuleHandler = new ModuleHandler(); $oModuleHandler->error = Context::getLang('msg_download_wanna_reply'); $oModuleHandler->displayContent($this); Context::close(); exit; } if ($called_position == "after_module_proc") { $oDocument = Context::get('oDocument'); // 글이 없는 경우 처리하지 않음 if (!$oDocument) { return; } $logged_info = Context::get('logged_info'); if ($logged_info) { // 본인이 작성한 글은 다운로드 가능 if ($logged_info->member_srl == $oDocument->variables['member_srl']) {
<?php if(!defined('__DEBUG__')) define('__DEBUG__', 1); if(!defined('__XE__')) define('__XE__', TRUE); if(!defined('__ZBXE__')) define('__ZBXE__', TRUE); if(!defined('_XE_PATH_')) define('_XE_PATH_', realpath(dirname(__FILE__) . '/../../../../') . '/'); require_once(_XE_PATH_ . 'config/config.inc.php'); require_once(_XE_PATH_ . 'modules/shop/libs/autoload/autoload.php'); // Delete any cache files FileHandler::removeFilesInDir(_XE_PATH_ . 'files/cache'); $oContext = Context::getInstance(); Context::setLangType('en'); // Load common language files, for the error messages to be displayed Context::loadLang(_XE_PATH_.'common/lang/'); /* End of file Bootstrap.php */ /* Location: ./modules/shop/tests/lib/Bootstrap.php */
/** * @brief file upload **/ function mobileFileUpload() { $oFileModel =& getModel('file'); $oFileController =& getController('file'); $oMobileexModel =& getModel('mobileex'); $mobileex_config = $oMobileexModel->getMobileexConfig($this->module_srl); // after upload set template $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile("after_upload"); // file lang load Context::loadLang('./modules/file/lang'); $module_srl = $this->module_srl; $file_info = Context::get('Filedata'); $upload_type = Context::get('upload_type'); $upload_target_srl = intval(Context::get('uploadTargetSrl')); if (!$upload_target_srl) { $upload_target_srl = intval(Context::get('upload_target_srl')); } // mobile document check if ($upload_target_srl && Context::get('document_srl')) { $mobile_check = $oMobileexModel->getMobileDocument($upload_target_srl); if (!$mobile_check->data) { Context::set('msg', Context::getLang('msg_not_mobile_document')); return; } } if (!$upload_target_srl) { $upload_target_srl = getNextSequence(); } // file exist check if (!$file_info['tmp_name'] || !is_uploaded_file($file_info['tmp_name'])) { Context::set('msg', Context::getLang('msg_no_file')); return; } // grant check $allow_fileupload = $oMobileexModel->getUploadGrant($module_srl, $upload_type); if (!$allow_fileupload) { Context::set('msg', Context::getLang('msg_not_fileupload_grant')); return; } // file ext check $allow_filetype = $oMobileexModel->getAllowedFileType($file_info, $module_srl); if (!$allow_filetype->allowed) { $msg = strtoupper(str_replace('.', '', $allow_filetype->file_ext)) . " " . Context::getLang('msg_not_allowed_filetype'); Context::set('msg', $msg); return; } // get file type $imglist = "GIF|PNG|JPG|JPEG"; if (!eregi(strtoupper(str_replace('.', '', $allow_filetype->file_ext)), $imglist)) { $is_img = 'N'; } else { $is_img = 'Y'; } $img_resize_width = (int) $mobileex_config->img_resize_width; $img_resize_height = (int) $mobileex_config->img_resize_height; if ($img_resize_width > 0 || $img_resize_height > 0) { $img_resize_use = true; } else { $img_resize_use = false; } if ($is_img == 'N' || $is_img == 'Y' && !$img_resize_use) { // file size check $allow_filesize = $oMobileexModel->getAllowedFileSize(filesize($file_info['tmp_name']), $module_srl, $upload_target_srl, $upload_type); if (!$allow_filesize->allowed_filesize || !$allow_filesize->allowed_attach_size) { if (!$allow_filesize->allowed_filesize) { Context::set('msg', Context::getLang('msg_not_allowed_filesize')); } else { if (!$allow_filesize->allowed_attach_size) { Context::set('msg', Context::getLang('msg_not_allowed_attach_size')); } } return; } } //insert file // A workaround for Firefox upload bug if (preg_match('/^=\\?UTF-8\\?B\\?(.+)\\?=$/i', $file_info['name'], $match)) { $file_info['name'] = base64_decode(strtr($match[1], ':', '/')); } // upload path if (preg_match("/\\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)\$/i", $file_info['name'])) { // direct 파일에 해킹을 의심할 수 있는 확장자가 포함되어 있으면 바로 삭제함 $file_info['name'] = preg_replace('/\\.(php|phtm|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']); $file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']); $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); // special character to '_' // change to md5 file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter $ext = substr(strrchr($file_info['name'], '.'), 1); //$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); $_filename = md5(crypt(rand(1000000, 900000), rand(0, 100))) . '.' . $ext; $filename = $path . $_filename; $idx = 1; while (file_exists($filename)) { $filename = $path . preg_replace('/\\.([a-z0-9]+)$/i', '_' . $idx . '.$1', $_filename); $idx++; } $direct_download = 'Y'; } else { $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); $filename = $path . md5(crypt(rand(1000000, 900000), rand(0, 100))); $direct_download = 'N'; } // make dir if (!FileHandler::makeDir($path)) { Context::set('msg', Context::getLang('msg_not_permitted_create')); return; } // move file if (!@move_uploaded_file($file_info['tmp_name'], $filename)) { $re_name = md5(crypt(rand(1000000, 900000) . $file_info['name'])); $filename = $path . $re_name . '.' . $ext; if (!@move_uploaded_file($file_info['tmp_name'], $filename)) { Context::set('msg', Context::getLang('msg_file_upload_error')); return; } } // image resize if ($is_img == 'Y' && $img_resize_use) { $resizeimg = $oMobileexModel->getImgResizeValue($filename, $img_resize_width, $img_resize_height); if ($resizeimg->width || $resizeimg->height) { $resize_target_width = $resizeimg->width; $resize_target_height = $resizeimg->height; $img_ext = '.' . $ext; $resize_path = str_replace($img_ext, "", $filename); $resize_file = $resize_path . '.' . $ext; $resize_url = Context::getRequestUri() . $resize_file; // resize $source_file = $filename; $resize_img = FileHandler::createImageFile($source_file, $resize_file, $resize_target_width, $resize_target_height, $ext, 'ratio'); $allow_filesize = $oMobileexModel->getAllowedFileSize(@filesize($filename), $module_srl, $upload_target_srl, $upload_type); if (!$allow_filesize->allowed_filesize || !$allow_filesize->allowed_attach_size) { FileHandler::removeFile($filename); if (!$allow_filesize->allowed_filesize) { Context::set('msg', Context::getLang('msg_not_allowed_filesize')); } else { if (!$allow_filesize->allowed_attach_size) { Context::set('msg', Context::getLang('msg_not_allowed_attach_size')); } } return; } } } // get member info $oMemberModel =& getModel('member'); $member_srl = $oMemberModel->getLoggedMemberSrl(); // file info $args->file_srl = getNextSequence(); $args->upload_target_srl = $upload_target_srl; $args->module_srl = $module_srl; $args->direct_download = $direct_download; $args->source_filename = $file_info['name']; $args->uploaded_filename = $filename; $args->download_count = $download_count; $args->file_size = @filesize($filename); $args->comment = NULL; $args->member_srl = $member_srl; $args->sid = md5(rand(rand(1111111, 4444444), rand(4444445, 9999999))); $output = executeQuery('file.insertFile', $args); if (!$output->toBool()) { Context::set('msg', Context::getLang('msg_file_upload_error')); return; } $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; $output->add('file_srl', $args->file_srl); $output->add('file_size', $args->file_size); $output->add('sid', $args->sid); $output->add('direct_download', $args->direct_download); $output->add('source_filename', $args->source_filename); $output->add('upload_target_srl', $upload_target_srl); $output->add('uploaded_filename', $args->uploaded_filename); // add file insert if ($mobileex_config->addfile_auto == 'Y' && $is_img == 'Y') { $args->module_srl = $module_srl; $args->upload_target_srl = $output->get('upload_target_srl'); $args->file_srl = $output->get('file_srl'); executeQuery('mobileex.insertMobileAddFile', $args); } if ($is_img != 'Y') { $img_href = './modules/editor/tpl/images/files.gif'; } else { $img_href = $output->get('uploaded_filename'); // create thumb $preview_thumb = $oMobileexModel->getFileThumbnail($output->get('file_srl'), $width = 100, $height = 100, $thumbnail_type = 'crop'); if (!$preview_thumb) { $preview_thumb = './modules/editor/tpl/images/files.gif'; } $img_href = $preview_thumb; if ($mobileex_config->addfile_thumb_use == 'Y') { $addfile_max_size = (int) $mobileex_config->addfile_max_size; // max_thumb $max_thumb = $oMobileexModel->getFileThumbnail($value->file_srl, $width = $addfile_max_size, $height = '', $thumbnail_type = ''); if (!$max_thumb) { $max_thumb = './modules/editor/tpl/images/files.gif'; } } } // get file size convert for kb $file_size = (int) $output->get('file_size') / 1024; $file_size = round($file_size, 1); // set uploaded file info Context::set('module_srl', $module_srl); Context::set('file_srl', $output->get('file_srl')); Context::set('upload_target_srl', $output->get('upload_target_srl')); // if temp document Context::set('source_filename', $output->get('source_filename')); Context::set('file_size', $file_size); Context::set('is_img', $is_img); Context::set('img_href', $img_href); }
/** * Spammer manage popup * * @return void **/ function dispMemberSpammer() { if (!Context::get('is_logged')) { return new Object(-1, 'msg_not_permitted'); } $member_srl = Context::get('member_srl'); $module_srl = Context::get('module_srl'); // check grant $oModuleModel = getModel('module'); $columnList = array('module_srl', 'module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); if (!$grant->manager) { return new Object(-1, 'msg_not_permitted'); } $oMemberModel = getModel('member'); Context::loadLang('modules/document/lang/'); Context::set('spammer_info', $oMemberModel->getMemberInfoByMemberSrl($member_srl)); Context::set('module_srl', $module_srl); // Select Pop-up layout $this->setLayoutPath('./common/tpl'); $this->setLayoutFile('popup_layout'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('spammer'); }
} if ($addon_info->target != 'all' && Context::get('is_logged')) { return; } $target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory'); if ($addon_info->apply_find_account == 'apply') { $target_acts[] = 'procMemberFindAccount'; } if ($addon_info->apply_resend_auth_mail == 'apply') { $target_acts[] = 'procMemberResendAuthMail'; } Context::addHtmlHeader('<script type="text/javascript"> var captchaTargetAct = new Array("' . implode('","', $target_acts) . '"); </script>'); // 캡챠 인증이 되지 않은 세션이면 실행 시작 if (!$_SESSION['captcha_authed']) { // 언어파일 로드 Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); // 캡챠 세션 세팅 if (Context::get('act') == 'setCaptchaSession') { $f = FileHandler::readDir('./addons/captcha/icon'); shuffle($f); $key = rand(0, count($f) - 1); $keyword = str_replace('.gif', '', $f[$key]); $_SESSION['captcha_keyword'] = $keyword; $target = Context::getLang('target_captcha'); header("Content-Type: text/xml; charset=UTF-8"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); printf("<response>\r\n<error>0</error>\r\n<message>success</message>\r\n<about><![CDATA[%s]]></about>\r\n<keyword><![CDATA[%s]]></keyword>\r\n</response>", Context::getLang('about_captcha'), $target[$keyword]);
/** * @brief Return the editor template * You can call upload_target_srl when modifying content * The upload_target_srl is used for a routine to check if an attachment exists */ function getEditor($upload_target_srl = 0, $option = null) { /** * Editor's default options */ // Option setting to allow file upload if ($upload_target_srl) { $option->editor_sequence = $upload_target_srl; } if (!$option->allow_fileupload) { $allow_fileupload = false; } else { $allow_fileupload = true; } // content_style setting if (!$option->content_style) { $option->content_style = 'ckeditor_light'; } Context::set('content_style', $option->content_style); Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style); // Default font setting Context::set('content_font', $option->content_font); Context::set('content_font_size', $option->content_font_size); Context::set('content_line_height', $option->content_line_height); Context::set('content_paragraph_spacing', $option->content_paragraph_spacing); Context::set('content_word_break', $option->content_word_break); Context::set('editor_additional_css', $option->additional_css); // Option setting to allow auto-save if (!$option->enable_autosave) { $enable_autosave = false; } elseif (Context::get($option->primary_key_name)) { $enable_autosave = false; } else { $enable_autosave = true; } // Option setting to allow the default editor component if (!$option->enable_default_component) { $enable_default_component = false; } else { $enable_default_component = true; } // Option setting to allow other extended components if (!$option->enable_component) { $enable_component = false; } else { $enable_component = true; } // Setting for html-mode if ($option->disable_html) { $html_mode = false; } else { $html_mode = true; } // Set Height if (!$option->height) { $editor_height = 300; } else { $editor_height = $option->height; } // Skin Setting $skin = $option->skin; if (!$skin) { $skin = 'ckeditor'; } $colorset = $option->colorset; if (!$colorset) { $colorset = 'moono'; } Context::set('colorset', $colorset); Context::set('skin', $skin); Context::set('module_type', $option->module_type); if ($skin == 'dreditor') { $this->loadDrComponents(); } /** * Check the automatic backup feature (do not use if the post is edited) */ if ($enable_autosave) { // Extract auto-saved data $saved_doc = $this->getSavedDoc($upload_target_srl); // Context setting auto-saved data Context::set('saved_doc', $saved_doc); } Context::set('enable_autosave', $enable_autosave); /** * Extract editor's unique number (in order to display multiple editors on a single page) */ if ($option->editor_sequence) { $editor_sequence = $option->editor_sequence; } else { if (!$_SESSION['_editor_sequence_']) { $_SESSION['_editor_sequence_'] = 1; } $editor_sequence = $_SESSION['_editor_sequence_']++; } /** * Upload setting by using configuration of the file module internally */ $files_count = 0; if ($allow_fileupload) { $oFileModel = getModel('file'); // Get upload configuration to set on SWFUploader $file_config = $oFileModel->getUploadConfig(); $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; Context::set('file_config', $file_config); // Configure upload status such as file size $upload_status = $oFileModel->getUploadStatus(); Context::set('upload_status', $upload_status); // Upload enabled (internally caching) $oFileController = getController('file'); $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); // Check if the file already exists if ($upload_target_srl) { $files_count = $oFileModel->getFilesCount($upload_target_srl); } } Context::set('files_count', (int) $files_count); Context::set('allow_fileupload', $allow_fileupload); // Set editor_sequence value Context::set('editor_sequence', $editor_sequence); // Set the document number to upload_target_srl for file attachments // If a new document, upload_target_srl = 0. The value becomes changed when file attachment is requested Context::set('upload_target_srl', $upload_target_srl); // Set the primary key valueof the document or comments Context::set('editor_primary_key_name', $option->primary_key_name); // Set content column name to sync contents Context::set('editor_content_key_name', $option->content_key_name); /** * Check editor component */ $site_module_info = Context::get('site_module_info'); $site_srl = (int) $site_module_info->site_srl; if ($enable_component) { if (!Context::get('component_list')) { $component_list = $this->getComponentList(true, $site_srl); Context::set('component_list', $component_list); } } Context::set('enable_component', $enable_component); Context::set('enable_default_component', $enable_default_component); /** * Variable setting if html_mode is available */ Context::set('html_mode', $html_mode); /** * Set a height of editor */ Context::set('editor_height', $editor_height); // Check an option whether to start the editor manually Context::set('editor_manual_start', $option->manual_start); /** * Set a skin path to pre-compile the template */ $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); $tpl_file = 'editor.html'; if (!file_exists($tpl_path . $tpl_file)) { $skin = 'ckeditor'; $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); } Context::set('editor_path', $tpl_path); // load editor skin lang Context::loadLang($tpl_path . 'lang'); // Return the compiled result from tpl file $oTemplate = TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); }
* 기능 수행 : 팝업 및 회원정보 보기에서 쪽지/친구 메뉴 추가. 시작할때 새쪽지가 왔는지 검사 **/ if ($called_position == 'before_module_init' && $this->module != 'member') { // 커뮤니케이션 모듈의 언어파일을 읽음 Context::loadLang('./modules/communication/lang'); // 회원 로그인 정보중에서 쪽지등의 메뉴를 추가 $oMemberController =& getController('member'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); // 새로운 쪽지에 대한 플래그가 있으면 쪽지 보기 팝업 띄움 $flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl); $flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl); if (file_exists($flag_file)) { $new_message_count = FileHandler::readFile($flag_file); FileHandler::removeFile($flag_file); Context::loadLang('./addons/member_communication/lang'); $script = sprintf('<script type="text/javascript"> jQuery(function() { if(confirm("%s")) { popopen("%s"); } }); </script>', sprintf(Context::getLang('alert_new_message_arrived'), $new_message_count), Context::getRequestUri() . '?module=communication&act=dispCommunicationNewMessage'); Context::addHtmlHeader($script); } /** * 기능 수행 : 사용자 이름을 클릭시 요청되는 팝업메뉴의 메뉴에 쪽지 발송, 친구추가등의 링크 추가 **/ } elseif ($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') { $oMemberController =& getController('member'); $member_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); // communication 모델 객체 생성 $oCommunicationModel =& getModel('communication'); // 자신이라면 쪽지함 보기 기능 추가 if ($logged_info->member_srl == $member_srl) { // 자신의 쪽지함 보기 기능 추가
function before_module_init_setCaptchaSession() { if ($_SESSION['captcha_authed']) { return false; } // Load language files Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); // Generate keywords $this->createKeyword(); $target = Context::getLang('target_captcha'); header("Content-Type: text/xml; charset=UTF-8"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); printf("<response>\r\n <error>0</error>\r\n <message>success</message>\r\n <about_captcha><![CDATA[%s]]></about_captcha>\r\n <captcha_reload><![CDATA[%s]]></captcha_reload>\r\n <captcha_play><![CDATA[%s]]></captcha_play>\r\n <cmd_input><![CDATA[%s]]></cmd_input>\r\n <cmd_cancel><![CDATA[%s]]></cmd_cancel>\r\n </response>", Context::getLang('about_captcha'), Context::getLang('captcha_reload'), Context::getLang('captcha_play'), Context::getLang('cmd_input'), Context::getLang('cmd_cancel')); Context::close(); exit; }
/** * 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(); } $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])) { ModuleHandler::_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; ModuleHandler::_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 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]; }
/** * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received * */ if ($this->module != 'member' && $called_position == 'before_module_init') { // Load a language file from the communication module Context::loadLang(_XE_PATH_ . 'modules/communication/lang'); // Add menus on the member login information $oMemberController = getController('member'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); $flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl; if ($addon_info->use_alarm != 'N' && file_exists($flag_file)) { // Pop-up to display messages if a flag on new message is set $new_message_count = (int) trim(FileHandler::readFile($flag_file)); FileHandler::removeFile($flag_file); Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang'); Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true); $text = preg_replace('@\\r?\\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); } } elseif ($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') { $member_srl = Context::get('target_srl'); $oCommunicationModel = getModel('communication'); // Add a feature to display own message box. if ($logged_info->member_srl == $member_srl) { $mid = Context::get('cur_mid'); $oMemberController = getController('member'); // Add your own viewing Note Template $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); // Display a list of friends $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
/** * return module searcher html */ function getModuleAdminModuleSearcherHtml() { Context::loadLang(_XE_PATH_ . 'modules/admin/lang'); $oTemplate = TemplateHandler::getInstance(); $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'module_searcher_v17.html'); $this->add('html', $tpl); }
<?php if (!defined("__XE__")) { exit; } $__tpl = TemplateHandler::getInstance(); echo $__tpl->compile('modules/authentication/tpl', 'header.html'); Context::loadLang('modules/authentication/lang'); ?> <form class="x_form-horizontal" action="./" method="post"><input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); ?> " /><input type="hidden" name="mid" value="<?php echo $__Context->mid; ?> " /><input type="hidden" name="vid" value="<?php echo $__Context->vid; ?> " /> <input type="hidden" name="act" value="procAuthenticationAdminDesignConfig" /> <input type="hidden" name="module" value="<?php echo $__Context->module; ?> " /> <input type="hidden" name="module_srl" value=<?php echo $__Context->module_srl; ?> /> <section class="section"> <h1>디자인 설정</h1> <div class="x_control-group">
<?php if (!defined("__XE__")) { exit; } echo Context::addHtmlHeader('<meta name="viewport" content="width=device-width, user-scalable=yes">'); Context::loadLang('layouts/xedition/lang'); ?> <?php $__Context->_is_indexmodule = $__Context->site_module_info->module_srl === $__Context->current_module_info->module_srl; ?> <?php $__Context->_body_class = array(); ?> <?php $__Context->_container_class = array(); ?> <?php $__Context->_visual_class = array(); ?> <?php $__Context->_selected_menu = null; ?> <?php $__Context->_magazine_header = false; ?> <?php $__Context->_onepage_header = false; ?> <?php $__Context->sub_header_title = $__Context->module_info->browser_title;
<?php if (!defined("__XE__")) { exit; } Context::addJsFile("./common/js/jquery.js", true, '', -100000); Context::addJsFile("./common/js/js_app.js", true, '', -100000); Context::addJsFile("./common/js/common.js", true, '', -100000); Context::addJsFile("./common/js/xml_handler.js", true, '', -100000); Context::addJsFile("./common/js/xml_js_filter.js", true, '', -100000); Context::loadLang('./modules/board/m.skins/default/lang'); $__tpl = TemplateHandler::getInstance(); echo $__tpl->compile('modules/board/m.skins/dgiBoard', '_header.html'); if ($__Context->oDocument->isExists()) { $__tpl = TemplateHandler::getInstance(); echo $__tpl->compile('modules/board/m.skins/dgiBoard', 'read.html'); } else { ?> <?php if ($__Context->mi->board_type == 'news') { ?> <?php $__tpl = TemplateHandler::getInstance(); echo $__tpl->compile('modules/board/m.skins/dgiBoard', '_list_news.html'); ?> <?php } elseif ($__Context->mi->board_type == 'webzine') { ?> <?php $__tpl = TemplateHandler::getInstance(); echo $__tpl->compile('modules/board/m.skins/dgiBoard', '_list_webzine.html');
/** * 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]; }
/** * @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]; }
/** * @brief 에디터 template을 return * upload_target_srl은 글의 수정시 호출하면 됨. * 이 upload_target_srl은 첨부파일의 유무를 체크하기 위한 루틴을 구현하는데 사용됨. **/ function getEditor($upload_target_srl = 0, $option = null) { /** * 기본적인 에디터의 옵션을 정리 **/ // 파일 업로드 유무 옵션 설정 if (!$option->allow_fileupload) { $allow_fileupload = false; } else { $allow_fileupload = true; } // content_style 세팅 if (!$option->content_style) { $option->content_style = 'default'; } Context::set('content_style', $option->content_style); // 기본 글꼴 지정 Context::set('content_font', $option->content_font); Context::set('content_font_size', $option->content_font_size); // 자동 저장 유무 옵션 설정 글 수정시는 사용 안함 if (!$option->enable_autosave) { $enable_autosave = false; } elseif (Context::get($option->primary_key_name)) { $enable_autosave = false; } else { $enable_autosave = true; } // 기본 에디터 컴포넌트 사용 설정 if (!$option->enable_default_component) { $enable_default_component = false; } else { $enable_default_component = true; } // 확장 컴포넌트 사용 설정 if (!$option->enable_component) { $enable_component = false; } else { $enable_component = true; } // html 모드 조절 if ($option->disable_html) { $html_mode = false; } else { $html_mode = true; } // 높이 설정 if (!$option->height) { $editor_height = 400; } else { $editor_height = $option->height; } // 스킨 설정 $skin = $option->skin; if (!$skin) { $skin = 'xpresseditor'; } $colorset = $option->colorset; Context::set('colorset', $colorset); Context::set('skin', $skin); /** * 자동백업 기능 체크 (글 수정일 경우는 사용하지 않음) **/ if ($enable_autosave) { // 자동 저장된 데이터를 추출 $saved_doc = $this->getSavedDoc($upload_target_srl); // 자동 저장 데이터를 context setting Context::set('saved_doc', $saved_doc); } Context::set('enable_autosave', $enable_autosave); /** * 에디터의 고유 번호 추출 (한 페이지에 여러개의 에디터를 출력하는 경우를 대비) **/ if ($option->editor_sequence) { $editor_sequence = $option->editor_sequence; } else { if (!$GLOBALS['_editor_sequence_']) { $GLOBALS['_editor_sequence_'] = 1; } $editor_sequence = $GLOBALS['_editor_sequence_']++; } /** * 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정 **/ $files_count = 0; if ($allow_fileupload) { $oFileModel =& getModel('file'); // SWFUploader에 세팅할 업로드 설정 구함 $file_config = $oFileModel->getUploadConfig(); $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; Context::set('file_config', $file_config); // 업로드 가능 용량등에 대한 정보를 세팅 $upload_status = $oFileModel->getUploadStatus(); Context::set('upload_status', $upload_status); // upload가능하다고 설정 (내부적으로 캐싱하여 처리) $oFileController =& getController('file'); $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); // 이미 등록된 파일이 있는지 검사 if ($upload_target_srl) { $files_count = $oFileModel->getFilesCount($upload_target_srl); } } Context::set('files_count', (int) $files_count); Context::set('allow_fileupload', $allow_fileupload); // 에디터 동작을 위한 editor_sequence값 설정 Context::set('editor_sequence', $editor_sequence); // 파일 첨부 관련 행동을 하기 위해 문서 번호를 upload_target_srl로 설정 // 신규문서일 경우 upload_target_srl=0 이고 첨부파일 관련 동작이 요청될때 이 값이 변경됨 Context::set('upload_target_srl', $upload_target_srl); // 문서 혹은 댓글의 primary key값을 세팅한다. Context::set('editor_primary_key_name', $option->primary_key_name); // 내용을 sync 맞추기 위한 content column name을 세팅한다 Context::set('editor_content_key_name', $option->content_key_name); /** * 에디터 컴포넌트 체크 **/ $site_module_info = Context::get('site_module_info'); $site_srl = (int) $site_module_info->site_srl; if ($enable_component) { if (!Context::get('component_list')) { $component_list = $this->getComponentList(true, $site_srl); Context::set('component_list', $component_list); } } Context::set('enable_component', $enable_component); Context::set('enable_default_component', $enable_default_component); /** * html_mode 가능한지 변수 설정 **/ Context::set('html_mode', $html_mode); /** * 에디터 세로 크기 설정 **/ Context::set('editor_height', $editor_height); // 에디터의 초기화를 수동으로하는 것에 대한 값 체크 Context::set('editor_manual_start', $option->manual_start); /** * 템플릿을 미리 컴파일해서 컴파일된 소스를 하기 위해 스킨의 경로를 설정 **/ $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); $tpl_file = 'editor.html'; if (!file_exists($tpl_path . $tpl_file)) { $skin = 'xpresseditor'; $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); } Context::set('editor_path', $tpl_path); // load editor skin lang Context::loadLang($tpl_path . 'lang'); // tpl 파일을 compile한 결과를 return $oTemplate = new TemplateHandler(); return $oTemplate->compile($tpl_path, $tpl_file); }
/** * Display FTP Configuration(settings) page * @return void */ function dispAdminConfigFtp() { Context::loadLang('modules/install/lang'); $ftp_info = Context::getFTPInfo(); Context::set('ftp_info', $ftp_info); Context::set('sftp_support', function_exists(ssh2_sftp)); $this->setTemplateFile('config_ftp'); //$security = new Security(); //$security->encodeHTML('ftp_info..'); }
/** * Site map admin menu index page * @return void */ function dispMenuAdminSiteMap() { Context::loadLang(_XE_PATH_ . 'modules/document/lang/'); Context::loadLang(_XE_PATH_ . 'modules/layout/lang/'); Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang/'); $site_srl = Context::get('site_srl'); $site_module_info = Context::get('site_module_info'); if (!$site_srl) { if ($logged_info->is_admin == 'Y' && !$site_keyword) { $site_srl = 0; } else { $site_srl = (int) $site_module_info->site_srl; } } // process for unlinked modules if ($site_srl == 0) { $oMenuController = getAdminController('menu'); $oMenuController->linkAllModuleInstancesToSitemap(); } $oAdmin = getClass('admin'); $oMenuAdminModel = getAdminModel('menu'); $menuListFromDB = $oMenuAdminModel->getMenus(); if (is_array($menuListFromDB)) { $output = array_reverse($menuListFromDB); } $menuList = array(); if (is_array($output)) { $menuItems = array(); foreach ($output as $key => $value) { if ($value->title == $oAdmin->getAdminMenuName()) { unset($output[$key]); } else { unset($menu, $menuItems); //$value->xml_file = sprintf('./files/cache/menu/%s.xml.php',$value->menu_srl); $value->php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php', $value->menu_srl); if (file_exists($value->php_file)) { include $value->php_file; } if (count($menu->list) > 0) { foreach ($menu->list as $key2 => $value2) { $this->_menuInfoSetting($menu->list[$key2]); } } //array_push($menuList, $value->xml_file); $menuItems = new stdClass(); $menuItems->menuSrl = $value->menu_srl; $menuItems->title = $value->title; $menuItems->desc = $value->desc; $menuItems->menuItems = $menu; $menuList[] = $menuItems; } } } Context::set('menu_list', $menuList); // get installed module list $oPageController = getController('page'); //for lang $resultModuleList = $oMenuAdminModel->getModuleListInSitemap($site_srl); Context::set('module_list', $resultModuleList); $oLayoutModel = getModel('layout'); $layoutList = $oLayoutModel->getLayoutList(); Context::set('layout_list', $layoutList); // choice theme file $theme_file = _XE_PATH_ . 'files/theme/theme_info.php'; if (is_readable($theme_file)) { include $theme_file; Context::set('current_layout', $theme_info->layout); } else { $oModuleModel = getModel('module'); $default_mid = $oModuleModel->getDefaultMid(); Context::set('current_layout', $default_mid->layout_srl); } // get default group list $oMemberModel = getModel('member'); $output = $oMemberModel->getGroups(); if (is_array($output)) { $groupList = array(); foreach ($output as $value) { $groupList[$value->group_srl] = new stdClass(); $groupList[$value->group_srl]->group_srl = $value->group_srl; $groupList[$value->group_srl]->title = $value->title; } } Context::set('group_list', $groupList); $this->setTemplateFile('sitemap'); }