From 02a913f2a07b2cb2d8e7e9c6c6e207219390eedb Mon Sep 17 00:00:00 2001 From: joyqi Date: Mon, 9 Dec 2013 09:52:39 +0800 Subject: [PATCH 1/2] fixed #111 --- var/Widget/Archive.php | 10 +++++++--- var/Widget/Feedback.php | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php index c5c4d3ae..f93cef51 100644 --- a/var/Widget/Archive.php +++ b/var/Widget/Archive.php @@ -216,8 +216,11 @@ class Widget_Archive extends Widget_Abstract_Contents { parent::__construct($request, $response, $params); - $this->parameter->setDefault(array('pageSize' => $this->options->pageSize, - 'type' => NULL)); + $this->parameter->setDefault(array( + 'pageSize' => $this->options->pageSize, + 'type' => NULL, + 'checkPermalink' => true + )); /** 用于判断是路由调用还是外部调用 */ if (NULL == $this->parameter->type) { @@ -599,7 +602,8 @@ class Widget_Archive extends Widget_Abstract_Contents if ('index' == $type // 首页跳转不用处理 || $this->_makeSinglePageAsFrontPage // 自定义首页不处理 || $this->_invokeByFeed // 不要处理feed - || $this->_invokeFromOutside) { // 不要处理外部调用 + || $this->_invokeFromOutside // 不要处理外部调用 + || !$this->parameter->checkPermalink) { // 强制关闭 return; } diff --git a/var/Widget/Feedback.php b/var/Widget/Feedback.php index fb4cf7c8..28b3801f 100644 --- a/var/Widget/Feedback.php +++ b/var/Widget/Feedback.php @@ -262,7 +262,9 @@ class Widget_Feedback extends Widget_Abstract_Comments implements Widget_Interfa { /** 回调方法 */ $callback = $this->request->type; - $this->_content = Typecho_Router::match($this->request->permalink); + $this->_content = Typecho_Router::match($this->request->permalink, array( + 'checkPermalink' => false + )); /** 判断内容是否存在 */ if (false !== $this->_content && $this->_content instanceof Widget_Archive && From c85bb1dc24a6f049444ffb2e96c4cbc441a3ec78 Mon Sep 17 00:00:00 2001 From: joyqi Date: Mon, 9 Dec 2013 12:55:05 +0800 Subject: [PATCH 2/2] fixed #111 --- var/Widget/Archive.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php index f93cef51..2ab8a42d 100644 --- a/var/Widget/Archive.php +++ b/var/Widget/Archive.php @@ -272,6 +272,7 @@ class Widget_Archive extends Widget_Abstract_Contents if ('/comments/' == $feedQuery || '/comments' == $feedQuery) { /** 专为feed使用的hack */ $this->parameter->type = 'comments'; + $this->parameter->checkPermalink = false; } else { $matched = Typecho_Router::match($this->request->feed, 'pageSize=10&isFeed=1'); if ($matched && $matched instanceof Widget_Archive) { @@ -602,6 +603,7 @@ class Widget_Archive extends Widget_Abstract_Contents if ('index' == $type // 首页跳转不用处理 || $this->_makeSinglePageAsFrontPage // 自定义首页不处理 || $this->_invokeByFeed // 不要处理feed + || 'feed' == $this->parameter->type // 不处理feed || $this->_invokeFromOutside // 不要处理外部调用 || !$this->parameter->checkPermalink) { // 强制关闭 return; @@ -610,8 +612,7 @@ class Widget_Archive extends Widget_Abstract_Contents $value = array( 'page' => $this->_currentPage ); - $value = array_merge($this->_archiveSingle ? $this->row - : $this->_pageRow, $value); + $value = array_merge($this->_archiveSingle ? $this->row : $this->_pageRow, $value); $path = Typecho_Router::url($type, $value); $permalink = Typecho_Common::url($path, $this->options->index);