function dispMemberSignUpForm() { $oMemberModel =& getModel('member'); if ($oMemberModel->isLogged()) { return $this->stop('msg_already_logged'); } $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $this->member_config); if (!$trigger_output->toBool()) { return $trigger_output; } if ($this->member_config->enable_join != 'Y') { return $this->stop('msg_signup_disabled'); } $oMemberAdminView =& getAdminView('member'); $formTags = $oMemberAdminView->_getMemberInputTag($member_info); Context::set('formTags', $formTags); $member_config = $oMemberModel->getMemberConfig(); Context::set('member_config', $member_config); global $lang; $identifierForm->title = $lang->{$member_config->identifier}; $identifierForm->name = $member_config->identifier; $identifierForm->value = $member_info->{$member_config->identifier}; Context::set('identifierForm', $identifierForm); // Set a template file $this->setTemplateFile('signup_form'); }
function init() { // forbit access if the user is not an administrator if (!$this->grant->manager && !$this->grant->is_admin) { return $this->stop("msg_is_not_administrator"); } // change into administration layout //$this->setTemplatePath('./modules/cympusadmin/tpl'); $this->setLayoutPath('./modules/cympusadmin/tpl'); $this->setLayoutFile(_CYMPUSADMIN_LAYOUT_); Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/'); if ($this->grant->is_admin) { // parse admin menu $oXmlParser = new XmlParser(); $xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_); $admin_menu = cympusadmin::getMenu($xml_obj->menu->item); Context::set('cympusadmin_menu', $admin_menu); } else { $output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu); if (!$output->toBool()) { return $output; } Context::set('cympusadmin_menu', $manager_menu); } $news = getNewsFromAgency(); Context::set('news', $news); Context::set('admin_bar', 'false'); $oModuleModel =& getModel('module'); $module_info = $oModuleModel->getModuleInfoXml('cympusadmin'); Context::set('cympus_modinfo', $module_info); return new Object(); }
/** * display the pop-up menu of the post * Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added * @return void */ function getCommentMenu() { // get the post's id number and the current login information $comment_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); $logged_info = Context::get('logged_info'); $act = Context::get('cur_act'); // array values for menu_list, "comment post, target, url" $menu_list = array(); // call a trigger ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list); $oCommentController =& getController('comment'); // feature that only member can do if ($logged_info->member_srl) { $oCommentModel =& getModel('comment'); $columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress'); $oComment = $oCommentModel->getComment($comment_srl, false, $columnList); $module_srl = $oComment->get('module_srl'); $member_srl = $oComment->get('member_srl'); $oModuleModel =& getModel('module'); $comment_config = $oModuleModel->getModulePartConfig('document', $module_srl); if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) { // Add a vote-up button for positive feedback $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript'); } if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) { // Add a vote-down button for negative feedback $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); } // Add the report feature against abused posts $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'javascript'); } // call a trigger (after) ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list); // find a comment by IP matching if an administrator. if ($logged_info->is_admin == 'Y') { $oCommentModel =& getModel('comment'); $oComment = $oCommentModel->getComment($comment_srl); if ($oComment->isExists()) { // Find a post of the corresponding ip address $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress()); $oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress()); $oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); } } // Changing a language of pop-up menu $menus = Context::get('comment_popup_menu_list'); $menus_count = count($menus); for ($i = 0; $i < $menus_count; $i++) { $menus[$i]->str = Context::getLang($menus[$i]->str); } // get a list of final organized pop-up menus $this->add('menus', $menus); }
/** * @brief 선택된 게시물의 팝업메뉴 표시 * * 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가 **/ function getCommentMenu() { // 요청된 게시물 번호와 현재 로그인 정보 구함 $comment_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); $logged_info = Context::get('logged_info'); $act = Context::get('cur_act'); // menu_list 에 "표시할글,target,url" 을 배열로 넣는다 $menu_list = array(); // trigger 호출 ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list); $oCommentController =& getController('comment'); // 회원이어야만 가능한 기능 if ($logged_info->member_srl) { // 추천 버튼 추가 $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url, 'cmd_vote', './modules/document/tpl/icons/vote_up.gif', 'javascript'); // 비추천 버튼 추가 $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', './modules/document/tpl/icons/vote_down.gif', 'javascript'); // 신고 기능 추가 $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url, 'cmd_declare', './modules/document/tpl/icons/declare.gif', 'javascript'); } // trigger 호출 (after) ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list); // 관리자일 경우 ip로 글 찾기 if ($logged_info->is_admin == 'Y') { $oCommentModel =& getModel('comment'); $oComment = $oCommentModel->getComment($comment_srl); if ($oComment->isExists()) { // ip주소에 해당하는 글 찾기 $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->get('ipaddress')); $icon_path = './modules/member/tpl/images/icon_management.gif'; $oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); $url = sprintf("var params = new Array(); params['ipaddress']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress()); $oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', './modules/document/tpl/icons/declare.gif', 'javascript'); } } // 팝업메뉴의 언어 변경 $menus = Context::get('comment_popup_menu_list'); $menus_count = count($menus); for ($i = 0; $i < $menus_count; $i++) { $menus[$i]->str = Context::getLang($menus[$i]->str); } // 최종적으로 정리된 팝업메뉴 목록을 구함 $this->add('menus', $menus); }
function init($module = null) { // change into administration layout $config = getModel('cympusadmin')->getConfig(); $args = new stdClass(); $args->module = 'cympusadmin'; $module_list = getModel('module')->getModuleSrlList($args); if (!empty($module_list)) { foreach ($module_list as $module_info) { $cympus_module_info = $module_info; } } $module_path = './modules/cympusadmin/'; $template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin); if (!is_dir($template_path) || !$cympus_module_info->skin) { $config->admin_skins = 'default'; $template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin); } if ($module) { $module->setLayoutPath($template_path); $module->setLayoutFile(_CYMPUSADMIN_LAYOUT_); } else { $this->setLayoutPath($template_path); $this->setLayoutFile(_CYMPUSADMIN_LAYOUT_); } Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/'); $logged_info = Context::get('logged_info'); if ($logged_info->is_admin == 'Y') { // parse admin menu $oXmlParser = new XmlParser(); $xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_); $admin_menu = cympusadmin::getMenu($xml_obj->menu->item); Context::set('cympusadmin_menu', $admin_menu); } else { $output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu); if (!$output->toBool()) { return $output; } Context::set('cympusadmin_menu', $manager_menu); } $news = getNewsFromAgency(); Context::set('news', $news); Context::set('admin_bar', 'false'); $oModuleModel = getModel('module'); $module_info = $oModuleModel->getModuleInfoXml('cympusadmin'); Context::set('cympus_modinfo', $module_info); return new Object(); }
/** * @brief get textyle custom menu **/ function getTextyleCustomMenu() { static $custom_menu = null; if (is_null($custom_menu)) { $oModuleModel =& getModel('module'); $config = $oModuleModel->getModuleConfig('textyle'); $custom_menu->hidden_menu = $config->hidden_menu; if (!$custom_menu->hidden_menu) { $custom_menu->hidden_menu = array(); } $custom_menu->attached_menu = $config->attached_menu; if (!$custom_menu->attached_menu) { $custom_menu->attached_menu = array(); } } $output = ModuleHandler::triggerCall('textyle.getTextyleCustomMenu', 'after', $custom_menu); if (!$output->toBool()) { return $output; } return $custom_menu; }
/** * @brief list transactions */ function dispEpayAdminTransactions() { // transactions $args->page = Context::get('page'); $output = executeQueryArray('epay.getTransactionList', $args); if (!$output->toBool()) { return $output; } $list = $output->data; ModuleHandler::triggerCall('epay.getTransactionList', 'after', $list); Context::set('list', $list); 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); // module instances $output = executeQueryArray('epay.getAllModInstList'); $modinst_list = array(); $list = $output->data; if (!is_array($list)) { $list = array(); } foreach ($list as $key => $modinfo) { $modinst_list[$modinfo->module_srl] = $modinfo; } Context::set('modinst_list', $modinst_list); $this->setTemplateFile('transactions'); }
function dispIssuetrackerAdminAdditionSetup() { $content = ''; // 추가 설정을 위한 트리거 호출 // 이슈트래커 모듈이지만 차후 다른 모듈에서의 사용도 고려하여 trigger 이름을 공용으로 사용할 수 있도록 하였음 $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content); $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); Context::set('setup_content', $content); // 템플릿 파일 지정 $this->setTemplateFile('addition_setup'); }
/** * @ 실행된 모듈의 컨텐츠를 출력 **/ function displayContent($oModule = NULL) { // 설정된 모듈이 정상이지 않을 경우 message 모듈 객체 생성 if (!$oModule || !is_object($oModule)) { $this->error = 'msg_module_is_not_exists'; } // install 모듈이 아닐 때 DB 접속에 문제가 있으면 오류 if ($this->module != 'install' && $GLOBALS['__DB__'][Context::getDBType()]->is_connected == false) { $this->error = 'msg_dbconnect_failed'; } // 모듈 동작을 마친 후 trigger call $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); if (!$output->toBool()) { $this->error = $output->getMessage(); } // HTML call 이면 message view 객체 이용하도록 if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { // 에러가 발생하였을시 처리 if ($this->error) { // message 모듈 객체를 생성해서 컨텐츠 생성 $oMessageView =& getView('message'); $oMessageView->setError(-1); $oMessageView->setMessage($this->error); $oMessageView->dispMessage(); // 정상적으로 호출된 객체가 있을 경우 해당 객체의 template를 변경 if ($oModule) { $oModule->setTemplatePath($oMessageView->getTemplatePath()); $oModule->setTemplateFile($oMessageView->getTemplateFile()); // 그렇지 않으면 message 객체를 호출된 객체로 지정 } else { $oModule = $oMessageView; } } // 해당 모듈에 layout_srl이 있는지 확인 if ($oModule->module_info->layout_srl && !$oModule->getLayoutFile()) { // layout_srl이 있으면 해당 레이아웃 정보를 가져와 layout_path/ layout_file 위치 변경 $oLayoutModel =& getModel('layout'); $layout_info = $oLayoutModel->getLayout($oModule->module_info->layout_srl); if ($layout_info) { // 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력 if ($layout_info->extra_var_count) { foreach ($layout_info->extra_var as $var_id => $val) { if ($val->type == 'image') { if (preg_match('/^\\.\\/files\\/attach\\/images\\/(.+)/i', $val->value)) { $val->value = Context::getRequestUri() . substr($val->value, 2); } } $layout_info->{$var_id} = $val->value; } } // 레이아웃 정보중 menu를 Context::set if ($layout_info->menu_count) { foreach ($layout_info->menu as $menu_id => $menu) { if (file_exists($menu->php_file)) { @(include $menu->php_file); } Context::set($menu_id, $menu); } } // 레이아웃 정보를 Context::set Context::set('layout_info', $layout_info); $oModule->setLayoutPath($layout_info->path); $oModule->setLayoutFile('layout'); // 레이아웃이 수정되었을 경우 수정본을 지정 $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); if (file_exists($edited_layout)) { $oModule->setEditedLayoutFile($edited_layout); } } } } // 컨텐츠 출력 $oDisplayHandler = new DisplayHandler(); $oDisplayHandler->printContent($oModule); }
/** * Delete User */ function deleteMember($member_srl) { // Call a trigger (before) $trigger_obj = new stdClass(); $trigger_obj->member_srl = $member_srl; $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); if (!$output->toBool()) { return $output; } // Create a model object $oMemberModel = getModel('member'); // Bringing the user's information if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) { $columnList = array('member_srl', 'is_admin'); $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); } if (!$this->memberInfo) { return new Object(-1, 'msg_not_exists_member'); } // If managers can not be deleted if ($this->memberInfo->is_admin == 'Y') { return new Object(-1, 'msg_cannot_delete_admin'); } $oDB =& DB::getInstance(); $oDB->begin(); $args = new stdClass(); $args->member_srl = $member_srl; // Delete the entries in member_auth_mail $output = executeQuery('member.deleteAuthMail', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } executeQuery('member.deleteMemberModifyNickNameLog', $args); // TODO: If the table is not an upgrade may fail. /* if(!$output->toBool()) { $oDB->rollback(); return $output; } */ // Delete the entries in member_group_member $output = executeQuery('member.deleteMemberGroupMember', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // member removed from the table $output = executeQuery('member.deleteMember', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // Call a trigger (after) ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); $oDB->commit(); // Name, image, image, mark, sign, delete $this->procMemberDeleteImageName($member_srl); $this->procMemberDeleteImageMark($member_srl); $this->procMemberDeleteProfileImage($member_srl); $this->delSignature($member_srl); $this->_clearMemberCache($member_srl); return $output; }
/** * Report posts * @param int $document_srl * @param string $declare_message * @return void|Object */ function declaredDocument($document_srl, $declare_message = '') { // Fail if session information already has a reported document if ($_SESSION['declared_document'][$document_srl]) { return new Object(-1, 'failed_declared'); } // Check if previously reported $args = new stdClass(); $args->document_srl = $document_srl; $output = executeQuery('document.getDeclaredDocument', $args); if (!$output->toBool()) { return $output; } $declared_count = $output->data->declared_count ? $output->data->declared_count : 0; $trigger_obj = new stdClass(); $trigger_obj->document_srl = $document_srl; $trigger_obj->declared_count = $declared_count; // Call a trigger (before) $trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj); if (!$trigger_output->toBool()) { return $trigger_output; } // Get the original document $oDocumentModel = getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl, false, false); // Pass if the author's IP address is as same as visitor's. if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { $_SESSION['declared_document'][$document_srl] = true; return new Object(-1, 'failed_declared'); } // Check if document's author is a member. if ($oDocument->get('member_srl')) { // Create a member model object $oMemberModel = getModel('member'); $member_srl = $oMemberModel->getLoggedMemberSrl(); // Pass after registering a session if author's information is same as the currently logged-in user's. if ($member_srl && $member_srl == abs($oDocument->get('member_srl'))) { $_SESSION['declared_document'][$document_srl] = true; return new Object(-1, 'failed_declared'); } } // Use member_srl for logged-in members and IP address for non-members. $args = new stdClass(); if ($member_srl) { $args->member_srl = $member_srl; } else { $args->ipaddress = $_SERVER['REMOTE_ADDR']; } $args->document_srl = $document_srl; $args->declare_message = trim(htmlspecialchars($declare_message)); $output = executeQuery('document.getDocumentDeclaredLogInfo', $args); // Pass after registering a sesson if reported/declared documents are in the logs. if ($output->data->count) { $_SESSION['declared_document'][$document_srl] = true; return new Object(-1, 'failed_declared'); } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // Add the declared document if ($declared_count > 0) { $output = executeQuery('document.updateDeclaredDocument', $args); } else { $output = executeQuery('document.insertDeclaredDocument', $args); } if (!$output->toBool()) { $oDB->rollback(); return $output; } // Leave logs $output = executeQuery('document.insertDocumentDeclaredLog', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } $this->add('declared_count', $declared_count + 1); // Call a trigger (after) $trigger_obj->declared_count = $declared_count + 1; ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj); // commit $oDB->commit(); // Leave in the session information $_SESSION['declared_document'][$document_srl] = true; $this->setMessage('success_declared'); }
/** * Report a blamed comment * @param $comment_srl * @return void */ function declaredComment($comment_srl) { // Fail if session information already has a reported document if ($_SESSION['declared_comment'][$comment_srl]) { return new Object(-1, 'failed_declared'); } // check if already reported $args = new stdClass(); $args->comment_srl = $comment_srl; $output = executeQuery('comment.getDeclaredComment', $args); if (!$output->toBool()) { return $output; } $declared_count = $output->data->declared_count ? $output->data->declared_count : 0; $trigger_obj = new stdClass(); $trigger_obj->comment_srl = $comment_srl; $trigger_obj->declared_count = $declared_count; // Call a trigger (before) $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj); if (!$trigger_output->toBool()) { return $trigger_output; } // get the original comment $oCommentModel = getModel('comment'); $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); // failed if both ip addresses between author's and the current user are same. if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { $_SESSION['declared_comment'][$comment_srl] = TRUE; return new Object(-1, 'failed_declared'); } // if the comment author is a member if ($oComment->get('member_srl')) { // create the member model object $oMemberModel = getModel('member'); $member_srl = $oMemberModel->getLoggedMemberSrl(); // session registered if the author information matches to the current logged-in user's. if ($member_srl && $member_srl == $oComment->get('member_srl')) { $_SESSION['declared_comment'][$comment_srl] = TRUE; return new Object(-1, 'failed_declared'); } } // If logged-in, use the member_srl. otherwise use the ipaddress. if ($member_srl) { $args->member_srl = $member_srl; } else { $args->ipaddress = $_SERVER['REMOTE_ADDR']; } $args->comment_srl = $comment_srl; $log_output = executeQuery('comment.getCommentDeclaredLogInfo', $args); // session registered if log info contains report log. if ($log_output->data->count) { $_SESSION['declared_comment'][$comment_srl] = TRUE; return new Object(-1, 'failed_declared'); } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // execute insert if ($output->data->declared_count > 0) { $output = executeQuery('comment.updateDeclaredComment', $args); } else { $output = executeQuery('comment.insertDeclaredComment', $args); } if (!$output->toBool()) { $oDB->rollback(); return $output; } // leave the log $output = executeQuery('comment.insertCommentDeclaredLog', $args); // Call a trigger (after) $trigger_obj->declared_count = $declared_count + 1; $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj); if (!$trigger_output->toBool()) { $oDB->rollback(); return $trigger_output; } $oDB->commit(); // leave into the session information $_SESSION['declared_comment'][$comment_srl] = TRUE; $this->setMessage('success_declared'); }
/** * display contents from executed module * @param ModuleObject $oModule module instance * @return void **/ function displayContent($oModule = NULL) { // If the module is not set or not an object, set error if (!$oModule || !is_object($oModule)) { $this->error = 'msg_module_is_not_exists'; $this->httpStatusCode = '404'; } // If connection to DB has a problem even though it's not install module, set error if ($this->module != 'install' && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == false) { $this->error = 'msg_dbconnect_failed'; } // Call trigger after moduleHandler proc $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); if (!$output->toBool()) { $this->error = $output->getMessage(); } // Use message view object, if HTML call $methodList = array('XMLRPC' => 1, 'JSON' => 1); if (!isset($methodList[Context::getRequestMethod()])) { if ($_SESSION['XE_VALIDATOR_RETURN_URL']) { $display_handler = new DisplayHandler(); $display_handler->_debugOutput(); header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); return; } // If error occurred, handle it if ($this->error) { // display content with message module instance $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') { $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); $oMessageObject->setTemplateFile('http_status_code'); } // If module was called normally, change the templates of the module into ones of the message view module if ($oModule) { $oModule->setTemplatePath($oMessageObject->getTemplatePath()); $oModule->setTemplateFile($oMessageObject->getTemplateFile()); // Otherwise, set message instance as the target module } else { $oModule = $oMessageObject; } $this->_clearErrorSession(); } // Check if layout_srl exists for the module if (Mobile::isFromMobilePhone()) { $layout_srl = $oModule->module_info->mlayout_srl; } else { $layout_srl = $oModule->module_info->layout_srl; } if ($layout_srl && !$oModule->getLayoutFile()) { // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file $oLayoutModel =& getModel('layout'); $layout_info = $oLayoutModel->getLayout($layout_srl); if ($layout_info) { // Input extra_vars into $layout_info if ($layout_info->extra_var_count) { foreach ($layout_info->extra_var as $var_id => $val) { if ($val->type == 'image') { if (preg_match('/^\\.\\/files\\/attach\\/images\\/(.+)/i', $val->value)) { $val->value = Context::getRequestUri() . substr($val->value, 2); } } $layout_info->{$var_id} = $val->value; } } // Set menus into context if ($layout_info->menu_count) { foreach ($layout_info->menu as $menu_id => $menu) { if (file_exists($menu->php_file)) { @(include $menu->php_file); } Context::set($menu_id, $menu); } } // Set layout information into context Context::set('layout_info', $layout_info); $oModule->setLayoutPath($layout_info->path); $oModule->setLayoutFile('layout'); // If layout was modified, use the modified version $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); if (file_exists($edited_layout)) { $oModule->setEditedLayoutFile($edited_layout); } } } } // Display contents $oDisplayHandler = new DisplayHandler(); $oDisplayHandler->printContent($oModule); }
/** * @brief Display member join form */ function dispMemberSignUpForm() { //setcookie for redirect url in case of going to member sign up setcookie("XE_REDIRECT_URL", $_SERVER['HTTP_REFERER']); $member_config = $this->member_config; $oMemberModel = getModel('member'); // Get the member information if logged-in if ($oMemberModel->isLogged()) { return $this->stop('msg_already_logged'); } // call a trigger (before) $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); if (!$trigger_output->toBool()) { return $trigger_output; } // Error appears if the member is not allowed to join if ($member_config->enable_join != 'Y') { return $this->stop('msg_signup_disabled'); } $oMemberAdminView = getAdminView('member'); $formTags = $oMemberAdminView->_getMemberInputTag($member_info); Context::set('formTags', $formTags); // Editor of the module set for signing by calling getEditor foreach ($formTags as $formTag) { if ($formTag->name == 'signature') { $oEditorModel = getModel('editor'); $option = new stdClass(); $option->primary_key_name = 'member_srl'; $option->content_key_name = 'signature'; $option->allow_fileupload = false; $option->enable_autosave = false; $option->enable_default_component = true; $option->enable_component = false; $option->resizable = false; $option->disable_html = true; $option->height = 100; $option->skin = $member_config->signature_editor_skin; $option->colorset = $member_config->sel_editor_colorset; $editor = $oEditorModel->getEditor($member_info->member_srl, $option); Context::set('editor', $editor); } } global $lang; $identifierForm = new stdClass(); $identifierForm->title = $lang->{$member_config->identifier}; $identifierForm->name = $member_config->identifier; $identifierForm->value = $member_info->{$member_config->identifier}; Context::set('identifierForm', $identifierForm); $this->addExtraFormValidatorMessage(); // Set a template file $this->setTemplateFile('signup_form'); }
function procAuthenticationVerifyAuthCode() { $reqvars = Context::getRequestVars(); $authentication_srl = Context::get('authentication_srl'); $args->authentication_srl = $authentication_srl; $output = executeQuery('authentication.getAuthentication', $args); if (!$output->toBool()) { return $output; } $authentication_1 = Context::get('authcode'); $authentication_2 = $output->data->authcode; if ($authentication_1 == $authentication_2) { $_SESSION['authentication_pass'] = '******'; $args->passed = 'Y'; $args->authentication_srl = $_SESSION['authentication_srl']; $output = executeQuery('authentication.updateAuthentication', $args); if (!$output->toBool()) { return $output; } $this->setMessage('인증이 완료되었습니다. 다음페이지로 이동합니다.'); $reqvars->passed = 'Y'; $reqvars->authentication_srl = $args->authentication_srl; $trigger_output = ModuleHandler::triggerCall('authentication.procAuthenticationVerifyAuthCode', 'after', $reqvars); if (!$trigger_output->toBool()) { return $trigger_output; } } else { $reqvars->passed = 'N'; $reqvars->authentication_srl = $args->authentication_srl; $trigger_output = ModuleHandler::triggerCall('authentication.procAuthenticationVerifyAuthCode', 'after', $reqvars); if (!$trigger_output->toBool()) { return $trigger_output; } return new Object(-1, '인증코드가 올바르지 않습니다.'); } }
/** * @brief when menu add in sitemap, select module list * this menu showing with trigger * @param int $site_srl * @return array */ function getModuleListInSitemap($site_srl = 0) { $oModuleModel = getModel('module'); $moduleList = array('page'); $output = $oModuleModel->getModuleListByInstance($site_srl); if (is_array($output->data)) { foreach ($output->data as $value) { if ($value->instanceCount > 1) { $moduleList[] = $value->module; } } } // after trigger $output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList); if (!$output->toBool()) { return $output; } $localModuleList = array_unique($moduleList); $oAutoinstallModel = getModel('autoinstall'); // get have instance $remotePackageList = $oAutoinstallModel->getHaveInstance(array('path')); $remoteModuleList = array(); foreach ($remotePackageList as $package) { if (strpos($package->path, './modules/') !== 0) { continue; } $pathInfo = explode('/', $package->path); $remoteModuleList[] = $pathInfo[2]; } // all module list $allModuleList = FileHandler::readDir('./modules', '/^([a-zA-Z0-9_-]+)$/'); // union have instance and all module list $haveInstance = array_intersect($remoteModuleList, $allModuleList); $haveDirectory = array_intersect($localModuleList, $allModuleList); // union $moduleList = array_unique(array_merge($haveDirectory, $haveInstance)); $moduleInfoList = array(); Context::loadLang('modules/page/lang'); if (is_array($moduleList)) { foreach ($moduleList as $value) { $moduleInfo = $oModuleModel->getModuleInfoXml($value); if ($value == 'page') { $pageTypeName = Context::getLang('page_type_name'); $moduleInfo->title = $pageTypeName['ARTICLE']; $moduleInfoList['ARTICLE'] = $moduleInfo; $wModuleInfo = clone $moduleInfo; unset($wModuleInfo->default_skin, $wModuleInfo->default_mskin); $wModuleInfo->title = $pageTypeName['WIDGET']; $wModuleInfo->no_skin = 'Y'; $moduleInfoList['WIDGET'] = $wModuleInfo; $oModuleInfo = clone $moduleInfo; unset($oModuleInfo->default_skin, $oModuleInfo->default_mskin); $oModuleInfo->title = $pageTypeName['OUTSIDE']; $oModuleInfo->no_skin = 'Y'; $moduleInfoList['OUTSIDE'] = $oModuleInfo; } else { $moduleInfoList[$value] = $moduleInfo; } } } return $moduleInfoList; }
/** * @brief Delete module * * Attempt to delete all related information when deleting a module. **/ function deleteModule($module_srl) { if (!$module_srl) { return new Object(-1, 'msg_invalid_request'); } // check start module $oModuleModel =& getModel('module'); $columnList = array('sites.index_module_srl'); $start_module = $oModuleModel->getSiteInfo(0, $columnList); if ($module_srl == $start_module->index_module_srl) { return new Object(-1, 'msg_cannot_delete_startmodule'); } // Call a trigger (before) $trigger_obj->module_srl = $module_srl; $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); if (!$output->toBool()) { return $output; } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); $args->module_srl = $module_srl; // Delete module information from the DB $output = executeQuery('module.deleteModule', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // Delete permission information $this->deleteModuleGrants($module_srl); // Remove skin information $this->deleteModuleSkinVars($module_srl); // Delete module extra vars $this->deleteModuleExtraVars($module_srl); // Remove the module manager $this->deleteAdminId($module_srl); // Call a trigger (after) if ($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); if (!$trigger_output->toBool()) { $oDB->rollback(); return $trigger_output; } } // commit $oDB->commit(); //remove from cache $oCacheHandler =& CacheHandler::getInstance('object'); if ($oCacheHandler->isSupport()) { $cache_key = 'object_module_info:' . $args->module_srl; $oCacheHandler->delete($cache_key); $cache_key = 'object:module_extra_vars_' . $args->module_srl; $oCacheHandler->delete($cache_key); } return $output; }
/** * @brief 모듈 추가 설정 일괄 적용 **/ function dispModuleAdminModuleAdditionSetup() { $module_srls = Context::get('module_srls'); $modules = explode(',', $module_srls); if (!count($modules)) { if (!$module_srls) { return new Object(-1, 'msg_invalid_request'); } } // content는 다른 모듈에서 call by reference로 받아오기에 미리 변수 선언만 해 놓음 $content = ''; // 추가 설정을 위한 트리거 호출 // 게시판 모듈이지만 차후 다른 모듈에서의 사용도 고려하여 trigger 이름을 공용으로 사용할 수 있도록 하였음 $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content); $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); Context::set('setup_content', $content); // 레이아웃을 팝업으로 지정 $this->setLayoutFile('popup_layout'); // 템플릿 파일 지정 $this->setTemplateFile('module_addition_setup'); }
/** * @brief display the additional setup panel * additonal setup panel is for connecting the service modules with other modules **/ function dispBoardAdminBoardAdditionSetup() { // sice content is obtained from other modules via call by reference, declare it first $content = ''; // get the addtional setup trigger // the additional setup triggers can be used in many modules $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content); $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); Context::set('setup_content', $content); // setup the template file $this->setTemplateFile('addition_setup'); }
/** * print either html or xml content given oModule object * @remark addon execution and the trigger execution are included within this method, which might create inflexibility for the fine grained caching * @param ModuleObject $oModule the module object * @return void */ function printContent(&$oModule) { // Check if the gzip encoding supported if (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1 && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && extension_loaded('zlib') && $oModule->gzhandler_enable) { $this->gz_enabled = TRUE; } // Extract contents to display by the request method if (Context::get('xeVirtualRequestMethod') == 'xml') { $handler = new VirtualXMLDisplayHandler(); } else { if (Context::getRequestMethod() == 'XMLRPC') { $handler = new XMLDisplayHandler(); if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) { $this->gz_enabled = FALSE; } } else { if (Context::getRequestMethod() == 'JSON') { $handler = new JSONDisplayHandler(); } else { if (Context::getRequestMethod() == 'JS_CALLBACK') { $handler = new JSCallbackDisplayHandler(); } else { $handler = new HTMLDisplayHandler(); } } } } $output = $handler->toDoc($oModule); // call a trigger before display ModuleHandler::triggerCall('display', 'before', $output); // execute add-on $called_position = 'before_display_content'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (file_exists($addon_file)) { include $addon_file; } if (method_exists($handler, "prepareToPrint")) { $handler->prepareToPrint($output); } // Start the session if $_SESSION was touched Context::getInstance()->checkSessionStatus(); // header output $httpStatusCode = $oModule->getHttpStatusCode(); if ($httpStatusCode && $httpStatusCode != 200) { $this->_printHttpStatusCode($httpStatusCode); } else { if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') { $this->_printJSONHeader(); } else { if (Context::getResponseMethod() != 'HTML') { $this->_printXMLHeader(); } else { $this->_printHTMLHeader(); } } } // debugOutput output $this->content_size = strlen($output); $output .= $this->_debugOutput(); // disable gzip if output already exists ob_flush(); if (headers_sent()) { $this->gz_enabled = FALSE; } // enable gzip using zlib extension if ($this->gz_enabled) { ini_set('zlib.output_compression', true); } // results directly output print $output; // call a trigger after display ModuleHandler::triggerCall('display', 'after', $output); flushSlowlog(); }
function deleteMaterial($material_srl) { if (strpos($material_srl, ',') === false) { $args->material_srl = $material_srl; } else { $args->material_srls = $material_srl; } $output = executeQuery('material.deleteMaterial', $args); // delete thumnail image $oFileModel =& getModel('file'); $file_list = array(); if (strpos(',', $material_srl) === false) { $file_list = $oFileModel->getFiles($material_srl); } else { $material_srls = explode(',', $material_srl); foreach ($material_srls as $srl) { $files = $oFileModel->getFiles($srl); if ($files) { $file_list = array_merge($file_list, $files); } } } if (count($file_list)) { foreach ($file_list as $k => $file) { $ext = substr(strrchr($file->source_filename, '.'), 1); $_filename = sprintf("%s%s.%%s.%s", preg_replace("/\\/[^\\/]*\$/", "/", $file->uploaded_filename), $material_srl, $ext); $s_filename = sprintf($_filename, 'S'); $l_filename = sprintf($_filename, 'L'); FileHandler::removeFile($s_filename); FileHandler::removeFile($l_filename); } } $obj->document_srl = $material_srl; // trigger 호출 (after) if ($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('material.deleteMaterial', 'after', $obj); if (!$trigger_output->toBool()) { return $trigger_output; } } return $output; }
/** * @brief 모듈객체를 받아서 content 출력 **/ function printContent(&$oModule) { // gzip encoding 지원 여부 체크 if (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1 && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('ob_gzhandler') && extension_loaded('zlib')) { $this->gz_enabled = true; } // request method에 따른 컨텐츠 결과물 추출 if (Context::get('xeVirtualRequestMethod') == 'xml') { $output = $this->_toVirtualXmlDoc($oModule); } else { if (Context::getRequestMethod() == 'XMLRPC') { $output = $this->_toXmlDoc($oModule); } else { if (Context::getRequestMethod() == 'JSON') { $output = $this->_toJSON($oModule); } else { $output = $this->_toHTMLDoc($oModule); } } } // HTML 출력 요청일 경우 레이아웃 컴파일과 더블어 완성된 코드를 제공 if (Context::getResponseMethod() == "HTML") { // 관리자 모드일 경우 #xeAdmin id를 가지는 div 추가 if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0) { $output = '<div id="xeAdmin">' . $output . '</div>'; } // 내용을 content라는 변수로 설정 (layout에서 {$output}에서 대체됨) Context::set('content', $output); // 레이아웃을 컴파일 $oTemplate =& TemplateHandler::getInstance(); // layout이라는 변수가 none으로 설정되면 기본 레이아웃으로 변경 if (Context::get('layout') != 'none') { if (__DEBUG__ == 3) { $start = getMicroTime(); } $layout_path = $oModule->getLayoutPath(); $layout_file = $oModule->getLayoutFile(); $edited_layout_file = $oModule->getEditedLayoutFile(); // 현재 요청된 레이아웃 정보를 구함 $oLayoutModel =& getModel('layout'); $current_module_info = Context::get('current_module_info'); $layout_srl = $current_module_info->layout_srl; // 레이아웃과 연결되어 있으면 레이아웃 컴파일 if ($layout_srl > 0) { $layout_info = Context::get('layout_info'); // faceoff 레이아웃일 경우 별도 처리 if ($layout_info && $layout_info->type == 'faceoff') { $oLayoutModel->doActivateFaceOff($layout_info); Context::set('layout_info', $layout_info); } // 관리자 레이아웃 수정화면에서 변경된 CSS가 있는지 조사 $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); if (file_exists($edited_layout_css)) { Context::addCSSFile($edited_layout_css, true, 'all', '', 100); } } if (!$layout_path) { $layout_path = "./common/tpl"; } if (!$layout_file) { $layout_file = "default_layout"; } $output = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); if (__DEBUG__ == 3) { $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; } } } // 출력하기 전에 trigger 호출 (before) ModuleHandler::triggerCall('display', 'before', $output); // 애드온 실행 $called_position = 'before_display_content'; $oAddonController =& getController('addon'); $addon_file = $oAddonController->getCacheFilePath(); if (file_exists($addon_file)) { @(include $addon_file); } // HTML 출력일 경우 최종적으로 common layout을 씌워서 출력 if (Context::getResponseMethod() == "HTML") { if (__DEBUG__ == 3) { $start = getMicroTime(); } // body 내의 <style ..></style>를 header로 이동 $output = preg_replace_callback('!<style(.*?)<\\/style>!is', array($this, 'moveStyleToHeader'), $output); // 메타 파일 변경 (캐싱기능등으로 인해 위젯등에서 <!--Meta:경로--> 태그를 content에 넣는 경우가 있음 $output = preg_replace_callback('/<!--Meta:([a-z0-9\\_\\/\\.\\@]+)-->/is', array($this, 'transMeta'), $output); // rewrite module 사용시 생기는 상대경로에 대한 처리를 함 if (Context::isAllowRewrite()) { $url = parse_url(Context::getRequestUri()); $real_path = $url['path']; $pattern = '/src=("|\'){1}(\\.\\/)?(files\\/attach|files\\/cache|files\\/faceOff|files\\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\\/([^"\']+)\\.(jpg|jpeg|png|gif)("|\'){1}/s'; $output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output); if (Context::get('vid')) { $pattern = '/\\/' . Context::get('vid') . '\\?([^=]+)=/is'; $output = preg_replace($pattern, '/?$1=', $output); } } // 간혹 background-image에 url(none) 때문에 request가 한번 더 일어나는 경우가 생기는 것을 방지 $output = preg_replace('/url\\((["\']?)none(["\']?)\\)/is', 'none', $output); if (__DEBUG__ == 3) { $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start; } // 불필요한 정보 제거 $output = preg_replace('/member\\_\\-([0-9]+)/s', 'member_0', $output); // 최종 레이아웃 변환 Context::set('content', $output); $output = $oTemplate->compile('./common/tpl', 'common_layout'); // 사용자 정의 언어 변환 $oModuleController =& getController('module'); $oModuleController->replaceDefinedLangCode($output); } // header 출력 if ($this->gz_enabled) { header("Content-Encoding: gzip"); } if (Context::getResponseMethod() == 'JSON') { $this->_printJSONHeader(); } else { if (Context::getResponseMethod() != 'HTML') { $this->_printXMLHeader(); } else { $this->_printHTMLHeader(); } } // debugOutput 출력 $this->content_size = strlen($output); $output .= $this->_debugOutput(); // 결과물 직접 출력 if ($this->gz_enabled) { print ob_gzhandler($output, 5); } else { print $output; } // 출력 후 trigger 호출 (after) ModuleHandler::triggerCall('display', 'after', $content); }
/** * Restore document from trash module, called by trash module * This method is passived * @param object|array $originObject * @return object */ function restoreTrash($originObject) { if (is_array($originObject)) { $originObject = (object) $originObject; } $oDocumentController = getController('document'); $oDocumentModel = getModel('document'); $oDB =& DB::getInstance(); $oDB->begin(); //DB restore $output = $oDocumentController->insertDocument($originObject, false, true, false); if (!$output->toBool()) { return new Object(-1, $output->getMessage()); } //FILE restore $oDocument = $oDocumentModel->getDocument($originObject->document_srl); // If the post was not temorarily saved, set the attachment's status to be valid if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) { $args = new stdClass(); $args->upload_target_srl = $oDocument->document_srl; $args->isvalid = 'Y'; $output = executeQuery('file.updateFileValid', $args); } // call a trigger (after) if ($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject); if (!$trigger_output->toBool()) { $oDB->rollback(); return $trigger_output; } } // commit $oDB->commit(); return new Object(0, 'success'); }
/** * @brief Delete comment **/ function deleteReview($review_srl, $is_admin = false, $isMoveToTrash = false) { // create the comment model object $oCommentModel =& getModel('store_review'); // check if comment already exists $comment = $oCommentModel->getReview($review_srl); if ($comment->review_srl != $review_srl) { return new Object(-1, 'msg_invalid_request'); } $item_srl = $comment->item_srl; // call a trigger (before) $output = ModuleHandler::triggerCall('store_review.deleteReview', 'before', $comment); if (!$output->toBool()) { return $output; } // check if child comment exists on the comment $child_count = $oCommentModel->getChildCommentCount($review_srl); if ($child_count > 0) { return new Object(-1, 'fail_to_delete_have_children'); } // check if permission is granted if (!$is_admin && !$comment->isGranted()) { return new Object(-1, 'msg_not_permitted'); } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); // Delete $args->review_srl = $review_srl; $output = executeQuery('store_review.deleteReview', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } $output = executeQuery('store_review.deleteReviewList', $args); // update the number of comments $comment_count = $oCommentModel->getReviewCount($item_srl); /* // create the controller object of the document $oDocumentController = &getController('document'); // update comment count of the article posting $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false); if(!$output->toBool()) { $oDB->rollback(); return $output; } */ // call a trigger (after) if ($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('store_review.deleteReview', 'after', $comment); if (!$trigger_output->toBool()) { $oDB->rollback(); return $trigger_output; } } if (!$isMoveToTrash) { $this->_deleteDeclaredComments($args); $this->_deleteVotedComments($args); } // commit $oDB->commit(); $output->add('item_srl', $item_srl); //remove from cache $oCacheHandler =& CacheHandler::getInstance('object'); if ($oCacheHandler->isSupport()) { $oCacheHandler->invalidateGroupKey('commentList'); } return $output; }
/** * @brief Display member join form */ function dispMemberSignUpForm() { //setcookie for redirect url in case of going to member sign up setcookie("XE_REDIRECT_URL", $_SERVER['HTTP_REFERER']); $member_config = $this->member_config; $oMemberModel = getModel('member'); // Get the member information if logged-in if ($oMemberModel->isLogged()) { return $this->stop('msg_already_logged'); } // call a trigger (before) $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); if (!$trigger_output->toBool()) { return $trigger_output; } // Error appears if the member is not allowed to join if ($member_config->enable_join != 'Y') { return $this->stop('msg_signup_disabled'); } $oMemberAdminView = getAdminView('member'); $formTags = $oMemberAdminView->_getMemberInputTag($member_info); Context::set('formTags', $formTags); global $lang; $identifierForm = new stdClass(); $identifierForm->title = $lang->{$member_config->identifier}; $identifierForm->name = $member_config->identifier; $identifierForm->value = $member_info->{$member_config->identifier}; Context::set('identifierForm', $identifierForm); $this->addExtraFormValidatorMessage(); // Set a template file $this->setTemplateFile('signup_form'); }
/** * @param void */ function flushSlowlog() { $trigger_args = new stdClass(); $trigger_args->_log_type = 'flush'; $trigger_args->_elapsed_time = 0; ModuleHandler::triggerCall('XE.writeSlowlog', 'after', $trigger_args); }
/** * @brief additional configuration support **/ function dispPlanetAdminAdditionalSetup() { $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content); $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); Context::set('setup_content', $content); // 템플릿 파일 지정 $this->setTemplateFile('additional_setup'); }
if (!$output->toBool()) { return $output; } // update mobile Layout $args->extra_vars = serialize($extra_vars); $output = $oLayoutAdminController->updateLayout($args); if (!$output->toBool()) { return $output; } $siteDesignPath = _XE_PATH_ . 'files/site_design/'; FileHandler::makeDir($siteDesignPath); $designInfo = new stdClass(); $designInfo->layout_srl = $layout_srl; $designInfo->mlayout_srl = $mlayout_srl; $moduleList = array('page', 'board', 'editor'); $moutput = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList); if ($moutput->toBool()) { $moduleList = array_unique($moduleList); } $skinTypes = array('skin' => 'skins/', 'mskin' => 'm.skins/'); $designInfo->module = new stdClass(); $oModuleModel = getModel('module'); /* @var $oModuleModel moduleModel */ foreach ($skinTypes as $key => $dir) { $skinType = $key == 'skin' ? 'P' : 'M'; foreach ($moduleList as $moduleName) { $designInfo->module->{$moduleName} = new stdClass(); $designInfo->module->{$moduleName}->{$key} = $oModuleModel->getModuleDefaultSkin($moduleName, $skinType, 0, false); } } $designInfo->module->board->skin = 'xedition';
/** * @brief update item **/ function procNproductAdminUpdateItem() { $oMemberModel =& getModel('member'); $oDocumentModel =& getModel('document'); $oNproductModel =& getModel('nproduct'); $oDocumentController =& getController('document'); $item_srl = Context::get('item_srl'); $module_srl = Context::get('disp_module_srl'); $item_name = Context::get('item_name'); $item_code = Context::get('item_code'); $category_id = Context::get('category_id'); $document_srl = Context::get('document_srl'); $description = Context::get('description'); $price = Context::get('price'); $discount_amount = Context::get('discount_amount'); $discount_info = Context::get('discount_info'); $taxfree = Context::get('taxfree'); $display = Context::get('display'); $delivery_info = Context::get('delivery_info'); $group_srl_list = Context::get('group_srl_list'); // update document $doc_args->document_srl = $document_srl; //$doc_args->category_srl = $category_id; $doc_args->module_srl = $module_srl; $doc_args->content = $description; $doc_args->title = $item_name; $doc_args->list_order = $doc_args->document_srl * -1; $doc_args->tags = Context::get('tag'); $doc_args->allow_comment = 'Y'; $output = $oDocumentController->updateDocument($oDocumentModel->getDocument($document_srl), $doc_args); if (!$output->toBool()) { return $output; } if (Context::get('delete_file')) { $delete_file_srl = Context::get('delete_file'); $this->deleteNproductFile($delete_file_srl, $item_srl); } // update item $args->item_srl = $item_srl; $args->item_name = $item_name; $args->item_code = $item_code; $args->module_srl = $module_srl; $args->node_route = 'f.'; if ($category_id) { $args->category_id = $category_id; $category_info = $oNproductModel->getCategoryInfo($category_id); $args->node_route = 'f.'; if ($category_info) { $args->node_route = $category_info->node_route . $category_info->node_id . '.'; } } $args->proc_module = Context::get('proc_module'); $args->document_srl = $document_srl; $args->price = $price; $args->discount_amount = $discount_amount; $args->discount_info = $discount_info; $args->taxfree = $taxfree; $args->display = $display; $args->delivery_info = $delivery_info; $args->group_srl_list = serialize($group_srl_list); $args->related_items = Context::get('related_items'); $args->minimum_order_quantity = Context::get('minimum_order_quantity'); $args->item_stock = Context::get('item_stock'); if ($args->item_stock < 0) { $args->item_stock = -1; } // extras $extra_vars = $oNproductModel->getExtraVars($module_srl); $extra_vars = delObjectVars($extra_vars, $args); $args->extra_vars = serialize($extra_vars); // before $output = ModuleHandler::triggerCall('nproduct.updateItem', 'before', $args); if (!$output->toBool()) { return $output; } /* * extra_vars update */ foreach ($extra_vars as $key => $val) { $ex_args->item_srl = $item_srl; $ex_args->name = $key; $ex_args->value = $val->getValuePlain(); $output = executeQuery('nproduct.deleteNproductExtraVars', $ex_args); if (!$output->toBool()) { return $output; } $output = executeQuery('nproduct.insertNproductExtraVars', $ex_args); if (!$output->toBool()) { return $output; } } /* * end */ $output = executeQuery('nproduct.updateItemAdmin', $args); if (!$output->toBool()) { return $output; } // update group discount $args->item_srl = $item_srl; $output = executeQuery('nproduct.deleteGroupDiscount', $args); if (!$output->toBool()) { return $output; } unset($args); $group_list = $oMemberModel->getGroups(); foreach ($group_list as $key => $val) { if (Context::get('group_discount_' . $val->group_srl)) { $opt = Context::get('group_opt_' . $val->group_srl); if (!$opt) { $opt = '1'; } $args->item_srl = $item_srl; $args->module_srl = $module_srl; $args->group_srl = $val->group_srl; $args->opt = $opt; $args->price = Context::get('group_discount_' . $val->group_srl); $output = executeQuery('nproduct.insertGroupDiscount', $args); if (!$output->toBool()) { return $output; } unset($args); } } $this->procNproductAdminUpdateItemFile(); // after $output = ModuleHandler::triggerCall('nproduct.updateItem', 'after', $args); if (!$output->toBool()) { return $output; } $this->setRedirectUrl(getNotEncodedUrl('', 'module', Context::get('module'), 'act', 'dispNproductAdminUpdateItem', 'module_srl', Context::get('module_srl'), 'item_srl', $item_srl, 's_item_name', Context::get('s_item_name'), 'category', Context::get('category'))); }
/** * excute the member method specified by $act variable * @return boolean true : success false : fail * */ function proc() { // pass if stop_proc is true if ($this->stop_proc) { debugPrint($this->message, 'ERROR'); return FALSE; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return FALSE; } // execute an addon(call called_position as before_module_proc) $called_position = 'before_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (FileHandler::exists($addon_file)) { include $addon_file; } if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { // Check permissions if ($this->module_srl && !$this->grant->access) { $this->stop("msg_not_permitted_act"); return FALSE; } // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) $is_default_skin = !Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N' || Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N'; $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) { $dir = Mobile::isFromMobilePhone() ? 'm.skins' : 'skins'; $valueName = Mobile::isFromMobilePhone() ? 'mskin' : 'skin'; $oModuleModel = getModel('module'); $skinType = Mobile::isFromMobilePhone() ? 'M' : 'P'; $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); if ($this->module == 'page') { $this->module_info->{$valueName} = $skinName; } else { $isTemplatPath = strpos($this->getTemplatePath(), '/tpl/') !== FALSE; if (!$isTemplatPath) { $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); } } } $oModuleModel = getModel('module'); $oModuleModel->syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); // Run $output = $this->{$this->act}(); } else { return FALSE; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return FALSE; } // execute an addon(call called_position as after_module_proc) $called_position = 'after_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (FileHandler::exists($addon_file)) { include $addon_file; } if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) { $this->setError($output->getError()); $this->setMessage($output->getMessage()); if (!$output->toBool()) { return FALSE; } } // execute api methos of the module if view action is and result is XMLRPC or JSON if ($this->module_info->module_type == 'view') { if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') { $oAPI = getAPI($this->module_info->module, 'api'); if (method_exists($oAPI, $this->act)) { $oAPI->{$this->act}($this); } } } return TRUE; }