private function viewDocument() { $no = Context::get('no'); $oDosirakstoreModel = getModel('dosirakstore'); // 권한 체크 if (!$this->grant->view) { return new Object(-1, 'msg_not_permitted'); } // document 얻기 $args->no = $no; $output = $oDosirakstoreModel->getDosirakstoreOne($args); // 존재하는지 확인 if (!$output->toBool()) { return new Object(-1, 'msg_not_founded'); } // 모듈 관리자이면 권한 세팅 if ($this->grant->manager) { //$oDocument->setGrant(); } // 브라우저 제목에 글 제목 추가 Context::addBrowserTitle($output->data->title); // 템플릿 변수 세팅 Context::set('oDosirakstore', $output->data); // 글 보기, 목록 보기 모두 act가 동일하기 때문에 템플릿 파일을 직접 지정 $this->setTemplateFile('View'); }
/** * @brief 목록 출력 (관리자용) **/ function dispSpringnoteContent() { // 권한 체크 if (!$this->grant->access) { return $this->dispSpringnoteMessage('msg_not_permitted'); } $pageid = (int) Context::get('pageid'); if ($this->module_info->pageid && $this->module_info->pageid_option != 'list') { $pageid = $this->module_info->pageid; } if (!$pageid && $this->module_info->pageid) { $pageid = $this->module_info->pageid; } $q = Context::get('q'); $oSpringnoteModel =& getModel('springnote'); $oSpringnoteModel->setInfo($this->module_info->openid, $this->module_info->userkey, $this->module_info->domain); // 특정 페이지 선택시 페이지 정보 가져오기 if ($this->grant->view && $pageid) { $page = $oSpringnoteModel->getPage($pageid); if ($page) { for ($i = 0; $i < count($page->css_files); $i++) { $css_file = $page->css_files[$i]; Context::addCssFile($css_file); } Context::addBrowserTitle($page->title); } } // 페이지 목록 가져오기 if ($this->module_info->pageid && $this->module_info->pageid_option != 'list') { $pages = null; } else { if ($this->module_info->pageid && $this->module_info->pageid_option == 'list') { $pages = $oSpringnoteModel->getPages($q, true, $this->module_info->pageid); } else { $pages = $oSpringnoteModel->getPages($q, true); } } if ($pageid) { if ($pages[$pageid]->prev) { $page->prev = $pages[$pageid]->prev; } if ($pages[$pageid]->next) { $page->next = $pages[$pageid]->next; } } Context::set('page', $page); Context::set('pages', $pages); $this->setTemplateFile('list'); }
/** * @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::addBrowserTitle($oDocument->getTitleText()); // 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', Context::getLang('thisissecret')); } } } // 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(); }
private function viewDocument() { $documentSrl = Context::get('document_srl'); $oDocumentModel = getModel('document'); // 권한 체크 if (!$this->grant->view) { return new Object(-1, 'msg_not_permitted'); } // document 얻기 $oDocument = $oDocumentModel->getDocument($documentSrl); // 존재하는지 확인 if (!$oDocument->isExists()) { return new Object(-1, 'msg_not_founded'); } // 모듈 관리자이면 권한 세팅 if ($this->grant->manager) { $oDocument->setGrant(); } // 조회수 증가 $oDocument->updateReadedCount(); // 브라우저 제목에 글 제목 추가 Context::addBrowserTitle($oDocument->getTitleText()); // 템플릿 변수 세팅 Context::set('oDocument', $oDocument); // 글 보기, 목록 보기 모두 act가 동일하기 때문에 템플릿 파일을 직접 지정 $this->setTemplateFile('View'); }
function dispWikiContentView() { // 요청된 변수 값들을 정리 $document_srl = Context::get('document_srl'); $entry = Context::get('entry'); $oDocumentModel =& getModel('document'); if (!$document_srl && !$entry) { $entry = "Front Page"; Context::set('entry', $entry); $document_srl = $oDocumentModel->getDocumentSrlByAlias($this->module_info->mid, $entry); } /** * 요청된 문서 번호가 있다면 문서를 구함 **/ if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl); // 해당 문서가 존재할 경우 필요한 처리를 함 if ($oDocument->isExists()) { // 글과 요청된 모듈이 다르다면 오류 표시 if ($oDocument->get('module_srl') != $this->module_info->module_srl) { return $this->stop('msg_invalid_request'); } // 관리 권한이 있다면 권한을 부여 if ($this->grant->manager) { $oDocument->setGrant(); } if (!Context::get('entry')) { Context::set('entry', $oDocument->getTitleText()); } // 상담기능이 사용되고 공지사항이 아니고 사용자의 글도 아니면 무시 $history_srl = Context::get('history_srl'); if ($history_srl) { $output = $oDocumentModel->getHistory($history_srl); if ($output && $output->content != null) { Context::set('history', $output); } } // 요청된 문서번호의 문서가 없으면 document_srl null 처리 및 경고 메세지 출력 } else { Context::set('document_srl', '', true); $this->alertMessage('msg_not_founded'); } /** * 요청된 문서 번호가 아예 없다면 빈 문서 객체 생성 **/ } else { $oDocument = $oDocumentModel->getDocument(0); } /** * 글 보기 권한을 체크해서 권한이 없으면 오류 메세지 출력하도록 처리 **/ if ($oDocument->isExists()) { // 브라우저 타이틀에 글의 제목을 추가 Context::addBrowserTitle($oDocument->getTitleText()); // 조회수 증가 (비밀글일 경우 권한 체크) if (!$oDocument->isSecret() || $oDocument->isGranted()) { $oDocument->updateReadedCount(); } // 비밀글일때 컨텐츠를 보여주지 말자. if ($oDocument->isSecret() && !$oDocument->isGranted()) { $oDocument->add('content', Context::getLang('thisissecret')); } $this->setTemplateFile('view_document'); // set contributors if ($this->use_history) { $oModel =& getModel('wiki'); $contributors = $oModel->getContributors($oDocument->document_srl); Context::set('contributors', $contributors); } // 댓글 허용일 경우 문서에 강제 지정 if ($this->module_info->use_comment) { $oDocument->add('allow_comment', 'Y'); } } else { $this->setTemplateFile('create_document'); } // 스킨에서 사용할 oDocument 변수 세팅 Context::set('oDocument', $oDocument); /** * 사용되는 javascript 필터 추가 **/ 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 (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 : 'Admin'; $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : ''; $browserTitle = $gnbTitleInfo->adminTitle . ' - ' . ($subMenuTitle ? $subMenuTitle : 'Dashboard'); // 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); } 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::addBrowserTitle($browserTitle); }
/** * @brief 이슈 목록 및 내용 보기 **/ function dispIssuetrackerViewIssue() { // 접근 권한 체크 if (!$this->grant->ticket_view) { return $this->dispIssuetrackerMessage('msg_not_permitted'); } // 프로젝트 관련 정보를 미리 구해서 project 라는 변수로 context setting $oIssuetrackerModel =& getModel('issuetracker'); Context::set('project', $oIssuetrackerModel->getProjectInfo($this->module_info->module_srl)); // 선택된 이슈가 있는지 조사하여 있으면 context setting $document_srl = Context::get('document_srl'); $oIssue = $oIssuetrackerModel->getIssue(0); if ($document_srl) { $oIssue->setIssue($document_srl); if (!$oIssue->isExists()) { unset($document_srl); Context::set('document_srl', '', true); $this->alertMessage('msg_not_founded'); } else { if ($oIssue->get('module_srl') != Context::get('module_srl')) { return $this->stop('msg_invalid_request'); } if ($this->grant->manager) { $oIssue->setGrant(); } if (!$this->grant->ticket_view && !$oIssue->isGranted()) { $oIssue = null; $oIssue = $oIssuetrackerModel->getIssue(0); Context::set('document_srl', '', true); $this->alertMessage('msg_not_permitted'); } else { // 브라우저 타이틀에 글의 제목을 추가 Context::addBrowserTitle($oIssue->getTitleText()); } } } // issue가 존재하지 않으면 목록 출력을 위한 준비 if (!$oIssue->isExists()) { $args->module_srl = $this->module_srl; // 목록을 구하기 위한 대상 모듈/ 페이지 수/ 목록 수/ 페이지 목록 수에 대한 옵션 설정 $args->page = Context::get('page'); $args->list_count = 20; $args->page_count = 10; // issue 검색을 위한 변수 $args->milestone_srl = Context::get('milestone_srl'); $args->priority_srl = Context::get('priority_srl'); $args->type_srl = Context::get('type_srl'); $args->component_srl = Context::get('component_srl'); $args->status = Context::get('status'); $args->occured_version_srl = Context::get('release_srl'); $args->resolution_srl = Context::get('resolution_srl'); $args->assignee_srl = Context::get('assignee_srl'); $args->member_srl = Context::get('member_srl'); // status 점검 if (!is_array($args->status) || !count($args->status)) { $args->status = array('new', 'assign', 'reopen', 'reviewing'); Context::set('status', $args->status); } $args->status = "'" . implode("','", $args->status) . "'"; // 키워드 검색을 위한 변수 $args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...) $args->search_keyword = Context::get('search_keyword'); ///< 검색어 // 일반 글을 구해서 context set $output = $oIssuetrackerModel->getIssueList($args); Context::set('issue_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); // 스킨에서 사용하기 위해 context set Context::set('oIssue', $oIssue); $this->setTemplateFile('issue_list'); } else { // 히스토리를 가져옴 $histories = $oIssuetrackerModel->getHistories($oIssue->get('document_srl')); $oIssue->add('histories', $histories); // 스킨에서 사용하기 위해 context set Context::set('oIssue', $oIssue); // javascript 필터 추가 Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_history.xml'); $this->setTemplateFile('view_issue'); } // 커미터 목록을 추출 Context::set('commiters', $oIssuetrackerModel->getGroupMembers($this->module_info->module_srl, 'commiter')); }
/** * @brief 선택된 게시글이 있을 경우 글을 가져와서 스킨에서 사용하도록 세팅 **/ function dispBoardContentView() { // 요청된 변수 값들을 정리 $document_srl = Context::get('document_srl'); $page = Context::get('page'); // document model 객체 생성 $oDocumentModel =& getModel('document'); /** * 요청된 문서 번호가 있다면 문서를 구함 **/ if ($document_srl) { $oDocument = $oDocumentModel->getDocument($document_srl); // 해당 문서가 존재할 경우 필요한 처리를 함 if ($oDocument->isExists()) { // 글과 요청된 모듈이 다르다면 오류 표시 if ($oDocument->get('module_srl') != $this->module_info->module_srl) { return $this->stop('msg_invalid_request'); } // 관리 권한이 있다면 권한을 부여 if ($this->grant->manager) { $oDocument->setGrant(); } // 상담기능이 사용되고 공지사항이 아니고 사용자의 글도 아니면 무시 if ($this->consultation && !$oDocument->isNotice()) { $logged_info = Context::get('logged_info'); if ($oDocument->get('member_srl') != $logged_info->member_srl) { $oDocument = $oDocumentModel->getDocument(0); } } // 요청된 문서번호의 문서가 없으면 document_srl null 처리 및 경고 메세지 출력 } else { Context::set('document_srl', '', true); $this->alertMessage('msg_not_founded'); } /** * 요청된 문서 번호가 아예 없다면 빈 문서 객체 생성 **/ } else { $oDocument = $oDocumentModel->getDocument(0); } /** * 글 보기 권한을 체크해서 권한이 없으면 오류 메세지 출력하도록 처리 **/ if ($oDocument->isExists()) { if (!$this->grant->view && !$oDocument->isGranted()) { $oDocument = $oDocumentModel->getDocument(0); Context::set('document_srl', '', true); $this->alertMessage('msg_not_permitted'); } else { // 브라우저 타이틀에 글의 제목을 추가 Context::addBrowserTitle($oDocument->getTitleText()); // 조회수 증가 (비밀글일 경우 권한 체크) if (!$oDocument->isSecret() || $oDocument->isGranted()) { $oDocument->updateReadedCount(); } // 비밀글일때 컨텐츠를 보여주지 말자. if ($oDocument->isSecret() && !$oDocument->isGranted()) { $oDocument->add('content', Context::getLang('thisissecret')); } } } // 스킨에서 사용할 oDocument 변수 세팅 $oDocument->add('module_srl', $this->module_srl); Context::set('oDocument', $oDocument); /** * 사용되는 javascript 필터 추가 **/ Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); // return new Object(); }