mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
#447 Member모듈에서 로그인/회원가입/정보-비밀번호 수정등 비밀번호 관련 정보의 전송에 대해 SSL사용을 설정할 수 있도록 변경. 단 서버에서 SSL지원이 되어야 하며 현재 기본포트에 대해서만 개발 완료되었음. 로그인 위젯의 경우 기본 위젯에 대해 보안페이지 설정 기능을 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4109 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a588225372
commit
89090a5cb9
32 changed files with 345 additions and 128 deletions
|
|
@ -10,6 +10,10 @@
|
|||
* php5 쓰고 싶당.. ㅡ.ㅜ
|
||||
**/
|
||||
|
||||
define('FOLLOW_REQUEST_SSL',0);
|
||||
define('ENFORCE_SSL',1);
|
||||
define('RELEASE_SSL',2);
|
||||
|
||||
class Context {
|
||||
|
||||
var $request_method = 'GET'; ///< @brief GET/POST/XMLRPC 중 어떤 방식으로 요청이 왔는지에 대한 값이 세팅. GET/POST/XML 3가지가 있음
|
||||
|
|
@ -19,8 +23,8 @@
|
|||
|
||||
var $db_info = NULL; ///< @brief DB 정보
|
||||
|
||||
var $ssl_actions = array(); ///< @brief ssl로 전송해야 할 action등록 (common/js/xml_handler.js에서 ajax통신시 활용)
|
||||
var $js_files = array(); ///< @brief display시에 사용하게 되는 js files의 목록
|
||||
|
||||
var $css_files = array(); ///< @brief display시에 사용하게 되는 css files의 목록
|
||||
|
||||
var $html_header = NULL; ///< @brief display시에 사용하게 되는 <head>..</head>내의 스크립트코드
|
||||
|
|
@ -129,9 +133,6 @@
|
|||
if(file_exists('./.htaccess')&&$this->db_info->use_rewrite == 'Y') $this->allow_rewrite = true;
|
||||
else $this->allow_rewrite = false;
|
||||
|
||||
// 상대 경로 설정
|
||||
$this->path = $this->getRequestUri();
|
||||
|
||||
// 기본 JS/CSS 등록
|
||||
$this->addJsFile("./common/js/x.js");
|
||||
$this->addJsFile("./common/js/common.js");
|
||||
|
|
@ -148,7 +149,7 @@
|
|||
if(!$val) continue;
|
||||
$url .= ($url?'&':'').$key.'='.$val;
|
||||
}
|
||||
Context::set('current_url',sprintf('%s?%s',$this->path, $url));
|
||||
Context::set('current_url',sprintf('%s?%s', $this->getRequestUri(), $url));
|
||||
} else {
|
||||
Context::set('current_url',$this->getUrl());
|
||||
}
|
||||
|
|
@ -576,33 +577,36 @@
|
|||
$var_count = count($get_vars);
|
||||
if(!$var_count) return '';
|
||||
|
||||
if($get_vars['act'] && $this->isExistsSSLAction($get_vars['act'])) $path = $this->getRequestUri(ENFORCE_SSL);
|
||||
else $path = $this->getRequestUri(RELEASE_SSL);
|
||||
|
||||
// rewrite모듈을 사용하고 인자의 값이 4개 이하일 경우
|
||||
if($this->allow_rewrite && $var_count < 4) {
|
||||
$var_keys = array_keys($get_vars);
|
||||
|
||||
if($var_count == 1) {
|
||||
if($var_keys[0]=='mid') return $this->path.$get_vars['mid'];
|
||||
elseif($var_keys[0]=='document_srl') return $this->path.$get_vars['document_srl'];
|
||||
if($var_keys[0]=='mid') return $path.$get_vars['mid'];
|
||||
elseif($var_keys[0]=='document_srl') return $path.$get_vars['document_srl'];
|
||||
} elseif($var_count == 2) {
|
||||
asort($var_keys);
|
||||
$target = implode('.',$var_keys);
|
||||
if($target=='act.mid' && !preg_match('/([A-Z]+)/',$get_vars['act'])) return sprintf('%s%s/%s',$this->path,$get_vars['mid'],$get_vars['act']);
|
||||
elseif($target=='document_srl.mid') return sprintf('%s%s/%s',$this->path,$get_vars['mid'],$get_vars['document_srl']);
|
||||
elseif($target=='act.document_srl') return sprintf('%s%s/%s',$this->path,$get_vars['document_srl'],$get_vars['act']);
|
||||
elseif($target=='mid.page') return sprintf('%s%s/page/%s',$this->path,$get_vars['mid'],$get_vars['page']);
|
||||
elseif($target=='category.mid') return sprintf('%s%s/category/%s',$this->path,$get_vars['mid'],$get_vars['category']);
|
||||
if($target=='act.mid' && !preg_match('/([A-Z]+)/',$get_vars['act'])) return sprintf('%s%s/%s',$path,$get_vars['mid'],$get_vars['act']);
|
||||
elseif($target=='document_srl.mid') return sprintf('%s%s/%s',$path,$get_vars['mid'],$get_vars['document_srl']);
|
||||
elseif($target=='act.document_srl') return sprintf('%s%s/%s',$path,$get_vars['document_srl'],$get_vars['act']);
|
||||
elseif($target=='mid.page') return sprintf('%s%s/page/%s',$path,$get_vars['mid'],$get_vars['page']);
|
||||
elseif($target=='category.mid') return sprintf('%s%s/category/%s',$path,$get_vars['mid'],$get_vars['category']);
|
||||
} elseif($var_count == 3) {
|
||||
asort($var_keys);
|
||||
$target = implode('.',$var_keys);
|
||||
if($target=='act.document_srl.key') {
|
||||
return sprintf('%s%s/%s/%s',$this->path,$get_vars['document_srl'],$get_vars['key'],$get_vars['act']);
|
||||
return sprintf('%s%s/%s/%s',$path,$get_vars['document_srl'],$get_vars['key'],$get_vars['act']);
|
||||
} elseif($target=='category.mid.page') {
|
||||
return sprintf('%s%s/category/%s/page/%s',$this->path,$get_vars['mid'],$get_vars['category'],$get_vars['page']);
|
||||
return sprintf('%s%s/category/%s/page/%s',$path,$get_vars['mid'],$get_vars['category'],$get_vars['page']);
|
||||
} elseif($target=='mid.search_keyword.search_target' && $get_vars['search_target']=='tag') {
|
||||
return sprintf('%s%s/tag/%s',$this->path,$get_vars['mid'],str_replace(' ','-',$get_vars['search_keyword']));
|
||||
return sprintf('%s%s/tag/%s',$path,$get_vars['mid'],str_replace(' ','-',$get_vars['search_keyword']));
|
||||
} elseif($target=='mid.search_keyword.search_target' && $get_vars['search_target']=='regdate') {
|
||||
if(strlen($get_vars['search_keyword'])==8) return sprintf('%s%s/%04d/%02d/%02d',$this->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',$this->path,$get_vars['mid'],substr($get_vars['search_keyword'],0,4),substr($get_vars['search_keyword'],4,2));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -613,14 +617,26 @@
|
|||
$url .= ($url?'&':'').$key.'='.urlencode($val);
|
||||
}
|
||||
|
||||
return $this->path.'?'.htmlspecialchars($url);
|
||||
return $path.'?'.htmlspecialchars($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 요청이 들어온 URL에서 argument를 제거하여 return
|
||||
**/
|
||||
function getRequestUri() {
|
||||
return sprintf("http://%s%s",$_SERVER['HTTP_HOST'], getScriptPath());
|
||||
function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL) {
|
||||
switch($ssl_mode) {
|
||||
case FOLLOW_REQUEST_SSL :
|
||||
if($_SERVER['HTTPS']=='on') $use_ssl = true;
|
||||
else $use_ssl = false;
|
||||
break;
|
||||
case ENFORCE_SSL :
|
||||
$use_ssl = true;
|
||||
break;
|
||||
case RELEASE_SSL :
|
||||
$use_ssl = false;
|
||||
break;
|
||||
}
|
||||
return sprintf("%s://%s%s",$use_ssl?'HTTPS':'HTTP',$_SERVER['HTTP_HOST'], getScriptPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -711,6 +727,38 @@
|
|||
return clone($this->get_vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SSL로 인증되어야 할 action이 있을 경우 등록
|
||||
* common/js/xml_handler.js에서 이 action들에 대해서 https로 전송되도록 함
|
||||
**/
|
||||
function addSSLAction($action) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addSSLAction($action);
|
||||
}
|
||||
|
||||
function _addSSLAction($action) {
|
||||
if(in_array($action, $this->ssl_actions)) return;
|
||||
$this->ssl_actions[] = $action;
|
||||
}
|
||||
|
||||
function getSSLActions() {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_getSSLActions();
|
||||
}
|
||||
|
||||
function _getSSLActions() {
|
||||
return $this->ssl_actions;
|
||||
}
|
||||
|
||||
function isExistsSSLAction($action) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_isExistsSSLAction($action);
|
||||
}
|
||||
|
||||
function _isExistsSSLAction($action) {
|
||||
return in_array($action, $this->ssl_actions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -45,14 +45,13 @@
|
|||
$layout_file = $oModule->getLayoutFile();
|
||||
$edited_layout_file = $oModule->getEditedLayoutFile();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if(__DEBUG__==3) $GLOBALS['__layout_compile_elapsed__'] = getMicroTime()-$start;
|
||||
|
||||
|
||||
// 각 위젯, 에디터 컴포넌트의 코드 변경
|
||||
if(__DEBUG__==3) $start = getMicroTime();
|
||||
|
||||
|
|
|
|||
|
|
@ -334,12 +334,20 @@
|
|||
$oModule->setModule($module);
|
||||
$oModule->setModulePath($class_path);
|
||||
|
||||
// 요청된 module에 constructor가 있으면 실행
|
||||
if(!isset($GLOBALS['_called_constructor'][$module])) {
|
||||
$GLOBALS['_called_constructor'][$module] = true;
|
||||
if(@method_exists($oModule, $module)) $oModule->{$module}();
|
||||
}
|
||||
|
||||
// GLOBALS 변수에 생성된 객체 저장
|
||||
$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
|
||||
}
|
||||
|
||||
if(__DEBUG__==3) $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
|
||||
|
||||
// init method가 있으면 실행
|
||||
|
||||
// 객체 리턴
|
||||
return $GLOBALS['_loaded_module'][$module][$type][$kind];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue