diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php index 8e6022982..d3f8244dc 100644 --- a/e107_plugins/forum/forum_viewforum.php +++ b/e107_plugins/forum/forum_viewforum.php @@ -129,7 +129,7 @@ if ($pages) { if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false) { - if(!$page) $page = 1; + //if(!$page) $page = 1; $url = rawurlencode(e107::getUrl()->getUrl('forum', 'forum', array('func' => 'view', 'id' => $forumId, 'page' => '[FROM]'))); $parms = "total={$pages}&type=page¤t={$page}&url=".$url."&caption=off"; $fVars->THREADPAGES = $e107->tp->parseTemplate("{NEXTPREV={$parms}}"); @@ -404,7 +404,7 @@ function parse_thread($thread_info) } $tVars->THREADNAME = "{$thread_name}"; - $pages = ceil(($tVars->REPLIES+1)/$forum->prefs->get('postspage')); + $pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage')); if ($pages > 1) { if($pages > 6) diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index 243c3c07e..e25b8a2dd 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -497,7 +497,7 @@ class e107ForumThread header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main'))); exit; } - $this->pages = ceil(($this->threadInfo['thread_total_replies'] + 1) / $this->perPage); + $this->pages = ceil(($this->threadInfo['thread_total_replies']) / $this->perPage); $this->noInc = false; } @@ -541,33 +541,33 @@ class e107ForumThread $postId = varset($_GET['id']); $postInfo = $forum->postGet($postId,'post'); $postNum = $forum->postGetPostNum($postInfo['post_thread'], $postId); - $postPage = ceil($postNum / $forum->prefs->get('postspage'))-1; - $url = $e107->url->getUrl('forum', 'thread', "func=view&id={$postInfo['post_thread']}&page=$postPage"); + $postPage = ceil($postNum / $forum->prefs->get('postspage')); + $url = $e107->url->getUrl('forum', 'thread', "func=view&id={$postInfo['post_thread']}&page=$postPage&raw"); header('location: '.$url); exit; break; case 'last': $pages = ceil(($thread->threadInfo['thread_total_replies'] + 1) / $thread->perPage); - $thread->page = ($pages); + $thread->page = ($pages - 1); break; - case 'next': + case 'next': // FIXME - nextprev thread detection not working $next = $forum->threadGetNextPrev('next', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']); if ($next) { - $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $next)); + $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $next, 'raw' => true)); header("location: {$url}"); exit; } $this->message = LAN_405; break; - case 'prev': + case 'prev': // FIXME - nextprev thread detection not working $prev = $forum->threadGetNextPrev('prev', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']); if ($prev) { - $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $prev)); + $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $prev, 'raw' => true)); header("location: {$url}"); exit; }