public function __construct() { if (!self::$scripts_added) { self::$scripts_added = true; Context::loadFile(array('./addons/recaptcha/recaptcha.js', 'body')); Context::addHtmlFooter('<script src="https://www.google.com/recaptcha/api.js?render=explicit&onload=reCaptchaCallback" async defer></script>'); $html = '<div id="recaptcha-config" data-sitekey="%s" data-theme="%s" data-size="%s"></div>'; $html = sprintf($html, escape(self::$config->site_key), self::$config->theme ?: 'light', self::$config->size ?: 'normal'); Context::addHtmlFooter($html); } }
/** * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method * * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 **/ function transHTML($xml_obj) { $code_type = $xml_obj->attrs->code_type; $option_file_path = $xml_obj->attrs->file_path; $option_description = $xml_obj->attrs->description; $option_first_line = $xml_obj->attrs->first_line; $option_collapse = $xml_obj->attrs->collapse; $option_nogutter = $xml_obj->attrs->nogutter; $option_nocontrols = $xml_obj->attrs->nocontrols; if ($option_collapse == 'true') { $option = $option . 'collapse: true;'; } if ($option_nogutter == 'true') { $option = $option . 'gutter: false;'; } if ($option_nocontrols == 'true' && $option_collapse != 'true') { $option = $option . 'toolbar: false;'; } if ($option_first_line > 1) { $option = $option . "first-line: " . $option_first_line . ";"; } $body = $xml_obj->body; $body = preg_replace('@(<br\\s?/?>)(\\n)?@i', "\n", $body); $body = strip_tags($body); if (!$GLOBALS['_called_editor_component_code_highlighter_']) { $GLOBALS['_called_editor_component_code_highlighter_'] = true; $js_code = <<<dpScript <script type="text/javascript"> SyntaxHighlighter.config.clipboardSwf = '{$this->component_path}script/clipboard.swf'; SyntaxHighlighter.all(); </script> dpScript; Context::addHtmlFooter($js_code); Context::addCSSFile($this->component_path . 'style/shCore.css'); Context::addCSSFile($this->component_path . 'style/shThemeDefault.css'); Context::addJsFile($this->component_path . 'script/shCore.js'); } Context::addJsFile($this->component_path . 'script/shBrush' . $code_type . '.js'); $output = null; if ($option_file_path != null || $option_description != null) { $output .= '<div class="ch_infobox">'; if ($option_file_path != null) { $output .= '<span class="file_path">' . $option_file_path . '</span>'; } if ($option_description != null) { $output .= '<span class="description">' . $option_description . '</span>'; } $output .= '</div>'; } $output .= sprintf('<pre class="brush: %s;%s">%s</pre>', strtolower($code_type), $option, $body); return $output; }
/** * Enviroment information send to XE collect server * @return void */ function showSendEnv() { if (Context::getResponseMethod() != 'HTML') { return; } $server = 'http://collect.xpressengine.com/env/img.php?'; $path = './files/env/'; $install_env = $path . 'install'; $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); if (file_exists(FileHandler::getRealPath($install_env))) { $oAdminAdminModel = getAdminModel('admin'); $params = $oAdminAdminModel->getEnv('INSTALL'); $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); Context::addHtmlFooter($img); FileHandler::writeFile($path . $mainVersion, '1'); } else { if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) { if ($_SESSION['enviroment_gather'] == 'Y') { $oAdminAdminModel = getAdminModel('admin'); $params = $oAdminAdminModel->getEnv(); $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); Context::addHtmlFooter($img); } FileHandler::writeFile($path . $mainVersion, '1'); unset($_SESSION['enviroment_gather']); } } }
<?php /* new_document_notify2.addon.php notify after check new document */ if (!defined('__XE__')) { exit; } if ($called_position == 'before_module_proc' && Context::get('module') != 'admin' && Context::get('act') != 'getFileList' && Context::get('act') != 'procFileUpload') { $delay = str_replace("ms", "", $addon_info->delay); if (!isset($addon_info->notifysound)) { $addon_info->notifysound = "false"; } Context::addHtmlHeader('<script src="https://cdn.socket.io/socket.io-1.0.3.js"></script>'); Context::addHtmlFooter('<script src="./addons/new_document_notify2/js/new_document_notify.js"></script>'); Context::addCssFile('./addons/new_document_notify2/css/style.css'); Context::addBodyHeader('<div id="notify-div"></div>'); Context::addHtmlHeader('<script type="text/javascript">var socket = io("' . $addon_info->nitrous . '");var delay = ' . $delay . ';var notifysound="' . $addon_info->notifysound . '"; </script>'); if (in_array($this->mid, explode(",", $addon_info->module_id))) { if (Context::get('act') == "dispBoardWrite" && Context::get('document_srl')) { $_SESSION['notify_modify'] = 'modify'; } else { if (Context::get('act') == 'procBoardInsertDocument' && $_SESSION['notify_modify'] == "modify") { } else { if ($_SESSION['notify_type'] == 'write') { $title = $_SESSION['notify_title']; $srl = $_SESSION['notify_srl']; unset($_SESSION['notify_type']); unset($_SESSION['notify_title']); unset($_SESSION['notify_srl']);
/** * get a module instance and execute an action * @return ModuleObject executed module instance * */ function procModule() { $oModuleModel = getModel('module'); $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; // If error occurred while preparation, return a message instance if ($this->error) { $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // Get action information with conf/module.xml $xml_info = $oModuleModel->getModuleActionXml($this->module); // If not installed yet, modify act if ($this->module == "install") { if (!$this->act || !$xml_info->action->{$this->act}) { $this->act = $xml_info->default_index_act; } } // if act exists, find type of the action, if not use default index act if (!$this->act) { $this->act = $xml_info->default_index_act; } // still no act means error if (!$this->act) { $this->error = 'msg_module_is_not_exists'; $this->httpStatusCode = '404'; $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // get type, kind $type = $xml_info->action->{$this->act}->type; $ruleset = $xml_info->action->{$this->act}->ruleset; $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; if (!$kind && $this->module == 'admin') { $kind = 'admin'; } // check REQUEST_METHOD in controller if ($type == 'controller') { $allowedMethod = $xml_info->action->{$this->act}->method; if (!$allowedMethod) { $allowedMethodList[0] = 'POST'; } else { $allowedMethodList = explode('|', strtoupper($allowedMethod)); } if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) { $this->error = "msg_invalid_request"; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($this->module_info->use_mobile != "Y") { Mobile::setMobile(FALSE); } $logged_info = Context::get('logged_info'); // check CSRF for POST actions if (Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { $this->error = 'msg_invalid_request'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } // Admin ip if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') { $this->_setInputErrorToContext(); $this->error = "msg_not_permitted_act"; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } // if(type == view, and case for using mobilephone) if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) { $orig_type = "view"; $type = "mobile"; // create a module instance $oModule = $this->getModuleInstance($this->module, $type, $kind); if (!is_object($oModule) || !method_exists($oModule, $this->act)) { $type = $orig_type; Mobile::setMobile(FALSE); $oModule = $this->getModuleInstance($this->module, $type, $kind); } } else { // create a module instance $oModule = $this->getModuleInstance($this->module, $type, $kind); } if (!is_object($oModule)) { $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // If there is no such action in the module object if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) { if (!Context::isInstalled()) { $this->_setInputErrorToContext(); $this->error = 'msg_invalid_request'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } $forward = NULL; // 1. Look for the module with action name if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\\_]+)(.*)$/', $this->act, $matches)) { $module = strtolower($matches[2] . $matches[3]); $xml_info = $oModuleModel->getModuleActionXml($module); if ($xml_info->action->{$this->act} && (stripos($this->act, 'admin') !== FALSE || $xml_info->action->{$this->act}->standalone != 'false')) { $forward = new stdClass(); $forward->module = $module; $forward->type = $xml_info->action->{$this->act}->type; $forward->ruleset = $xml_info->action->{$this->act}->ruleset; $forward->act = $this->act; } else { $this->error = 'msg_invalid_request'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if (!$forward) { $forward = $oModuleModel->getActionForward($this->act); } if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) { $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; $type = $forward->type; $ruleset = $forward->ruleset; $tpl_path = $oModule->getTemplatePath(); $orig_module = $oModule; $xml_info = $oModuleModel->getModuleActionXml($forward->module); // SECISSUE also check foward act method // check REQUEST_METHOD in controller if ($type == 'controller') { $allowedMethod = $xml_info->action->{$forward->act}->method; if (!$allowedMethod) { $allowedMethodList[0] = 'POST'; } else { $allowedMethodList = explode('|', strtoupper($allowedMethod)); } if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) { $this->error = "msg_invalid_request"; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($type == "view" && Mobile::isFromMobilePhone()) { $orig_type = "view"; $type = "mobile"; // create a module instance $oModule = $this->getModuleInstance($forward->module, $type, $kind); if (!is_object($oModule) || !method_exists($oModule, $this->act)) { $type = $orig_type; Mobile::setMobile(FALSE); $oModule = $this->getModuleInstance($forward->module, $type, $kind); } } else { $oModule = $this->getModuleInstance($forward->module, $type, $kind); } if (!is_object($oModule)) { $this->_setInputErrorToContext(); $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage('msg_module_is_not_exists'); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } if ($this->module == "admin" && $type == "view") { if ($logged_info->is_admin == 'Y') { if ($this->act != 'dispLayoutAdminLayoutModify') { $oAdminView = getAdminView('admin'); $oAdminView->makeGnbUrl($forward->module); $oModule->setLayoutPath("./modules/admin/tpl"); $oModule->setLayoutFile("layout.html"); } } else { $this->_setInputErrorToContext(); $this->error = 'msg_is_not_administrator'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($kind == 'admin') { $grant = $oModuleModel->getGrant($this->module_info, $logged_info); if (!$grant->manager) { $this->_setInputErrorToContext(); $this->error = 'msg_is_not_manager'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } else { if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') { $this->_setInputErrorToContext(); $this->error = 'msg_is_not_administrator'; $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } } } else { if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) { $this->act = $xml_info->default_index_act; } else { $this->error = 'msg_invalid_request'; $oModule->setError(-1); $oModule->setMessage($this->error); return $oModule; } } } // ruleset check... if (!empty($ruleset)) { $rulesetModule = $forward->module ? $forward->module : $this->module; $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); if (!empty($rulesetFile)) { if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) { $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; foreach ($errorLang as $key => $val) { Context::setLang($key, $val); } unset($_SESSION['XE_VALIDATOR_ERROR_LANG']); } $Validator = new Validator($rulesetFile); $result = $Validator->validate(); if (!$result) { $lastError = $Validator->getLastError(); $returnUrl = Context::get('error_return_url'); $errorMsg = $lastError['msg'] ? $lastError['msg'] : 'validation error'; //for xml response $oModule->setError(-1); $oModule->setMessage($errorMsg); //for html redirect $this->error = $errorMsg; $_SESSION['XE_VALIDATOR_ERROR'] = -1; $_SESSION['XE_VALIDATOR_MESSAGE'] = $this->error; $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; $_SESSION['XE_VALIDATOR_RETURN_URL'] = $returnUrl; $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); $this->_setInputValueToSession(); return $oModule; } } } $oModule->setAct($this->act); $this->module_info->module_type = $type; $oModule->setModuleInfo($this->module_info, $xml_info); $skipAct = array('dispEditorConfigPreview' => 1, 'dispLayoutPreviewWithModule' => 1); $db_use_mobile = Mobile::isMobileEnabled(); if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) { global $lang; $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; Context::addHtmlHeader($header); Context::addHtmlFooter($footer); } if ($type == "view" && $kind != 'admin') { $module_config = $oModuleModel->getModuleConfig('module'); if ($module_config->htmlFooter) { Context::addHtmlFooter($module_config->htmlFooter); } if ($module_config->siteTitle) { $siteTitle = Context::getBrowserTitle(); if (!$siteTitle) { Context::setBrowserTitle($module_config->siteTitle); } } } // if failed message exists in session, set context $this->_setInputErrorToContext(); $procResult = $oModule->proc(); $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) { $error = $oModule->getError(); $message = $oModule->getMessage(); $messageType = $oModule->getMessageType(); $redirectUrl = $oModule->getRedirectUrl(); if ($messageType == 'error') { debugPrint($message, 'ERROR'); } if (!$procResult) { $this->error = $message; if (!$redirectUrl && Context::get('error_return_url')) { $redirectUrl = Context::get('error_return_url'); } $this->_setInputValueToSession(); } else { } $_SESSION['XE_VALIDATOR_ERROR'] = $error; $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); if ($message != 'success') { $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; } $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; if (Context::get('xeVirtualRequestMethod') != 'xml') { $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; } } unset($logged_info); return $oModule; }
if ($this->module != 'member' && $called_position == 'before_module_init') { // Load a language file from the communication module Context::loadLang(_XE_PATH_ . 'modules/communication/lang'); // Add menus on the member login information $oMemberController = getController('member'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); $flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl; if ($addon_info->use_alarm != 'N' && file_exists($flag_file)) { // Pop-up to display messages if a flag on new message is set $new_message_count = (int) trim(FileHandler::readFile($flag_file)); FileHandler::removeFile($flag_file); Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang'); Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true); $text = preg_replace('@\\r?\\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); } } elseif ($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') { $member_srl = Context::get('target_srl'); $oCommunicationModel = getModel('communication'); // Add a feature to display own message box. if ($logged_info->member_srl == $member_srl) { $mid = Context::get('cur_mid'); $oMemberController = getController('member'); // Add your own viewing Note Template $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); // Display a list of friends $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); // If not, Add menus to send message and to add friends } else { // Get member information
// Add menus on the member login information $oMemberController =& getController('member'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); // Pop-up to display messages if a flag on new message is set $flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl); $flag_file = $flag_path . $logged_info->member_srl; if (file_exists($flag_file)) { $new_message_count = trim(FileHandler::readFile($flag_file)); FileHandler::removeFile($flag_file); Context::loadLang('./addons/member_communication/lang'); Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true); $text = preg_replace('@\\r?\\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); $link = Context::getRequestUri() . '?module=communication&act=dispCommunicationNewMessage'; $script = "<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"; Context::addHtmlFooter($script); } } elseif ($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') { $oMemberController =& getController('member'); $member_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); // Creates communication model object $oCommunicationModel =& getModel('communication'); // Add a feature to display own message box. if ($logged_info->member_srl == $member_srl) { // Add your own viewing Note Template $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); // Display a list of friends $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); // If not, Add menus to send message and to add friends } else {
/** * Produce HTML compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string compiled template string */ function toDoc(&$oModule) { $oTemplate = TemplateHandler::getInstance(); // compile module tpl // deprecated themes skin $template_path = $oModule->getTemplatePath(); if (!is_dir($template_path)) { if ($oModule->module_info->module == $oModule->module) { $skin = $oModule->origin_module_info->skin; } else { $skin = $oModule->module_config->skin; } if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) { if ($skin && is_string($skin)) { $theme_skin = explode('|@|', $skin); $template_path = $oModule->getTemplatePath(); if (count($theme_skin) == 2) { $theme_path = sprintf('./themes/%s', $theme_skin[0]); // FIXME $theme_path $theme_path $theme_path ?? if (substr($theme_path, 0, strlen($theme_path)) != $theme_path) { $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); } } } else { $template_path = $oModule->getTemplatePath(); } } else { $template_path = $oModule->getTemplatePath(); } } $tpl_file = $oModule->getTemplateFile(); $output = $oTemplate->compile($template_path, $tpl_file); // add .x div for adminitration pages if (Context::getResponseMethod() == 'HTML') { if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') { $output = '<div class="x">' . $output . '</div>'; } if (Context::get('layout') != 'none') { if (__DEBUG__ == 3) { $start = getMicroTime(); } Context::set('content', $output, false); $layout_path = $oModule->getLayoutPath(); $layout_file = $oModule->getLayoutFile(); $edited_layout_file = $oModule->getEditedLayoutFile(); // get the layout information currently requested $oLayoutModel = getModel('layout'); $layout_info = Context::get('layout_info'); $layout_srl = $layout_info->layout_srl; // compile if connected to the layout if ($layout_srl > 0) { // handle separately if the layout is faceoff if ($layout_info && $layout_info->type == 'faceoff') { $oLayoutModel->doActivateFaceOff($layout_info); Context::set('layout_info', $layout_info); } // search if the changes CSS exists in the admin layout edit window $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); if (FileHandler::exists($edited_layout_css)) { Context::loadFile(array($edited_layout_css, '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 popup_layout, remove admin bar. $realLayoutPath = FileHandler::getRealPath($layout_path); if (substr_compare($realLayoutPath, '/', -1) !== 0) { $realLayoutPath .= '/'; } $pathInfo = pathinfo($layout_file); $onlyLayoutFile = $pathInfo['filename']; if ($realLayoutPath === _XE_PATH_ . 'common/tpl/' && $onlyLayoutFile === 'popup_layout') { Context::set('admin_bar', 'false'); } // DISABLE ADMIN BAR Context::set('admin_bar', 'false'); if (__DEBUG__ == 3) { $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; } if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) { Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); } } } return $output; }
/** * @brief the method for displaying the warning messages * display an error message if it has not a special design **/ function alertMessage($message) { $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', lang($message)); Context::addHtmlFooter($script); $this->setHttpStatusCode(403); }
$np = "@font-face{font-family:np;font-style:normal;font-weight:normal;src:url(http://themes.googleusercontent.com/static/fonts/earlyaccess/nanumpenscript/v2/NanumPenScript-Regular.eot)\\9}"; } if (!$addon_info->notice) { Context::addCssFile('./addons/webfont/css/webfont.css'); if (Mobile::isMobileCheckByAgent()) { Context::addJsFile('./addons/webfont/js/webfont_notice_m.js', false, '', null, 'body'); } else { Context::addJsFile('./addons/webfont/js/webfont_notice.js', false, '', null, 'body'); } if (!$addon_info->expires) { $addon_info->expires = "1"; } } } $fontcheck = "\n<div id=\"fontcheck\" title=\"{$addon_info->expires}\" style=\"position:absolute;top:-999px;left:-999px;visibility:hidden;font-size:72px\">\n\t<p id=\"fontcheck_nanum1\" style=\"float:left;font-family:NanumGothic,나눔고딕,monospace,Verdana !important\">abcXYZ, 세종대왕,1234</p>\n\t<p id=\"fontcheck_nanum2\" style=\"float:left;font-family:monospace,Verdana !important\">abcXYZ, 세종대왕,1234</p>\n</div>\n\t\t"; Context::addHtmlFooter($fontcheck); } if ($addon_info->font1_name) { $font1 = "@font-face{font-family:{$addon_info->font1_name};font-style:normal;font-weight:normal;src:url('{$addon_info->font1_woff}') format('woff');src:url({$addon_info->font1_eot})\\9}"; if ($addon_info->font1_force == 'Y') { $font1_force = "body,input,textarea,select,button,table{font-family:{$addon_info->font1_name}}"; } } if ($addon_info->font2_name) { $font2 = "@font-face{font-family:{$addon_info->font2_name};font-style:normal;font-weight:normal;src:url('{$addon_info->font2_woff}') format('woff');src:url({$addon_info->font21_eot})\\9}"; if ($addon_info->font2_force == 'Y') { $font2_force = "body,input,textarea,select,button,table{font-family:{$addon_info->font2_name}}"; } } if ($addon_info->font3_name) { $font3 = "@font-face{font-family:{$addon_info->font3_name};font-style:normal;font-weight:normal;src:url('{$addon_info->font3_woff}') format('woff');src:url({$addon_info->font3_eot})\\9}";
} if (!$addon_info->show_title) { $addon_info->show_title = "false"; } if (!$addon_info->opacity) { $addon_info->opacity = ".8"; } if (!$addon_info->theme) { $addon_info->theme = "pp_default"; } if (!$addon_info->noWidth) { $addon_info->noWidth = "100"; } if (!$addon_info->noHeight) { $addon_info->noHeight = "100"; } if (!$addon_info->iframeWidth) { $addon_info->iframeWidth = "100%"; } if (!$addon_info->iframeHeight) { $addon_info->iframeHeight = "100%"; } if (!$addon_info->linkStyle) { $addon_info->linkStyle = "pp_i1"; } if (!$addon_info->linkViewer) { $addon_info->linkViewer = "1"; } $prettyphoto = "\n<script type=\"text/javascript\">//<![CDATA[\nvar slideshow0 = {$addon_info->slideshow};\nvar autoplay_slideshow0 = {$addon_info->auto_slide};\nvar opacity0 = {$addon_info->opacity};\nvar show_title0 = {$addon_info->show_title};\nvar theme0 = '{$addon_info->theme}';\nvar noWidth = {$addon_info->noWidth};\nvar noHeight = {$addon_info->noHeight};\nvar iframeWidth = '{$addon_info->iframeWidth}';\nvar iframeHeight = '{$addon_info->iframeHeight}';\nvar linkStyle = '{$addon_info->linkStyle}';\nvar linkMixed = '{$addon_info->linkMixed}';\nvar ifLink = '{$addon_info->ifLink}';\nvar ifLinkViewer = '{$addon_info->linkViewer}';\n//]]></script>\n\t\t"; Context::addHtmlFooter($prettyphoto); }
<?php /* Copyright (C) misol and Rhymix contributors */ if (!defined('RX_VERSION')) { exit; } /** * @file rx_photoswipe.addon.php * @author MinSoo Kim <*****@*****.**> * @brief Add-on to highlight an activated image. */ if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && Context::get('module') != 'admin' && !isCrawler()) { Context::loadFile(array('./addons/photoswipe/PhotoSwipe/photoswipe.css', '', '', null), true); Context::loadFile(array('./addons/photoswipe/PhotoSwipe/default-skin/default-skin.css', '', '', null), true); Context::loadFile(array('./addons/photoswipe/PhotoSwipe/photoswipe.js', 'body', '', null), true); Context::loadFile(array('./addons/photoswipe/PhotoSwipe/photoswipe-ui-default.js', 'body', '', null), true); Context::loadFile(array('./addons/photoswipe/rx_photoswipe.js', 'body', '', null), true); $footer = FileHandler::readFile('./addons/photoswipe/PhotoSwipe/pswp.html'); Context::addHtmlFooter($footer); } /* End of file photoswipe.addon.php */ /* Location: ./addons/photoswipe/photoswipe.addon.php */
/** * @brief 소스 브라우징 **/ function dispIssuetrackerViewSource() { // 접근 권한 체크 if (!$this->grant->browser_source || !$this->module_info->svn_url) { return $this->dispIssuetrackerMessage('msg_not_permitted'); } require_once $this->module_path . 'classes/svn.class.php'; $path = urldecode(Context::get('path')); if (!$path) { $path = '/'; } Context::set('path', $path); $revs = Context::get('revs'); $erev = Context::get('erev'); $brev = Context::get('brev'); $oSvn = new Svn($this->module_info->svn_url, $this->module_info->svn_cmd); $current = $oSvn->getStatus($path); Context::set('current', $current); $type = Context::get('type'); switch ($type) { case 'diff': case 'compare': $comp = $oSvn->getComp($path, $brev, $erev); Context::set('comp', $comp); $path_tree = Svn::explodePath($path, true); Context::set('path_tree', $path_tree); $this->setTemplateFile('source_compare'); break; case 'log': if (!$erev) { $erev = $current->revision; } $logs = $oSvn->getLog($path, $erev, $brev, false, 50); Context::set('logs', $logs); if (!$erev) { $erev = $current->erev; } context::set('erev', $erev); context::set('brev', $brev); $path_tree = Svn::explodePath($path, true); Context::set('path_tree', $path_tree); $this->setTemplateFile('source_log'); break; case 'file': if ($revs) { $erev = $revs; } if (!$erev) { $erev = $current->revision; } $content = $oSvn->getFileContent($path, $erev); Context::set('content', $content); $logs = $oSvn->getLog($path, $erev, $brev, false, 2); $erev = $logs[0]->revision; $brev = $logs[1]->revision; context::set('erev', $erev); context::set('brev', $brev); $path_tree = Svn::explodePath($path, true); Context::set('path_tree', $path_tree); $file_name = array_pop(array_keys($path_tree)); $file_ext = array_pop(explode(".", $file_name)); $extlist = array("document" => array("doc", "pdf", "hwp"), "image" => array("jpg", "jpeg", "jpe", "gif", "png", "bmp"), "sound" => array("mp3", "ogg", "wma", "wav"), "movie" => array("avi", "mpg", "mpeg", "mpe", "wmv", "asf", "asx", "mov", "flv", "swf")); foreach ($extlist as $key => $exts) { foreach ($exts as $s_key => $ext) { if (!strcasecmp($file_ext, $ext)) { $file_type = $key; break 2; } } } if (!$file_type) { $file_type = "code"; $extToLang = array("h" => "Cpp", "cpp" => "Cpp", "csharp" => "CSharp", "css" => "Css", "html" => "Xml", "sql" => "Sql", "java" => "Java", "py" => "Python", "rb" => "Ruby", "js" => "JScript", "c" => "Cpp", "vb" => "Vb", "xml" => "Xml", "php" => "Php"); $file_ext_tmp = strtolower($file_ext); if ($extToLang[$file_ext_tmp]) { $file_ext = $extToLang[$file_ext_tmp]; } if (file_exists("./common/js/plugins/code_highlighter/script/shBrush" . $file_ext . ".js")) { Context::loadJavascriptPlugin("code_highlighter"); Context::addJsFile('./common/js/plugins/code_highlighter/script/shBrush' . $file_ext . '.js', false); $js_code = <<<dpScript <script type="text/javascript"> SyntaxHighlighter.config.clipboardSwf = './modules/editor/components/code_highlighter/script/clipboard.swf'; SyntaxHighlighter.all(); </script> dpScript; Context::addHtmlFooter($js_code); Context::set('file_ext', $file_ext_tmp); } } Context::set('file_type', $file_type); $this->setTemplateFile('source_file_view'); break; default: $path_tree = Svn::explodePath($path, false); Context::set('path_tree', $path_tree); $list = $oSvn->getList($path, $revs); Context::set('list', $list); $this->setTemplateFile('source_list'); break; } Context::addJsFile($this->module_path . 'tpl/js/svn.js'); }
/** * @brief faceOff관련 서비스 출력을 위한 동작 실행 **/ function doActivateFaceOff(&$layout_info) { $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout); // 기본 faceoff layout CSS Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); // 레이아웃 매니져에서 생성된 CSS $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); if ($faceoff_layout_css) { Context::addCSSFile($faceoff_layout_css); } // 레이아웃의 위젯을 위한 css출력 Context::addCSSFile($this->module_path . '/tpl/css/widget.css'); if ($layout_info->extra_var->colorset->value == 'black') { Context::addCSSFile($this->module_path . '/tpl/css/widget@black.css'); } else { Context::addCSSFile($this->module_path . '/tpl/css/widget@white.css'); } // 권한에 따른 다른 내용 출력 $logged_info = Context::get('logged_info'); // faceOff 레이아웃 편집 버튼 노출 if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) { Context::addHtmlFooter("<div class=\"faceOffManager\"><a href=\"" . getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y') . "\" class=\"buttonSet buttonLayoutEditor\"><span>" . Context::getLang('cmd_layout_edit') . "</span></a></div>"); } // faceOff페이지 수정시에 메뉴 출력 if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) { $oTemplate =& TemplateHandler::getInstance(); Context::addBodyHeader($oTemplate->compile($this->module_path . '/tpl', 'faceoff_layout_menu')); } }
/** * get a module instance and execute an action * @return ModuleObject executed module instance **/ function procModule() { $oModuleModel =& getModel('module'); // If error occurred while preparation, return a message instance if ($this->error) { $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // Get action information with conf/module.xml $xml_info = $oModuleModel->getModuleActionXml($this->module); // If not installed yet, modify act if ($this->module == "install") { if (!$this->act || !$xml_info->action->{$this->act}) { $this->act = $xml_info->default_index_act; } } // if act exists, find type of the action, if not use default index act if (!$this->act) { $this->act = $xml_info->default_index_act; } // still no act means error if (!$this->act) { $this->error = 'msg_module_is_not_exists'; $this->httpStatusCode = '404'; $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // get type, kind $type = $xml_info->action->{$this->act}->type; $ruleset = $xml_info->action->{$this->act}->ruleset; $kind = strpos(strtolower($this->act), 'admin') !== false ? 'admin' : ''; if (!$kind && $this->module == 'admin') { $kind = 'admin'; } if ($this->module_info->use_mobile != "Y") { Mobile::setMobile(false); } // admin menu check if (Context::isInstalled()) { $oMenuAdminModel =& getAdminModel('menu'); $output = $oMenuAdminModel->getMenuByTitle('__XE_ADMIN__'); if (!$output->menu_srl) { $oAdminClass =& getClass('admin'); $oAdminClass->createXeAdminMenu(); } else { if (!is_readable($output->php_file)) { $oMenuAdminController =& getAdminController('menu'); $oMenuAdminController->makeXmlFile($output->menu_srl); } } } // Admin ip $logged_info = Context::get('logged_info'); if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') { $this->error = "msg_not_permitted_act"; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } // if(type == view, and case for using mobilephone) if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) { $orig_type = "view"; $type = "mobile"; // create a module instance $oModule =& $this->getModuleInstance($this->module, $type, $kind); if (!is_object($oModule) || !method_exists($oModule, $this->act)) { $type = $orig_type; Mobile::setMobile(false); $oModule =& $this->getModuleInstance($this->module, $type, $kind); } } else { // create a module instance $oModule =& $this->getModuleInstance($this->module, $type, $kind); } if (!is_object($oModule)) { $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } // If there is no such action in the module object if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) { if (!Context::isInstalled()) { $this->error = 'msg_invalid_request'; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); if ($this->httpStatusCode) { $oMessageObject->setHttpStatusCode($this->httpStatusCode); } return $oMessageObject; } $forward = null; // 1. Look for the module with action name if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\\_]+)(.*)$/', $this->act, $matches)) { $module = strtolower($matches[2] . $matches[3]); $xml_info = $oModuleModel->getModuleActionXml($module); if ($xml_info->action->{$this->act}) { $forward->module = $module; $forward->type = $xml_info->action->{$this->act}->type; $forward->ruleset = $xml_info->action->{$this->act}->ruleset; $forward->act = $this->act; } } if (!$forward) { $forward = $oModuleModel->getActionForward($this->act); } if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) { $kind = strpos(strtolower($forward->act), 'admin') !== false ? 'admin' : ''; $type = $forward->type; $ruleset = $forward->ruleset; $tpl_path = $oModule->getTemplatePath(); $orig_module = $oModule; if ($type == "view" && Mobile::isFromMobilePhone()) { $orig_type = "view"; $type = "mobile"; // create a module instance $oModule =& $this->getModuleInstance($forward->module, $type, $kind); if (!is_object($oModule) || !method_exists($oModule, $this->act)) { $type = $orig_type; Mobile::setMobile(false); $oModule =& $this->getModuleInstance($forward->module, $type, $kind); } } else { $oModule =& $this->getModuleInstance($forward->module, $type, $kind); } $xml_info = $oModuleModel->getModuleActionXml($forward->module); $oMemberModel =& getModel('member'); if ($this->module == "admin" && $type == "view") { if ($logged_info->is_admin == 'Y') { if ($this->act != 'dispLayoutAdminLayoutModify') { $oAdminView =& getAdminView('admin'); $oAdminView->makeGnbUrl($forward->module); $oModule->setLayoutPath("./modules/admin/tpl"); $oModule->setLayoutFile("layout.html"); } } else { $this->error = 'msg_is_not_administrator'; $oMessageObject =& ModuleHandler::getModuleInstance('message', $type); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } if ($kind == 'admin') { $grant = $oModuleModel->getGrant($this->module_info, $logged_info); if (!$grant->is_admin && !$grant->manager) { $this->error = 'msg_is_not_manager'; $oMessageObject =& ModuleHandler::getModuleInstance('message', 'view'); $oMessageObject->setError(-1); $oMessageObject->setMessage($this->error); $oMessageObject->dispMessage(); return $oMessageObject; } } } else { if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) { $this->act = $xml_info->default_index_act; } else { $this->error = 'msg_invalid_request'; $oModule->setError(-1); $oModule->setMessage($this->error); return $oModule; } } } // ruleset check... if (!empty($ruleset)) { $rulesetModule = $forward->module ? $forward->module : $this->module; $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); if (!empty($rulesetFile)) { if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) { $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; foreach ($errorLang as $key => $val) { Context::setLang($key, $val); } unset($_SESSION['XE_VALIDATOR_ERROR_LANG']); } $Validator = new Validator($rulesetFile); $result = $Validator->validate(); if (!$result) { $lastError = $Validator->getLastError(); $returnUrl = Context::get('error_return_url'); $errorMsg = $lastError['msg'] ? $lastError['msg'] : 'validation error'; //for xml response $oModule->setError(-1); $oModule->setMessage($errorMsg); //for html redirect $this->error = $errorMsg; $_SESSION['XE_VALIDATOR_ERROR'] = -1; $_SESSION['XE_VALIDATOR_MESSAGE'] = $this->error; $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; $_SESSION['XE_VALIDATOR_RETURN_URL'] = $returnUrl; $this->_setInputValueToSession(); return $oModule; } } } $oModule->setAct($this->act); $this->module_info->module_type = $type; $oModule->setModuleInfo($this->module_info, $xml_info); if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent()) { global $lang; $header = '<style type="text/css">div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; Context::addHtmlHeader($header); Context::addHtmlFooter($footer); } if ($type == "view" && $kind != 'admin') { $module_config = $oModuleModel->getModuleConfig('module'); if ($module_config->htmlFooter) { Context::addHtmlFooter($module_config->htmlFooter); } } // if failed message exists in session, set context $this->_setInputErrorToContext(); $procResult = $oModule->proc(); $methodList = array('XMLRPC' => 1, 'JSON' => 1); if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) { $error = $oModule->getError(); $message = $oModule->getMessage(); $messageType = $oModule->getMessageType(); $redirectUrl = $oModule->getRedirectUrl(); if (!$procResult) { $this->error = $message; if (!$redirectUrl && Context::get('error_return_url')) { $redirectUrl = Context::get('error_return_url'); } $this->_setInputValueToSession(); } else { if (count($_SESSION['INPUT_ERROR'])) { Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); $_SESSION['INPUT_ERROR'] = ''; } } $_SESSION['XE_VALIDATOR_ERROR'] = $error; if ($message != 'success') { $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; } $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; if (Context::get('xeVirtualRequestMethod') != 'xml') { $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; } } unset($logged_info); return $oModule; }
if (!defined("__ZBXE__")) { exit; } /** * @file lemonpen.addon.php * @author zero (zero@nzeo.com) * @brief LemonPen addon * 스프링노트의 레몬펜을 사이트에 설치하는 애드온입니다 **/ if (Context::getResponseMethod() == "XMLRPC") { return; } // 모듈의 실행 이후에 script를 추가함 if (Context::get('module') != 'admin' && $called_position == 'after_module_proc') { if ($this->getLayoutFile() != 'popup_layout.html') { $sid = $addon_info->sid; if ($sid) { Context::addHtmlFooter(sprintf('<script src="http://script.lemonpen.com/site/lemonpen.js?sid=%s" type="text/javascript" charset="UTF-8"></script>', $sid)); $GLOBALS['__lemonpen_is_called__'] = true; } } return; } // XE의 문서와 permant link를 레몬펜의 규약에 맞춰서 출력 if ($GLOBALS['__lemonpen_is_called__'] && $called_position == 'before_display_content') { // 글 본문을 링크 $output = preg_replace('/<div class="document_([0-9]+)_([0-9]+) xe_content">/is', '<div class="document_$1_$2 xe_content hentry"><a href="' . getUrl('', 'document_srl', "\$1") . '" rel="bookmark" style="display:none;">' . getUrl('', 'document_srl', "\$1") . '</a>', $output); // 댓글 본문을 링크 $output = preg_replace('/<div class="comment_([0-9]+)_([0-9]+) xe_content">/is', '<div class="comment_$1_$2 xe_content hentry"><a href="' . getUrl('', 'document_srl', "\$1") . '" rel="bookmark" style="display:none;">' . getUrl('', 'document_srl', "\$1") . '</a>', $output); }
/** * @brief the method for displaying the warning messages * display an error message if it has not a special design **/ function alertMessage($message) { $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); Context::addHtmlFooter($script); }
function triggerBeforeDisplay(&$output_display) { $act = Context::get('act'); // 팝업창이면 중지 if (Context::get('ncenterlite_is_popup')) { return; } // 자신의 알림목록을 보고 있을 경우엔 알림센터창을 띄우지 않는다. if ($act == 'dispNcenterliteNotifyList') { return; } if (count($this->disable_notify_bar_act)) { if (in_array(Context::get('act'), $this->disable_notify_bar_act)) { return; } } // HTML 모드가 아니면 중지 + act에 admin이 포함되어 있으면 중지 if (Context::getResponseMethod() != 'HTML' || strpos(strtolower(Context::get('act')), 'admin') !== false) { return; } $logged_info = Context::get('logged_info'); // 로그인 상태가 아니면 중지 if (!$logged_info) { return; } $module_info = Context::get('module_info'); if (count($this->disable_notify_bar_mid)) { if (in_array($module_info->mid, $this->disable_notify_bar_mid)) { return; } } // admin 모듈이면 중지 if ($module_info->module == 'admin') { return; } $oNcenterliteModel = getModel('ncenterlite'); $config = $oNcenterliteModel->getConfig(); // 알림센터가 비활성화 되어 있으면 중지 if ($config->use != 'Y') { return new Object(); } if ($config->display_use == 'N') { return new Object(); } // 노티바 제외 페이지이면 중지 if (in_array($module_info->module_srl, $config->hide_module_srls)) { return new Object(); } Context::set('ncenterlite_config', $config); $oModuleModel = getModel('module'); $ncenterlite_module_info = $oModuleModel->getModuleInfoXml('ncenterlite'); $jsCacheRefresh = '?' . $ncenterlite_module_info->version . '.' . $ncenterlite_module_info->date . '.js'; Context::addJsFile('./modules/ncenterlite/tpl/js/ncenterlite.js' . $jsCacheRefresh, true, '', 100000); $oNcenterliteModel = getModel('ncenterlite'); // 알림 목록 가져오기 $_output = $oNcenterliteModel->getMyNotifyList(); if (!$_output->data) { return; } // 알림 메시지가 없어도 항상 표시하게 하려면 이 줄을 제거 또는 주석 처리하세요. $_latest_notify_id = array_slice($_output->data, 0, 1); $_latest_notify_id = $_latest_notify_id[0]->notify; Context::set('ncenterlite_latest_notify_id', $_latest_notify_id); if ($_COOKIE['_ncenterlite_hide_id'] && $_COOKIE['_ncenterlite_hide_id'] == $_latest_notify_id) { return; } setcookie('_ncenterlite_hide_id', '', 0, '/'); $oMemberModel = getModel('member'); $memberConfig = $oMemberModel->getMemberConfig(); if ($memberConfig->profile_image == 'Y') { $profileImage = $oMemberModel->getProfileImage($logged_info->member_srl); Context::set('profileImage', $profileImage); } Context::set('useProfileImage', $memberConfig->profile_image == 'Y' ? true : false); Context::set('ncenterlite_list', $_output->data); Context::set('ncenterlite_page_navigation', $_output->page_navigation); if (Mobile::isFromMobilePhone()) { $this->template_path = sprintf('%sm.skins/%s/', $this->module_path, $config->mskin); if (!is_dir($this->template_path) || !$config->mskin) { $config->mskin = 'default'; $this->template_path = sprintf('%sm.skins/%s/', $this->module_path, $config->mskin); } } else { $this->template_path = sprintf('%sskins/%s/', $this->module_path, $config->skin); if (!is_dir($this->template_path) || !$config->skin) { $config->skin = 'default'; $this->template_path = sprintf('%sskins/%s/', $this->module_path, $config->skin); } } Context::addHtmlFooter('<script>'); if ($config->message_notify != 'N') { Context::addHtmlFooter('window.xeNotifyMessage = function() {};'); } Context::addHtmlFooter('(function(){setTimeout(function(){var s = jQuery(document).scrollTop();jQuery(document).scrollTop(s-30);}, 700);})();</script>'); $this->_addFile(); $html = $this->_getTemplate(); $output_display = $html . $output_display; }
/** * faceOff related services for the operation run out * @deprecated * @param object $layout_info * @return void */ function doActivateFaceOff(&$layout_info) { $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout); // faceoff layout CSS Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); // CSS generated in the layout manager $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); if ($faceoff_layout_css) { Context::addCSSFile($faceoff_layout_css); } // CSS output for the widget Context::loadFile($this->module_path . '/tpl/css/widget.css', true); if ($layout_info->extra_var->colorset->value == 'black') { Context::loadFile($this->module_path . '/tpl/css/widget@black.css', true); } else { Context::loadFile($this->module_path . '/tpl/css/widget@white.css', true); } // Different page displayed upon user's permission $logged_info = Context::get('logged_info'); // Display edit button for faceoff layout if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) { Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="' . getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y') . '">' . lang('cmd_layout_edit') . '</a></div>'); } // Display menu when editing the faceOff page if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) { $oTemplate =& TemplateHandler::getInstance(); Context::addBodyHeader($oTemplate->compile($this->module_path . '/tpl', 'faceoff_layout_menu')); } }
/** * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method **/ function transHTML($xml_obj) { $script_path = getScriptPath() . 'modules/editor/components/code_highlighter/syntaxhighlighter/scripts/'; $code_type = ucfirst($xml_obj->attrs->code_type); $option_title = ' title="' . $xml_obj->attrs->title . '"'; $option_first_line = $xml_obj->attrs->first_line; $option_collapse = $xml_obj->attrs->collapse; $option_nogutter = $xml_obj->attrs->nogutter; $option_highlight = $xml_obj->attrs->highlight; $option[] = 'brush:' . strtolower($code_type); if (in_array($option_collapse, array('true', 'checked', 'Y'))) { $option[] = 'collapse:true'; } if (in_array($option_nogutter, array('true', 'checked', 'Y'))) { $option[] = 'gutter:false'; } if ($option_highlight) { $option[] = 'highlight:[' . $option_highlight . ']'; } if ($option_first_line > 1) { $option[] = 'first-line:' . $option_first_line; } $body = $xml_obj->body; $body = strip_tags($body, '<br>'); $body = preg_replace("/(<br\\s*\\/?>)(\n|\r)*/i", "\n", $body); $body = strip_tags($body); $body = str_replace(' ', ' ', $body); if (!$GLOBALS['_called_editor_component_code_highlighter_']) { $GLOBALS['_called_editor_component_code_highlighter_'] = true; foreach ($this->brushes as $item) { $brush[] = '"' . $item[2] . ' ' . $script_path . 'shBrush' . $item[1] . '.js"'; } $sh_js_code[] = '<script type="text/javascript">'; $sh_js_code[] = 'window.SyntaxHighlighter.autoloader('; $sh_js_code[] = implode(',' . PHP_EOL, $brush); $sh_js_code[] = ');'; $sh_js_code[] = 'window.SyntaxHighlighter.config.bloggerMode = true;'; $sh_js_code[] = 'window.SyntaxHighlighter.all();'; $sh_js_code[] = '</script>'; if (!$this->theme) { $this->theme = 'Default'; } $theme_file = $this->component_path . 'syntaxhighlighter/styles/shCore' . $this->theme . '.css'; if (!file_exists($theme_file)) { $theme_file = $this->component_path . 'syntaxhighlighter/styles/shCoreDjango.css'; } Context::set('script_path', $script_path); Context::addHtmlFooter(implode(PHP_EOL, $sh_js_code)); Context::addCSSFile($theme_file); Context::addJsFile($script_path . 'shCore.js'); Context::addJsFile($script_path . 'shAutoloader.js'); } $output = sprintf('<pre class="%s" %s>%s</pre>', implode(';', $option), $option_title, $body); return $output; }