mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
#18206713, r6726의 문제 사항을 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6727 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3a396b6f16
commit
1168c09fb9
2 changed files with 33 additions and 14 deletions
|
|
@ -269,7 +269,7 @@
|
|||
/**
|
||||
* @brief 원격파일을 다운받아 return
|
||||
**/
|
||||
function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array()) {
|
||||
function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array()) {
|
||||
set_include_path(_XE_PATH_."libs/PEAR");
|
||||
require_once('PEAR.php');
|
||||
require_once('HTTP/Request.php');
|
||||
|
|
@ -278,16 +278,26 @@
|
|||
$oRequest = new HTTP_Request(__PROXY_SERVER__);
|
||||
$oRequest->setMethod('POST');
|
||||
$oRequest->_timeout = $timeout;
|
||||
$oRequest->addPostData('arg', serialize(array('Destination'=>$url, 'method'=>$method, 'body'=>$body, 'content_type'=>$content_type, "headers"=>$headers)));
|
||||
$oRequest->addPostData('arg', serialize(array('Destination'=>$url, 'method'=>$method, 'body'=>$body, 'content_type'=>$content_type, "headers"=>$headers, "post_data"=>$post_data)));
|
||||
} else {
|
||||
$oRequest = new HTTP_Request($url);
|
||||
if(!$content_type) $oRequest->addHeader('Content-Type', 'text/html');
|
||||
else $oRequest->addHeader('Content-Type', $content_type);
|
||||
if(count($headers)) {
|
||||
foreach($headers as $key => $val) {
|
||||
$oRequest->addHeader($key, $val);
|
||||
}
|
||||
}
|
||||
if($cookies[$host]) {
|
||||
foreach($cookies[$host] as $key => $val) {
|
||||
$oRequest->addCookie($key, $val);
|
||||
}
|
||||
}
|
||||
if(count($post_data)) {
|
||||
foreach($post_data as $key => $val) {
|
||||
$oRequest->addPostData($key, $val);
|
||||
}
|
||||
}
|
||||
if(!$content_type) $oRequest->addHeader('Content-Type', 'text/html');
|
||||
else $oRequest->addHeader('Content-Type', $content_type);
|
||||
$oRequest->setMethod($method);
|
||||
if($body) $oRequest->setBody($body);
|
||||
|
||||
|
|
@ -298,17 +308,20 @@
|
|||
|
||||
$code = $oRequest->getResponseCode();
|
||||
$header = $oRequest->getResponseHeader();
|
||||
$body = $oRequest->getResponseBody();
|
||||
$response = $oRequest->getResponseBody();
|
||||
if($c = $oRequest->getResponseCookies()) {
|
||||
foreach($c as $k => $v) {
|
||||
$cookies[$host][$v['name']] = $v['value'];
|
||||
}
|
||||
}
|
||||
|
||||
if($code == 301 || $code == 302) {
|
||||
$url = $header['location'];
|
||||
if($url) return FileHandler::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers);
|
||||
else return;
|
||||
if($code > 300 && $code < 399 && $header['location']) {
|
||||
return FileHandler::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
|
||||
}
|
||||
|
||||
if($code != 200) return;
|
||||
|
||||
return $body;
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -110,12 +110,18 @@
|
|||
//if($this->module && $module_info->module != $this->module) unset($module_info);
|
||||
}
|
||||
|
||||
// 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
|
||||
if(!$module_info && !$this->module) {
|
||||
$module_info = clone($site_module_info);
|
||||
$module_info->site_srl = $module_info->module_site_srl;
|
||||
// module_site_srl과 site_srl 값이 다르면 redirect 시도
|
||||
if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) {
|
||||
$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
|
||||
header("location:".getSiteUrl($site_info->domain,'mid',$site_module_info->mid));
|
||||
return false;
|
||||
}
|
||||
|
||||
// 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
|
||||
if(!$module_info && !$this->module) $module_info = $site_module_info;
|
||||
|
||||
if(!$module_info && !$this->module && $site_module_info->module_site_srl) $module_info = $site_module_info;
|
||||
|
||||
// 모듈정보와 사이트 모듈정보가 다르면(다른 사이트이면) 페이지 리다이렉트
|
||||
if($module_info && $module_info->site_srl != $site_module_info->site_srl) {
|
||||
// 현재 요청된 모듈이 가상 사이트 모듈일 경우
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue