mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
#17610569 SSL 상태에서 파일 업로드시 발생하는 오류 수정
#18070211 SSL 항상/ 선택/ 사용안함 상태 설정시 항상은 늘 SSL 상태로, 선택은 선택된 Action에 대해서만 SSL로, 사용안함은 https로 접속하든 http로 접속하면 접속된 상태를 따르도록 개선 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6756 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a0ff0e7b2c
commit
2231d9c271
4 changed files with 110 additions and 21 deletions
|
|
@ -774,6 +774,7 @@
|
|||
**/
|
||||
function _getUrl($num_args=0, $args_list=array(), $domain = null, $encode = true) {
|
||||
static $site_module_info = null;
|
||||
static $current_info = null;
|
||||
|
||||
// 가상 사이트 정보를 구함
|
||||
if(is_null($site_module_info)) $site_module_info = Context::get('site_module_info');
|
||||
|
|
@ -793,9 +794,10 @@
|
|||
// $domain값이 있을 경우 현재 요청된 도메인과 비교해서 동일할 경우 제거 그렇지 않으면 http 프로토콜을 제거하고 제일 뒤에 / 를 붙임
|
||||
if($domain) {
|
||||
$domain_info = parse_url($domain);
|
||||
$current_info = parse_url($_SERVER['HTTP_HOST'].getScriptPath());
|
||||
if($domain_info['host'].$domain_info['path']==$current_info['host'].$current_info['path']) unset($domain);
|
||||
else {
|
||||
if(is_null($current_info)) $current_info = parse_url(($_SERVER['HTTPS']=='on'?'https':'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
|
||||
if($domain_info['host'].$domain_info['path']==$current_info['host'].$current_info['path']) {
|
||||
unset($domain);
|
||||
} else {
|
||||
$domain = preg_replace('/^(http|https):\/\//i','', trim($domain));
|
||||
if(substr($domain,-1) != '/') $domain .= '/';
|
||||
}
|
||||
|
|
@ -882,17 +884,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
// XE가 설치된 절대 경로를 구해서 query를 완성
|
||||
|
||||
// 항상 SSL을 이용하고 현재 SSL이 아닌 경우 https에 대한 prefix를 붙임
|
||||
if(Context::get('_use_ssl')=='always') {
|
||||
if($_SERVER['HTTPS']!='on') $query = $this->getRequestUri(ENFORCE_SSL, $domain).$query;
|
||||
$query = $this->getRequestUri(ENFORCE_SSL, $domain).$query;
|
||||
// 상황에 따라 혹은 지정된 대상만 SSL 취급될 경우
|
||||
} elseif(Context::get('_use_ssl')=='optional') {
|
||||
$ssl_mode = RELEASE_SSL;
|
||||
if($get_vars['act'] && $this->_isExistsSSLAction($get_vars['act'])) $ssl_mode = ENFORCE_SSL;
|
||||
$query = $this->getRequestUri($ssl_mode, $domain).$query;
|
||||
// SSL 을 사용하지 않을 경우
|
||||
} else {
|
||||
// SSL상태인데 대상이 SSL이 아닌 경우
|
||||
if($_SERVER['HTTPS']=='on') $query = $this->getRequestUri(ENFORCE_SSL, $domain).$query;
|
||||
// SSL 상태가 아니면 domain값에 따라 query 완성
|
||||
if($_SERVER['HTTPS']=='on' ) $query = $this->getRequestUri(ENFORCE_SSL, $domain).$query;
|
||||
|
||||
// $domain 값이 있을 경우
|
||||
else if($domain) $query = $this->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
|
||||
|
||||
// $domain 값이 없을 경우
|
||||
else $query = getScriptPath().$query;
|
||||
}
|
||||
|
||||
|
|
@ -908,7 +916,6 @@
|
|||
|
||||
// HTTP Request가 아니면 패스
|
||||
if(!isset($_SERVER['SERVER_PROTOCOL'])) return ;
|
||||
|
||||
if(Context::get('_use_ssl') == "always") $ssl_mode = ENFORCE_SSL;
|
||||
|
||||
if($domain) $domain_key = md5($domain);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
) $this->gz_enabled = true;
|
||||
|
||||
// request method에 따른 컨텐츠 결과물 추출
|
||||
if(Context::getRequestMethod() == 'XMLRPC') $output = $this->_toXmlDoc($oModule);
|
||||
if(Context::get('xeVirtualRequestMethod')=='xml') $output = $this->_toVirtualXmlDoc($oModule);
|
||||
else if(Context::getRequestMethod() == 'XMLRPC') $output = $this->_toXmlDoc($oModule);
|
||||
else if(Context::getRequestMethod() == 'JSON') $output = $this->_toJSON($oModule);
|
||||
else $output = $this->_toHTMLDoc($oModule);
|
||||
|
||||
|
|
@ -178,6 +179,32 @@
|
|||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RequestMethod가 virtualXML이면 성공, 실패, redirect에 대해 컨텐츠 생성
|
||||
**/
|
||||
function _toVirtualXmlDoc(&$oModule) {
|
||||
$error = $oModule->getError();
|
||||
$message = $oModule->getMessage();
|
||||
$redirect_url = $oModule->get('redirect_url');
|
||||
$request_uri = Context::get('xeRequestURI');
|
||||
|
||||
if($error === 0) {
|
||||
if($message != 'success') $output->message = $message;
|
||||
if($redirect_url) $output->url = $redirect_url;
|
||||
else $output->url = $request_uri;
|
||||
} else {
|
||||
if($message != 'fail') $output->message = $message;
|
||||
}
|
||||
|
||||
$html = '<script type="text/javascript">'."\n";
|
||||
if($output->message) $html .= 'alert("'.$output->message.'");'."\n";
|
||||
if($output->url) {
|
||||
$output->url = preg_replace('/#(.+)$/i','',$output->url);
|
||||
$html .= 'top.location.href = "'.$output->url.'";'."\n";
|
||||
}
|
||||
$html .= '</script>'."\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RequestMethod가 XML이면 XML 데이터로 컨텐츠 생성
|
||||
|
|
|
|||
|
|
@ -94,6 +94,71 @@ function zGetXmlHttp() {
|
|||
}
|
||||
|
||||
function xml_handlerRequest(callBackFunc, xmlObj, callBackFunc2, response_tags, callback_func_arg, fo_obj) {
|
||||
// ssl action
|
||||
if(typeof(ssl_actions)!='undefined' && typeof(ssl_actions.length)!='undefined' && typeof(this.params['act'])!='undefined') {
|
||||
var action = this.params['act'];
|
||||
for(i=0;i<ssl_actions.length;i++) {
|
||||
if(ssl_actions[i]==action) {
|
||||
this.xml_path = this.xml_path.replace(/^http:\/\//i,'https://');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _u1 = xCreateElement('a');
|
||||
_u1.href = location.href;
|
||||
var _u2 = xCreateElement('a');
|
||||
_u2.href = this.xml_path;
|
||||
|
||||
// 현 url과 ajax call 대상 url의 schema 또는 port가 다르면 직접 form 전송
|
||||
if(_u1.protocol != _u2.protocol || _u1.port != _u2.port) {
|
||||
var fr = xGetElementById('xeTmpIframe');
|
||||
if(!fr) {
|
||||
fr = xCreateElement('iframe');
|
||||
fr.style.position = 'absolute';
|
||||
fr.style.left = '-1px';
|
||||
fr.style.top = '1px';
|
||||
fr.style.width = '1px';
|
||||
fr.style.height = '1px';
|
||||
fr.name = fr.id = 'xeTmpIframe';
|
||||
document.body.appendChild(fr);
|
||||
}
|
||||
|
||||
var fo = xGetElementById('xeVirtualForm');
|
||||
if(fo) document.body.removeChild(fo);
|
||||
|
||||
fo = xCreateElement('form');
|
||||
fo.id = 'xeVirtualForm';
|
||||
fo.action = this.xml_path;
|
||||
fo.method = 'post';
|
||||
fo.target = 'xeTmpIframe';
|
||||
|
||||
var i = xCreateElement('input');
|
||||
i.type = 'hidden';
|
||||
i.name = 'xeVirtualRequestMethod';
|
||||
i.value = 'xml';
|
||||
fo.appendChild(i);
|
||||
|
||||
var j = xCreateElement('input');
|
||||
j.type = 'hidden';
|
||||
j.name = 'xeRequestURI';
|
||||
j.value = location.href;
|
||||
fo.appendChild(j);
|
||||
|
||||
for (var key in this.params) {
|
||||
if(!this.params.hasOwnProperty(key)) continue;
|
||||
var i = xCreateElement('input');
|
||||
i.type = 'hidden';
|
||||
i.name = key;
|
||||
i.value = this.params[key];
|
||||
fo.appendChild(i);
|
||||
}
|
||||
document.body.appendChild(fo);
|
||||
fo.submit();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var rd = "";
|
||||
rd += "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
|
||||
+ "<methodCall>\n"
|
||||
|
|
@ -108,16 +173,6 @@ function xml_handlerRequest(callBackFunc, xmlObj, callBackFunc2, response_tags,
|
|||
rd += "</params>\n"
|
||||
+ "</methodCall>\n";
|
||||
|
||||
// ssl action
|
||||
if(typeof(ssl_actions)!='undefined' && typeof(ssl_actions.length)!='undefined' && typeof(this.params['act'])!='undefined' && /^https:\/\//i.test(location.href) ) {
|
||||
var action = this.params['act'];
|
||||
for(i=0;i<ssl_actions.length;i++) {
|
||||
if(ssl_actions[i]==action) {
|
||||
this.xml_path = this.xml_path.replace(/^http:\/\//i,'https://');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.objXmlHttp.readyState!=0) {
|
||||
this.objXmlHttp.abort();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function XEUploaderStart(obj) {
|
|||
|
||||
var settings = {
|
||||
flash_url : request_uri+"modules/editor/tpl/images/SWFUpload.swf",
|
||||
upload_url: request_uri,
|
||||
upload_url: request_uri.replace(/^https/i,'http'),
|
||||
post_params: {
|
||||
"mid" : current_mid,
|
||||
"act" : "procFileUpload",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue