mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 17:22:20 +09:00
css 및 js 호출순서 조정기능 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5785 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4f380d9c48
commit
61851f1dfe
2149 changed files with 109090 additions and 18689 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @class Context
|
||||
* @class Context
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief Request Argument/환경변수등의 모든 Context를 관리
|
||||
* Context 클래스는 Context::methodname() 처럼 쉽게 사용하기 위해 만들어진 객체를 받아서
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
var $request_method = 'GET'; ///< @brief GET/POST/XMLRPC 중 어떤 방식으로 요청이 왔는지에 대한 값이 세팅. GET/POST/XML 3가지가 있음
|
||||
var $response_method = ''; ///< @brief HTML/XMLRPC 중 어떤 방식으로 결과를 출력할지 결정. (강제 지정전까지는 request_method를 따름)
|
||||
|
||||
var $context = NULL; ///< @brief request parameter 및 각종 환경 변수등을 정리하여 담을 변수
|
||||
var $context = NULL; ///< @brief request parameter 및 각종 환경 변수등을 정리하여 담을 변수
|
||||
|
||||
var $db_info = NULL; ///< @brief DB 정보
|
||||
var $ftp_info = NULL; ///< @brief FTP 정보
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
var $css_files = array(); ///< @brief display시에 사용하게 되는 css files의 목록
|
||||
|
||||
var $html_header = NULL; ///< @brief display시에 사용하게 되는 <head>..</head>내의 스크립트코드
|
||||
var $body_header = NULL; ///< @brief display시에 사용하게 되는 <body> 바로 다음에 출력될 스크립트 코드
|
||||
var $html_footer = NULL; ///< @brief display시에 사용하게 되는 </body> 바로 앞에 추가될 코드
|
||||
|
||||
var $path = ''; ///< zbxe의 경로
|
||||
|
|
@ -40,10 +41,12 @@
|
|||
|
||||
var $site_title = ''; ///< @brief 현 사이트의 browser title. Context::setBrowserTitle() 로 변경 가능
|
||||
|
||||
var $get_vars = NULL; ///< @brief form이나 get으로 요청이 들어온 변수만 별도로 관리
|
||||
var $get_vars = NULL; ///< @brief form이나 get으로 요청이 들어온 변수만 별도로 관리
|
||||
|
||||
var $is_uploaded = false; ///< @brief 첨부파일이 업로드 된 요청이였는지에 대한 체크 플래그
|
||||
|
||||
var $widget_include_info_flag = false; // 위젯 정보 코드 출력
|
||||
|
||||
/**
|
||||
* @brief 유일한 Context 객체를 반환 (Singleton)
|
||||
* Context는 어디서든 객체 선언없이 사용하기 위해서 static 하게 사용
|
||||
|
|
@ -64,6 +67,9 @@
|
|||
$this->context->lang = &$GLOBALS['lang'];
|
||||
$this->context->_COOKIE = $_COOKIE;
|
||||
|
||||
// 사용자의 쿠키 설정된 언어 타입 추출
|
||||
if($_COOKIE['lang_type']) $this->lang_type = $_COOKIE['lang_type'];
|
||||
|
||||
// 기본적인 DB정보 세팅
|
||||
$this->_loadDBInfo();
|
||||
|
||||
|
|
@ -83,19 +89,6 @@
|
|||
);
|
||||
session_start();
|
||||
|
||||
// 쿠키로 설정된 언어타입 가져오기
|
||||
if($_COOKIE['lang_type']) $this->lang_type = $_COOKIE['lang_type'];
|
||||
else $this->lang_type = $this->db_info->lang_type;
|
||||
if(!in_array($this->lang_type, array_keys($lang_supported))) $this->lang_type = $this->db_info->lang_type;
|
||||
if(!$this->lang_type) $this->lang_type = "en";
|
||||
|
||||
Context::set('lang_supported', $lang_supported);
|
||||
$this->setLangType($this->lang_type);
|
||||
|
||||
// 기본 언어파일 로드
|
||||
$this->lang = &$GLOBALS['lang'];
|
||||
$this->_loadLang(_XE_PATH_."common/lang/");
|
||||
|
||||
// Request Method 설정
|
||||
$this->_setRequestMethod();
|
||||
|
||||
|
|
@ -105,13 +98,31 @@
|
|||
$this->_setRequestArgument();
|
||||
$this->_setUploadedArgument();
|
||||
|
||||
// 인증 관련 정보를 Context와 세션에 설정
|
||||
// 설치가 되어 있다면 가상 사이트 정보를 구함
|
||||
if(Context::isInstalled()) {
|
||||
// site_module_info를 구함
|
||||
$oModuleModel = &getModel('module');
|
||||
$site_module_info = $oModuleModel->getDefaultMid();
|
||||
Context::set('site_module_info', $site_module_info);
|
||||
}
|
||||
|
||||
// 사용자 설정 언어 타입이 없으면 기본 언어타입으로 지정
|
||||
if(!$this->lang_type) {
|
||||
// 가상 사이트라면 가상사이트의 언어타입으로 지정
|
||||
if($site_module_info && $site_module_info->default_language) $this->db_info->lang_type = $site_module_info->default_language;
|
||||
|
||||
// 언어 타입 지정
|
||||
$this->lang_type = $this->db_info->lang_type;
|
||||
}
|
||||
// 지정된 언어가 지원 언어에 속하지 않거나 없으면 영문으로 지정
|
||||
if(!in_array($this->lang_type, array_keys($lang_supported))) $this->lang_type = $this->db_info->lang_type;
|
||||
if(!$this->lang_type) $this->lang_type = "en";
|
||||
|
||||
Context::set('lang_supported', $lang_supported);
|
||||
$this->setLangType($this->lang_type);
|
||||
|
||||
// 인증 관련 정보를 Context와 세션에 설정
|
||||
if(Context::isInstalled()) {
|
||||
// 인증관련 데이터를 Context에 설정
|
||||
$oMemberModel = &getModel('member');
|
||||
$oMemberController = &getController('member');
|
||||
|
|
@ -129,6 +140,10 @@
|
|||
$this->_set('logged_info', $oMemberModel->getLoggedInfo() );
|
||||
}
|
||||
|
||||
// 기본 언어파일 로드
|
||||
$this->lang = &$GLOBALS['lang'];
|
||||
$this->_loadLang(_XE_PATH_."common/lang/");
|
||||
|
||||
// rewrite 모듈사용 상태 체크
|
||||
if(file_exists(_XE_PATH_.'.htaccess')&&$this->db_info->use_rewrite == 'Y') $this->allow_rewrite = true;
|
||||
else $this->allow_rewrite = false;
|
||||
|
|
@ -206,7 +221,7 @@
|
|||
if(!$db_info->use_ssl) $db_info->use_ssl = 'none';
|
||||
|
||||
$this->_setDBInfo($db_info);
|
||||
|
||||
|
||||
$GLOBALS['_time_zone'] = $db_info->time_zone;
|
||||
$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
|
||||
$this->set('_use_ssl', $db_info->use_ssl);
|
||||
|
|
@ -265,6 +280,14 @@
|
|||
return $this->db_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 기본 URL을 return
|
||||
**/
|
||||
function getDefaultUrl() {
|
||||
$db_info = Context::getDBInfo();
|
||||
return $db_info->default_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 지원되는 언어 파일 찾기
|
||||
**/
|
||||
|
|
@ -305,6 +328,46 @@
|
|||
return $lang_selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SSO URL이 설정되어 있고 아직 SSO URL검사를 하지 않았다면 return true
|
||||
**/
|
||||
function checkSSO() {
|
||||
// GET 접속이 아니거나 설치가 안되어 있으면 패스
|
||||
if(Context::getRequestMethod()!='GET' || !Context::isInstalled()) 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')) {
|
||||
setcookie(session_name(), Context::get('SSOID'), 0, '/');
|
||||
header("location:".getUrl('SSOID',''));
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @biref FTP 정보가 등록되었는지 확인
|
||||
|
|
@ -347,8 +410,8 @@
|
|||
* @brief 사이트 title adding
|
||||
**/
|
||||
function _addBrowserTitle($site_title) {
|
||||
if($this->site_title) $this->site_title .= ' - '.htmlspecialchars($site_title);
|
||||
else $this->site_title .= htmlspecialchars($site_title);
|
||||
if($this->site_title) $this->site_title .= ' - '.$site_title;
|
||||
else $this->site_title .= $site_title;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -364,7 +427,7 @@
|
|||
* @brief 사이트 title setting
|
||||
**/
|
||||
function _setBrowserTitle($site_title) {
|
||||
$this->site_title = htmlspecialchars($site_title);
|
||||
$this->site_title = $site_title;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -558,7 +621,7 @@
|
|||
* @brief GET/POST방식일 경우 처리
|
||||
**/
|
||||
function _setRequestArgument() {
|
||||
if($this->_getRequestMethod() == 'XMLRPC') return;
|
||||
if($this->_getRequestMethod() == 'XMLRPC' || $this->_getRequestMethod() == 'JSON') return;
|
||||
if(!count($_REQUEST)) return;
|
||||
|
||||
foreach($_REQUEST as $key => $val) {
|
||||
|
|
@ -671,6 +734,21 @@
|
|||
return $this->request_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 현재 요청된 full url을 return
|
||||
**/
|
||||
function getRequestUrl() {
|
||||
static $url = null;
|
||||
if(is_null($url)) {
|
||||
$url = Context::getRequestUri();
|
||||
if(count($_GET)) {
|
||||
foreach($_GET as $key => $val) $vars[] = $key.'='.$val;
|
||||
$url .= '?'.implode('&',$vars);
|
||||
}
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 요청받은 url에 args_list를 적용하여 return
|
||||
**/
|
||||
|
|
@ -683,14 +761,25 @@
|
|||
* @brief 요청받은 url에 args_list를 적용하여 return
|
||||
**/
|
||||
function _getUrl($num_args=0, $args_list=array(), $domain = null) {
|
||||
if($domain) {
|
||||
$domain = preg_replace('/^(http|https):\/\//i','', trim($domain));
|
||||
if(substr($domain,-1) != '/') $domain .= '/';
|
||||
static $site_module_info = null;
|
||||
if(is_null($site_module_info)) {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
}
|
||||
|
||||
if(!$domain) {
|
||||
if($site_module_info->domain) $domain = $site_module_info->domain;
|
||||
else {
|
||||
if($this->db_info->default_url) $domain = $this->db_info->default_url;
|
||||
else if(!$domain) $domain = Context::getRequestUri();
|
||||
}
|
||||
}
|
||||
|
||||
$domain = preg_replace('/^(http|https):\/\//i','', trim($domain));
|
||||
if(substr($domain,-1) != '/') $domain .= '/';
|
||||
|
||||
if(!$this->get_vars || $args_list[0]=='') {
|
||||
$get_vars = null;
|
||||
if($args_list[0]=='') {
|
||||
if(is_array($args_list) && $args_list[0]=='') {
|
||||
array_shift($args_list);
|
||||
$num_args = count($args_list);
|
||||
}
|
||||
|
|
@ -711,6 +800,9 @@
|
|||
/* member module중의 쪽지함/친구 관리 기능이 communication 모듈로 이전하여 하위 호환성을 위한 act값 변경 */
|
||||
if($get_vars['act'] == 'dispMemberFriend') $get_vars['act'] = 'dispCommunicationFriend';
|
||||
elseif($get_vars['act'] == 'dispMemberMessages') $get_vars['act'] = 'dispCommunicationMessages';
|
||||
/* 기존의 action의 값이 바뀌어서 이를 강제 변경 */
|
||||
elseif($get_vars['act'] == 'dispDocumentAdminManageDocument') $get_vars['act'] = 'dispDocumentManageDocument';
|
||||
elseif($get_vars['act'] == 'dispModuleAdminSelectList') $get_vars['act'] = 'dispModuleSelectList';
|
||||
|
||||
if($get_vars['act'] && $this->isExistsSSLAction($get_vars['act'])) $path = $this->getRequestUri(ENFORCE_SSL, $domain);
|
||||
else $path = $this->getRequestUri(RELEASE_SSL, $domain);
|
||||
|
|
@ -727,39 +819,41 @@
|
|||
$target = implode('.',$var_keys);
|
||||
|
||||
switch($target) {
|
||||
case 'mid' :
|
||||
case 'mid' :
|
||||
return $path.$get_vars['mid'];
|
||||
case 'document_srl' :
|
||||
case 'document_srl' :
|
||||
return $path.$get_vars['document_srl'];
|
||||
case 'act.mid' :
|
||||
case 'act.mid' :
|
||||
return sprintf('%s%s/%s',$path,$get_vars['mid'],$get_vars['act']);
|
||||
case 'document_srl.mid' :
|
||||
case 'document_srl.mid' :
|
||||
return sprintf('%s%s/%s',$path,$get_vars['mid'],$get_vars['document_srl']);
|
||||
case 'act.document_srl' :
|
||||
case 'act.document_srl' :
|
||||
return sprintf('%s%s/%s',$path,$get_vars['document_srl'],$get_vars['act']);
|
||||
case 'mid.page' :
|
||||
case 'mid.page' :
|
||||
return sprintf('%s%s/page/%s',$path,$get_vars['mid'],$get_vars['page']);
|
||||
case 'category.mid' :
|
||||
case 'category.mid' :
|
||||
return sprintf('%s%s/category/%s',$path,$get_vars['mid'],$get_vars['category']);
|
||||
case 'act.document_srl.key' :
|
||||
case 'act.document_srl.key' :
|
||||
return sprintf('%s%s/%s/%s',$path,$get_vars['document_srl'],$get_vars['key'],$get_vars['act']);
|
||||
case 'document_srl.mid.page' :
|
||||
case 'document_srl.mid.page' :
|
||||
return sprintf('%s%s/%s/page/%s',$path,$get_vars['mid'],$get_vars['document_srl'],$get_vars['page']);
|
||||
case 'category.mid.page' :
|
||||
case 'category.mid.page' :
|
||||
return sprintf('%s%s/category/%s/page/%s',$path,$get_vars['mid'],$get_vars['category'],$get_vars['page']);
|
||||
case 'mid.search_keyword.search_target' :
|
||||
switch($get_vars['search_target']) {
|
||||
case 'tag' :
|
||||
case 'tag' :
|
||||
return sprintf('%s%s/tag/%s',$path,$get_vars['mid'],str_replace(' ','+',$get_vars['search_keyword']));
|
||||
case 'nick_name' :
|
||||
case 'nick_name' :
|
||||
return sprintf('%s%s/writer/%s',$path,$get_vars['mid'],str_replace(' ','+',$get_vars['search_keyword']));
|
||||
case 'regdate' :
|
||||
case 'regdate' :
|
||||
if(strlen($get_vars['search_keyword'])==8) return sprintf('%s%s/%04d/%02d/%02d',$path,$get_vars['mid'],substr($get_vars['search_keyword'],0,4),substr($get_vars['search_keyword'],4,2),substr($get_vars['search_keyword'],6,2));
|
||||
elseif(strlen($get_vars['search_keyword'])==6) return sprintf('%s%s/%04d/%02d',$path,$get_vars['mid'],substr($get_vars['search_keyword'],0,4),substr($get_vars['search_keyword'],4,2));
|
||||
elseif(strlen($get_vars['search_keyword'])==6) return sprintf('%s%s/%04d/%02d',$path,$get_vars['mid'],substr($get_vars['search_keyword'],0,4),substr($get_vars['search_keyword'],4,2));
|
||||
}
|
||||
break;
|
||||
case 'act.document_srl.mid' :
|
||||
return sprintf('%s%s/%s/%s',$path,$get_vars['mid'], $get_vars['act'],$get_vars['document_srl']);
|
||||
case 'entry.mid' :
|
||||
return sprintf('%s%s/entry/%s',$path,$get_vars['mid'],$get_vars['entry']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -805,7 +899,7 @@
|
|||
|
||||
if($domain) {
|
||||
$target_url = trim($domain);
|
||||
if(substr($target_url,-1) != '/') $target_url.= '/';
|
||||
if(substr($target_url,-1) != '/') $target_url.= '/';
|
||||
} else {
|
||||
$target_url= $_SERVER['HTTP_HOST'].getScriptPath();
|
||||
}
|
||||
|
|
@ -952,17 +1046,20 @@
|
|||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function addJsFile($file, $optimized = true, $targetie = '') {
|
||||
function addJsFile($file, $optimized = true, $targetie = '',$index=null) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addJsFile($file, $optimized, $targetie);
|
||||
return $oContext->_addJsFile($file, $optimized, $targetie,$index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function _addJsFile($file, $optimized, $targetie) {
|
||||
function _addJsFile($file, $optimized, $targetie,$index) {
|
||||
if(in_array($file, $this->js_files)) return;
|
||||
$this->js_files[] = array('file' => $file, 'optimized' => $optimized, 'targetie' => $targetie);
|
||||
|
||||
if(is_null($index)) $index=count($this->js_files);
|
||||
for($i=$index;array_key_exists($i,$this->js_files);$i++);
|
||||
$this->js_files[$i] = array('file' => $file, 'optimized' => $optimized, 'targetie' => $targetie);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -985,10 +1082,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief javascript filter 추가
|
||||
**/
|
||||
function addJsFilter($path, $filename) {
|
||||
$oXmlFilter = new XmlJSFilter($path, $filename);
|
||||
$oXmlFilter->compile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief array_unique와 동작은 동일하나 file 첨자에 대해서만 동작함
|
||||
**/
|
||||
function _getUniqueFileList($files) {
|
||||
ksort($files);
|
||||
$files = array_values($files);
|
||||
$filenames = array();
|
||||
$size = count($files);
|
||||
for($i = 0; $i < $size; ++ $i)
|
||||
|
|
@ -997,6 +1104,7 @@
|
|||
unset($files[$i]);
|
||||
$filenames[] = $files[$i]['file'];
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
|
|
@ -1020,19 +1128,22 @@
|
|||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function addCSSFile($file, $optimized = true, $media = 'all', $targetie = '') {
|
||||
function addCSSFile($file, $optimized = true, $media = 'all', $targetie = '',$index = null) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addCSSFile($file, $optimized, $media, $targetie);
|
||||
return $oContext->_addCSSFile($file, $optimized, $media, $targetie,$index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function _addCSSFile($file, $optimized, $media, $targetie) {
|
||||
function _addCSSFile($file, $optimized, $media, $targetie, $index) {
|
||||
if(in_array($file, $this->css_files)) return;
|
||||
|
||||
if(is_null($index)) $index=count($this->css_files);
|
||||
for($i=$index;array_key_exists($i,$this->css_files);$i++);
|
||||
|
||||
//if(preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
|
||||
$this->css_files[] = array('file' => $file, 'optimized' => $optimized, 'media' => $media, 'targetie' => $targetie);
|
||||
$this->css_files[$i] = array('file' => $file, 'optimized' => $optimized, 'media' => $media, 'targetie' => $targetie);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1081,6 +1192,10 @@
|
|||
}
|
||||
|
||||
function _loadJavascriptPlugin($plugin_name) {
|
||||
static $loaded_plugins = array();
|
||||
if($loaded_plugins[$plugin_name]) return;
|
||||
$loaded_plugins[$plugin_name] = true;
|
||||
|
||||
$plugin_path = './common/js/plugins/'.$plugin_name.'/';
|
||||
if(!is_dir($plugin_path)) return;
|
||||
|
||||
|
|
@ -1129,6 +1244,36 @@
|
|||
return $this->html_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BodyHeader 추가
|
||||
**/
|
||||
function addBodyHeader($header) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addBodyHeader($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BodyHeader 추가
|
||||
**/
|
||||
function _addBodyHeader($header) {
|
||||
$this->body_header .= "\n".$header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BodyHeader return
|
||||
**/
|
||||
function getBodyHeader() {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_getBodyHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BodyHeader return
|
||||
**/
|
||||
function _getBodyHeader() {
|
||||
return $this->body_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HtmlFooter 추가
|
||||
**/
|
||||
|
|
@ -1179,24 +1324,40 @@
|
|||
* 단순히 db config 파일의 존재 유무로 설치 여부를 체크한다
|
||||
**/
|
||||
function isInstalled() {
|
||||
return file_exists(Context::getConfigFile());
|
||||
return file_exists(Context::getConfigFile()) && filesize(Context::getConfigFile());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 내용의 위젯이나 기타 기능에 대한 code를 실제 code로 변경을 위한 flag set
|
||||
**/
|
||||
function setTransWidgetCodeIncludeInfo($flag=false){
|
||||
$oContext = &Context::getInstance();
|
||||
$oContext->widget_include_info_flag = $flag ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 내용의 위젯이나 기타 기능에 대한 code를 실제 code로 변경
|
||||
**/
|
||||
function transContent($content) {
|
||||
// 위젯 코드 변경
|
||||
|
||||
// 사용자 정의 언어로 변경
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->replaceDefinedLangCode($content);
|
||||
|
||||
// 위젯 코드 변경
|
||||
$oWidgetController = &getController('widget');
|
||||
$content = $oWidgetController->transWidgetCode($content, false);
|
||||
$content = $oWidgetController->transWidgetCode($content,$this->widget_include_info_flag);
|
||||
|
||||
// 메타 파일 변경
|
||||
$content = preg_replace_callback('!<\!\-\-Meta:([^\-]*?)\-\->!is', array($this,'transMeta'), $content);
|
||||
|
||||
|
||||
// 에디터 컴포넌트를 찾아서 결과 코드로 변환
|
||||
$content = preg_replace_callback('!<div([^\>]*)editor_component=([^\>]*)>(.*?)\<\/div\>!is', array($this,'transEditorComponent'), $content);
|
||||
$content = preg_replace_callback('!<img([^\>]*)editor_component=([^\>]*?)\>!is', array($this,'transEditorComponent'), $content);
|
||||
|
||||
// style의 url 경로를 재정의 한다.
|
||||
$content = preg_replace('/url\(http:\/\/([^ ]+)http:\/\//is','url(http://', $content);
|
||||
// body 내의 <style ..></style>를 header로 이동
|
||||
$content = preg_replace_callback('!<style(.*?)<\/style>!is', array($this,'moveStyleToHeader'), $content);
|
||||
|
||||
|
|
@ -1267,7 +1428,7 @@
|
|||
function isGzEnabled() {
|
||||
if(
|
||||
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
|
||||
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
|
||||
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
|
||||
function_exists('ob_gzhandler') &&
|
||||
extension_loaded('zlib')
|
||||
) return true;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
**/
|
||||
function &getInstance($db_type = NULL) {
|
||||
if(!$db_type) $db_type = Context::getDBType();
|
||||
if(!$db_type) return new Object(-1, 'msg_db_not_setted');
|
||||
if(!$db_type && Context::isInstalled()) return new Object(-1, 'msg_db_not_setted');
|
||||
|
||||
if(!$GLOBALS['__DB__']) {
|
||||
$class_name = sprintf("DB%s%s", strtoupper(substr($db_type,0,1)), strtolower(substr($db_type,1)));
|
||||
|
|
@ -269,14 +269,13 @@
|
|||
|
||||
if(!file_exists($cache_file)) return new Object(-1, 'msg_invalid_queryid');
|
||||
|
||||
if($source_args) $args = clone($source_args);
|
||||
if($source_args) $args = @clone($source_args);
|
||||
|
||||
$output = @include($cache_file);
|
||||
|
||||
if( (is_a($output, 'Object')||is_subclass_of($output,'Object'))&&!$output->toBool()) return $output;
|
||||
$output->_tables = ($output->_tables && is_array($output->_tables)) ? $output->_tables : array();
|
||||
|
||||
|
||||
// action값에 따라서 쿼리 생성으로 돌입
|
||||
switch($output->action) {
|
||||
case 'insert' :
|
||||
|
|
@ -300,6 +299,7 @@
|
|||
else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) $output = new Object();
|
||||
$output->add('_query', $this->query);
|
||||
$output->add('_elapsed_time', sprintf("%0.5f",$this->elapsed_time));
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -434,7 +434,7 @@
|
|||
return $name.' in ('.$value.')';
|
||||
break;
|
||||
case 'notin' :
|
||||
return $name.' notin ('.$value.')';
|
||||
return $name.' not in ('.$value.')';
|
||||
break;
|
||||
case 'notequal' :
|
||||
return $name.' <> '.$value;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
* @class DBCubrid
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief Cubrid DBMS를 이용하기 위한 class
|
||||
* @version 0.1
|
||||
* @version 0.1p1
|
||||
*
|
||||
* cubrid 7.0 에서 테스트 하였음.
|
||||
* CUBRID2008 R1.3 에 대응하도록 수정 Prototype (prototype@cubrid.com) / 09.02.23
|
||||
* 7.3 ~ 2008 R1.3 까지 테스트 완료함.
|
||||
* 기본 쿼리만 사용하였기에 특화된 튜닝이 필요
|
||||
**/
|
||||
|
||||
|
|
@ -222,6 +223,14 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter class %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 column의 정보를 return
|
||||
**/
|
||||
|
|
@ -411,8 +420,14 @@
|
|||
$pipe = $v['pipe'];
|
||||
|
||||
$value = $this->getConditionValue($name, $value, $operation, $type, $column_type);
|
||||
if(!$value) $value = $v['value'];
|
||||
$str = $this->getConditionPart($name, $value, $operation);
|
||||
if(!$value) {
|
||||
$value = $v['value'];
|
||||
if(strpos($value, ".") == false) $valuetmp = $value;
|
||||
else $valuetmp = '"'.str_replace('.', '"."', $value).'"';
|
||||
} else $valuetmp = $value;
|
||||
if(strpos($name, ".") == false) $nametmp = '"'.$name.'"';
|
||||
else $nametmp = '"'.str_replace('.', '"."', $name).'"';
|
||||
$str = $this->getConditionPart($nametmp, $valuetmp, $operation);
|
||||
if($sub_condition) $sub_condition .= ' '.$pipe.' ';
|
||||
$sub_condition .= $str;
|
||||
}
|
||||
|
|
@ -544,7 +559,7 @@
|
|||
// 테이블 정리
|
||||
$table_list = array();
|
||||
foreach($output->tables as $key => $val) {
|
||||
$table_list[] = '"'.$this->prefix.$val.'" as '.$key;
|
||||
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
|
||||
}
|
||||
|
||||
$left_join = array();
|
||||
|
|
@ -554,7 +569,7 @@
|
|||
foreach($left_tables as $key => $val) {
|
||||
$condition = $this->_getCondition($output->left_conditions[$key],$output->column_type);
|
||||
if($condition){
|
||||
$left_join[] = $val . ' "'.$this->prefix.$output->tables[$key].'" as '.$key . ' on (' . $condition . ')';
|
||||
$left_join[] = $val . ' "'.$this->prefix.$output->_tables[$key].'" as "'.$key . '" on (' . $condition . ')';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -698,7 +713,7 @@
|
|||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||
|
||||
// 전체 개수를 구함
|
||||
$count_query = sprintf("select count(*) as count from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
|
||||
$count_query = sprintf("select count(*) as \"count\" from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
|
||||
$total_count = $this->getCountCache($output->tables, $condition);
|
||||
if($total_count === false) {
|
||||
$result = $this->_query($count_query);
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@
|
|||
return $string;
|
||||
}
|
||||
|
||||
function autoValueQuotes($string, $output){
|
||||
function autoValueQuotes($string, $tables){
|
||||
$tok = strtok($string, ",");
|
||||
while($tok !== false) {
|
||||
$values[] = $tok;
|
||||
|
|
@ -225,8 +225,9 @@
|
|||
$tmpString2 = trim($tmpString2);
|
||||
|
||||
$isTable = false;
|
||||
foreach($output->tables as $key => $val) {
|
||||
foreach($tables as $key => $val) {
|
||||
if($key == $tmpString1) $isTable = true;
|
||||
if($val == $tmpString1) $isTable = true;
|
||||
}
|
||||
|
||||
if($isTable) {
|
||||
|
|
@ -321,10 +322,18 @@
|
|||
|
||||
while($tmp = ibase_fetch_object($result)) {
|
||||
foreach($tmp as $key => $val) {
|
||||
$type = $output->column_type[$key];
|
||||
$type = $output->column_type[$key];
|
||||
|
||||
if($type == null) {
|
||||
foreach($output->columns as $cols) {
|
||||
if($cols['alias'] == $key) {
|
||||
$type = $output->column_type[$cols['name']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($type == "text" || $type == "bigtext") {
|
||||
$blob_data = ibase_blob_info($tmp->{$key});
|
||||
$blob_data = ibase_blob_info($tmp->{$key});
|
||||
$blob_hndl = ibase_blob_open($tmp->{$key});
|
||||
$tmp->{$key} = ibase_blob_get($blob_hndl, $blob_data[0]);
|
||||
ibase_blob_close($blob_hndl);
|
||||
|
|
@ -382,6 +391,14 @@
|
|||
@ibase_commit($this->fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 column의 정보를 return
|
||||
|
|
@ -598,17 +615,17 @@
|
|||
**/
|
||||
function getCondition($output) {
|
||||
if(!$output->conditions) return;
|
||||
$condition = $this->_getCondition($output->conditions,$output->column_type);
|
||||
$condition = $this->_getCondition($output->conditions,$output->column_type,$output->tables);
|
||||
if($condition) $condition = ' where '.$condition;
|
||||
return $condition;
|
||||
}
|
||||
|
||||
function getLeftCondition($conditions,$column_type){
|
||||
return $this->_getCondition($conditions,$column_type);
|
||||
function getLeftCondition($conditions,$column_type,$tables){
|
||||
return $this->_getCondition($conditions,$column_type,$tables);
|
||||
}
|
||||
|
||||
|
||||
function _getCondition($conditions,$column_type) {
|
||||
function _getCondition($conditions,$column_type,$tables) {
|
||||
$condition = '';
|
||||
foreach($conditions as $val) {
|
||||
$sub_condition = '';
|
||||
|
|
@ -627,7 +644,7 @@
|
|||
if(!$value) $value = $v['value'];
|
||||
|
||||
$name = $this->autoQuotes($name);
|
||||
$value = $this->autoValueQuotes($value, $output);
|
||||
$value = $this->autoValueQuotes($value, $tables);
|
||||
|
||||
$str = $this->getConditionPart($name, $value, $operation);
|
||||
if($sub_condition) $sub_condition .= ' '.$pipe.' ';
|
||||
|
|
@ -638,6 +655,7 @@
|
|||
$condition .= '('.$sub_condition.')';
|
||||
}
|
||||
}
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
|
|
@ -710,12 +728,17 @@
|
|||
}
|
||||
|
||||
if(strlen($value) != 0) {
|
||||
if(($pos = strpos($value, '+1')) !== false) {
|
||||
$substr = substr($value, 0, $pos);
|
||||
$value = '"'.$substr.'"'."+1";
|
||||
$column_list[] = sprintf("\"%s\" = %s", $name, $value);
|
||||
continue;
|
||||
}
|
||||
$pos = strpos($value, '+');
|
||||
if($pos == 0) $pos = strpos($value, '-');
|
||||
if($pos == 0) $pos = strpos($value, '*');
|
||||
if($pos == 0) $pos = strpos($value, '/');
|
||||
|
||||
if($pos != 0) {
|
||||
$substr = substr($value, 0, $pos);
|
||||
$value = '"'.$substr.'"'.substr($value, $pos, strlen($value));
|
||||
$column_list[] = sprintf("\"%s\" = %s", $name, $value);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$values[] = $value;
|
||||
|
|
@ -769,7 +792,7 @@
|
|||
$left_tables= (array)$output->left_tables;
|
||||
|
||||
foreach($left_tables as $key => $val) {
|
||||
$condition = $this->_getCondition($output->left_conditions[$key],$output->column_type);
|
||||
$condition = $this->getLeftCondition($output->left_conditions[$key],$output->column_type,$output->tables);
|
||||
if($condition){
|
||||
$left_join[] = $val . ' "'.$this->prefix.$output->_tables[$key].'" as '.$key . ' on (' . $condition . ')';
|
||||
}
|
||||
|
|
@ -850,7 +873,7 @@
|
|||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||
|
||||
// 전체 개수를 구함
|
||||
$count_query = sprintf("select count(*) as count from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
|
||||
$count_query = sprintf("select count(*) as \"count\" from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
|
||||
$total_count = $this->getCountCache($output->tables, $condition);
|
||||
if($total_count === false) {
|
||||
$result = $this->_query($count_query);
|
||||
|
|
@ -925,6 +948,14 @@
|
|||
foreach($tmp as $key => $val){
|
||||
$type = $output->column_type[$key];
|
||||
|
||||
if($type == null) {
|
||||
foreach($output->columns as $cols) {
|
||||
if($cols['alias'] == $key) {
|
||||
$type = $output->column_type[$cols['name']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($type == "text" || $type == "bigtext") {
|
||||
$blob_data = ibase_blob_info($tmp->{$key});
|
||||
$blob_hndl = ibase_blob_open($tmp->{$key});
|
||||
|
|
|
|||
|
|
@ -229,6 +229,13 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 column의 정보를 return
|
||||
|
|
|
|||
|
|
@ -239,6 +239,13 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 column의 정보를 return
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -209,6 +209,13 @@
|
|||
return $this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop column %s ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 column의 정보를 return
|
||||
|
|
|
|||
|
|
@ -232,6 +232,14 @@
|
|||
return $this->_execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop column %s ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 column의 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -34,12 +34,17 @@
|
|||
// 요청방식에 따라 출력을 별도로
|
||||
if(Context::getResponseMethod()=="HTML") {
|
||||
|
||||
// 관리자 모드일 경우 #xeAdmin id를 가지는 div 추가
|
||||
if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')>0) $content = '<div id="xeAdmin">'.$content.'</div>';
|
||||
|
||||
// 내용을 content라는 변수로 설정 (layout에서 {$content}에서 대체됨)
|
||||
Context::set('content', $content);
|
||||
|
||||
// 레이아웃을 컴파일
|
||||
if(__DEBUG__==3) $start = getMicroTime();
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
|
||||
// layout이라는 변수가 none으로 설정되면 기본 레이아웃으로 변경
|
||||
if(Context::get('layout') != 'none') {
|
||||
$layout_path = $oModule->getLayoutPath();
|
||||
$layout_file = $oModule->getLayoutFile();
|
||||
|
|
@ -47,8 +52,30 @@
|
|||
}
|
||||
if(!$layout_path) $layout_path = './common/tpl/';
|
||||
if(!$layout_file) $layout_file = 'default_layout.html';
|
||||
$zbxe_final_content = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||
|
||||
// 현재 요청된 레이아웃 정보를 구함
|
||||
$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);
|
||||
}
|
||||
|
||||
// 관리자 레이아웃 수정화면에서 변경된 CSS가 있는지 조사
|
||||
$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
|
||||
|
||||
|
||||
if(file_exists($edited_layout_css)) Context::addCSSFile($edited_layout_css,true,'all','',100);
|
||||
}
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
$zbxe_final_content = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||
if(__DEBUG__==3) $GLOBALS['__layout_compile_elapsed__'] = getMicroTime()-$start;
|
||||
|
||||
|
||||
|
|
@ -62,17 +89,23 @@
|
|||
|
||||
// 최종 결과를 common_layout에 넣어버림
|
||||
Context::set('zbxe_final_content', $zbxe_final_content);
|
||||
|
||||
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
||||
|
||||
// 사용자 정의 언어 변경
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->replaceDefinedLangCode($output);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$output = $content;
|
||||
|
||||
}
|
||||
|
||||
// 애드온 실행
|
||||
$called_position = 'before_display_content';
|
||||
@include("./files/cache/activated_addons.cache.php");
|
||||
$oAddonController = &getController('addon');
|
||||
$addon_file = $oAddonController->getCacheFilePath();
|
||||
if(file_exists($addon_file)) @include($addon_file);
|
||||
|
||||
$this->content_size = strlen($output);
|
||||
|
||||
|
|
@ -234,8 +267,6 @@
|
|||
|
||||
// 파일 및 HTML 주석으로 출력
|
||||
} else {
|
||||
// debug string 작성 시작
|
||||
$buff = "** Debug at ".date('Y-m-d H:i:s').str_repeat('*', 60)."\n";
|
||||
|
||||
// 전체 실행 시간 출력, Request/Response info 출력
|
||||
if(__DEBUG__ & 2) {
|
||||
|
|
@ -283,22 +314,25 @@
|
|||
|
||||
// HTML 주석으로 출력
|
||||
if(__DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') {
|
||||
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
|
||||
|
||||
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
||||
$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
|
||||
}
|
||||
|
||||
return "<!--\r\n".$buff."\r\n-->";
|
||||
}
|
||||
|
||||
// 파일에 출력
|
||||
if(__DEBUG_OUTPUT__ == 0) {
|
||||
$debug_file = _XE_PATH_.'files/_debug_message.php';
|
||||
$debug_output = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($debug_output, true));
|
||||
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
|
||||
|
||||
if($display_option === true) $debug_output = str_repeat('=', 40)."\n".$debug_output.str_repeat('-', 40);
|
||||
$debug_output = "\n<?php\n/*".$debug_output."*/\n?>\n";
|
||||
$buff = str_repeat('=', 40)."\n".$buff.str_repeat('-', 40);
|
||||
$buff = "\n<?php\n/*".$buff."*/\n?>\n";
|
||||
|
||||
if(@!$fp = fopen($debug_file, 'a')) return;
|
||||
fwrite($fp, $debug_output);
|
||||
fwrite($fp, $buff);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
314
classes/extravar/Extravar.class.php
Normal file
314
classes/extravar/Extravar.class.php
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
<?php
|
||||
/**
|
||||
* @class ExtraVar
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 게시글, 회원등에서 사용하는 확장변수를 핸들링하는 클래스
|
||||
*
|
||||
* php4대비 class static 변수가 안됨으로 $GLOBALS['XE_EXTRAVARS']를 이용해서 같은 효과 냄
|
||||
**/
|
||||
class ExtraVar {
|
||||
|
||||
var $module_srl = null;
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function &getInstance($module_srl) {
|
||||
static $oInstance = array();
|
||||
if(!$oInstance[$module_srl]) $oInstance[$module_srl] = new ExtraVar($module_srl);
|
||||
return $oInstance[$module_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function ExtraVar($module_srl) {
|
||||
$this->module_srl = $module_srl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 불필요한 등록을 피하기 위해서 특정 module_srl에 확장변수가 등록되었는지 확인
|
||||
**/
|
||||
function isSettedExtraVars() {
|
||||
return isset($GLOBALS['XE_EXTRAVARS'][$this->module_srl]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 확장변수 키를 등록
|
||||
* php4를 대비해 class static 멤버변수 대신 $GLOBAL 변수 사용
|
||||
* @param module_srl, idx, name, type, default, desc, is_required, search, value
|
||||
**/
|
||||
function setExtraVarKeys($extra_keys) {
|
||||
if(!$this->isSettedExtraVars()) {
|
||||
if(!$extra_keys || !count($extra_keys)) $GLOBALS['XE_EXTRAVARS'][$this->module_srl] = array();
|
||||
else {
|
||||
if(!is_array($GLOBALS['XE_EXTRAVARS'][$this->module_srl])) $GLOBALS['XE_EXTRAVARS'][$this->module_srl] = array();
|
||||
foreach($extra_keys as $key => $val) {
|
||||
$obj = null;
|
||||
$obj = new ExtraItem($val->module_srl, $val->idx, $val->name, $val->type, $val->default, $val->desc, $val->is_required, $val->search, $val->value);
|
||||
$GLOBALS['XE_EXTRAVARS'][$this->module_srl][$val->idx] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 확장변수 객체 배열 return
|
||||
**/
|
||||
function getExtraVars() {
|
||||
if(!$this->isSettedExtraVars()) return array();
|
||||
return $GLOBALS['XE_EXTRAVARS'][$this->module_srl];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @class ExtraItem
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 확장변수의 개별 값
|
||||
**/
|
||||
class ExtraItem {
|
||||
var $module_srl = 0;
|
||||
var $idx = 0;
|
||||
var $name = 0;
|
||||
var $type = 'text';
|
||||
var $default = null;
|
||||
var $desc = '';
|
||||
var $is_required = 'N';
|
||||
var $search = 'N';
|
||||
var $value = null;
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function ExtraItem($module_srl, $idx, $name, $type = 'text', $default = null, $desc = '', $is_required = 'N', $search = 'N', $value = null) {
|
||||
if(!$idx) return;
|
||||
$this->module_srl = $module_srl;
|
||||
$this->idx = $idx;
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
$this->default = $default;
|
||||
$this->desc = $desc;
|
||||
$this->is_required = $is_required;
|
||||
$this->search = $search;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 값 지정
|
||||
**/
|
||||
function setValue($value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief type에 따라서 주어진 값을 변형하여 원형 값을 return
|
||||
**/
|
||||
function _getTypeValue($type, $value) {
|
||||
$value = trim($value);
|
||||
if(!isset($value)) return;
|
||||
switch($type) {
|
||||
case 'homepage' :
|
||||
if(!preg_match('/^([a-z]+):\/\//i',$value)) $value = 'http://'.$value;
|
||||
return htmlspecialchars($value);
|
||||
break;
|
||||
case 'tel' :
|
||||
if(is_array($value)) $values = $value;
|
||||
elseif(strpos($value,'|@|')!==false) $values = explode('|@|', $value);
|
||||
elseif(strpos($value,',')!==false) $values = explode(',', $value);
|
||||
$values[0] = $values[0];
|
||||
$values[1] = $values[1];
|
||||
$values[2] = $values[2];
|
||||
return $values;
|
||||
break;
|
||||
break;
|
||||
case 'checkbox' :
|
||||
case 'radio' :
|
||||
case 'select' :
|
||||
if(is_array($value)) $values = $value;
|
||||
elseif(strpos($value,'|@|')!==false) $values = explode('|@|', $value);
|
||||
elseif(strpos($value,',')!==false) $values = explode(',', $value);
|
||||
else $values = array($value);
|
||||
for($i=0;$i<count($values);$i++) $values[$i] = htmlspecialchars($values[$i]);
|
||||
return $values;
|
||||
break;
|
||||
case 'kr_zip' :
|
||||
if(is_array($value)) $values = $value;
|
||||
elseif(strpos($value,'|@|')!==false) $values = explode('|@|', $value);
|
||||
elseif(strpos($value,',')!==false) $values = explode(',', $value);
|
||||
return $values;
|
||||
break;
|
||||
//case 'date' :
|
||||
//case 'email_address' :
|
||||
//case 'text' :
|
||||
//case 'textarea' :
|
||||
default :
|
||||
return htmlspecialchars($value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 값을 return
|
||||
* 원형 값을 HTML 결과물로 return
|
||||
**/
|
||||
function getValueHTML() {
|
||||
$value = $this->_getTypeValue($this->type, $this->value);
|
||||
switch($this->type) {
|
||||
case 'homepage' :
|
||||
return sprintf('<a href="%s" onclick="window.open(this.href); return false;">%s</a>', $value, $value);
|
||||
case 'email_address' :
|
||||
return sprintf('<a href="mailto:%s">%s</a>', $value, $value);
|
||||
break;
|
||||
case 'tel' :
|
||||
return sprintf('%s - %s - %s', $value[0],$value[1],$value[2]);
|
||||
break;
|
||||
case 'textarea' :
|
||||
return nl2br($value);
|
||||
break;
|
||||
case 'checkbox' :
|
||||
if(is_array($value)) return implode(', ',$value);
|
||||
else return $value;
|
||||
break;
|
||||
case 'date' :
|
||||
return zdate($value,"Y-m-d");
|
||||
break;
|
||||
case 'select' :
|
||||
case 'radio' :
|
||||
if(is_array($value)) return implode(', ',$value);
|
||||
else return $value;
|
||||
break;
|
||||
case 'kr_zip' :
|
||||
if(is_array($value)) return implode(' ',$value);
|
||||
else return $value;
|
||||
break;
|
||||
// case 'text' :
|
||||
default :
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief type에 따른 form을 리턴
|
||||
**/
|
||||
function getFormHTML() {
|
||||
$type = $this->type;
|
||||
$name = $this->name;
|
||||
$value = $this->_getTypeValue($this->type, $this->value);
|
||||
$default = $this->_getTypeValue($this->type, $this->default);
|
||||
$column_name = 'extra_vars'.$this->idx;
|
||||
|
||||
$buff = '';
|
||||
switch($type) {
|
||||
// 홈페이지 주소
|
||||
case 'homepage' :
|
||||
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="homepage" />';
|
||||
break;
|
||||
|
||||
// Email 주소
|
||||
case 'email_address' :
|
||||
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="email_address" />';
|
||||
break;
|
||||
|
||||
// 전화번호
|
||||
case 'tel' :
|
||||
$buff .=
|
||||
'<input type="text" name="'.$column_name.'" value="'.$value[0].'" size="4" class="tel" />'.
|
||||
'<input type="text" name="'.$column_name.'" value="'.$value[1].'" size="4" class="tel" />'.
|
||||
'<input type="text" name="'.$column_name.'" value="'.$value[2].'" size="4" class="tel" />';
|
||||
break;
|
||||
|
||||
// textarea
|
||||
case 'textarea' :
|
||||
$buff .= '<textarea name="'.$column_name.'" class="textarea">'.$value.'</textarea>';
|
||||
break;
|
||||
|
||||
// 다중 선택
|
||||
case 'checkbox' :
|
||||
$buff .= '<ul>';
|
||||
foreach($default as $v) {
|
||||
if($value && in_array($v, $value)) $checked = ' checked="checked"';
|
||||
else $checked = '';
|
||||
$buff .='<li><input type="checkbox" name="'.$column_name.'" value="'.htmlspecialchars($v).'" '.$checked.' />'.$v.'</li>';
|
||||
}
|
||||
$buff .= '</ul>';
|
||||
break;
|
||||
|
||||
// 단일 선택
|
||||
case 'select' :
|
||||
$buff .= '<select name="'.$column_name.'" class="select">';
|
||||
foreach($default as $v) {
|
||||
if($value && in_array($v,$value)) $selected = ' selected="selected"';
|
||||
else $selected = '';
|
||||
$buff .= '<option value="'.$v.'" '.$selected.'>'.$v.'</option>';
|
||||
}
|
||||
$buff .= '</select>';
|
||||
break;
|
||||
|
||||
// radio
|
||||
case 'radio' :
|
||||
$buff .= '<ul>';
|
||||
foreach($default as $v) {
|
||||
if($value && in_array($v,$value)) $checked = ' checked="checked"';
|
||||
else $checked = '';
|
||||
$buff .= '<li><input type="radio" name="'.$column_name.'" '.$checked.' value="'.$v.'" class="radio" />'.$v.'</li>';
|
||||
}
|
||||
$buff .= '</ul>';
|
||||
break;
|
||||
|
||||
// 날짜 입력
|
||||
case 'date' :
|
||||
// datepicker javascript plugin load
|
||||
Context::loadJavascriptPlugin('ui.datepicker');
|
||||
|
||||
$buff .=
|
||||
'<input type="hidden" name="'.$column_name.'" value="'.$value.'" />'.
|
||||
'<input type="text" id="date_'.$column_name.'" value="'.zdate($value,'Y-m-d').'" readonly="readonly" class="date" />'."\n".
|
||||
'<script type="text/javascript">'."\n".
|
||||
'(function($){'."\n".
|
||||
' $(function(){'."\n".
|
||||
' var option = { gotoCurrent: false,yearRange:\'-100:+10\', onSelect:function(){'."\n".
|
||||
' $(this).prev(\'input[type="hidden"]\').val(this.value.replace(/-/g,""))}'."\n".
|
||||
' };'."\n".
|
||||
' $.extend(option,$.datepicker.regional[\''.Context::getLangType().'\']);'."\n".
|
||||
' $("#date_'.$column_name.'").datepicker(option);'."\n".
|
||||
' });'."\n".
|
||||
'})(jQuery);'."\n".
|
||||
'</script>';
|
||||
break;
|
||||
|
||||
// 주소 입력
|
||||
case "kr_zip" :
|
||||
// krzip address javascript plugin load
|
||||
Context::loadJavascriptPlugin('ui.krzip');
|
||||
|
||||
$buff .=
|
||||
'<div id="addr_searched_'.$column_name.'" style="display:'.($value[0]?'block':'none').';">'.
|
||||
'<input type="text" readonly="readonly" name="'.$column_name.'" value="'.$value[0].'" class="address" />'.
|
||||
'<a href="#" onclick="doShowKrZipSearch(this, \''.$column_name.'\'); return false;" class="button red"><span>'.Context::getLang('cmd_cancel').'</span></a>'.
|
||||
'</div>'.
|
||||
|
||||
'<div id="addr_list_'.$column_name.'" style="display:none;">'.
|
||||
'<select name="addr_list_'.$column_name.'"></select>'.
|
||||
'<a href="#" onclick="doSelectKrZip(this, \''.$column_name.'\'); return false;" class="button blue"><span>'.Context::getLang('cmd_select').'</span></a>'.
|
||||
'<a href="#" onclick="doHideKrZipList(this, \''.$column_name.'\'); return false;" class="button red"><span>'.Context::getLang('cmd_cancel').'</span></a>'.
|
||||
'</div>'.
|
||||
|
||||
'<div id="addr_search_'.$column_name.'" style="display:'.($value[0]?'none':'block').'">'.
|
||||
'<input type="text" name="addr_search_'.$column_name.'" class="address" value="" />'.
|
||||
'<a href="#" onclick="doSearchKrZip(this, \''.$column_name.'\'); return false;" class="button green"><span>'.Context::getLang('cmd_search').'</span></a>'.
|
||||
'</div>'.
|
||||
|
||||
'<input type="text" name="'.$column_name.'" value="'.htmlspecialchars($value[1]).'" class="address" />'.
|
||||
'';
|
||||
break;
|
||||
|
||||
// 일반 text
|
||||
default :
|
||||
$buff .=' <input type="text" name="'.$column_name.'" value="'.$value.'" class="text" />';
|
||||
break;
|
||||
}
|
||||
if($this->desc) $buff .= '<p>'.$this->desc.'</p>';
|
||||
return $buff;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -18,8 +18,6 @@
|
|||
return $source;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief 특정 디렉토리를 복사
|
||||
**/
|
||||
|
|
@ -50,6 +48,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
function copyFile($source, $target, $force='Y'){
|
||||
$source = FileHandler::getRealPath($source);
|
||||
$target_dir = FileHandler::getRealPath(dirname($target));
|
||||
$target = basename($target);
|
||||
if(!file_exists($target_dir)) FileHandler::makeDir($target_dir);
|
||||
if($force=='Y') @unlink($target_dir.'/'.$target);
|
||||
@copy($source, $target_dir.'/'.$target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 파일의 내용을 읽어서 return
|
||||
|
|
@ -255,8 +261,8 @@
|
|||
**/
|
||||
function filesize($size) {
|
||||
if(!$size) return "0Byte";
|
||||
if($size<1024) return ($size."Byte");
|
||||
if($size >1024 && $size< 1024 *1024) return sprintf("%0.1fKB",$size / 1024);
|
||||
if($size < 1024) return ($size."Byte");
|
||||
if($size >= 1024 && $size < 1024*1024) return sprintf("%0.1fKB",$size / 1024);
|
||||
return sprintf("%0.2fMB",$size / (1024*1024));
|
||||
}
|
||||
|
||||
|
|
@ -441,5 +447,44 @@
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief ini 파일을 읽는다
|
||||
**/
|
||||
function readIniFile($filename){
|
||||
$filename = FileHandler::getRealPath($filename);
|
||||
if(!file_exists($filename)) return false;
|
||||
$arr = parse_ini_file($filename, true);
|
||||
if(is_array($arr) && count($arr)>0) return $arr;
|
||||
else return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief array를 ini 파일로 저장한다.
|
||||
**/
|
||||
function writeIniFile($filename,$arr){
|
||||
if(count($arr)==0) return false;
|
||||
FileHandler::writeFile($filename,FileHandler::_makeIniBuff($arr));
|
||||
return true;
|
||||
}
|
||||
|
||||
function _makeIniBuff($arr){
|
||||
$return = '';
|
||||
foreach($arr as $key => $val){
|
||||
// section
|
||||
if(is_array($val)){
|
||||
$return .= sprintf("[%s]\n",$key);
|
||||
foreach($val as $k => $v){
|
||||
$return .= sprintf("%s=\"%s\"\n",$k,$v);
|
||||
}
|
||||
// value
|
||||
}else if(is_string($val) || is_int($val)){
|
||||
$return .= sprintf("%s=\"%s\"\n",$key,$val);
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@
|
|||
if(!$module_srl) $this->module_srl = (int)Context::get('module_srl');
|
||||
else $this->module_srl = (int)$module_srl;
|
||||
|
||||
$this->entry = Context::get('entry');
|
||||
|
||||
// 기본 변수들의 검사 (XSS방지를 위한 기초적 검사)
|
||||
if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->module)) die(Context::getLang("msg_invalid_request"));
|
||||
if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->mid)) die(Context::getLang("msg_invalid_request"));
|
||||
|
|
@ -63,7 +65,9 @@
|
|||
|
||||
// 애드온 실행 (모듈 실행 전)
|
||||
$called_position = 'before_module_init';
|
||||
@include(_XE_PATH_."files/cache/activated_addons.cache.php");
|
||||
$oAddonController = &getController('addon');
|
||||
$addon_file = $oAddonController->getCacheFilePath();
|
||||
if(file_exists($addon_file)) @include($addon_file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,42 +78,63 @@
|
|||
$oModuleModel = &getModel('module');
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = $site_module_info->site_srl;
|
||||
|
||||
// document_srl만 있을 경우 document_srl로 모듈과 모듈 정보를 구함
|
||||
if($this->document_srl && !$this->mid && !$this->module_srl) {
|
||||
if(!$this->document_srl && $this->mid && $this->entry) {
|
||||
$oDocumentModel = &getModel('document');
|
||||
$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
|
||||
if($this->document_srl) Context::set('document_srl', $this->document_srl);
|
||||
}
|
||||
|
||||
// 문서번호(document_srl)가 있을 경우 모듈 정보를 구해옴
|
||||
if($this->document_srl) {
|
||||
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
|
||||
|
||||
// 문서가 존재하지 않으면 문서 정보를 제거
|
||||
if(!$module_info) {
|
||||
unset($this->document_srl);
|
||||
// 문서가 존재할 경우 모듈 정보를 바탕으로 virtual site 및 mid 비교
|
||||
} else {
|
||||
// mid 값이 다르면 문서의 mid로 설정
|
||||
if($this->mid != $module_info->mid) {
|
||||
$this->mid = $module_info->mid;
|
||||
Context::set('mid', $module_info->mid, true);
|
||||
}
|
||||
}
|
||||
// 요청된 모듈과 문서 번호가 다르면 문서 번호에 의한 모듈 정보를 제거
|
||||
if($this->module && $module_info->module != $this->module) unset($module_info);
|
||||
}
|
||||
|
||||
// 아직 모듈을 못 찾았고 $mid값이 있으면 $mid로 모듈을 구함
|
||||
// 모듈정보를 구하지 못했고 mid 요청이 있으면 mid에 해당하는 모듈 정보를 구함
|
||||
if(!$module_info && $this->mid) {
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_srl);
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
|
||||
if($this->module && $module_info->module != $this->module) unset($module_info);
|
||||
}
|
||||
|
||||
// 모듈정보와 사이트 모듈정보가 다르면(다른 사이트이면) 페이지 리다이렉트
|
||||
if($module_info && $site_module_info && $module_info->site_srl != $site_module_info->site_srl) {
|
||||
$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
|
||||
$redirect_url = getSiteUrl($site_info->domain, 'mid',Context::get('mid'),'document_srl',Context::get('document_srl'),'module_srl',Context::get('module_srl'));
|
||||
header("location:".$redirect_url);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 모듈을 여전히(;;) 못 찾고 $module_srl이 있으면 해당 모듈을 구함
|
||||
if(!$module_info && $this->module_srl) {
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl);
|
||||
if($this->module && $module_info->module != $this->module) unset($module_info);
|
||||
}
|
||||
// 모듈을 여전히(;;) 못 찾고 모듈번호(module_srl)가 있으면 해당 모듈을 구함
|
||||
// module_srl로 대상 모듈을 찾는 것을 주석 처리함.
|
||||
//if(!$module_info && $this->module_srl) {
|
||||
//$module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl);
|
||||
//if($this->module && $module_info->module != $this->module) unset($module_info);
|
||||
//}
|
||||
|
||||
// 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
|
||||
if(!$module_info && !$this->module) $module_info = $site_module_info;
|
||||
|
||||
if($module_info && $site_module_info && $site_module_info->site_srl != $module_info->site_srl) {
|
||||
unset($site_module_info);
|
||||
$site_module_info = $oModuleModel->getSiteInfo($module_info->site_srl);
|
||||
// 모듈정보와 사이트 모듈정보가 다르면(다른 사이트이면) 페이지 리다이렉트
|
||||
if($module_info && $module_info->site_srl != $site_module_info->site_srl) {
|
||||
// 현재 요청된 모듈이 가상 사이트 모듈일 경우
|
||||
if($module_info->site_srl) {
|
||||
$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
|
||||
$redirect_url = getSiteUrl($site_info->domain, 'mid',Context::get('mid'),'document_srl',Context::get('document_srl'),'module_srl',Context::get('module_srl'),'entry',Context::get('entry'));
|
||||
// 가상 사이트 모듈이 아닌데 가상 사이트에서 호출되었을 경우
|
||||
} else {
|
||||
$db_info = Context::getDBInfo();
|
||||
if(!$db_info->default_url) return die("기본 URL이 정해지지 않아서 동작을 중지합니다");
|
||||
else $redirect_url = getSiteUrl($db_info->default_url, 'mid',Context::get('mid'),'document_srl',Context::get('document_srl'),'module_srl',Context::get('module_srl'),'entry',Context::get('entry'));
|
||||
}
|
||||
header("location:".$redirect_url);
|
||||
return false;
|
||||
}
|
||||
Context::set('site_module_info', $site_module_info);
|
||||
|
||||
// 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함, 모듈 정보에서 module 이름을 구해움
|
||||
if($module_info) {
|
||||
|
|
@ -117,6 +142,8 @@
|
|||
$this->mid = $module_info->mid;
|
||||
$this->module_info = $module_info;
|
||||
Context::setBrowserTitle($module_info->browser_title);
|
||||
$part_config= $oModuleModel->getModulePartConfig('layout',$module_info->layout_srl);
|
||||
Context::addHtmlHeader($part_config->header_script);
|
||||
}
|
||||
|
||||
// 모듈정보에 module과 mid를 강제로 지정
|
||||
|
|
@ -146,8 +173,14 @@
|
|||
* @brief 모듈과 관련된 정보를 이용하여 객체를 구하고 act 실행까지 진행시킴
|
||||
**/
|
||||
function procModule() {
|
||||
// 에러가 있으면 return
|
||||
if($this->error) return;
|
||||
// 에러가 있으면 메세지 객체를 만들어서 return
|
||||
if($this->error) {
|
||||
$oMessageView = &getView('message');
|
||||
$oMessageView->setError(-1);
|
||||
$oMessageView->setMessage($this->error);
|
||||
$oMessageView->dispMessage();
|
||||
return $oMessageView;
|
||||
}
|
||||
|
||||
// ModuleModel 객체 생성
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -169,9 +202,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// type, grant 값 구함
|
||||
// type, kind 값 구함
|
||||
$type = $xml_info->action->{$this->act}->type;
|
||||
$grant = $xml_info->action->{$this->act}->grant;
|
||||
$kind = strpos(strtolower($this->act),'admin')!==false?'admin':'';
|
||||
if(!$kind && $this->module == 'admin') $kind = 'admin';
|
||||
|
||||
|
|
@ -209,8 +241,8 @@
|
|||
$this->error = 'msg_dbconnect_failed';
|
||||
}
|
||||
|
||||
// XMLRPC call 이 아니면 message view 객체 이용하도록
|
||||
if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() != 'JSON') {
|
||||
// HTML call 이면 message view 객체 이용하도록
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
// 에러가 발생하였을시 처리
|
||||
if($this->error) {
|
||||
// message 모듈 객체를 생성해서 컨텐츠 생성
|
||||
|
|
@ -236,16 +268,18 @@
|
|||
// 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) {
|
||||
|
|
@ -254,9 +288,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 레이아웃 정보중 header_script가 있으면 헤더 추가
|
||||
if($layout_info->header_script) Context::addHtmlHeader($layout_info->header_script);
|
||||
|
||||
// 레이아웃 정보를 Context::set
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
|
|
@ -264,7 +295,9 @@
|
|||
$oModule->setLayoutFile('layout');
|
||||
|
||||
// 레이아웃이 수정되었을 경우 수정본을 지정
|
||||
$edited_layout = sprintf('./files/cache/layout/%d.html', $layout_info->layout_srl);
|
||||
$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
||||
// $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
|
||||
// Context::addCSSFile($edited_layout_css);
|
||||
if(file_exists($edited_layout)) $oModule->setEditedLayoutFile($edited_layout);
|
||||
}
|
||||
}
|
||||
|
|
@ -379,8 +412,6 @@
|
|||
|
||||
if(__DEBUG__==3) $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
|
||||
|
||||
// init method가 있으면 실행
|
||||
|
||||
// 객체 리턴
|
||||
return $GLOBALS['_loaded_module'][$module][$type][$kind];
|
||||
}
|
||||
|
|
@ -393,20 +424,7 @@
|
|||
if(!Context::isInstalled()) return new Object();
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$cache_dir = sprintf("%sfiles/cache/triggers/",_XE_PATH_);
|
||||
if(!is_dir($cache_dir)) FileHandler::makeDir($cache_dir);
|
||||
|
||||
$cache_file = sprintf("%s%s.%s", $cache_dir, $trigger_name, $called_position);
|
||||
|
||||
if(!@file_exists($cache_file)) {
|
||||
$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
|
||||
FileHandler::writeFile($cache_file, serialize($triggers));
|
||||
} else {
|
||||
$buff = FileHandler::readFile($cache_file);
|
||||
$triggers = unserialize($buff);
|
||||
}
|
||||
|
||||
$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
|
||||
if(!$triggers || !count($triggers)) return new Object();
|
||||
|
||||
foreach($triggers as $item) {
|
||||
|
|
@ -420,6 +438,7 @@
|
|||
|
||||
$output = $oModule->{$called_method}($obj);
|
||||
if(!$output->toBool()) return $output;
|
||||
unset($oModule);
|
||||
}
|
||||
|
||||
return new Object();
|
||||
|
|
|
|||
|
|
@ -82,109 +82,39 @@
|
|||
// 웹서비스에서 꼭 필요한 인증 정보와 권한 설정 체크
|
||||
$is_logged = Context::get('is_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$user_id = $logged_info->user_id;
|
||||
$user_group = $logged_info->group_list;
|
||||
$grant->is_admin = false;
|
||||
|
||||
// module model 객체 생성
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
// 로그인되어 있다면 관리자 여부를 확인
|
||||
if($is_logged) {
|
||||
/* 로그인 사용자에 대한 관리자 여부는 다양한 방법으로 체크가 됨 */
|
||||
// 1. 최고관리자일 경우
|
||||
if($logged_info->is_admin == 'Y') {
|
||||
$grant->is_admin = true;
|
||||
// 사이트 관리자이면 로그인 정보의 is_admin 에 'Y'로 세팅
|
||||
//if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_admin = 'Y';
|
||||
|
||||
// 2. 사이트 관리자일 경우 사이트 관리 권한을 줌
|
||||
} elseif($oModuleModel->isSiteAdmin()) {
|
||||
$grant->is_admin = true;
|
||||
// XE에서 access, manager (== is_admin) 는 고정된 권한명이며 이와 관련된 권한 설정
|
||||
$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
|
||||
|
||||
// 현재 모듈의 access 권한이 없으면 권한 없음 표시
|
||||
//if(!$grant->access) return $this->stop("msg_not_permitted");
|
||||
|
||||
// 3. 최고 관리자는 아니지만 모듈 object가 있고 admin_id 컬럼에 로그인 사용자의 아이디가 있을 경우
|
||||
} elseif($this->module_info->admin_id) {
|
||||
if(is_array($this->module_info->admin_id) && in_array($user_id, $this->module_info->admin_id)) $grant->is_admin = true;
|
||||
|
||||
// 4. 1/2/3번이 아닐 경우 그룹을 체크하고 직접 모듈에 요청을 하여 체크를 함. (모듈.class.php에 정의)
|
||||
} else {
|
||||
$manager_group = $this->module_info->grants['manager'];
|
||||
if(count($user_group) && count($manager_group)) {
|
||||
foreach($user_group as $group_srl => $group_info) {
|
||||
if(in_array($group_srl, $manager_group)) $grant->is_admin = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$grant->is_admin && $module_info->module) {
|
||||
$oClass = &getClass($module_info->module);
|
||||
if($oClass && method_exists($oClass, 'isAdmin')) $grant->is_admin = $oClass->isAdmin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 권한 설정
|
||||
if($xml_info->grant) {
|
||||
|
||||
// 이 모듈에 action.xml에서 선언된 권한 목록을 루프
|
||||
foreach($xml_info->grant as $grant_name => $grant_item) {
|
||||
|
||||
// 제목과 기타 설정 없을 경우의 기본 권한(guest, member, root)에 대한 변수 설정
|
||||
$title = $grant_item->title;
|
||||
$default = $grant_item->default;
|
||||
|
||||
// 최고 관리자이면 모든 권한에 대해 true 설정
|
||||
if($grant->is_admin) {
|
||||
$grant->{$grant_name} = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 일단 현재 권한에 대해 false 지정
|
||||
$grant->{$grant_name} = false;
|
||||
|
||||
// 모듈의 개별 설정에서 이 권한에 대한 그룹 지정이 있으면 체크
|
||||
if(count($this->module_info->grants[$grant_name])) {
|
||||
$group_srls = $this->module_info->grants[$grant_name];
|
||||
if(!is_array($group_srls)) $group_srls = array($group_srls);
|
||||
|
||||
if(count($user_group)) {
|
||||
foreach($user_group as $group_srl => $group_title) {
|
||||
if(in_array($group_srl, $group_srls)) {
|
||||
$grant->{$grant_name} = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 별도의 지정이 없으면 default값으로 권한 체크
|
||||
} else {
|
||||
switch($default) {
|
||||
case 'member' :
|
||||
if($is_logged) $grant->{$grant_name} = true;
|
||||
break;
|
||||
case 'root' :
|
||||
if($logged_info->is_admin == 'Y') $grant->{$grant_name} = true;
|
||||
break;
|
||||
default :
|
||||
$grant->{$grant_name} = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 현재 action값에 따른 최고 관리 권한 부여
|
||||
if($this->act && $xml_info->permission) {
|
||||
// 관리 권한이 없으면 permision, action 확인
|
||||
if(!$grant->manager) {
|
||||
// 현재 요청된 action의 퍼미션 type(guest, member, manager, root)를 구함
|
||||
$permission_target = $xml_info->permission->{$this->act};
|
||||
if($permission_target && $grant->{$permission_target}) {
|
||||
foreach($grant as $key => $val) $grant->{$key} = true;
|
||||
}
|
||||
}
|
||||
|
||||
// act값에 admin이 들어 있는데 관리자가 아닌 경우 해당 모듈의 관리자 체크
|
||||
if(substr_count($this->act, 'Admin')) {
|
||||
if(!$is_logged) $this->setAct("dispMemberLoginForm");
|
||||
else if($logged_info->is_admin != 'Y' && (!method_exists($this, 'checkAdminActionGrant') || !$this->checkAdminActionGrant())) {
|
||||
$this->stop('msg_not_permitted_act');
|
||||
}
|
||||
// module.xml에 명시된 퍼미션이 없을때 ation명에 Admin이 있으면 manager로 체크
|
||||
if(!$permission_target && substr_count($this->act, 'Admin')) $permission_target = 'manager';
|
||||
|
||||
// 권한 체크
|
||||
switch($permission_target) {
|
||||
case 'root' :
|
||||
$this->stop('msg_not_permitted_act');
|
||||
break;
|
||||
case 'manager' :
|
||||
if(!$grant->manager) $this->stop('msg_not_permitted_act');
|
||||
break;
|
||||
case 'member' :
|
||||
if(!$is_logged) $this->stop('msg_not_permitted_act');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 권한변수 설정
|
||||
|
|
@ -301,55 +231,90 @@
|
|||
**/
|
||||
function proc() {
|
||||
// stop_proc==true이면 그냥 패스
|
||||
if($this->stop_proc==true) return false;
|
||||
if($this->stop_proc) return false;
|
||||
|
||||
// addon 실행(called_position 를 before_module_proc로 하여 호출)
|
||||
$called_position = 'before_module_proc';
|
||||
@include(_XE_PATH_."files/cache/activated_addons.cache.php");
|
||||
$oAddonController = &getController('addon');
|
||||
$addon_file = $oAddonController->getCacheFilePath();
|
||||
if(file_exists($addon_file)) @include($addon_file);
|
||||
|
||||
// 지금까지 이상이 없었다면 action 실행
|
||||
if(!$this->stop_proc) {
|
||||
// 현재 모듈에 act값이 있으면 해당 act를 실행
|
||||
if(method_exists($this, $this->act)) {
|
||||
$output = $this->{$this->act}();
|
||||
// action 실행
|
||||
if(method_exists($this, $this->act)) {
|
||||
|
||||
// act가 없으면 action_forward에서 해당하는 act가 있는지 찾아서 대신 실행
|
||||
} else if(Context::isInstalled()) {
|
||||
// 권한 체크
|
||||
if(!$this->grant->access) return $this->stop("msg_not_permitted_act");
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$forward = $oModuleModel->getActionForward($this->act);
|
||||
if($forward->module && $forward->type && $forward->act) {
|
||||
// 모듈의 스킨 정보를 연동 (스킨 정보의 테이블 분리로 동작대상 모듈에만 스킨 정보를 싱크시키도록 변경)
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
||||
Context::set('module_info', $this->module_info);
|
||||
|
||||
$kind = strpos(strtolower($forward->act),'admin')!==false?'admin':'';
|
||||
$oModule = &getModule($forward->module, $forward->type, $kind);
|
||||
$xml_info = $oModuleModel->getModuleActionXml($forward->module);
|
||||
$oModule->setAct($forward->act);
|
||||
$oModule->init();
|
||||
$oModule->setModuleInfo($this->module_info, $xml_info);
|
||||
// 실행
|
||||
$output = $this->{$this->act}();
|
||||
|
||||
$output = $oModule->{$forward->act}();
|
||||
// act이 없으면 action_forward에서 해당하는 act가 있는지 찾아서 대신 실행
|
||||
} else if(Context::isInstalled()) {
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$this->setTemplatePath($oModule->getTemplatePath());
|
||||
$this->setTemplateFile($oModule->getTemplateFile());
|
||||
$forward = null;
|
||||
|
||||
} else {
|
||||
if($this->xml_info->default_index_act) {
|
||||
if(method_exists($this, $this->xml_info->default_index_act)) {
|
||||
$output = $this->{$this->xml_info->default_index_act}();
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// 현재 요청된 action의 대상 모듈을 찾음
|
||||
// 1. action이름으로 검색 (DB검색 없이 하기 위함)
|
||||
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->act = $this->act;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 2. 1번에서 찾지 못하면 action forward를 검색
|
||||
if(!$forward) $forward = $oModuleModel->getActionForward($this->act);
|
||||
|
||||
// 찾아진 forward 모듈이 있으면 실행
|
||||
if($forward->module && $forward->type && $forward->act) {
|
||||
|
||||
$kind = strpos(strtolower($forward->act),'admin')!==false?'admin':'';
|
||||
|
||||
$oModule = &getModule($forward->module, $forward->type, $kind);
|
||||
$xml_info = $oModuleModel->getModuleActionXml($forward->module);
|
||||
|
||||
$oModule->setAct($forward->act);
|
||||
$oModule->init();
|
||||
if($oModule->stop_proc) return $this->stop($oModule->getMessage());
|
||||
|
||||
$oModule->setModuleInfo($this->module_info, $xml_info);
|
||||
|
||||
if(method_exists($oModule, $forward->act)) {
|
||||
$output = $oModule->{$forward->act}();
|
||||
} else {
|
||||
return $this->stop("msg_module_is_not_exists");
|
||||
}
|
||||
|
||||
// forward 모듈의 실행 결과 검사
|
||||
if($oModule->stop_proc) return $this->stop($oModule->getMessage());
|
||||
|
||||
$this->setTemplatePath($oModule->getTemplatePath());
|
||||
$this->setTemplateFile($oModule->getTemplateFile());
|
||||
|
||||
// forward 모듈을 찾지 못했다면 원 모듈의 default index action을 실행
|
||||
} else if($this->xml_info->default_index_act && method_exists($this, $this->xml_info->default_index_act)) {
|
||||
$output = $this->{$this->xml_info->default_index_act}();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// addon 실행(called_position 를 after_module_proc로 하여 호출)
|
||||
$called_position = 'after_module_proc';
|
||||
@include(_XE_PATH_."files/cache/activated_addons.cache.php");
|
||||
$oAddonController = &getController('addon');
|
||||
$addon_file = $oAddonController->getCacheFilePath();
|
||||
if(file_exists($addon_file)) @include($addon_file);
|
||||
|
||||
if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) {
|
||||
$this->setError($output->getError());
|
||||
|
|
@ -357,7 +322,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
// view action이고 결과 출력이 XMLRPC일 경우 해당 모듈의 api method를 실행
|
||||
// view action이고 결과 출력이 XMLRPC 또는 JSON일 경우 해당 모듈의 api method를 실행
|
||||
if($this->module_info->module_type == 'view'){
|
||||
if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
|
||||
$oAPI = getAPI($this->module_info->module, 'api');
|
||||
|
|
@ -365,11 +330,6 @@
|
|||
$oAPI->{$this->act}($this);
|
||||
}
|
||||
}
|
||||
}else if($this->module_info->module_type == 'controller'){
|
||||
if(Context::getResponseMethod() == 'JSON'){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -100,9 +100,6 @@
|
|||
// include 변경 <!--#include($filename)-->
|
||||
$buff = preg_replace_callback('!<\!--#include\(([^\)]*?)\)-->!is', array($this, '_compileIncludeToCode'), $buff);
|
||||
|
||||
// include 변경 <!--#include($filename)-->
|
||||
//$buff = preg_replace_callback('!<\!--#include\(([^\)]*?)\)-->!is', array($this, '_compileIncludeToCode'), $buff);
|
||||
|
||||
// 이미지 태그 img의 src의 값이 http:// 나 / 로 시작하지 않으면 root경로부터 시작하도록 변경
|
||||
$buff = preg_replace_callback('/<(img|input)([^>]*)src=[\'"]{1}(?!http)(.*?)[\'"]{1}/is', array($this, '_compileImgPath'), $buff);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
$object_vars = get_object_vars($args);
|
||||
if(count($object_vars)) {
|
||||
foreach($object_vars as $key => $val) {
|
||||
if(in_array($key, array('body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right'))) continue;
|
||||
if(in_array($key, array('body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','document_srl'))) continue;
|
||||
$args->{$key} = utf8RawUrlDecode($val);
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
// 캐시 파일을 갱신하여야 할 경우 lock파일을 만들고 캐시 생성
|
||||
$oWidget = WidgetHandler::getObject($widget);
|
||||
if(!$oWidget) return;
|
||||
if(!$oWidget || !method_exists($oWidget,'proc')) return;
|
||||
|
||||
$widget_content = $oWidget->proc($args);
|
||||
FileHandler::writeFile($cache_file, $widget_content);
|
||||
|
|
@ -93,11 +93,12 @@
|
|||
$object_vars = get_object_vars($args);
|
||||
if(count($object_vars)) {
|
||||
foreach($object_vars as $key => $val) {
|
||||
if(in_array($key, array('body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right'))) continue;
|
||||
if(in_array($key, array('body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue;
|
||||
$args->{$key} = utf8RawUrlDecode($val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 위젯이 widgetContent/ widgetBox가 아니라면 내용을 구함
|
||||
**/
|
||||
|
|
@ -122,11 +123,19 @@
|
|||
$inner_style = sprintf("padding:%dpx %dpx %dpx %dpx !important; padding:none !important;", $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left);
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
|
||||
/**
|
||||
* 위젯 출력물을 구함
|
||||
**/
|
||||
|
||||
$widget_content_header = '';
|
||||
$widget_content_body = '';
|
||||
$widget_content_footer = '';
|
||||
|
||||
// 일반 페이지 호출일 경우 지정된 스타일만 꾸면서 바로 return 함
|
||||
if(!$include_info) {
|
||||
if($args->id) $args->id = ' id="'.$args->id.'" ';
|
||||
switch($widget) {
|
||||
// 내용 직접 추가일 경우
|
||||
case 'widgetContent' :
|
||||
|
|
@ -136,17 +145,23 @@
|
|||
} else {
|
||||
$body = base64_decode($args->body);
|
||||
}
|
||||
$output = sprintf('<div style="overflow:hidden;%s"><div style="%s">%s</div></div>', $style, $inner_style, $body);
|
||||
|
||||
$widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s"><div style="%s">', $args->id, $style, $inner_style);
|
||||
$widget_content_body = $body;
|
||||
$widget_content_footer = '</div></div>';
|
||||
|
||||
break;
|
||||
|
||||
// 위젯 박스일 경우
|
||||
case 'widgetBox' :
|
||||
$output = sprintf('<div style="overflow:hidden;%s;"><div style="%s"><div>', $style, $inner_style);
|
||||
$widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
|
||||
break;
|
||||
|
||||
// 일반 위젯일 경우
|
||||
default :
|
||||
$output = sprintf('<div style="overflow:hidden;%s;"><div style="%s">%s</div></div>', $style, $inner_style, $widget_content);
|
||||
$widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s">',$args->id,$style);
|
||||
$widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style,$widget_content);
|
||||
$widget_content_footer = '</div>';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -161,37 +176,49 @@
|
|||
} else {
|
||||
$body = base64_decode($args->body);
|
||||
}
|
||||
|
||||
// args 정리
|
||||
$attribute = array();
|
||||
if($args) {
|
||||
foreach($args as $key => $val) {
|
||||
if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
|
||||
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
|
||||
$attribute[] = sprintf('%s="%s"', $key, str_replace('"','\"',$val));
|
||||
}
|
||||
}
|
||||
|
||||
$oWidgetController = &getController('widget');
|
||||
|
||||
$output = sprintf(
|
||||
'<div class="widgetOutput" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d">'.
|
||||
$widget_content_header = sprintf(
|
||||
'<div class="widgetOutput" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
|
||||
'<div class="widgetResize"></div>'.
|
||||
'<div class="widgetResizeLeft"></div>'.
|
||||
'<div class="widgetBorder">'.
|
||||
'<div style="%s">'.
|
||||
'%s'.
|
||||
'</div><div class="clear"></div>'.
|
||||
'</div>'.
|
||||
'<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'.
|
||||
'</div>',
|
||||
'<div style="%s">',$args->widgetstyle,
|
||||
$style,
|
||||
$args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom,
|
||||
$args->document_srl,
|
||||
$inner_style,
|
||||
$body,
|
||||
base64_encode($body)
|
||||
);
|
||||
implode(' ',$attribute),
|
||||
$inner_style);
|
||||
|
||||
$widget_content_body = $body;
|
||||
$widget_content_footer = sprintf('</div><div class="clear"></div>'.
|
||||
'</div>'.
|
||||
'<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'.
|
||||
'</div>',base64_encode($body));
|
||||
|
||||
break;
|
||||
|
||||
// 위젯 박스일 경우
|
||||
case 'widgetBox' :
|
||||
$output = sprintf(
|
||||
'<div class="widgetOutput" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s">'.
|
||||
|
||||
$widget_content_header = sprintf(
|
||||
'<div class="widgetOutput" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s">'.
|
||||
'<div class="widgetBoxResize"></div>'.
|
||||
'<div class="widgetBoxResizeLeft"></div>'.
|
||||
'<div class="widgetBoxBorder">'.
|
||||
'<div class="nullWidget" style="%s">',
|
||||
$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, $inner_style);
|
||||
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,$inner_style);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// 일반 위젯일 경우
|
||||
|
|
@ -206,29 +233,31 @@
|
|||
}
|
||||
}
|
||||
|
||||
$output = sprintf(
|
||||
'<div class="widgetOutput" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
|
||||
$widget_content_header = sprintf('<div class="widgetOutput" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
|
||||
'<div class="widgetResize"></div>'.
|
||||
'<div class="widgetResizeLeft"></div>'.
|
||||
'<div class="widgetBorder">'.
|
||||
'<div style="%s">'.
|
||||
'%s'.
|
||||
'</div><div class="clear"></div>'.
|
||||
'</div>'.
|
||||
'</div>',
|
||||
$style,
|
||||
'<div class="widgetBorder">',$args->widgetstyle,$style,
|
||||
$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
|
||||
$widget, implode(' ',$attribute),
|
||||
$inner_style,
|
||||
$widget_content
|
||||
);
|
||||
$widget, implode(' ',$attribute));
|
||||
|
||||
$widget_content_body = sprintf('<div style="%s">%s</div></div><div class="clear"></div>',$inner_style, $widget_content);
|
||||
|
||||
$widget_content_footer = '</div>';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 위젯 스타일을 컴파일 한다.
|
||||
if($args->widgetstyle){
|
||||
$widget_content_body = WidgetHandler::complieWidgetStyle($args->widgetstyle, $widget_content_body, $args);
|
||||
}
|
||||
|
||||
$output = $widget_content_header . $widget_content_body . $widget_content_footer;
|
||||
|
||||
// 위젯 결과물 생성 시간을 debug 정보에 추가
|
||||
if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
|
||||
|
||||
// 결과 return
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -263,5 +292,31 @@
|
|||
return $GLOBALS['_xe_loaded_widgets_'][$widget];
|
||||
}
|
||||
|
||||
|
||||
function complieWidgetStyle($widgetStyle,$widget_content_body, $args){
|
||||
if(!$widgetStyle) return $widget_content_body;
|
||||
|
||||
$oWidgetModel = &getModel('widget');
|
||||
|
||||
// 위젯 스타일의 extra_var를 가져와 묶는다
|
||||
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle);
|
||||
if(!$widgetstyle_info) return $widget_content_body;
|
||||
|
||||
$widgetstyle_extar_var_key = get_object_vars($widgetstyle_info);
|
||||
if(count($widgetstyle_extar_var_key['extra_var'])){
|
||||
foreach($widgetstyle_extar_var_key['extra_var'] as $key => $val){
|
||||
$widgetstyle_extar_var->{$key} = $args->{$key};
|
||||
}
|
||||
}
|
||||
Context::set('widgetstyle_extar_var', $widgetstyle_extar_var);
|
||||
Context::set('widget_content', $widget_content_body);
|
||||
|
||||
// 컴파일
|
||||
$widgetstyle_path = $oWidgetModel->getWidgetStylePath($widgetStyle);
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($widgetstyle_path, 'widgetstyle');
|
||||
|
||||
return $tpl;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
* @brief constructor
|
||||
**/
|
||||
function XmlJsFilter($path, $xml_file) {
|
||||
if(substr($path,-1)!=='/') $path .= '/';
|
||||
$this->xml_file = sprintf("%s%s",$path, $xml_file);
|
||||
$this->js_file = $this->_getCompiledFileName($this->xml_file);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue