mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
virtual site + homepage package 추가. 아직 미완성 버전이므로 서비스 반영하지 말아주세요. 테스트중
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4871 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c5dbc3405c
commit
e745b70268
171 changed files with 5243 additions and 274 deletions
|
|
@ -3,11 +3,8 @@
|
|||
* @class Context
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief Request Argument/환경변수등의 모든 Context를 관리
|
||||
*
|
||||
* Context 클래스는 Context::methodname() 처럼 쉽게 사용하기 위해 만들어진 객체를 받아서
|
||||
* 호출하는 구조를 위해 이중 method 구조를 가지고 있다.
|
||||
* php5에서 static variables를 사용하게 된다면 불필요한 구조를 제거할 수 있다.
|
||||
* php5 쓰고 싶당.. ㅡ.ㅜ
|
||||
**/
|
||||
|
||||
define('FOLLOW_REQUEST_SSL',0);
|
||||
|
|
@ -35,7 +32,6 @@
|
|||
|
||||
/**
|
||||
* @brief 언어 정보
|
||||
*
|
||||
* 기본으로 ko. HTTP_USER_AGENT나 사용자의 직접 세팅(쿠키이용)등을 통해 변경됨
|
||||
**/
|
||||
var $lang_type = ''; ///< 언어 종류
|
||||
|
|
@ -50,7 +46,6 @@
|
|||
|
||||
/**
|
||||
* @brief 유일한 Context 객체를 반환 (Singleton)
|
||||
*
|
||||
* Context는 어디서든 객체 선언없이 사용하기 위해서 static 하게 사용
|
||||
**/
|
||||
function &getInstance() {
|
||||
|
|
@ -61,9 +56,7 @@
|
|||
|
||||
/**
|
||||
* @brief DB정보, Request Argument등을 세팅
|
||||
*
|
||||
* Context::init()은 단 한번만 호출되어야 하며 init()시에
|
||||
* Request Argument, DB/언어/세션정보등의 모든 정보를 세팅한다
|
||||
* Context::init()은 단 한번만 호출되어야 하며 init()시에 Request Argument, DB/언어/세션정보등의 모든 정보를 세팅한다
|
||||
**/
|
||||
function init() {
|
||||
// context 변수를 $GLOBALS의 변수로 지정
|
||||
|
|
@ -114,6 +107,11 @@
|
|||
|
||||
// 인증 관련 정보를 Context와 세션에 설정
|
||||
if(Context::isInstalled()) {
|
||||
// site_module_info를 구함
|
||||
$oModuleModel = &getModel('module');
|
||||
$site_module_info = $oModuleModel->getDefaultMid();
|
||||
Context::set('site_module_info', $site_module_info);
|
||||
|
||||
// 인증관련 데이터를 Context에 설정
|
||||
$oMemberModel = &getModel('member');
|
||||
$oMemberController = &getController('member');
|
||||
|
|
@ -665,15 +663,20 @@
|
|||
/**
|
||||
* @brief 요청받은 url에 args_list를 적용하여 return
|
||||
**/
|
||||
function getUrl($num_args=0, $args_list=array()) {
|
||||
function getUrl($num_args=0, $args_list=array(), $domain = null) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_getUrl($num_args, $args_list);
|
||||
return $oContext->_getUrl($num_args, $args_list, $domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 요청받은 url에 args_list를 적용하여 return
|
||||
**/
|
||||
function _getUrl($num_args=0, $args_list=array()) {
|
||||
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 .= '/';
|
||||
}
|
||||
|
||||
if(!$this->get_vars || $args_list[0]=='') {
|
||||
$get_vars = null;
|
||||
if($args_list[0]=='') {
|
||||
|
|
@ -698,11 +701,16 @@
|
|||
if($get_vars['act'] == 'dispMemberFriend') $get_vars['act'] = 'dispCommunicationFriend';
|
||||
elseif($get_vars['act'] == 'dispMemberMessages') $get_vars['act'] = 'dispCommunicationMessages';
|
||||
|
||||
$var_count = count($get_vars);
|
||||
if(!$var_count) return '';
|
||||
if(!$domain) {
|
||||
if($get_vars['act'] && $this->isExistsSSLAction($get_vars['act'])) $path = $this->getRequestUri(ENFORCE_SSL);
|
||||
else $path = $this->getRequestUri(RELEASE_SSL);
|
||||
} else {
|
||||
if($get_vars['act'] && $this->isExistsSSLAction($get_vars['act'])) $path = 'https://'.$domain;
|
||||
else $path = 'http://'.$domain;
|
||||
}
|
||||
|
||||
if($get_vars['act'] && $this->isExistsSSLAction($get_vars['act'])) $path = $this->getRequestUri(ENFORCE_SSL);
|
||||
else $path = $this->getRequestUri(RELEASE_SSL);
|
||||
$var_count = count($get_vars);
|
||||
if(!$var_count) return $path;
|
||||
|
||||
// rewrite모듈을 사용할때 getUrl()을 이용한 url 생성
|
||||
if($this->allow_rewrite) {
|
||||
|
|
@ -768,6 +776,10 @@
|
|||
* @brief 요청이 들어온 URL에서 argument를 제거하여 return
|
||||
**/
|
||||
function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL) {
|
||||
static $url = array();
|
||||
|
||||
if(isset($url[$ssl_mode])) return $url[$ssl_mode];
|
||||
|
||||
switch($ssl_mode) {
|
||||
case FOLLOW_REQUEST_SSL :
|
||||
if($_SERVER['HTTPS']=='on') $use_ssl = true;
|
||||
|
|
@ -781,7 +793,16 @@
|
|||
break;
|
||||
}
|
||||
|
||||
return sprintf("%s://%s%s",$use_ssl?'https':'http',$_SERVER['HTTP_HOST'], getScriptPath());
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$domain = trim($site_module_info->domain);
|
||||
if($domain) {
|
||||
$domain = preg_replace('/^(http|https):\/\//i','', trim($domain));
|
||||
if(substr($domain,-1) != '/') $domain .= '/';
|
||||
} else $domain = $_SERVER['HTTP_HOST'].getScriptPath();
|
||||
|
||||
$url[$ssl_mode] = sprintf("%s://%s",$use_ssl?'https':'http',$domain);
|
||||
|
||||
return $url[$ssl_mode];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@
|
|||
break;
|
||||
case 'number' :
|
||||
case 'numbers' :
|
||||
if(!preg_match('/^[0-9,]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_number, $lang->{$key}?$lang->{$key}:$key));
|
||||
if(!preg_match('/^(-?)[0-9,]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_number, $lang->{$key}?$lang->{$key}:$key));
|
||||
break;
|
||||
case 'alpha' :
|
||||
if(!preg_match('/^[a-z]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key}?$lang->{$key}:$key));
|
||||
|
|
|
|||
|
|
@ -248,6 +248,15 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf("drop %s index %s on %s%s", $is_unique?'unique':'', $index_name, $this->prefix, $table_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -418,6 +418,15 @@
|
|||
@ibase_commit($this->fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf('DROP INDEX "%s" ON "%s%s"', $index_name, $this->prefix, $table_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -260,6 +260,15 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf("alter table %s%s drop index %s;", $this->prefix, $table_name, $index_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -270,6 +270,14 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf("alter table %s%s drop index %s;", $this->prefix, $table_name, $index_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -249,6 +249,20 @@
|
|||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
if(strpos($table_name,$this->prefix)===false) $table_name = $this->prefix.$table_name;
|
||||
|
||||
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
|
||||
$index_name = $table_name.$index_name;
|
||||
|
||||
$query = sprintf("drop index %s", $index_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -242,6 +242,15 @@
|
|||
return $this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("DROP INDEX %s", $this->prefix, $table_name, $key_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -265,6 +265,15 @@
|
|||
$this->_execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("DROP INDEX %s", $this->prefix, $table_name, $key_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@
|
|||
// ModuleModel 객체 생성
|
||||
$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) {
|
||||
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
|
||||
|
|
@ -81,10 +84,18 @@
|
|||
|
||||
// 아직 모듈을 못 찾았고 $mid값이 있으면 $mid로 모듈을 구함
|
||||
if(!$module_info && $this->mid) {
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($this->mid);
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $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);
|
||||
|
|
@ -92,7 +103,13 @@
|
|||
}
|
||||
|
||||
// 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
|
||||
if(!$module_info && !$this->module) $module_info = $oModuleModel->getModuleInfoByMid();
|
||||
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);
|
||||
}
|
||||
Context::set('site_module_info', $site_module_info);
|
||||
|
||||
// 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함, 모듈 정보에서 module 이름을 구해움
|
||||
if($module_info) {
|
||||
|
|
@ -117,7 +134,12 @@
|
|||
|
||||
// 실제 동작을 하기 전에 trigger 호출
|
||||
$output = ModuleHandler::triggerCall('display', 'before', $content);
|
||||
if(!$output->toBool()) die($output->getMessage());
|
||||
if(!$output->toBool()) {
|
||||
$this->error = $output->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -251,9 +273,6 @@
|
|||
// 컨텐츠 출력
|
||||
$oDisplayHandler = new DisplayHandler();
|
||||
$oDisplayHandler->printContent($oModule);
|
||||
|
||||
// DB 및 기타 자원의 종결 처리
|
||||
Context::close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@
|
|||
$user_group = $logged_info->group_list;
|
||||
$grant->is_admin = false;
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
// 로그인되어 있다면 관리자 여부를 확인
|
||||
if($is_logged) {
|
||||
/* 로그인 사용자에 대한 관리자 여부는 다양한 방법으로 체크가 됨 */
|
||||
|
|
@ -93,11 +95,16 @@
|
|||
if($logged_info->is_admin == 'Y') {
|
||||
$grant->is_admin = true;
|
||||
|
||||
// 2. 최고 관리자는 아니지만 모듈 object가 있고 admin_id 컬럼에 로그인 사용자의 아이디가 있을 경우
|
||||
// 2. 사이트 관리자일 경우 사이트 관리 권한을 줌
|
||||
} elseif($oModuleModel->isSiteAdmin()) {
|
||||
$grant->is_admin = true;
|
||||
|
||||
|
||||
// 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번이 아닐 경우 그룹을 체크하고 직접 모듈에 요청을 하여 체크를 함. (모듈.class.php에 정의)
|
||||
// 4. 1/2/3번이 아닐 경우 그룹을 체크하고 직접 모듈에 요청을 하여 체크를 함. (모듈.class.php에 정의)
|
||||
} else {
|
||||
$manager_group = $this->module_info->grants['manager'];
|
||||
if(count($user_group) && count($manager_group)) {
|
||||
|
|
@ -123,7 +130,7 @@
|
|||
$title = $grant_item->title;
|
||||
$default = $grant_item->default;
|
||||
|
||||
// 관리자이면 모든 권한에 대해 true 설정
|
||||
// 최고 관리자이면 모든 권한에 대해 true 설정
|
||||
if($grant->is_admin) {
|
||||
$grant->{$grant_name} = true;
|
||||
continue;
|
||||
|
|
@ -153,7 +160,7 @@
|
|||
if($is_logged) $grant->{$grant_name} = true;
|
||||
break;
|
||||
case 'root' :
|
||||
if($grant->is_admin) $grant->{$grant_name} = true;
|
||||
if($logged_info->is_admin == 'Y') $grant->{$grant_name} = true;
|
||||
break;
|
||||
default :
|
||||
$grant->{$grant_name} = true;
|
||||
|
|
@ -172,11 +179,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
// act값에 admin이 들어 있는데 관리자가 아닌 경우 오류 표시
|
||||
// act값에 admin이 들어 있는데 관리자가 아닌 경우 해당 모듈의 관리자 체크
|
||||
if(substr_count($this->act, 'Admin')) {
|
||||
// 로그인 되어 있지 않다면 무조건 금지
|
||||
if(!$is_logged) $this->setAct("dispMemberLoginForm");
|
||||
elseif(!$grant->is_admin) $this->stop('msg_not_permitted_act');
|
||||
else if($logged_info->is_admin != 'Y' && (!method_exists($this, 'checkAdminActionGrant') || !$this->checkAdminActionGrant())) {
|
||||
$this->stop('msg_not_permitted_act');
|
||||
}
|
||||
}
|
||||
|
||||
// 권한변수 설정
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue