화면에 표시되는 컨텐츠의 내용중 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

@ -16,9 +16,9 @@
$GLOBALS['_transImageNameList'][$member_srl]->cached = true;
$image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
$image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl);
if(file_exists($image_name_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_name_file = Context::getRequestUri().$image_name_file;
if(file_exists($image_name_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_name_file = $image_name_file;
else $image_name_file = '';
if(file_exists($image_mark_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = Context::getRequestUri().$image_mark_file;
if(file_exists($image_mark_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = $image_mark_file;
else $image_mark_file = '';
} else {
$image_name_file = $GLOBALS['_transImageNameList'][$member_srl]->image_name_file;
@ -28,8 +28,8 @@
// 이미지이름이나 마크가 없으면 원본 정보를 세팅
if(!$image_name_file && !$image_mark_file) return $matches[0];
if($image_name_file) $nick_name = sprintf('<img src="%s" border="0" alt="id: %s" title="id: %s" style="vertical-align:middle;margin-right:3px" />', $image_name_file, strip_tags($nick_name), strip_tags($nick_name));
if($image_mark_file) $nick_name = sprintf('<img src="%s" border="0" alt="id: %s" title="id : %s" style="vertical-align:middle;margin-right:3px"/>%s', $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name);
if($image_name_file) $nick_name = sprintf('<img src="%s%s" border="0" alt="id: %s" title="id: %s" style="vertical-align:middle;margin-right:3px" />', Context::getRequestUri(),$image_name_file, strip_tags($nick_name), strip_tags($nick_name));
if($image_mark_file) $nick_name = sprintf('<img src="%s%s" border="0" alt="id: %s" title="id : %s" style="vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(),$image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name);
$orig_text = preg_replace('/'.preg_quote($matches[5],'/').'<\/'.$matches[6].'>$/', '', $matches[0]);
return $orig_text.$nick_name.'</'.$matches[6].'>';

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);
}
/**

View file

@ -27,8 +27,6 @@
require _XE_PATH_.'config/config.user.inc.php';
}
/**
* @brief 디버깅 메시지 출력 (비트 )
* 0 : 디버그 메시지를 생성/ 출력하지 않음
@ -113,4 +111,4 @@
require_once(_XE_PATH_.'classes/template/TemplateHandler.class.php');
require_once(_XE_PATH_.'classes/mail/Mail.class.php');
if(__DEBUG__) $GLOBALS['__elapsed_class_load__'] = getMicroTime() - __ClassLoadStartTime__;
?>
?>