mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 15:22:15 +09:00
BUG FIX : XE를 도메인 루트가 아닌 곳에 설치했을 때 외부 페이지에서 사용된 파일의 경로를 올바르게 변경하지 못하던 버그 수정 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7354 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
050e5a7c8c
commit
9e91ec5639
2 changed files with 39 additions and 4 deletions
|
|
@ -1520,5 +1520,40 @@
|
|||
$oContext = &Context::getInstance();
|
||||
return $oContext->allow_rewrite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 로컬 경로를 웹 경로로 변경
|
||||
*/
|
||||
function pathToUrl($path) {
|
||||
$xe = _XE_PATH_;
|
||||
$path = strtr($path, "\\", "/");
|
||||
|
||||
$base_url = preg_replace('@^https?://[^/]+/+@', '', Context::getDefaultUrl());
|
||||
|
||||
$_xe = explode('/', $xe);
|
||||
$_path = explode('/', $path);
|
||||
$_base = explode('/', $base_url);
|
||||
|
||||
if (!$_base[count($_base)-1]) array_pop($_base);
|
||||
|
||||
foreach($_xe as $idx=>$dir) {
|
||||
if($_path[0] != $dir) break;
|
||||
array_shift($_path);
|
||||
}
|
||||
|
||||
$idx = count($_xe) - $idx - 1;
|
||||
while($idx--) {
|
||||
if (count($_base)) array_shift($_base);
|
||||
else array_unshift($_base, '..');
|
||||
}
|
||||
|
||||
if (count($_base)) {
|
||||
array_unshift($_path, implode('/', $_base));
|
||||
}
|
||||
|
||||
$path = '/'.implode('/', $_path);
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue