/** * @brief 외부 http로 요청되는 파일일 경우 파일을 받아와서 저장 후 return **/ function getHtmlPage($path, $caching_interval, $cache_file) { // 캐시 검사 if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > time()) { $content = FileHandler::readFile($cache_file); } else { FileHandler::getRemoteFile($path, $cache_file); $content = FileHandler::readFile($cache_file); } // opage controller 생성 $oOpageController =& getController('opage'); // 외부 서버의 페이지 일 경우 이미지, css, javascript등의 url을 변경 $content = $oOpageController->replaceSrc($content, $path); // 해당 문서를 utf-8로 변경 $buff->content = $content; $buff = Context::convertEncoding($buff); $content = $buff->content; // title 추출 $title = $oOpageController->getTitle($content); if ($title) { Context::setBrowserTitle($title); } // header script 추출 $head_script = $oOpageController->getHeadScript($content); if ($head_script) { Context::addHtmlHeader($head_script); } // body 내용 추출 $body_script = $oOpageController->getBodyScript($content); if (!$body_script) { $body_script = $content; } return $content; }
/** * Document printing * I make it out to find the geulman;; * @return void|Object */ function dispDocumentPrint() { // Bring a list of variables needed to implement $document_srl = Context::get('document_srl'); // module_info not use in UI //$oModuleModel = &getModel('module'); //$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); // Create the document object. If the document module of basic data structures, write it all works .. -_-; $oDocumentModel =& getModel('document'); // Creates an object for displaying the selected document $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager); if (!$oDocument->isExists()) { return new Object(-1, 'msg_invalid_request'); } // Check permissions if (!$oDocument->isAccessible()) { return new Object(-1, 'msg_not_permitted'); } // Information setting module //Context::set('module_info', $module_info); //module_info not use in UI // Browser title settings Context::setBrowserTitle($oDocument->getTitleText()); Context::set('oDocument', $oDocument); Context::set('layout', 'none'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('print_page'); }
/** * @brief 트랙백 발송 **/ function procTrackbackSend() { // 게시물 번호와 발송하려는 엮인글 주소를 구함 $document_srl = Context::get('target_srl'); $trackback_url = Context::get('trackback_url'); $charset = Context::get('charset'); if (!$document_srl || !$trackback_url || !$charset) { return new Object(-1, 'msg_invalid_request'); } // 로그인 정보 구함 $logged_info = Context::get('logged_info'); if (!$logged_info->member_srl) { return new Object(-1, 'msg_not_permitted'); } // 게시물의 정보를 구해와서 있는지 여부와 권한을 체크 $oDocumentModel =& getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); if (!$oDocument->isExists()) { return new Object(-1, 'msg_invalid_request'); } if ($oDocument->getMemberSrl() != $logged_info->member_srl) { return new Object(-1, 'msg_not_permitted'); } // 현재 글이 있는 모듈의 타이틀 지정 $oModuleModel =& getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl')); Context::setBrowserTitle($module_info->browser_title); // 엮인글 발송 return $this->sendTrackback($oDocument, $trackback_url, $charset); }
/** * @brief Initialization */ function init() { // Stop if already installed. if (Context::isInstalled()) { return $this->stop('msg_already_installed'); } // Set the browser title. Context::setBrowserTitle(Context::getLang('introduce_title')); // Specify the template path. $this->setTemplatePath($this->module_path . 'tpl'); // Check the environment. $oInstallController = getController('install'); self::$checkEnv = $oInstallController->checkInstallEnv(); if (self::$checkEnv) { $oInstallController->makeDefaultDirectory(); } }
/** * @brief Initialization */ function init() { // Set browser title Context::setBrowserTitle(Context::getLang('introduce_title')); // Specify the template path $this->setTemplatePath($this->module_path . 'tpl'); // Error occurs if already installed if (Context::isInstalled()) { return $this->stop('msg_already_installed'); } // Install a controller $oInstallController = getController('install'); $this->install_enable = $oInstallController->checkInstallEnv(); // If the environment is installable, execute installController::makeDefaultDirectory() if ($this->install_enable) { $oInstallController->makeDefaultDirectory(); } }
/** * Trackbacks sent * @return object */ function procTrackbackSend() { // Yeokingeul to post numbers and shipping addresses Wanted $document_srl = Context::get('target_srl'); $trackback_url = Context::get('trackback_url'); $charset = Context::get('charset'); if (!$document_srl || !$trackback_url || !$charset) { return new Object(-1, 'msg_invalid_request'); } // Login Information Wanted $logged_info = Context::get('logged_info'); if (!$logged_info->member_srl) { return new Object(-1, 'msg_not_permitted'); } // Posts of the information obtained permission to come and check whether $oDocumentModel =& getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); if (!$oDocument->isExists() || !$oDocument->getSummary()) { return new Object(-1, 'msg_invalid_request'); } if ($oDocument->getMemberSrl() != $logged_info->member_srl) { return new Object(-1, 'msg_not_permitted'); } // Specify the title of the module, the current article $oModuleModel =& getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl')); Context::setBrowserTitle($module_info->browser_title); // Shipping yeokingeul $output = $this->sendTrackback($oDocument, $trackback_url, $charset); if ($output->toBool() && !in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { global $lang; htmlHeader(); alertScript($lang->success_registed); reload(true); closePopupScript(); htmlFooter(); Context::close(); exit; } return $output; }
/** * @brief 문서 인쇄 기능 * 해당 글만 찾아서 그냥 출력해버린다;; **/ function dispDocumentPrint() { // 목록 구현에 필요한 변수들을 가져온다 $document_srl = Context::get('document_srl'); // document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-; $oDocumentModel =& getModel('document'); // 선택된 문서 표시를 위한 객체 생성 $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager); if (!$oDocument->isExists()) { return new Object(-1, 'msg_invalid_request'); } // 권한 체크 if (!$oDocument->isAccessible()) { return new Object(-1, 'msg_not_permitted'); } // 브라우저 타이틀 설정 Context::setBrowserTitle($oDocument->getTitleText()); Context::set('oDocument', $oDocument); Context::set('layout', 'none'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('print_page'); }
/** * @brief 글감 수집기 팝업 **/ function dispMaterialPopup() { global $lang; $mid = Context::get('mid'); $auth = Context::get('auth'); Context::set('site_module_info', null); $oMaterialModel =& getModel('material'); $oModuleModel =& getModel('module'); $module_info = $oModuleModel->getModuleInfoByMid($mid, $site_srl = 0); $module_srl = $module_info->module_srl; $member_srl = $oMaterialModel->getMemberSrlByAuth($auth); if (!$member_srl) { Context::set('error', true); } // 템플릿 변수 $objects = explode("\t", Context::get('objects')); $images = explode("\t", Context::get('images')); $objects = array_unique($objects); $images = array_unique($images); $img = array(); foreach ($images as $key => $image) { if (preg_match('/\\.(gif|jpg|jpeg|png)(\\?.*|)$/i', $image)) { $img[] = $image; } } Context::set('objects', $objects); Context::set('images', $img); if (!Context::get('title')) { Context::set('title', Context::get('url')); } Context::setBrowserTitle($lang->material->popup_title); // 템플릿 지정 $this->setLayoutFile("popup_layout"); $this->setTemplateFile('popup'); Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_material.xml'); }
<?php if (!defined('__XE__')) { exit; } if ($called_position != "before_display_content") { return; } // 컨텐츠를 표시하는 시점에 호출되어야 합니다. $title = Context::getBrowserTitle() . ' ' . $addon_info->title_sep . ' ' . $addon_info->homepage_title; // 문서의 제목을 가져옵니다. $title = htmlspecialchars($title); // 이스케이프는 언제 어디서나 필수! Context::setBrowserTitle($title); // 설정.
function dispSocialxeTextyleTool() { // 텍스타일의 최신 버전이 아니면 직접 처리 $oTextyleView =& getView('textyle'); if (!method_exists($oTextyleView, 'initTool')) { $oTextyleModel =& getModel('textyle'); $site_module_info = Context::get('site_module_info'); $textyle = $oTextyleModel->getTextyle($site_module_info->index_module_srl); Context::set('textyle', $textyle); Context::set('custom_menu', $oTextyleModel->getTextyleCustomMenu()); $template_path = sprintf("%stpl", $oTextyleView->module_path); $this->setLayoutPath($template_path); $this->setLayoutFile('_tool_layout'); if ($_COOKIE['tclnb']) { Context::addBodyClass('lnbClose'); } else { Context::addBodyClass('lnbToggleOpen'); } // browser title 지정 Context::setBrowserTitle($textyle->get('browser_title') . ' - admin'); Context::addHtmlHeader('<link rel="shortcut icon" href="' . $textyle->getFaviconSrc() . '" />'); } // 설정 정보를 받아옴 Context::set('config', $this->config); // 서비스 목록 $provider_list = $this->providerManager->getFullProviderList(); Context::set('provider_list', $provider_list); // 템플릿 파일 지정 $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('textyleConfig'); }
/** * @brief 초기화 **/ function init() { // template path 지정 $this->setTemplatePath($this->module_path . 'tpl'); // 접속 사용자에 대한 체크 $oMemberModel =& getModel('member'); $logged_info = $oMemberModel->getLoggedInfo(); // 관리자가 아니면 금지 if ($logged_info->is_admin != 'Y') { return $this->stop("msg_is_not_administrator"); } // 관리자용 레이아웃으로 변경 $this->setLayoutPath($this->getTemplatePath()); $this->setLayoutFile('layout.html'); // 설치된 모듈 목록 가져와서 적절히 분리 $oModuleModel =& getModel('module'); $installed_module_list = $oModuleModel->getModulesXmlInfo(); $installed_modules = $package_modules = array(); $package_idx = 0; foreach ($installed_module_list as $key => $val) { if ($val->module == 'admin' || !$val->admin_index_act) { continue; } // action 정보 구함 $action_spec = $oModuleModel->getModuleActionXml($val->module); $actions = array(); if ($action_spec->default_index_act) { $actions[] = $action_spec->default_index_act; } if ($action_spec->admin_index_act) { $actions[] = $action_spec->admin_index_act; } if ($action_spec->action) { foreach ($action_spec->action as $k => $v) { $actions[] = $k; } } $obj = null; $obj->category = $val->category; $obj->title = $val->title; $obj->description = $val->description; $obj->index_act = $val->admin_index_act; if (in_array(Context::get('act'), $actions)) { $obj->selected = true; } // 패키지 모듈 if ($val->category == 'package') { if ($package_idx == 0) { $obj->position = "first"; } else { $obj->position = "mid"; } $package_modules[] = $obj; $package_idx++; if ($obj->selected) { Context::set('package_selected', true); } // 일반 모듈 } else { $installed_modules[] = $obj; } if ($obj->selected) { Context::set('selected_module_category', $val->category); Context::set('selected_module_info', $val); } } if (count($package_modules)) { $package_modules[count($package_modules) - 1]->position = 'end'; } Context::set('package_modules', $package_modules); Context::set('installed_modules', $installed_modules); $db_info = Context::getDBInfo(); Context::set('time_zone_list', $GLOBALS['time_zone']); Context::set('time_zone', $GLOBALS['_time_zone']); Context::set('use_rewrite', $db_info->use_rewrite == 'Y' ? 'Y' : 'N'); Context::set('use_optimizer', $db_info->use_optimizer != 'N' ? 'Y' : 'N'); Context::set('qmail_compatibility', $db_info->qmail_compatibility == 'Y' ? 'Y' : 'N'); Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y'); Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); if ($db_info->http_port) { Context::set('http_port', $db_info->http_port); } if ($db_info->https_port) { Context::set('https_port', $db_info->https_port); } Context::setBrowserTitle("XE Admin Page"); }
function dispTextyle() { $oTextyleModel =& getModel('textyle'); $oTextyleController =& getController('textyle'); $oDocumentModel =& getModel('document'); $args->category_srl = Context::get('category_srl'); $args->search_target = Context::get('search_target'); $args->search_keyword = Context::get('search_keyword'); $args->module_srl = $this->module_srl; $args->site_srl = $this->site_srl; $args->page = Context::get('page'); $args->page = $args->page > 0 ? $args->page : 1; Context::set('page', $args->page); // set category $category_list = $oDocumentModel->getCategoryList($this->module_srl); Context::set('category_list', $category_list); $document_srl = Context::get('document_srl'); if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl, false, false); if ($oDocument->isExists()) { if ($oDocument->get('module_srl') != $this->module_info->module_srl) { return $this->stop('msg_invalid_request'); } Context::setBrowserTitle($this->textyle->get('browser_title') . ' » ' . $oDocument->getTitle()); // meta keywords category + tag $tag_array = $oDocument->get('tag_list'); if ($tag_array) { $tag = htmlspecialchars(join(', ', $tag_array)); } else { $tag = ''; } $category_srl = $oDocument->get('category_srl'); if ($tag && $category_srl > 0) { $tag = $category_list[$category_srl]->title . ', ' . $tag; } Context::addHtmlHeader(sprintf('<meta name="keywords" content="%s" />', $tag)); if ($this->grant->manager) { $oDocument->setGrant(); } } else { Context::set('document_srl', '', true); $oDocument = $oDocumentModel->getDocument(0, false, false); } } if (!$document_srl) { if ($args->category_srl || $args->search_target && $args->search_keyword) { $args->list_count = 10; $output = $oDocumentModel->getDocumentList($args, false, false); $document_list = $output->data; Context::set('page_navigation', $output->page_navigation); Context::set('document_list', $document_list); $this->setTemplateFile('list'); } } if ((!$oDocument || !$oDocument->isExists()) && !$document_list) { $args->list_count = 1; $output = $oDocumentModel->getDocumentList($args, false, false); if ($output->data && count($output->data)) { $oDocument = array_pop($output->data); } } if ($oDocument && $oDocument->isExists()) { $args->document_srl = $oDocument->document_srl; $output = executeQuery('textyle.getNextDocument', $args); if ($output->data->document_srl) { Context::set('prev_document', new documentItem($output->data->document_srl, false)); } $output = executeQuery('textyle.getPrevDocument', $args); if ($output->data->document_srl) { Context::set('next_document', new documentItem($output->data->document_srl, false)); } Context::set('oDocument', $oDocument); $this->setTemplateFile('read'); Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); } }
/** * 별도저장 회원 목록을 표시하는 메소드. */ public function dispMember_ExpireAdminListMoved() { // 현재 설정을 불러온다. $config = $this->getConfig(); Context::set('mex_config', $config); // 검색 조건을 불러온다. $search_target = Context::get('search_target'); $search_keyword = Context::get('search_keyword'); if (!in_array($search_target, array('email_address', 'user_id', 'user_name', 'nick_name')) || !$search_keyword) { Context::set('search_target', $search_target = null); Context::set('search_keyword', $search_keyword = null); } // 휴면계정 목록을 불러온다. $obj = new stdClass(); if ($search_target && $search_keyword) { $obj->{$search_target} = trim($search_keyword); } $moved_members_count = executeQuery('member_expire.countMovedMembers', $obj); $moved_members_count = $moved_members_count->toBool() ? $moved_members_count->data->count : 0; $obj->page = $page = Context::get('page') ? Context::get('page') : 1; $obj->orderby = 'desc'; $moved_members = executeQuery('member_expire.getMovedMembers', $obj); $moved_members = $moved_members->toBool() ? $moved_members->data : array(); Context::set('expire_threshold', $this->translateThreshold($config->expire_threshold)); Context::set('moved_members_count', $moved_members_count); Context::set('moved_members', $moved_members); // 페이징을 처리한다. $paging = new Object(); $paging->total_count = $moved_members_count; $paging->total_page = max(1, ceil($moved_members_count / 10)); $paging->page = $page; $paging->page_navigation = new PageHandler($paging->total_count, $paging->total_page, $page, 10); Context::set('paging', $paging); Context::set('page', $page); // 템플릿을 지정한다. Context::setBrowserTitle('별도저장 회원 목록 - XE Admin'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('list_moved'); }
/** * 예외 목록 화면을 표시하는 메소드. */ public function dispMember_ExpireAdminListExceptions() { // 현재 설정을 불러온다. $config = $this->getConfig(); Context::set('mex_config', $config); // 검색 조건을 불러온다. $search_target = Context::get('search_target'); $search_keyword = Context::get('search_keyword'); if (!in_array($search_target, array('email_address', 'user_id', 'user_name', 'nick_name')) || !$search_keyword) { Context::set('search_target', $search_target = null); Context::set('search_keyword', $search_keyword = null); } $valid_list_counts = array(10, 20, 30, 50, 100, 200, 300); $list_count = intval(Context::get('list_count')); if (!in_array($list_count, $valid_list_counts)) { $list_count = 10; } Context::set('list_count', $list_count); // 발송 내역을 불러온다. $obj = new stdClass(); if ($search_target && $search_keyword) { $obj->{$search_target} = trim($search_keyword); } $exception_count = executeQuery('member_expire.countExceptions', $obj); $exception_count = $exception_count->toBool() ? $exception_count->data->count : 0; $obj->list_count = $list_count; $obj->page = $page = Context::get('page') ? Context::get('page') : 1; $obj->orderby = 'desc'; $exceptions = executeQuery('member_expire.getExceptions', $obj); $exceptions = $exceptions->toBool() ? $exceptions->data : array(); $member_srls = array(); foreach ($exceptions as $member) { $member_srls[] = $member->member_srl; } $exceptions_groups = getModel('member')->getMembersGroups($member_srls); Context::set('exception_count', $exception_count); Context::set('exceptions', $exceptions); Context::set('exceptions_groups', $exceptions_groups); // 페이징을 처리한다. $paging = new Object(); $paging->total_count = $exception_count; $paging->total_page = max(1, ceil($exception_count / $list_count)); $paging->page = $page; $paging->page_navigation = new PageHandler($paging->total_count, $paging->total_page, $page, $list_count); Context::set('paging', $paging); Context::set('page', $page); // 템플릿을 지정한다. Context::setBrowserTitle('예외 목록 - XE Admin'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('exceptions'); }
/** * @brief display the board conent view **/ function dispBoardContentView() { // get the variable value $document_srl = Context::get('document_srl'); $page = Context::get('page'); // generate document model object $oDocumentModel = getModel('document'); /** * if the document exists, then get the document information **/ if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl, false, true); // if the document is existed if ($oDocument->isExists()) { // if the module srl is not consistent if ($oDocument->get('module_srl') != $this->module_info->module_srl) { return $this->stop('msg_invalid_request'); } // check the manage grant if ($this->grant->manager) { $oDocument->setGrant(); } // if the consultation function is enabled, and the document is not a notice if ($this->consultation && !$oDocument->isNotice()) { $logged_info = Context::get('logged_info'); if ($oDocument->get('member_srl') != $logged_info->member_srl) { $oDocument = $oDocumentModel->getDocument(0); } } // if the document is TEMP saved, check Grant if ($oDocument->getStatus() == 'TEMP') { if (!$oDocument->isGranted()) { $oDocument = $oDocumentModel->getDocument(0); } } } else { // if the document is not existed, then alert a warning message Context::set('document_srl', '', true); $this->alertMessage('msg_not_founded'); } /** * if the document is not existed, get an empty document **/ } else { $oDocument = $oDocumentModel->getDocument(0); } /** *check the document view grant **/ if ($oDocument->isExists()) { if (!$this->grant->view && !$oDocument->isGranted()) { $oDocument = $oDocumentModel->getDocument(0); Context::set('document_srl', '', true); $this->alertMessage('msg_not_permitted'); } else { // add the document title to the browser Context::setCanonicalURL($oDocument->getPermanentUrl()); $seo_title = config('seo.document_title') ?: '$SITE_TITLE - $DOCUMENT_TITLE'; getController('module')->replaceDefinedLangCode($seo_title); Context::setBrowserTitle($seo_title, array('site_title' => Context::getSiteTitle(), 'site_subtitle' => Context::getSiteSubtitle(), 'subpage_title' => $this->module_info->browser_title, 'document_title' => $oDocument->getTitleText(), 'page' => Context::get('page') ?: 1)); // update the document view count (if the document is not secret) if (!$oDocument->isSecret() || $oDocument->isGranted()) { $oDocument->updateReadedCount(); } // disappear the document if it is secret if ($oDocument->isSecret() && !$oDocument->isGranted()) { $oDocument->add('content', lang('thisissecret')); } } } Context::set('update_view', $this->grant->update_view); // setup the document oject on context $oDocument->add('module_srl', $this->module_srl); Context::set('oDocument', $oDocument); /** * add javascript filters **/ Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); // return new Object(); }
/** * Include admin menu php file and make menu url * Setting admin logo, newest news setting * @return void */ function makeGnbUrl($module = 'admin') { global $lang; // Check is_shortcut column $oDB = DB::getInstance(); if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) { return; } $oAdminAdminModel = getAdminModel('admin'); $lang->menu_gnb_sub = $oAdminAdminModel->getAdminMenuLang(); $result = $oAdminAdminModel->checkAdminMenu(); include $result->php_file; $oModuleModel = getModel('module'); // get current menu's subMenuTitle $moduleActionInfo = $oModuleModel->getModuleActionXml($module); $currentAct = Context::get('act'); $subMenuTitle = ''; foreach ((array) $moduleActionInfo->menu as $key => $value) { if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) { $subMenuTitle = $value->title; break; } } // get current menu's srl(=parentSrl) $parentSrl = 0; $oMenuAdminConroller = getAdminController('menu'); foreach ((array) $menu->list as $parentKey => $parentMenu) { if (!is_array($parentMenu['list']) || !count($parentMenu['list'])) { continue; } if ($parentMenu['href'] == '#' && count($parentMenu['list'])) { $firstChild = current($parentMenu['list']); $menu->list[$parentKey]['href'] = $firstChild['href']; } foreach ($parentMenu['list'] as $childKey => $childMenu) { if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0) { $parentSrl = $childMenu['parent_srl']; } } } // Admin logo, title setup $objConfig = $oModuleModel->getModuleConfig('admin'); $gnbTitleInfo = new stdClass(); $gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin'; $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png'; $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle; // Get list of favorite $oAdminAdminModel = getAdminModel('admin'); $output = $oAdminAdminModel->getFavoriteList(0, true); Context::set('favorite_list', $output->get('favoriteList')); // Retrieve recent news and set them into context, // move from index method, because use in admin footer $newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); $cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) { // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page // Ensure to access the administration page even though news cannot be displayed FileHandler::writeFile($cache_file, ''); FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); } if (file_exists($cache_file)) { $oXml = new XmlParser(); $buff = $oXml->parse(FileHandler::readFile($cache_file)); $item = $buff->zbxe_news->item; if ($item) { if (!is_array($item)) { $item = array($item); } foreach ($item as $key => $val) { $obj = new stdClass(); $obj->title = $val->body; $obj->date = $val->attrs->date; $obj->url = $val->attrs->url; $news[] = $obj; } Context::set('news', $news); if (isset($news) && is_array($news)) { Context::set('latestVersion', array_shift($news)); } } Context::set('released_version', $buff->zbxe_news->attrs->released_version); Context::set('download_link', $buff->zbxe_news->attrs->download_link); } Context::set('subMenuTitle', $subMenuTitle); Context::set('gnbUrlList', $menu->list); Context::set('parentSrl', $parentSrl); Context::set('gnb_title_info', $gnbTitleInfo); Context::setBrowserTitle($browserTitle); }
function dispMultiPostTextyle() { // $document_srl is obtained only at Comment Reply and Comment Modify. $document_srl = Context::get('document_srl'); $oDocumentModel =& getModel('document'); $category = Context::get('category'); if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl, false, false); // If document exists, then this is a comment posting case, // so we don't need to perform all other operations if ($oDocument->isExists()) { // If this document doesn't belong to this blog module, // ignore it. if ($oDocument->get('module_srl') != $this->module_info->module_srl) { return $this->stop('msg_invalid_request'); } } else { Context::set('document_srl', '', true); return $this->stop('msg_invalid_request'); } } else { $alias_title = Context::get('alias_title'); if ($alias_title) { $query_arguments->alias_title = "/" . $alias_title . "/"; $output = executeQuery('textyle.getDocumentSrlByAlias', $query_arguments); if ($output->data) { $document_srl = $output->data->document_srl; $oDocument = $oDocumentModel->getDocument($document_srl, false, false); if ($oDocument->isExists()) { $oDocument->alias_title = $category . '/' . $alias_title . '/'; } } } } // set the page $page = Context::get('page'); $page = $page > 0 ? $page : 1; Context::set('page', $page); // get a list of categories of textyle $category_list = $oDocumentModel->getCategoryList($this->module_srl); Context::set('module_name', $this->textyle->domain); Context::set('category_list', $category_list); // Wanted Post List $args->module_srl = $this->module_srl; $args->page_count = 10; $args->sort_index = Context::get('sort_index'); $args->order_type = Context::get('order_type'); if (!in_array($args->sort_index, $this->order_target)) { $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; } if (!in_array($args->order_type, array('asc', 'desc'))) { $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; } $recentTags = array(); // ì„ íƒ�ë�œ 글ì�´ 하나ë�¼ë�„ 글 목ë¡�으로 형성 if ($oDocument && $oDocument->isExists()) { $mode = 'content'; // set the browser title Context::setBrowserTitle($oDocument->getTitle() . ' | ' . $this->textyle->get('browser_title')); // set meta keywords category + all tags of the document $docTags = $oDocument->get('tags'); $category_srl = $oDocument->get('category_srl'); if ($category_srl) { $tags = $category_list[$category_srl]->title; } if ($docTags) { $docTagsArray = $oDocument->get('tag_list'); foreach ($docTagsArray as $tag) { ++$recentTags[$tag]; } $tags .= ($tags ? ',' : '') . $docTags; } // ì„ íƒ�ë�œ 글ì�´ 하나ì�¼ 경우 ì�´ì „/ 다ì�Œ 페ì�´ì§€ 구함 + 조회수 ì¦�ê°€ + referer 기ë¡� $oDocument->updateReadedCount(); // referer 남김 $oTextyleController =& getController('textyle'); $oTextyleController->insertReferer($oDocument); // 관리 권한ì�´ 있다면 권한ì�„ 부여 if ($this->grant->manager) { $oDocument->setGrant(); } $oDocument->variables['relative_date'] = $this->zdateRelative($oDocument->getRegdateTime()); $document_list[] = $oDocument; $nr_documents = count($document_list); Context::set('nr_documents', $nr_documents); if ($nr_documents == 1) { $_comment_list = $oDocument->getComments(); if (isset($_comment_list)) { foreach ($_comment_list as $comment) { $comment->variables['relativeDate'] = $this->zdateRelative($comment->getRegdateTime()); } } Context::set('_comment_list', $_comment_list); } Context::set('document_list', $document_list); } else { $mode = $this->textyle->getPostStyle(); // Check if the search is within a specific tag $search_target = Context::get('search_target'); if ($search_target == 'tags') { $args->tag = Context::get('search_keyword'); } // Get the category $args->category_srl = urldecode($category); if ($args->category_srl && !is_numeric($args->category_srl)) { $arguments->category_title = $args->category_srl; $arguments->module_srl = $this->module_srl; $output = executeQuery('textyle.getCategorySrl', $arguments); if ($output->data) { $args->category_srl = $output->data->category_srl; $args->categories[] = $args->category_srl; if ($category_list[$args->category_srl]->child_count) { foreach ($category_list[$args->category_srl]->childs as $child) { $args->categories[] = $child; } } $tags = $category_list[$args->category_srl]->title; // set the browser title for this category Context::setBrowserTitle($tags . ' | ' . $this->textyle->get('browser_title')); } } else { $args->category_srl = Context::get('category_srl'); } // If there is such a category if ($args->category_srl) { Context::set('selected_category', $category_list[$args->category_srl]->title); } elseif ($page == 1 && !isset($args->tag)) { $args->module_srl = $this->module_srl; $args->start_date = date('YmdHis', strtotime("-1 month")); $args->end_date = date('YmdHis'); $args->sort_index = 'readed_count'; $args->page = 1; $args->list_count = 3; $mostPopularBlogs = $this->getDocumentItems('textyle.getTopViewDocumentsInDateRange', $args); foreach ($mostPopularBlogs->data as $popularBlog) { $popularBlog->variables['relative_date'] = $this->zdateRelative($popularBlog->getRegdateTime()); if ($popularBlog->get('alias_title')) { $popularBlog->variables['url'] = getSiteUrl() . $this->textyle->domain . '/entry/' . $popularBlog->get('alias_title'); } else { $popularBlog->variables['url'] = getSiteUrl() . $this->textyle->domain . '/' . $popularBlog->get('document_srl'); } } Context::set('mostPopularBlogs', $mostPopularBlogs->data); unset($args->start_date); unset($args->end_date); $args->list_count = 5; $args->page = $page; $allPopularBlogs = $this->getDocumentItems('textyle.getAllTimeTopViewDocuments', $args); foreach ($allPopularBlogs->data as $popularBlog) { $popularBlog->variables['relative_date'] = $this->zdateRelative($popularBlog->getRegdateTime()); if ($popularBlog->get('alias_title')) { $popularBlog->variables['url'] = getSiteUrl() . $this->textyle->domain . '/entry/' . $popularBlog->get('alias_title'); } else { $popularBlog->variables['url'] = getSiteUrl() . $this->textyle->domain . '/' . $popularBlog->get('document_srl'); } } Context::set('allPopularBlogs', $allPopularBlogs->data); } // Get a list of latest posts $args->module_srl = $this->module_srl; $args->list_count = $this->textyle->getPostListCount(); $args->sort_index = 'list_order'; $args->page = $page; $args->page_count = 10; $latestBlogs = $this->getDocumentItems('textyle.getPosts', $args); Context::set('latestBlogs', $latestBlogs->data); Context::set('page_navigation', $latestBlogs->page_navigation); if (isset($latestBlogs->data)) { foreach ($latestBlogs->data as $document) { $docTags = $document->get('tag_list'); if (isset($docTags)) { foreach ($docTags as $tag) { $recentTags[$tag]++; } } $document->variables['relative_date'] = $this->zdateRelative($document->getRegdateTime()); if ($document->get('alias_title')) { $document->variables['url'] = getSiteUrl() . $this->textyle->domain . '/entry/' . $document->get('alias_title'); } else { $document->variables['url'] = getSiteUrl() . $this->textyle->domain . '/' . $document->get('document_srl'); } } } arsort($recentTags); $tags .= ',' . implode(',', array_keys($recentTags)); } Context::addHtmlHeader(sprintf('<meta name="keywords" content="%s" />', $tags)); Context::addJsFilter($this->module_path . 'skins/' . $this->module_info->skin . '/filter', 'insert_comment.xml'); Context::set('textyle_mode', $mode); Context::set('recentTags', $recentTags); Context::set('module_path', $this->module_path); }
/** * Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action * @return boolean true: OK, false: redirected **/ function init() { $oModuleModel =& getModel('module'); $site_module_info = Context::get('site_module_info'); if (!$this->document_srl && $this->mid && $this->entry) { $oDocumentModel =& getModel('document'); $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); if ($this->document_srl) { Context::set('document_srl', $this->document_srl); } } // Get module's information based on document_srl, if it's specified if ($this->document_srl && !$this->module) { $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); // If the document does not exist, remove document_srl if (!$module_info) { unset($this->document_srl); } else { // If it exists, compare mid based on the module information // if mids are not matching, set it as the document's mid if ($this->mid != $module_info->mid) { $this->mid = $module_info->mid; Context::set('mid', $module_info->mid, true); header('location:' . getNotEncodedSiteUrl($site_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); return false; } } // if requested module is different from one of the document, remove the module information retrieved based on the document number if ($this->module && $module_info->module != $this->module) { unset($module_info); } } // If module_info is not set yet, and there exists mid information, get module information based on the mid if (!$module_info && $this->mid) { $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); //if($this->module && $module_info->module != $this->module) unset($module_info); } // redirect, if module_site_srl and site_srl are different if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) { $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); return false; } // If module_info is not set still, and $module does not exist, find the default module if (!$module_info && !$this->module && !$this->mid) { $module_info = $site_module_info; } if (!$module_info && !$this->module && $site_module_info->module_site_srl) { $module_info = $site_module_info; } // redirect, if site_srl of module_info is different from one of site's module_info if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) { // If the module is of virtual site if ($module_info->site_srl) { $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); // If it's called from a virtual site, though it's not a module of the virtual site } else { $db_info = Context::getDBInfo(); if (!$db_info->default_url) { return Context::getLang('msg_default_url_is_not_defined'); } else { $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); } } header("location:" . $redirect_url); return false; } // If module info was set, retrieve variables from the module information if ($module_info) { $this->module = $module_info->module; $this->mid = $module_info->mid; $this->module_info = $module_info; Context::setBrowserTitle($module_info->browser_title); $part_config = $oModuleModel->getModulePartConfig('layout', $module_info->layout_srl); Context::addHtmlHeader($part_config->header_script); } // Set module and mid into module_info $this->module_info->module = $this->module; $this->module_info->mid = $this->mid; // Set site_srl add 2011 08 09 $this->module_info->site_srl = $site_module_info->site_srl; // Still no module? it's an error if (!$this->module) { $this->error = 'msg_module_is_not_exists'; $this->httpStatusCode = '404'; } // If mid exists, set mid into context if ($this->mid) { Context::set('mid', $this->mid, true); } // Call a trigger after moduleHandler init $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); if (!$output->toBool()) { $this->error = $output->getMessage(); return false; } // Set current module info into context Context::set('current_module_info', $this->module_info); return true; }
/** * shop init service **/ public function initService(&$oModule, $is_other_module = FALSE, $isMobile = FALSE){ if (!$oModule) $oModule = $this; /** @var $oShopModel shopModel */ $oShopModel = getModel('shop'); $this->initCommon($is_other_module); Context::addJsFile($this->module_path.'tpl/js/shop_service.js'); $preview_skin = Context::get('preview_skin'); if(!$isMobile) { if($is_other_module){ $path_method = 'setLayoutPath'; $file_method = 'setLayoutFile'; $css_path_method = 'getLayoutPath'; Context::set('shop_mode', 'module'); Context::set('external_module', $oModule->module); }else{ $path_method = 'setTemplatePath'; $file_method = 'setTemplateFile'; $css_path_method = 'getTemplatePath'; } if(!$preview_skin){ $oShopModel->checkShopPath($this->module_srl, $this->module_info->skin); $oModule->{$path_method}($oShopModel->getShopPath($this->module_srl)); }else{ $oModule->{$path_method}($this->module_path.'skins/'.$preview_skin); } $oModule->{$file_method}('shop'); Context::addCssFile($oModule->{$css_path_method}().'shop.css',TRUE,'all','',100); } Context::set('root_url', Context::getRequestUri()); Context::set('home_url', getFullSiteUrl($this->shop->domain)); Context::set('profile_url', getSiteUrl($this->shop->domain,'','mid',$this->module_info->mid,'act','dispShopProfile')); if(Context::get('is_logged')) Context::set('admin_url', getSiteUrl($this->shop->domain,'','mid',$this->module_info->mid,'act','dispShopToolDashboard')); else Context::set('admin_url', getSiteUrl($this->shop->domain,'','mid','shop','act','dispShopToolLogin')); Context::set('shop_title', $this->shop->get('shop_title')); // set browser title Context::setBrowserTitle($this->shop->get('browser_title')); // Load cart for display on all pages (in header) $cartRepo = new CartRepository(); $logged_info = Context::get('logged_info'); // If cart doesn't exist, create new one $cart = $cartRepo->getCart($this->module_srl, NULL, $logged_info->member_srl, session_id(), TRUE); Context::set('cart', $cart); // Load cart preview (for ajax cart feature in header) $cart_preview = new CartPreview($cart, 3); Context::set('cart_preview', $cart_preview); // Load menu for display on all pages (in header) $shop = Context::get('shop'); $menus = $shop->getMenus(); foreach($menus as $menu_key => $menu_srl) { $menu = new ShopMenu($menu_srl); Context::set($menu_key, $menu->getHtml()); } // Load categories for display in search dropdown (header) $category_repository = new CategoryRepository(); $tree = $category_repository->getNavigationCategoriesTree($this->module_srl); $flat_tree = $tree->toFlatStructure(); Context::set('search_categories', $flat_tree); }
function triggerBeforeDisplay(&$output_content) { if (Context::getResponseMethod() != 'HTML') { return; } if (Context::get('module') == 'admin') { return; } $oModuleModel = getModel('module'); $config = $this->getConfig(); $logged_info = Context::get('logged_info'); $current_module_info = Context::get('current_module_info'); $site_module_info = Context::get('site_module_info'); $document_srl = Context::get('document_srl'); $is_article = false; $is_index = $current_module_info->module_srl == $site_module_info->module_srl ? true : false; $piece = new stdClass(); $piece->document_title = null; $piece->type = 'website'; $piece->url = getFullUrl(''); $piece->title = Context::getBrowserTitle(); $piece->description = $config->site_description; $piece->keywords = $config->site_keywords; $piece->image = array(); $piece->author = null; if ($document_srl) { $oDocument = Context::get('oDocument'); if (!is_a($oDocument, 'documentItem')) { $oDocumentModel = getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); } if (is_a($oDocument, 'documentItem') && $document_srl == $oDocument->document_srl) { $is_article = true; } } // 문서 데이터 수집 if ($is_article) { if (!$oDocument->isSecret()) { $piece->document_title = $oDocument->getTitleText(); $piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl', $document_srl); $piece->type = 'article'; $piece->description = trim(str_replace(' ', ' ', $oDocument->getContentText(400))); $piece->author = $oDocument->getNickName(); if (count($oDocument->get('tag_list'))) { $tags = implode(',', $oDocument->get('tag_list')); if ($tags) { $piece->keywords = $tags; } } if ($oDocument->hasUploadedFiles()) { $image_ext = array('bmp', 'gif', 'jpg', 'jpeg', 'png'); foreach ($oDocument->getUploadedFiles() as $file) { if ($file->isvalid != 'Y') { continue; } $ext = array_pop(explode('.', $file->uploaded_filename)); if (!in_array(strtolower($ext), $image_ext)) { continue; } $piece->image[] = Context::get('request_uri') . $file->uploaded_filename; } } } else { $piece->url = getFullUrl('', 'mid', $current_module_info->mid); } } else { if (!$is_index) { $page = Context::get('page') > 1 ? Context::get('page') : null; $piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page', $page); } } $piece->title = $this->getBrowserTitle($piece->document_title); if ($config->site_image_url) { $piece->image[] = $config->site_image_url; } $this->addLink('canonical', $piece->url); $this->addMeta('keywords', $piece->keywords); $this->addMeta('description', $piece->description); // Open Graph $this->addMeta('og:type', $piece->type); $this->addMeta('og:url', $piece->url); $this->addMeta('og:site_name', $config->site_name); $this->addMeta('og:title', $piece->title); $this->addMeta('og:description', $piece->description); $this->addMeta('og:article:author', $piece->author); foreach ($piece->image as $img) { $this->addMeta('og:image', $img); } $this->canonical_url = $piece->url; $this->applySEO(); if ($config->use_optimize_title == 'Y') { Context::setBrowserTitle($piece->title); } }
/** * @brief 즐겨찾기 보기 **/ function favorite() { $oPlanetModel =& getModel('planet'); // 개별 플래닛의 정보를 세팅 $planet = $oPlanetModel->getPlanet($this->module_srl); Context::set('planet', $planet); // 내플래닛인지 아닌지 $logged_info = Context::get('logged_info'); Context::set('isMyPlanet', $planet->getMemberSrl() == $logged_info->member_srl); // 플래닛의 메모 가져오기 $memo_output = $oPlanetModel->getMemoList($this->module_srl); Context::set('memo_list', $memo_output->data); Context::set('memo_navigation', $memo_output->page_navigation); // 플래닛의 관심태그 가져오기 $interest_tags = $oPlanetModel->getInterestTags($this->module_srl); Context::set('interest_tags', $interest_tags); // 브라우저 타이틀 변경 Context::setBrowserTitle($planet->getPlanetTitle() . ' - ' . $planet->getBrowserTitle()); // 내 플래닛이 아닐 경우 즐찾에 포함되어 있는 대상인지 확인 $myplanet = Context::get('myplanet'); if (Context::get('isMyPlanet') || $oPlanetModel->isInsertedFavorite($myplanet->module_srl, $this->module_srl)) { Context::set('myFavoritePlanet', true); } else { Context::set('myFavoritePlanet', false); } // 즐찾 가져오기 $page = Context::get('page'); $output = $oPlanetModel->getFavoriteContentList($this->module_srl, $page, 10); Context::set('content_list', $output->data); Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('page_navigation', $output->page_navigation); // 템플릿 지정 $this->setTemplateFile('favorite'); }
/** * @brief wap procedure method **/ function procWAP(&$oMobile) { // 권한 체크 if (!$this->grant->list || $this->module_info->consultation == 'Y') { return $oMobile->setContent(Context::getLang('msg_not_permitted')); } // document model 객체 생성 $oDocumentModel =& getModel('document'); // 선택된 게시글이 있을 경우 $document_srl = Context::get('document_srl'); if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl); if ($oDocument->isExists()) { // 권한 확인 if (!$this->grant->view) { return $oMobile->setContent(Context::getLang('msg_not_permitted')); } // 글 제목 설정 Context::setBrowserTitle($oDocument->getTitleText()); // 댓글 보기 일 경우 if ($this->act == 'dispBoardContentCommentList') { $oCommentModel =& getModel('comment'); $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount()); $content = ''; if (count($output->data)) { foreach ($output->data as $key => $val) { $oComment = new commentItem(); $oComment->setAttribute($val); if (!$oComment->isAccessible()) { continue; } $content .= "<b>" . $oComment->getNickName() . "</b> (" . $oComment->getRegdate("Y-m-d") . ")<br>\r\n" . $oComment->getContent(false, false) . "<br>\r\n"; } } // 내용 설정 $oMobile->setContent($content); // 상위 페이지를 목록으로 돌아가기로 지정 $oMobile->setUpperUrl(getUrl('act', ''), Context::getLang('cmd_go_upper')); // 댓글 보기가 아니면 글 보여줌 } else { // 내용 지정 (태그를 모두 제거한 내용을 설정) $content = strip_tags(str_replace('<p>', '<br> ', $oDocument->getContent(false, false, false)), '<br><b><i><u><em><small><strong><big>'); // 내용 상단에 정보 출력 (댓글 보기 링크 포함) $content = Context::getLang('replies') . ' : <a href="' . getUrl('act', 'dispBoardContentCommentList') . '">' . $oDocument->getCommentCount() . '</a><br>' . "\r\n" . $content; $content = '<b>' . $oDocument->getNickName() . '</b> (' . $oDocument->getRegdate("Y-m-d") . ")<br>\r\n" . $content; // 내용 설정 $oMobile->setContent($content); // 상위 페이지를 목록으로 돌아가기로 지정 $oMobile->setUpperUrl(getUrl('document_srl', ''), Context::getLang('cmd_list')); } return; } } // 게시글 목록 $args->module_srl = $this->module_srl; $args->page = Context::get('page'); $args->list_count = 9; $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; $output = $oDocumentModel->getDocumentList($args, $this->except_notice); $document_list = $output->data; $page_navigation = $output->page_navigation; $childs = array(); if ($document_list && count($document_list)) { foreach ($document_list as $key => $val) { $href = getUrl('mid', $_GET['mid'], 'document_srl', $val->document_srl); $obj = null; $obj['href'] = $val->getPermanentUrl(); $title = htmlspecialchars($val->getTitleText()); if ($val->getCommentCount()) { $title .= ' [' . $val->getCommentCount() . ']'; } $obj['link'] = $obj['text'] = '[' . $val->getNickName() . '] ' . $title; $childs[] = $obj; } $oMobile->setChilds($childs); } $totalPage = $page_navigation->last_page; $page = (int) Context::get('page'); if (!$page) { $page = 1; } // next/prevUrl 지정 if ($page > 1) { $oMobile->setPrevUrl(getUrl('mid', $_GET['mid'], 'page', $page - 1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page - 1, $totalPage)); } if ($page < $totalPage) { $oMobile->setNextUrl(getUrl('mid', $_GET['mid'], 'page', $page + 1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page + 1, $totalPage)); } $oMobile->mobilePage = $page; $oMobile->totalPage = $totalPage; }
/** * @brief Save the file and return if a file is requested by http */ function getHtmlPage($path, $caching_interval, $cache_file) { // Verify cache if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME']) { $content = FileHandler::readFile($cache_file); } else { FileHandler::getRemoteFile($path, $cache_file); $content = FileHandler::readFile($cache_file); } // Create opage controller $oPageController = getController('page'); // change url of image, css, javascript and so on if the page is from external server $content = $oPageController->replaceSrc($content, $path); // Change the document to utf-8 format $buff = new stdClass(); $buff->content = $content; $buff = Context::convertEncoding($buff); $content = $buff->content; // Extract a title $title = $oPageController->getTitle($content); if ($title) { Context::setBrowserTitle($title); } // Extract header script $head_script = $oPageController->getHeadScript($content); if ($head_script) { Context::addHtmlHeader($head_script); } // Extract content from the body $body_script = $oPageController->getBodyScript($content); if (!$body_script) { $body_script = $content; } return $content; }
/** * @brief wap procedure method **/ function procWAP(&$oMobile) { // check grant if (!$this->grant->list || $this->module_info->consultation == 'Y') { return $oMobile->setContent(lang('msg_not_permitted')); } // generate document model object $oDocumentModel = getModel('document'); // if the doument is existed $document_srl = Context::get('document_srl'); if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl); if ($oDocument->isExists()) { // check the grant if (!$this->grant->view) { return $oMobile->setContent(lang('msg_not_permitted')); } // setup the browser title Context::setBrowserTitle($oDocument->getTitleText()); // if the act is display comment list if ($this->act == 'dispBoardContentCommentList') { $oCommentModel = getModel('comment'); $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount()); $content = ''; if (count($output->data)) { foreach ($output->data as $key => $val) { $oComment = new commentItem(); $oComment->setAttribute($val); if (!$oComment->isAccessible()) { continue; } $content .= "<b>" . $oComment->getNickName() . "</b> (" . $oComment->getRegdate("Y-m-d") . ")<br>\r\n" . $oComment->getContent(false, false) . "<br>\r\n"; } } // setup mobile contents $oMobile->setContent($content); // setup upper URL $oMobile->setUpperUrl(getUrl('act', ''), lang('cmd_go_upper')); // display the document if the act is not display the comment list } else { // setup contents (strip all html tags) $content = strip_tags(str_replace('<p>', '<br> ', $oDocument->getContent(false, false, false)), '<br><b><i><u><em><small><strong><big>'); // setup content information(include the comments link) $content = lang('replies') . ' : <a href="' . getUrl('act', 'dispBoardContentCommentList') . '">' . $oDocument->getCommentCount() . '</a><br>' . "\r\n" . $content; $content = '<b>' . $oDocument->getNickName() . '</b> (' . $oDocument->getRegdate("Y-m-d") . ")<br>\r\n" . $content; // setup mobile contents $oMobile->setContent($content); // setup upper URL $oMobile->setUpperUrl(getUrl('document_srl', ''), lang('cmd_list')); } return; } } // board index $args = new stdClass(); $args->module_srl = $this->module_srl; $args->page = Context::get('page'); $args->list_count = 9; $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; $output = $oDocumentModel->getDocumentList($args, $this->except_notice); $document_list = $output->data; $page_navigation = $output->page_navigation; $childs = array(); if ($document_list && count($document_list)) { foreach ($document_list as $key => $val) { $href = getUrl('mid', $_GET['mid'], 'document_srl', $val->document_srl); $obj = null; $obj['href'] = $val->getPermanentUrl(); $title = htmlspecialchars($val->getTitleText()); if ($val->getCommentCount()) { $title .= ' [' . $val->getCommentCount() . ']'; } $obj['link'] = $obj['text'] = '[' . $val->getNickName() . '] ' . $title; $childs[] = $obj; } $oMobile->setChilds($childs); } $totalPage = $page_navigation->last_page; $page = (int) Context::get('page'); if (!$page) { $page = 1; } // next/prevUrl specification if ($page > 1) { $oMobile->setPrevUrl(getUrl('mid', $_GET['mid'], 'page', $page - 1), sprintf('%s (%d/%d)', lang('cmd_prev'), $page - 1, $totalPage)); } if ($page < $totalPage) { $oMobile->setNextUrl(getUrl('mid', $_GET['mid'], 'page', $page + 1), sprintf('%s (%d/%d)', lang('cmd_next'), $page + 1, $totalPage)); } $oMobile->mobilePage = $page; $oMobile->totalPage = $totalPage; }
/** * get a module instance and execute an action * @return ModuleObject executed module instance * */ function procModule() { $oModuleModel = getModel('module'); $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; // If error occurred while preparation, return a message instance if ($this->error) { $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // Get action information with conf/module.xml $xml_info = $oModuleModel->getModuleActionXml($this->module); // If not installed yet, modify act if ($this->module == "install") { if (!$this->act || !$xml_info->action->{$this->act}) { $this->act = $xml_info->default_index_act; } } // if act exists, find type of the action, if not use default index act if (!$this->act) { $this->act = $xml_info->default_index_act; } // still no act means error if (!$this->act) { $this->error = 'msg_module_is_not_exists'; $this->httpStatusCode = '404'; $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // get type, kind $type = $xml_info->action->{$this->act}->type; $ruleset = $xml_info->action->{$this->act}->ruleset; $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; if (!$kind && $this->module == 'admin') { $kind = 'admin'; } // check REQUEST_METHOD in controller if ($type == 'controller') { $allowedMethod = $xml_info->action->{$this->act}->method; if (!$allowedMethod) { $allowedMethodList[0] = 'POST'; } else { $allowedMethodList = explode('|', strtoupper($allowedMethod)); } if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) { $this->error = "msg_invalid_request"; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($this->module_info->use_mobile != "Y") { Mobile::setMobile(FALSE); } $logged_info = Context::get('logged_info'); // check CSRF for POST actions if (Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { $this->error = 'msg_invalid_request'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } // Admin ip if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') { $this->_setInputErrorToContext(); $this->error = "msg_not_permitted_act"; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } // if(type == view, and case for using mobilephone) if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) { $orig_type = "view"; $type = "mobile"; // create a module instance $oModule = $this->getModuleInstance($this->module, $type, $kind); if (!is_object($oModule) || !method_exists($oModule, $this->act)) { $type = $orig_type; Mobile::setMobile(FALSE); $oModule = $this->getModuleInstance($this->module, $type, $kind); } } else { // create a module instance $oModule = $this->getModuleInstance($this->module, $type, $kind); } if (!is_object($oModule)) { $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // If there is no such action in the module object if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) { if (!Context::isInstalled()) { $this->_setInputErrorToContext(); $this->error = 'msg_invalid_request'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } $forward = NULL; // 1. Look for the module with action name if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\\_]+)(.*)$/', $this->act, $matches)) { $module = strtolower($matches[2] . $matches[3]); $xml_info = $oModuleModel->getModuleActionXml($module); if ($xml_info->action->{$this->act} && (stripos($this->act, 'admin') !== FALSE || $xml_info->action->{$this->act}->standalone != 'false')) { $forward = new stdClass(); $forward->module = $module; $forward->type = $xml_info->action->{$this->act}->type; $forward->ruleset = $xml_info->action->{$this->act}->ruleset; $forward->act = $this->act; } else { $this->error = 'msg_invalid_request'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if (!$forward) { $forward = $oModuleModel->getActionForward($this->act); } if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) { $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; $type = $forward->type; $ruleset = $forward->ruleset; $tpl_path = $oModule->getTemplatePath(); $orig_module = $oModule; $xml_info = $oModuleModel->getModuleActionXml($forward->module); // SECISSUE also check foward act method // check REQUEST_METHOD in controller if ($type == 'controller') { $allowedMethod = $xml_info->action->{$forward->act}->method; if (!$allowedMethod) { $allowedMethodList[0] = 'POST'; } else { $allowedMethodList = explode('|', strtoupper($allowedMethod)); } if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) { $this->error = "msg_invalid_request"; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($type == "view" && Mobile::isFromMobilePhone()) { $orig_type = "view"; $type = "mobile"; // create a module instance $oModule = $this->getModuleInstance($forward->module, $type, $kind); if (!is_object($oModule) || !method_exists($oModule, $this->act)) { $type = $orig_type; Mobile::setMobile(FALSE); $oModule = $this->getModuleInstance($forward->module, $type, $kind); } } else { $oModule = $this->getModuleInstance($forward->module, $type, $kind); } if (!is_object($oModule)) { $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage('msg_module_is_not_exists'); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } if ($this->module == "admin" && $type == "view") { if ($logged_info->is_admin == 'Y') { if ($this->act != 'dispLayoutAdminLayoutModify') { $oAdminView = getAdminView('admin'); $oAdminView->makeGnbUrl($forward->module); $oModule->setLayoutPath("./modules/admin/tpl"); $oModule->setLayoutFile("layout.html"); } } else { $this->_setInputErrorToContext(); $this->error = 'msg_is_not_administrator'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($kind == 'admin') { $grant = $oModuleModel->getGrant($this->module_info, $logged_info); if (!$grant->manager) { $this->_setInputErrorToContext(); $this->error = 'msg_is_not_manager'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } else { if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') { $this->_setInputErrorToContext(); $this->error = 'msg_is_not_administrator'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } } } else { if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) { $this->act = $xml_info->default_index_act; } else { $this->error = 'msg_invalid_request'; $oModule->setError(-1); $oModule->setMessage($this->error); return $oModule; } } } // ruleset check... if (!empty($ruleset)) { $rulesetModule = $forward->module ? $forward->module : $this->module; $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); if (!empty($rulesetFile)) { if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) { $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; foreach ($errorLang as $key => $val) { Context::setLang($key, $val); } unset($_SESSION['XE_VALIDATOR_ERROR_LANG']); } $Validator = new Validator($rulesetFile); $result = $Validator->validate(); if (!$result) { $lastError = $Validator->getLastError(); $returnUrl = Context::get('error_return_url'); $errorMsg = $lastError['msg'] ? $lastError['msg'] : 'validation error'; //for xml response $oModule->setError(-1); $oModule->setMessage($errorMsg); //for html redirect $this->error = $errorMsg; $_SESSION['XE_VALIDATOR_ERROR'] = -1; $_SESSION['XE_VALIDATOR_MESSAGE'] = $this->error; $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; $_SESSION['XE_VALIDATOR_RETURN_URL'] = $returnUrl; $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); $this->_setInputValueToSession(); return $oModule; } } } $oModule->setAct($this->act); $this->module_info->module_type = $type; $oModule->setModuleInfo($this->module_info, $xml_info); $skipAct = array('dispEditorConfigPreview' => 1, 'dispLayoutPreviewWithModule' => 1); $db_use_mobile = Mobile::isMobileEnabled(); if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) { global $lang; $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; Context::addHtmlHeader($header); Context::addHtmlFooter($footer); } if ($type == "view" && $kind != 'admin') { $module_config = $oModuleModel->getModuleConfig('module'); if ($module_config->htmlFooter) { Context::addHtmlFooter($module_config->htmlFooter); } if ($module_config->siteTitle) { $siteTitle = Context::getBrowserTitle(); if (!$siteTitle) { Context::setBrowserTitle($module_config->siteTitle); } } } // if failed message exists in session, set context $this->_setInputErrorToContext(); $procResult = $oModule->proc(); $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) { $error = $oModule->getError(); $message = $oModule->getMessage(); $messageType = $oModule->getMessageType(); $redirectUrl = $oModule->getRedirectUrl(); if ($messageType == 'error') { debugPrint($message, 'ERROR'); } if (!$procResult) { $this->error = $message; if (!$redirectUrl && Context::get('error_return_url')) { $redirectUrl = Context::get('error_return_url'); } $this->_setInputValueToSession(); } else { } $_SESSION['XE_VALIDATOR_ERROR'] = $error; $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); if ($message != 'success') { $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; } $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; if (Context::get('xeVirtualRequestMethod') != 'xml') { $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; } } unset($logged_info); return $oModule; }
/** * @brief display item detail info */ function dispNproductItemDetail() { if ($_COOKIE['mobile'] == "true") { Context::set('is_mobile', 'true'); } $oDocumentModel =& getModel('document'); $oFileModel =& getModel('file'); $oNproductModel =& getModel('nproduct'); $oStoreReviewModel =& getModel('store_review'); $item_srl = Context::get('item_srl'); $document_srl = Context::get('document_srl'); Context::set('list_config', $oNproductModel->getDetailListConfig($this->module_info->module_srl)); // get config $config = $oNproductModel->getModuleConfig(); Context::set('config', $config); // item info if ($item_srl) { $args->item_srl = $item_srl; } else { if ($document_srl) { $args->document_srl = $document_srl; } else { return new Object(-1, 'Item Not Found.'); } } $output = executeQuery('nproduct.getItemInfo', $args); if (!$output->toBool()) { return $output; } $item_info = $output->data; // thumbnail if ($item_info->thumb_file_srl) { $file = $oFileModel->getFile($item_info->thumb_file_srl); if ($file) { $item_info->thumbnail_url = getFullUrl() . $file->download_url; } } $item_info = new nproductItem($item_info, $config->currency, $config->as_sign, $config->decimals); // category $this->getCategoryTree($this->module_info->module_srl); // document $oDocument = $oDocumentModel->getDocument($item_info->document_srl); Context::set('oDocument', $oDocument); if ($item_info->item_srl) { $review_list = $oNproductModel->getReviews($item_info); Context::set('review_list', $review_list); } $output = $oNproductModel->discountItem($item_info); $item_info->discounted_price = $output->discounted_price; $item_info->discount_amount = $output->discount_amount; $item_info->discount_info = $output->discount_info; Context::set('discounted_price', $output->discounted_price); Context::set('discount_amount', $output->discount_amount); Context::set('discount_info', $output->discount_info); // get options $args->item_srl = $item_info->item_srl; $output = executeQueryArray('nproduct.getOptions', $args); Context::set('options', $output->data); // set browser title Context::setBrowserTitle(strip_tags($item_info->item_name) . ' - ' . Context::getBrowserTitle()); // get related items information if ($item_info->related_items) { if (!$this->isJson($item_info->related_items)) { $item_info->related_items = $this->convertCsvToJson($item_info->related_items); } $relatedItems = json_decode($item_info->related_items); $relatedItemSrls = array(); foreach ($relatedItems as $key => $val) { $relatedItemSrls[] = $val->item_srl; } if (count($relatedItemSrls)) { $item_info->related_items = $oNproductModel->getItemList(implode(',', $relatedItemSrls), 999); } } $trigger_output = ModuleHandler::triggerCall('nproduct.dispNproductItemDetail', 'before', $item_info); if (!$trigger_output->toBool()) { return $trigger_output; } // pass variables to html template Context::set('category', $item_info->category_id); Context::set('item_srl', $item_info->item_srl); Context::set('item_info', $item_info); $extra_vars = NExtraItemList::getList($item_info); Context::set('extra_vars', $extra_vars); $this->setTemplateFile('itemdetail'); }
function dispGradeupConfirmGroup() { //모듈설정 가져오기 $oModuleModel = getModel('module'); $module_config = $oModuleModel->getModuleConfig('gradeup'); //회원그룹 리스트 구함 $oMemberModel = getModel('member'); $group_list = $oMemberModel->getGroups(); //모델호출 $oGradeupModel = getModel('gradeup'); //로그인정보가져옴 $logged_info = Context::get('logged_info'); //조건이 있는 등업정보만 세팅 $check_date = array(); foreach ($group_list as $key => $val) { $group = $module_config->gradeup_condition[$val->title]; //변수추가 $module_config->gradeup_condition[$val->title]['group_name'] = $oMemberModel->getGroup($group['gradeup_group_srl'])->title; $module_config->gradeup_condition[$val->title]['group_explain'] = $oMemberModel->getGroup($group['gradeup_group_srl'])->description; //등업방식 한글로변경 if ($group['gradeup_type'] == 'auto') { $module_config->gradeup_condition[$val->title]['gradeup_type'] = '자동등업'; } if ($group['gradeup_type'] == 'confirm') { $module_config->gradeup_condition[$val->title]['gradeup_type'] = '승인등업'; } if ($group['gradeup_type'] == 'term') { $module_config->gradeup_condition[$val->title]['gradeup_type'] = '기간등업'; } //등업조건 세부정보 구함 $check_date = $group['gradeup_date']; //조회할 날짜 $module_config->gradeup_condition[$val->title]['doc_count'] = $oGradeupModel->getMemberInfo('doc', $logged_info->member_srl, $check_date); $module_config->gradeup_condition[$val->title]['com_count'] = $oGradeupModel->getMemberInfo('com', $logged_info->member_srl, $check_date); $module_config->gradeup_condition[$val->title]['lv'] = $oGradeupModel->getMemberInfo('lv', $logged_info->member_srl); //충족여부 확인 if ($module_config->gradeup_condition[$val->title]['doc_count'] >= $group['gradeup_doc'] && $module_config->gradeup_condition[$val->title]['com_count'] >= $group['gradeup_com'] && $module_config->gradeup_condition[$val->title]['lv'] >= $group['gradeup_lv']) { $module_config->gradeup_condition[$val->title]['condition'] = 'ok'; } //기본그룹인 경우 조건삭제 if ($val->is_default == 'Y' && $val->title == $module_config->gradeup_condition[$val->title]['group_name']) { unset($module_config->gradeup_condition[$val->title]['gradeup_type']); } //설정된 조건 없을시 등업정보에서 삭제 if (!$group['gradeup_doc'] && !$group['gradeup_com'] && !$group['gradeup_lv']) { unset($module_config->gradeup_condition[$val->title]); } } //변수세팅 Context::set('group_list', $group_list); Context::set('check_date', $check_date); Context::set('logged_info', $logged_info); Context::set('module_config', $module_config); //신청자 로그 가져옴 $args = new stdClass(); $args->list_count = '10'; $args->page = Context::get('page'); $args->order_type = Context::get('order_type'); $args->s_state = 'ready'; //등업신청중인 로그만 가져옴 if (!$args->order_type) { $args->order_type = 'desc'; } $output = $oGradeupModel->getConfirmGroupLog($args); //그룹 보기 편하기 정리 (group_srl -> group_title) foreach ($output->data as $key => $val) { $group_srl = explode('@', $val->old_group_srl); $output->data[$key]->old_group_srl_title = null; foreach ($group_srl as $val) { $group_info = $oMemberModel->getGroup($val); if (!$output->data[$key]->old_group_srl_title) { $output->data[$key]->old_group_srl_title = $group_info->title; } else { $output->data[$key]->old_group_srl_title = $group_info->title . ', ' . $output->data[$key]->old_group_srl_title; } } } foreach ($output->data as $key => $val) { $group_info = $oMemberModel->getGroup($val->add_group_srl); $val->add_group_srl_title = $group_info->title; } //로그 세팅 Context::set('log_info', $output->data); Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page_list', $output->data); Context::set('page', $output->page); Context::set('page_navigation', $output->page_navigation); //브라우저 제목 세팅 Context::setBrowserTitle('등업안내'); //템플릿 파일 설정 $this->setTemplateFile('grade_explain'); }
/** * @brief module, mid, document_srl을 이용하여 모듈을 찾고 act를 실행하기 위한 준비를 함 **/ function init() { // ModuleModel 객체 생성 $oModuleModel =& getModel('module'); $site_module_info = Context::get('site_module_info'); if (!$this->document_srl && $this->mid && $this->entry) { $oDocumentModel =& getModel('document'); $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); if ($this->document_srl) { Context::set('document_srl', $this->document_srl); } } // 문서번호(document_srl)가 있을 경우 모듈 정보를 구해옴 if ($this->document_srl && !$this->module) { $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); // 문서가 존재하지 않으면 문서 정보를 제거 if (!$module_info) { unset($this->document_srl); // 문서가 존재할 경우 모듈 정보를 바탕으로 virtual site 및 mid 비교 } else { // mid 값이 다르면 문서의 mid로 설정 if ($this->mid != $module_info->mid) { $this->mid = $module_info->mid; Context::set('mid', $module_info->mid, true); } } // 요청된 모듈과 문서 번호가 다르면 문서 번호에 의한 모듈 정보를 제거 if ($this->module && $module_info->module != $this->module) { unset($module_info); } } // 모듈정보를 구하지 못했고 mid 요청이 있으면 mid에 해당하는 모듈 정보를 구함 if (!$module_info && $this->mid) { $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); //if($this->module && $module_info->module != $this->module) unset($module_info); } // module_site_srl과 site_srl 값이 다르면 redirect 시도 if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) { $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); return false; } // 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄 if (!$module_info && !$this->module) { $module_info = $site_module_info; } if (!$module_info && !$this->module && $site_module_info->module_site_srl) { $module_info = $site_module_info; } // 모듈정보와 사이트 모듈정보가 다르면(다른 사이트이면) 페이지 리다이렉트 if ($module_info && $module_info->site_srl != $site_module_info->site_srl) { // 현재 요청된 모듈이 가상 사이트 모듈일 경우 if ($module_info->site_srl) { $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); // 가상 사이트 모듈이 아닌데 가상 사이트에서 호출되었을 경우 } else { $db_info = Context::getDBInfo(); if (!$db_info->default_url) { return die("기본 URL이 정해지지 않아서 동작을 중지합니다"); } else { $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); } } header("location:" . $redirect_url); return false; } // 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함, 모듈 정보에서 module 이름을 구해움 if ($module_info) { $this->module = $module_info->module; $this->mid = $module_info->mid; $this->module_info = $module_info; Context::setBrowserTitle($module_info->browser_title); $part_config = $oModuleModel->getModulePartConfig('layout', $module_info->layout_srl); Context::addHtmlHeader($part_config->header_script); } // 모듈정보에 module과 mid를 강제로 지정 $this->module_info->module = $this->module; $this->module_info->mid = $this->mid; // 여기까지도 모듈 정보를 찾지 못했다면 깔끔하게 시스템 오류 표시 if (!$this->module) { $this->error = 'msg_module_is_not_exists'; } // mid값이 있을 경우 mid값을 세팅 if ($this->mid) { Context::set('mid', $this->mid, true); } // 실제 동작을 하기 전에 trigger 호출 $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); if (!$output->toBool()) { $this->error = $output->getMessage(); return false; } // 현재 모듈의 정보를 세팅 Context::set('current_module_info', $this->module_info); return true; }
$db_info = Context::getDBInfo(); if (!$db_info->default_url) { return Context::getLang('msg_default_url_is_not_defined'); } else { $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); } } header("location:" . $redirect_url); return false; } // If module info was set, retrieve variables from the module information if ($module_info) { $this->module = $module_info->module; $this->mid = $module_info->mid; $this->module_info = $module_info; Context::setBrowserTitle($module_info->browser_title); $part_config = $oModuleModel->getModulePartConfig('layout', $module_info->layout_srl); Context::addHtmlHeader($part_config->header_script); } // Set module and mid into module_info $this->module_info->module = $this->module; $this->module_info->mid = $this->mid; // Still no module? it's an error if (!$this->module) { $this->error = 'msg_module_is_not_exists'; } // If mid exists, set mid into context if ($this->mid) { Context::set('mid', $this->mid, true); } // Set current module info into context