diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index a1e09de46..1bd7b0646 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -96,6 +96,17 @@ // 상대 경로 설정 $this->path = $this->getRequestUri(); + + // rewrite module때문에 javascript에서 location.href 문제 해결을 위해 직접 실제 경로 설정 + if($this->get_vars) { + foreach($this->get_vars as $key => $val) { + if(!$val) continue; + $url .= ($url?'&':'').$key.'='.$val; + } + Context::set('current_url',sprintf('%s?%s',$this->path, $url)); + } else { + Context::set('current_url',$this->getUrl()); + } } /** diff --git a/common/js/common.js b/common/js/common.js index f30b255b1..08b54b824 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -8,9 +8,9 @@ * @brief location.href에서 특정 key의 값을 return **/ String.prototype.getQuery = function(key) { - var idx = this.indexOf('?'); + var idx = current_url.indexOf('?'); if(idx == -1) return null; - var query_string = this.substr(idx+1, this.length); + var query_string = current_url.substr(idx+1, current_url.length); var args = {} query_string.replace(/([^=]+)=([^&]*)(&|$)/g, function() { args[arguments[1]] = arguments[2]; }); @@ -24,12 +24,12 @@ String.prototype.getQuery = function(key) { * @brief location.href에서 특정 key의 값을 return **/ String.prototype.setQuery = function(key, val) { - var idx = this.indexOf('?'); - var uri = this; + var idx = current_url.indexOf('?'); + var uri = current_url; uri = uri.replace(/#$/,''); if(idx != -1) { - uri = this.substr(0, idx); - var query_string = this.substr(idx+1, this.length); + uri = current_url.substr(0, idx); + var query_string = current_url.substr(idx+1, current_url.length); var args = new Array(); query_string.replace(/([^=]+)=([^&]*)(&|$)/g, function() { args[arguments[1]] = arguments[2]; }); diff --git a/common/tpl/common_layout.html b/common/tpl/common_layout.html index 6e2b489ef..f0aabceb2 100644 --- a/common/tpl/common_layout.html +++ b/common/tpl/common_layout.html @@ -19,6 +19,7 @@ {Context::getHtmlHeader()} diff --git a/modules/blog/skins/default/trackback.html b/modules/blog/skins/default/trackback.html index 48e27b3c3..857fd47e8 100644 --- a/modules/blog/skins/default/trackback.html +++ b/modules/blog/skins/default/trackback.html @@ -16,7 +16,7 @@