function procSmartPhone(&$oSmartPhone) { $prev_date = Context::get('prev_date'); if ($prev_date) { $oSmartPhone->setPrevUrl(getUrl('date', $prev_date, 'document_srl', '')); } $next_date = Context::get('next_date'); if ($next_date) { $oSmartPhone->setNextUrl(getUrl('date', $next_date, 'document_srl', '')); } $oTemplate = new TemplateHandler(); $content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone'); $oSmartPhone->setContent($content); }
function procSmartPhone(&$oSmartPhone) { if (!$this->grant->access) { return $oSmartPhone->setContent(Context::getLang('msg_not_permitted')); } // 위젯을 1렬로 정렬 preg_match_all('!(<img)([^\\>]*)(widget=)([^\\>]*?)(\\>)!is', $this->module_info->content, $matches); $content = ''; for ($i = 0, $c = count($matches[0]); $i < $c; $i++) { $content .= preg_replace('/ style\\=\\"([^\\"]+)\\" /i', ' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ', $matches[0][$i]) . "\n\n"; } Context::set('content', $content); $oTemplate = new TemplateHandler(); $content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone'); $oSmartPhone->setContent($content); }
function procSmartPhone(&$oSmartPhone) { $oDocumentModel =& getModel('document'); if (!$this->grant->list || $this->module_info->consultation == 'Y') { return $oSmartPhone->setContent(Context::getLang('msg_not_permitted')); } $oDocument = Context::get('oDocument'); if ($oDocument->isExists()) { if (Context::get('comment') == 'true' && $oDocument->getCommentCount()) { Context::set('comment_list', $oDocument->getComments()); $comment_page_navigation = $oDocument->comment_page_navigation; if ($comment_page_navigation) { if ($comment_page_navigation->cur_page > $comment_page_navigation->first_page) { $oSmartPhone->setPrevUrl(getUrl('cpage', $comment_page_navigation->cur_page - 1)); } if ($comment_page_navigation->cur_page < $comment_page_navigation->last_page) { $oSmartPhone->setNextUrl(getUrl('cpage', $comment_page_navigation->cur_page + 1)); } } $oSmartPhone->setParentUrl(getUrl('comment', '')); $tpl_file = 'comment_list'; } else { $oSmartPhone->setParentUrl(getUrl('document_srl', '')); $tpl_file = 'view_document'; } } else { $page_navigation = Context::get('page_navigation'); if ($page_navigation) { if ($page_navigation->cur_page > $page_navigation->first_page) { $oSmartPhone->setPrevUrl(getUrl('page', $page_navigation->cur_page - 1)); } if ($page_navigation->cur_page < $page_navigation->last_page) { $oSmartPhone->setNextUrl(getUrl('page', $page_navigation->cur_page + 1)); } } $tpl_file = 'list'; } $oTemplate = new TemplateHandler(); $content = $oTemplate->compile($this->module_path . 'tpl/smartphone', $tpl_file); $oSmartPhone->setContent($content); }
function getTextyleCommentPage() { $document_srl = Context::get('document_srl'); $oDocumentModel =& getModel('document'); if (!$document_srl) { return new Object(-1, "msg_invalid_request"); } $oDocument = $oDocumentModel->getDocument($document_srl); if (!$oDocument->isExists()) { return new Object(-1, "msg_invalid_request"); } Context::set('oDocument', $oDocument); $oTemplate = new TemplateHandler(); $html = $oTemplate->compile($this->getTemplatePath(), "comment.html"); $this->add("html", $html); }
/** * @brief WAP content is available as a separate output if the final results */ function displayContent() { Context::set('layout', 'none'); // Compile a template $oTemplate = new TemplateHandler(); $oContext =& Context::getInstance(); $content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile()); $this->setContent($content); // Output $this->display(); }
/** * Feed output. * When trying to directly print out the RSS, the results variable can be directly specified through $oRssView->rss($document_list) * * @param Object $document_list Document list * @param string $rss_title Rss title * @param string $add_description Add description */ function rss($document_list = null, $rss_title = null, $add_description = null) { $oDocumentModel = getModel('document'); $oModuleModel = getModel('module'); $oModuleController = getController('module'); // Get the content and information for the current requested module if the method is not called from another module if (!$document_list) { $site_module_info = Context::get('site_module_info'); $site_srl = $site_module_info->site_srl; $mid = Context::get('mid'); // The target module id, if absent, then all $start_date = (int) Context::get('start_date'); $end_date = (int) Context::get('end_date'); $module_srls = array(); $rss_config = array(); $total_config = ''; $total_config = $oModuleModel->getModuleConfig('rss'); // If one is specified, extract only for this mid if ($mid) { $module_srl = $this->module_info->module_srl; $config = $oModuleModel->getModulePartConfig('rss', $module_srl); if ($config->open_rss && $config->open_rss != 'N') { $module_srls[] = $module_srl; $open_rss_config[$module_srl] = $config->open_rss; } // If mid is not selected, then get all } else { if ($total_config->use_total_feed != 'N') { $rss_config = $oModuleModel->getModulePartConfigs('rss', $site_srl); if ($rss_config) { foreach ($rss_config as $module_srl => $config) { if ($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N') { $module_srls[] = $module_srl; $open_rss_config[$module_srl] = $config->open_rss; } } } } } if (!count($module_srls) && !$add_description) { return $this->dispError(); } $info = new stdClass(); $args = new stdClass(); if ($module_srls) { $args->module_srl = implode(',', $module_srls); //$module_list = $oModuleModel->getMidList($args); //perhaps module_list varialbles not use $args->search_target = 'is_secret'; $args->search_keyword = 'N'; $args->page = (int) Context::get('page'); $args->list_count = 15; if ($total_config->feed_document_count) { $args->list_count = $total_config->feed_document_count; } if (!$args->page || $args->page < 1) { $args->page = 1; } if ($start_date || $start_date != 0) { $args->start_date = $start_date; } if ($end_date || $end_date != 0) { $args->end_date = $end_date; } if ($start_date == 0) { unset($start_date); } if ($end_date == 0) { unset($end_date); } $args->sort_index = 'list_order'; $args->order_type = 'asc'; $output = $oDocumentModel->getDocumentList($args); $document_list = $output->data; // Extract the feed title and information with Context::getBrowserTitle if ($mid) { $info->title = Context::getBrowserTitle(); $oModuleController->replaceDefinedLangCode($info->title); $info->title = str_replace('\'', ''', $info->title); if ($config->feed_description) { $info->description = str_replace('\'', ''', htmlspecialchars($config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); } else { $info->description = str_replace('\'', ''', htmlspecialchars($this->module_info->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); } $info->link = getUrl('', 'mid', $mid); $info->feed_copyright = str_replace('\'', ''', htmlspecialchars($feed_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); if (!$info->feed_copyright) { $info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); } } } } if (!$info->title) { if ($rss_title) { $info->title = $rss_title; } else { if ($total_config->feed_title) { $info->title = $total_config->feed_title; } else { $site_module_info = Context::get('site_module_info'); $info->title = $site_module_info->browser_title; } } $oModuleController->replaceDefinedLangCode($info->title); $info->title = str_replace('\'', ''', htmlspecialchars($info->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); $info->description = str_replace('\'', ''', htmlspecialchars($total_config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); $info->link = Context::getRequestUri(); $info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); } if ($add_description) { $info->description .= "\r\n" . $add_description; } if ($total_config->image) { $info->image = Context::getRequestUri() . str_replace('\'', ''', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); } switch (Context::get('format')) { case 'atom': $info->date = date('Y-m-d\\TH:i:sP'); if ($mid) { $info->id = getUrl('', 'mid', $mid, 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date')); } else { $info->id = getUrl('', 'module', 'rss', 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date')); } break; case 'rss1.0': $info->date = date('Y-m-d\\TH:i:sP'); break; default: $info->date = date("D, d M Y H:i:s") . ' ' . $GLOBALS['_time_zone']; break; } if ($_SERVER['HTTPS'] == 'on') { $proctcl = 'https://'; } else { $proctcl = 'http://'; } $temp_link = explode('/', $info->link); if ($temp_link[0] == '' && $info->link) { $info->link = $proctcl . $_SERVER['HTTP_HOST'] . $info->link; } $temp_id = explode('/', $info->id); if ($temp_id[0] == '' && $info->id) { $info->id = $proctcl . $_SERVER['HTTP_HOST'] . $info->id; } $info->language = str_replace('jp', 'ja', Context::getLangType()); // Set the variables used in the RSS output Context::set('info', $info); Context::set('feed_config', $config); Context::set('open_rss_config', $open_rss_config); Context::set('document_list', $document_list); // Force the result output to be of XMLRPC Context::setResponseMethod("XMLRPC"); // Perform the preprocessing function of the editor component as the results are obtained $path = $this->module_path . 'tpl/'; //if($args->start_date || $args->end_date) $file = 'xe_rss'; //else $file = 'rss20'; switch (Context::get('format')) { case 'xe': $file = 'xe_rss'; break; case 'atom': $file = 'atom10'; break; case 'rss1.0': $file = 'rss10'; break; default: $file = 'rss20'; break; } $oTemplate = new TemplateHandler(); $content = $oTemplate->compile($path, $file); Context::set('content', $content); // Set the template file $this->setTemplatePath($path); $this->setTemplateFile('display'); }
function procSmartPhone(&$oSmartPhone) { $oTemplate = new TemplateHandler(); $content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone'); $oSmartPhone->setContent($content); }
/** * @brief Return the editor template * You can call upload_target_srl when modifying content * The upload_target_srl is used for a routine to check if an attachment exists **/ function getEditor($upload_target_srl = 0, $option = null) { /** * Editor's default options **/ // Option setting to allow file upload if ($upload_target_srl) { $option->editor_sequence = $upload_target_srl; } if (!$option->allow_fileupload) { $allow_fileupload = false; } else { $allow_fileupload = true; } // content_style setting if (!$option->content_style) { $option->content_style = 'default'; } Context::set('content_style', $option->content_style); // Default font setting Context::set('content_font', $option->content_font); Context::set('content_font_size', $option->content_font_size); // Option setting to allow auto-save if (!$option->enable_autosave) { $enable_autosave = false; } elseif (Context::get($option->primary_key_name)) { $enable_autosave = false; } else { $enable_autosave = true; } // Option setting to allow the default editor component if (!$option->enable_default_component) { $enable_default_component = false; } else { $enable_default_component = true; } // Option setting to allow other extended components if (!$option->enable_component) { $enable_component = false; } else { $enable_component = true; } // Setting for html-mode if ($option->disable_html) { $html_mode = false; } else { $html_mode = true; } // Set Height if (!$option->height) { $editor_height = 400; } else { $editor_height = $option->height; } // Skin Setting $skin = $option->skin; if (!$skin) { $skin = 'xpresseditor'; } $colorset = $option->colorset; Context::set('colorset', $colorset); Context::set('skin', $skin); if ($skin == 'dreditor') { $this->loadDrComponents(); } /** * Check the automatic backup feature (do not use if the post is edited) **/ if ($enable_autosave) { // Extract auto-saved data $saved_doc = $this->getSavedDoc($upload_target_srl); // Context setting auto-saved data Context::set('saved_doc', $saved_doc); } Context::set('enable_autosave', $enable_autosave); /** * Extract editor's unique number (in order to display multiple editors on a single page) **/ if ($option->editor_sequence) { $editor_sequence = $option->editor_sequence; } else { if (!$_SESSION['_editor_sequence_']) { $_SESSION['_editor_sequence_'] = 1; } $editor_sequence = $_SESSION['_editor_sequence_']++; } /** * Upload setting by using configuration of the file module internally **/ $files_count = 0; if ($allow_fileupload) { $oFileModel =& getModel('file'); // Get upload configuration to set on SWFUploader $file_config = $oFileModel->getUploadConfig(); $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; Context::set('file_config', $file_config); // Configure upload status such as file size $upload_status = $oFileModel->getUploadStatus(); Context::set('upload_status', $upload_status); // Upload enabled (internally caching) $oFileController =& getController('file'); $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); // Check if the file already exists if ($upload_target_srl) { $files_count = $oFileModel->getFilesCount($upload_target_srl); } } Context::set('files_count', (int) $files_count); Context::set('allow_fileupload', $allow_fileupload); // Set editor_sequence value Context::set('editor_sequence', $editor_sequence); // Set the document number to upload_target_srl for file attachments // If a new document, upload_target_srl = 0. The value becomes changed when file attachment is requested Context::set('upload_target_srl', $upload_target_srl); // Set the primary key valueof the document or comments Context::set('editor_primary_key_name', $option->primary_key_name); // Set content column name to sync contents Context::set('editor_content_key_name', $option->content_key_name); /** * Check editor component **/ $site_module_info = Context::get('site_module_info'); $site_srl = (int) $site_module_info->site_srl; if ($enable_component) { if (!Context::get('component_list')) { $component_list = $this->getComponentList(true, $site_srl); Context::set('component_list', $component_list); } } Context::set('enable_component', $enable_component); Context::set('enable_default_component', $enable_default_component); /** * Variable setting if html_mode is available **/ Context::set('html_mode', $html_mode); /** * Set a height of editor **/ Context::set('editor_height', $editor_height); // Check an option whether to start the editor manually Context::set('editor_manual_start', $option->manual_start); /** * Set a skin path to pre-compile the template ?**/ $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); $tpl_file = 'editor.html'; if (!file_exists($tpl_path . $tpl_file)) { $skin = 'xpresseditor'; $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); } Context::set('editor_path', $tpl_path); // load editor skin lang Context::loadLang($tpl_path . 'lang'); // Return the compiled result from tpl file $oTemplate = new TemplateHandler(); return $oTemplate->compile($tpl_path, $tpl_file); }
/** * @brief 에디터 template을 return * upload_target_srl은 글의 수정시 호출하면 됨. * 이 upload_target_srl은 첨부파일의 유무를 체크하기 위한 루틴을 구현하는데 사용됨. **/ function getEditor($upload_target_srl = 0, $option = null) { /** * 기본적인 에디터의 옵션을 정리 **/ // 파일 업로드 유무 옵션 설정 if (!$option->allow_fileupload) { $allow_fileupload = false; } else { $allow_fileupload = true; } // content_style 세팅 if (!$option->content_style) { $option->content_style = 'default'; } Context::set('content_style', $option->content_style); // 기본 글꼴 지정 Context::set('content_font', $option->content_font); Context::set('content_font_size', $option->content_font_size); // 자동 저장 유무 옵션 설정 글 수정시는 사용 안함 if (!$option->enable_autosave) { $enable_autosave = false; } elseif (Context::get($option->primary_key_name)) { $enable_autosave = false; } else { $enable_autosave = true; } // 기본 에디터 컴포넌트 사용 설정 if (!$option->enable_default_component) { $enable_default_component = false; } else { $enable_default_component = true; } // 확장 컴포넌트 사용 설정 if (!$option->enable_component) { $enable_component = false; } else { $enable_component = true; } // html 모드 조절 if ($option->disable_html) { $html_mode = false; } else { $html_mode = true; } // 높이 설정 if (!$option->height) { $editor_height = 400; } else { $editor_height = $option->height; } // 스킨 설정 $skin = $option->skin; if (!$skin) { $skin = 'xpresseditor'; } $colorset = $option->colorset; Context::set('colorset', $colorset); Context::set('skin', $skin); /** * 자동백업 기능 체크 (글 수정일 경우는 사용하지 않음) **/ if ($enable_autosave) { // 자동 저장된 데이터를 추출 $saved_doc = $this->getSavedDoc($upload_target_srl); // 자동 저장 데이터를 context setting Context::set('saved_doc', $saved_doc); } Context::set('enable_autosave', $enable_autosave); /** * 에디터의 고유 번호 추출 (한 페이지에 여러개의 에디터를 출력하는 경우를 대비) **/ if ($option->editor_sequence) { $editor_sequence = $option->editor_sequence; } else { if (!$GLOBALS['_editor_sequence_']) { $GLOBALS['_editor_sequence_'] = 1; } $editor_sequence = $GLOBALS['_editor_sequence_']++; } /** * 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정 **/ $files_count = 0; if ($allow_fileupload) { $oFileModel =& getModel('file'); // SWFUploader에 세팅할 업로드 설정 구함 $file_config = $oFileModel->getUploadConfig(); $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; Context::set('file_config', $file_config); // 업로드 가능 용량등에 대한 정보를 세팅 $upload_status = $oFileModel->getUploadStatus(); Context::set('upload_status', $upload_status); // upload가능하다고 설정 (내부적으로 캐싱하여 처리) $oFileController =& getController('file'); $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); // 이미 등록된 파일이 있는지 검사 if ($upload_target_srl) { $files_count = $oFileModel->getFilesCount($upload_target_srl); } } Context::set('files_count', (int) $files_count); Context::set('allow_fileupload', $allow_fileupload); // 에디터 동작을 위한 editor_sequence값 설정 Context::set('editor_sequence', $editor_sequence); // 파일 첨부 관련 행동을 하기 위해 문서 번호를 upload_target_srl로 설정 // 신규문서일 경우 upload_target_srl=0 이고 첨부파일 관련 동작이 요청될때 이 값이 변경됨 Context::set('upload_target_srl', $upload_target_srl); // 문서 혹은 댓글의 primary key값을 세팅한다. Context::set('editor_primary_key_name', $option->primary_key_name); // 내용을 sync 맞추기 위한 content column name을 세팅한다 Context::set('editor_content_key_name', $option->content_key_name); /** * 에디터 컴포넌트 체크 **/ $site_module_info = Context::get('site_module_info'); $site_srl = (int) $site_module_info->site_srl; if ($enable_component) { if (!Context::get('component_list')) { $component_list = $this->getComponentList(true, $site_srl); Context::set('component_list', $component_list); } } Context::set('enable_component', $enable_component); Context::set('enable_default_component', $enable_default_component); /** * html_mode 가능한지 변수 설정 **/ Context::set('html_mode', $html_mode); /** * 에디터 세로 크기 설정 **/ Context::set('editor_height', $editor_height); // 에디터의 초기화를 수동으로하는 것에 대한 값 체크 Context::set('editor_manual_start', $option->manual_start); /** * 템플릿을 미리 컴파일해서 컴파일된 소스를 하기 위해 스킨의 경로를 설정 **/ $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); $tpl_file = 'editor.html'; if (!file_exists($tpl_path . $tpl_file)) { $skin = 'xpresseditor'; $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); } Context::set('editor_path', $tpl_path); // load editor skin lang Context::loadLang($tpl_path . 'lang'); // tpl 파일을 compile한 결과를 return $oTemplate = new TemplateHandler(); return $oTemplate->compile($tpl_path, $tpl_file); }
/** * @brief 서브 코멘트 리스트 컴파일 **/ function getMobileexSubCommentList() { $document_srl = Context::get('document_srl'); $targetModule = Context::get('target_module'); $targetSkin = Context::get('skin_name'); $paginate = Context::get('paginate'); // 추가해야함 $view_count = Context::get('view_count'); // 추가해야함 $up_category = Context::get('up_category'); // 추가해야함 if (!$paginate) { $paginate = 1; } //기본값 if (!$view_count) { $view_count = 20; } //기본값 if (!$up_category) { return new Object(-1, "msg_invalid_request"); } if (!$document_srl) { return new Object(-1, "msg_invalid_request"); } if (!$targetModule) { return new Object(-1, "msg_invalid_request"); } if (!$targetSkin) { return new Object(-1, "msg_invalid_request"); } $oDocumentModel =& getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); if (!$oDocument->isExists()) { return new Object(-1, "msg_invalid_request"); } Context::set('oDocument', $oDocument); $oMobileexModel =& getModel('mobileex'); $comment_list = $oMobileexModel->getMobileexSubCommentList($up_category, $paginate, $view_count); if (!$comment_list) { return new Object(-1, "msg_invalid_request"); } Context::set('comment_list', $comment_list->get('list')); Context::set('total', $comment_list->get('total')); $templatePath = sprintf('./modules/%s/m.skins/%s/compile', $targetModule, $targetSkin); $oTemplate = new TemplateHandler(); $html = $oTemplate->compile($templatePath, "comment_sub_list.html"); $this->add("html", $html); }
Context::set('module_info', $module_info); Context::set('addon_info', $addon_info); $logged_info = Context::get('logged_info'); Context::set('logged_info', $logged_info); $addon_info->gg_skin = $addon_info->gg_skin ? $addon_info->gg_skin : 'default'; if ($module_info->module == 'board' && Context::get('document_srl')) { $oDocument = $oDocumentModel->getDocument(Context::get('document_srl')); $scrap_output = $oDocument->variables['content']; } if ($module_info->module == 'page') { $oDocument = $oDocumentModel->getDocumentList($module_info); $oDocument = $oDocument->data[1]; $scrap_output = $oDocument->variables['content']; } $oTemplate = new TemplateHandler(); $template_btn_text = $oTemplate->compile('./addons/ggwoorimailscrap/skins/' . $addon_info->gg_skin, 'index'); $btn_text = '<div style=text-align:' . $addon_info->text_align . ';width:100%;height:50px;z-index:99999;>' . $template_btn_text . '</div>'; $ggoutput = new stdClass(); if ($addon_info->text_position == 'top') { $ggoutput = str_replace($scrap_output, $btn_text . $scrap_output, $output); } else { $ggoutput = str_replace($scrap_output, $scrap_output . $btn_text, $output); } $output = $ggoutput; } if ($called_position == 'before_display_content' && Context::get('ggtype') == 'ggwoorimailscrap') { $config = new stdClass(); $config->w_serv_url = 'woorimail.com'; $config->w_ssl = $addon_info->w_ssl; $config->w_ssl_port = '20080'; $config->w_authkey = $addon_info->w_authkey;