/** * Check SSL * * @return bool If using ssl returns true, otherwise returns false. * @deprecated */ function isSsl() { if (!is_null(self::$isSSL)) { return self::$isSSL; } $url_info = parse_url(Context::getRequestUrl()); self::$isSSL = $url_info['scheme'] == 'https'; return self::$isSSL; }
/** * Check SSL * * @return bool If using ssl returns true, otherwise returns false. */ function isSsl() { if ($GLOBAL['__XE_IS_SSL__']) { return $GLOBAL['__XE_IS_SSL__']; } $url_info = parse_url(Context::getRequestUrl()); if ($url_info['scheme'] == 'https') { $GLOBAL['__XE_IS_SSL__'] = true; } else { $GLOBAL['__XE_IS_SSL__'] = false; } return $GLOBAL['__XE_IS_SSL__']; }
/** * @brief bookmark url return **/ function getBookmarkUrl($member_srl) { if (!$member_srl) { return ''; } $base_url = Context::getDefaultUrl(); if (!$base_url) { $base_url = Context::getRequestUrl(); } $html_url = str_replace('&', '&', $base_url . '?act=dispMaterialPopup&module=material'); $js_url = Context::getRequestUri() . 'modules/material/tpl/js/material_grabber.js'; $auth = $this->getAuthByMemberSrl($member_srl); if (!$auth) { $oMaterialController =& getController('material'); $output = $oMaterialController->insertMaterialAuth($member_srl); $auth = $this->getAuthByMemberSrl($member_srl); } $bookmark_url = "javascript:(function(){var w=window,d=document,x=w.open('about:blank','XE_materialGrabWin','width=300,height=0,location=0,scrollbars=0,toolbar=0,status=0,menubar=0,resizable'),s=d.createElement('script');s.setAttribute('src','" . $js_url . "');w.auth='" . $auth . "';w.__xe_root='" . $html_url . "';d.body.appendChild(s);w.setTimeout(function(){x.focus()},100);})();"; return $bookmark_url; }
/** * Single Sign On (SSO) * * @return bool True : Module handling is necessary in the control path of current request , False : Otherwise */ function checkSSO() { // pass if it's not GET request or XE is not yet installed if ($this->db_info->use_sso != 'Y' || isCrawler()) { return true; } $checkActList = array('rss' => 1, 'atom' => 1); if (Context::getRequestMethod() != 'GET' || !Context::isInstalled() || isset($checkActList[Context::get('act')])) { return true; } // pass if default URL is not set $default_url = trim($this->db_info->default_url); if (!$default_url) { return true; } if (substr($default_url, -1) != '/') { $default_url .= '/'; } // for sites recieving SSO valdiation if ($default_url == Context::getRequestUri()) { if (Context::get('default_url')) { $url = base64_decode(Context::get('default_url')); $url_info = parse_url($url); $url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); header('location:' . $redirect_url); return false; } // for sites requesting SSO validation } else { // result handling : set session_name() if (Context::get('SSOID')) { $session_name = Context::get('SSOID'); setcookie(session_name(), $session_name); $url = preg_replace('/([\\?\\&])$/', '', str_replace('SSOID=' . $session_name, '', Context::getRequestUrl())); header('location:' . $url); return false; // send SSO request } else { if ($_COOKIE['sso'] != md5(Context::getRequestUri()) && !Context::get('SSOID')) { setcookie('sso', md5(Context::getRequestUri()), 0, '/'); $url = sprintf("%s?default_url=%s", $default_url, base64_encode(Context::getRequestUrl())); header('location:' . $url); return false; } } } return true; }
/** * @brief 위젯의 실행 부분 * * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다 * 결과를 만든후 print가 아니라 return 해주어야 한다 **/ function proc($args) { $oSocialxeModel =& getModel('socialxe'); Context::set('colorset', $args->colorset); // 언어 로드 Context::loadLang($this->widget_path . 'lang'); // 페이지 수정일 때는 실제 모습은 보이지 않도록 if (in_array(Context::get('act'), array("procWidgetGenerateCodeInPage", "dispPageAdminContentModify", "dispPageAdminMobileContentModify"))) { $tpl_path = sprintf('%stpl', $this->widget_path); $tpl_file = 'pageedit'; $oTemplate =& TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } // 서비스 목록 $provider_list = $oSocialxeModel->getProviderList(); Context::set('provider_list', $provider_list); // 서비스 로그인 상태 $logged_provider = $oSocialxeModel->loggedProviderList(); $logged_count = count($logged_provider); foreach ($provider_list as $provider) { $provider_is_logged[$provider] = $oSocialxeModel->isLogged($provider); } if (!isset($provider_is_logged)) { $provider_is_logged = array(); } Context::set('provider_is_logged', $provider_is_logged); Context::set('logged_provider', $logged_provider); Context::set('logged_count', $logged_count); // 로그인한 서비스의 닉네임들 foreach ($logged_provider as $provider) { $nick_names[$provider] = $oSocialxeModel->getProviderNickName($provider); } Context::set('nick_names', $nick_names); // 대표 계정 $master_provider = $oSocialxeModel->getMasterProvider(); Context::set('master_provider', $master_provider); // 대표 계정의 프로필 이미지 $profile_image = $oSocialxeModel->getProfileImage(); Context::set('profile_image', $profile_image); // 대표 계정의 닉네임 $nick_name = $oSocialxeModel->getNickName(); Context::set('nick_name', $nick_name); // 부계정 $slave_provider = $oSocialxeModel->getSlaveProvider(); Context::set('slave_provider', $slave_provider); // 부계정의 프로필 이미지 $slave_profile_image = $oSocialxeModel->getSlaveProfileImage(); Context::set('slave_profile_image', $slave_profile_image); // 부계정의 닉네임 $slave_nick_name = $oSocialxeModel->getSlaveNickName(); Context::set('slave_nick_name', $slave_nick_name); // 현재 페이지 주소의 쿼리 정보를 세팅 $url_info = parse_url(Context::getRequestUrl()); Context::set('query', urlencode($url_info['query'])); // 댓글이 등록될 문서번호 Context::set('document_srl', $args->document_srl); // 소셜 서비스에 등록될 주소 Context::set('content_link', htmlspecialchars($args->content_link)); // 소셜 서비스에 등록될 제목 Context::set('content_title', htmlspecialchars($args->content_title)); // 자동 로그인 키 $auto_login_key = $oSocialxeModel->getAutoLoginKey(); Context::set('auto_login_key', $auto_login_key); // 자동 로그인 키 요청 주소 $auto_login_key_url = $oSocialxeModel->getAutoLoginKeyUrl(); Context::set('auto_login_key_url', $auto_login_key_url); // 엔터 전송 여부 $enter_send = $args->enter_send; if (!$enter_send) { $enter_send = 'Y'; } Context::set('enter_send', $enter_send); // 대댓글 자동 펼침 여부 $auto_view_sub = $args->auto_view_sub; if (!$auto_view_sub) { $auto_view_sub = 'N'; } Context::set('auto_view_sub', $auto_view_sub); // 한번에 볼 댓글 개수 $list_count = $args->list_count; if (!$list_count) { $list_count = 10; } Context::set('list_count', $list_count); // comment_srl이 있으면 해당 댓글을 가져온다. $comment_srl = Context::get('comment_srl'); if ($comment_srl) { $comment_list = $oSocialxeModel->getComment($args->document_srl, $comment_srl); Context::set('comment_srl', null, true); Context::set('use_comment_srl', $comment_list->get('use_comment_srl')); Context::set('socialxe_comment_srl', $comment_srl); } else { $comment_list = $oSocialxeModel->getCommentList($args->document_srl, 0, $list_count); } Context::set('comment_list', $comment_list->get('list')); Context::set('total', $comment_list->get('total')); // 해당 글의 댓글 잠김을 확인한다. $oDocumentModel =& getModel('document'); $oDocument = $oDocumentModel->getDocument($args->document_srl); Context::set('allow_comment', $oDocument->allowComment()); // mid와 document_srl이 속한 모듈을 체크해서 같을 때만 _document_srl을 세팅 $oModuleModel =& getModel('module'); $module_info_by_mid = $oModuleModel->getModuleInfoByMid(Context::get('mid')); $module_info_by_document_srl = $oModuleModel->getModuleInfoByDocumentSrl($args->document_srl); if ($module_info_by_mid->module_srl == $module_info_by_document_srl->module_srl) { Context::set('_document_srl', $args->document_srl); } // 사용하는 필터 등록 Context::addJsFilter($this->widget_path . 'filter', 'insert_social_comment.xml'); Context::addJsFilter($this->widget_path . 'filter', 'delete_social_comment.xml'); Context::addJsFilter($this->widget_path . 'filter', 'insert_sub_comment.xml'); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin); Context::set('skin', $args->skin); // 템플릿 파일을 지정 $tpl_file = 'comment'; // 템플릿 컴파일 $oTemplate =& TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); }
/** * @brief SSO URL이 설정되어 있고 아직 SSO URL검사를 하지 않았다면 return true **/ function checkSSO() { // GET 접속이 아니거나 설치가 안되어 있으면 패스 if (Context::getRequestMethod() != 'GET' || !Context::isInstalled() || in_array(Context::get('act'), array('rss', 'atom'))) { return true; } // DB info에 설정된 Default URL이 없다면 무조건 무사통과 $default_url = trim($this->db_info->default_url); if (!$default_url) { return true; } if (substr($default_url, -1) != '/') { $default_url .= '/'; } // SSO 검증을 요청 받는 사이트 if ($default_url == Context::getRequestUri()) { if (Context::get('default_url')) { $url = base64_decode(Context::get('default_url')); $url_info = parse_url($url); $url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); header("location:" . $redirect_url); return false; } // SSO 검증을 요청하는 사이트 } else { // SSO 결과를 받는 경우 session_name() 세팅 if (Context::get('SSOID')) { $session_name = Context::get('SSOID'); setcookie(session_name(), $session_name); $url = preg_replace('/([\\?\\&])$/', '', str_replace('SSOID=' . $session_name, '', Context::getRequestUrl())); header("location:" . $url); return false; // SSO 결과를 요청 } else { if ($_COOKIE['sso'] != md5(Context::getRequestUri()) && !Context::get('SSOID')) { setcookie('sso', md5(Context::getRequestUri()), 0, '/'); $url = sprintf("%s?default_url=%s", $default_url, base64_encode(Context::getRequestUrl())); header("location:" . $url); return false; } } } return true; }