화면에 표시되는 컨텐츠의 내용중 rewrite mod 사용시 상대경로로 인하여 브라우저 캐시 없이 계속 요청되는 경로를 제대로 표시하도록 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5375 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2009-01-16 04:53:11 +00:00
parent c6f5442b82
commit e8ec53438c
5 changed files with 26 additions and 17 deletions

View file

@ -1203,8 +1203,9 @@
// <img|br> 코드 변환
$content = preg_replace('/<(img|br)([^>\/]*)(\/>|>)/i','<$1$2 />', $content);
// 주소/?mid등과 같은 index.php가 명시되지 않은 파일의 target 변경
//$content = str_replace(Context::getRequestUri().'?',Context::getRequestUri().'index.php?',$content);
// 이미지등의 잘못된 경로를 제거
$content = str_replace(Context::getRequestUri().Context::get('mid').'/'.Context::get('act'),Context::getRequestUri(),$content);
$content = str_replace(Context::getRequestUri().Context::get('mid'),Context::getRequestUri(),$content);
return $content;
}

View file

@ -66,7 +66,13 @@
array_unshift($files, array('file' => $path.'/'.$filename, 'media' => 'all'));
return $this->_getOptimizedRemoved($files);
$files = $this->_getOptimizedRemoved($files);
if(!count($files)) return $files;
foreach($files as $key => $val) {
if(substr($val['file'],0,2)=='./') $files[$key]['file'] = Context::getRequestUri().substr($val['file'],2);
}
return $files;
}
/**
@ -208,10 +214,15 @@ if(!$cached) {
}
function _replaceCssPath($matches) {
static $abpath = null;
if(is_null($abpath)) {
$url_info = parse_url(Context::getRequestUri());
$abpath = $url_info['path'];
}
$path = str_replace(array('"',"'"),'',$matches[1]);
if(preg_match('/^http|^\//i', $path) || preg_match('/\.htc$/i',$path) ) return $matches[0];
return 'url("../../../../'.$this->tmp_css_path.$path.'")';
return 'url("'.$abpath.$this->tmp_css_path.$path.'")';
}
}

View file

@ -47,7 +47,7 @@
// tpl_file이 비어 있거나 해당 파일이 없으면 return
if(!$tpl_file || !file_exists(FileHandler::getRealPath($tpl_file))) return;
$this->tpl_path = $tpl_path;
$this->tpl_path = preg_replace('/^\.\//','',$tpl_path);
$this->tpl_file = $tpl_file;
// compiled된(or 될) 파일이름을 구함
@ -155,12 +155,11 @@
$str1 = $matches[0];
$str2 = $path = $matches[3];
if(!preg_match('/^([a-z0-9\_\.])/i',$path)) return $str1;
if(substr($path,0,1)=='/') return $str1;
$path = preg_replace('/^(\.\/|\/)/','',$path);
$path = '<?php echo $this->tpl_path?>'.$path;
$output = str_replace($str2, $path, $str1);
return $output;
if(substr($path,0,2)=='./') $path = substr($path,2);
$path = '<?php echo Context::getRequestUri().$this->tpl_path; ?>'.$path;
return str_replace($str2, $path, $str1);
}
/**