From 1a6c988db1190b8697a325de3242666a2a9d8200 Mon Sep 17 00:00:00 2001 From: bnu Date: Sun, 14 Jun 2009 10:58:18 +0000 Subject: [PATCH] =?UTF-8?q?#18032595=20*=20=EC=99=B8=EB=B6=80=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=9D=98=20=EA=B2=BD=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EC=A1=B0=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6539 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/opage/opage.controller.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/opage/opage.controller.php b/modules/opage/opage.controller.php index abaebe022..c9b24e53b 100644 --- a/modules/opage/opage.controller.php +++ b/modules/opage/opage.controller.php @@ -70,6 +70,7 @@ function replaceSrc($content, $path) { $url_info = parse_url($path); $host = sprintf("%s://%s%s",$url_info['scheme'],$url_info['host'],$url_info['port']?':'.$url_info['port']:''); + $this->host = $host.'/'; $path = $url_info['path']; if(substr($path,-1)=='/') $path = substr($path,-1); $t = explode('/',$path); @@ -79,7 +80,7 @@ if(!$v) continue; $_t[] = $v; } - $path = $host.implode('/',$_t); + $path = $host.'/'.implode('/',$_t); if(substr($path,-1)!='/') $path .= '/'; $this->path = $path; $content = preg_replace_callback('/(src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content); @@ -89,9 +90,15 @@ function _replacePath($matches) { $val = trim($matches[3]); - if(preg_match('/^(http|\/|\.\.)/i',$val)) return $matches[0]; - if(substr($val,0,2)=='./') $val = substr($val,2); - return sprintf("%s%s%s%s",$matches[1],$matches[2],$this->path.$val,$matches[4]); + if(preg_match('/^(http|https|ftp|telnet|mms|mailto)/i',$val)) return $matches[0]; + if(substr($val,0,2)=='./') { + $path = $this->path.substr($val,2); + } elseif(substr($val,0,1)=='/') { + $path = $this->host.substr($val,1); + } else { + $path = $this->path.$val; + } + return sprintf("%s%s%s%s", $matches[1], $matches[2], $path, $matches[4]); } }