function makeLim($page, $numRows, $viewMax) { $page = pageChk($page, $numRows, $viewMax); if (intval($numRows / $viewMax) != 0 && $numRows > 0) { if ($page > 0) { return $page * $viewMax . ',' . $viewMax; } else { return $viewMax; } } else { return ''; } }
function pageNav($page, $numRows, $url, $viewMax, $navCell) { $pageNav = $GLOBALS['l_pages'] . ':'; if (isset($GLOBALS['mod_rewrite']) and $GLOBALS['mod_rewrite'] and ($GLOBALS['action'] == 'vtopic' or $GLOBALS['action'] == 'vthread' or $GLOBALS['action'] == '')) { $mr = '.html'; } else { $mr = ''; } $page = pageChk($page, $numRows, $viewMax); $iVal = intval(($numRows - 1) / $viewMax); if ($iVal > $GLOBALS['viewpagelim']) { $iVal = $GLOBALS['viewpagelim']; if ($GLOBALS['viewpagelim'] >= 1) { $iVal -= 1; } } if ($numRows > 0 && $iVal > 0 && $numRows != $viewMax) { $end = $iVal; if (!$navCell || true) { $start = 0; } else { $start = 1; } if ($page > 0 && !$navCell) { $pageNav .= ' <a href="' . $url . ($page - 1) . $mr . '" class="pageNav"><< ' . $GLOBALS['l_prev'] . '</a>'; } if ($navCell && $end > 4) { $end = 3; $pageNav .= ' '; } elseif ($page < 9 && $end > 9) { $end = 9; $pageNav .= ' '; } elseif ($page >= 9 && $end > 9) { $start = intval($page / 9) * 9 - 1; $end = $start + 10; if ($end > $iVal) { $end = $iVal; } $pageNav .= ' <a href="' . $url . '0' . $mr . '" class="pageNav">1</a> ...'; } else { $pageNav .= ' '; } for ($i = $start; $i <= $end; $i++) { if ($i == $page && !$navCell) { $pageNav .= ' <b class="pageNav pageNavSelected">' . ($i + 1) . '</b> '; } else { $pageNav .= ' <a href="' . $url . $i . $mr . '" class="pageNav" title="' . $GLOBALS['l_page'] . ' ' . ($i + 1) . '">' . ($i + 1) . '</a> '; if ($i >= $end && $i == $iVal) { $pageNav .= ' - <a href="' . $url . $i . $mr . '" class="pageNav" title="' . $GLOBALS['l_page'] . ' ' . ($i + 1) . '">' . $GLOBALS['l_lastpage'] . '</a> '; } } } if ($navCell && $iVal > 4 || $iVal > 9 && $start <= $iVal - 10) { if ($navCell && $iVal < 6) { } else { $pageNav .= '..'; } for ($n = $iVal - 1; $n <= $iVal; $n++) { if ($n >= $i) { $pageNav .= ' <a href="' . $url . $n . $mr . '" class="pageNav" title="' . $GLOBALS['l_page'] . ' ' . ($n + 1) . '">' . ($n + 1) . '</a> '; if ($n == $iVal) { $pageNav .= ' - <a href="' . $url . $n . $mr . '" class="pageNav" title="' . $GLOBALS['l_page'] . ' ' . ($n + 1) . '">' . $GLOBALS['l_lastpage'] . '</a> '; } } } } if ($page < $iVal && !$navCell) { $pageNav .= ' <a href="' . $url . ($page + 1) . $mr . '" class="pageNav">' . $GLOBALS['l_next'] . ' >></a>'; } return $pageNav; } }
$meta_relocate = "{$urlp}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { header("Location: {$urlp}"); exit; } } $topicDesc = 0; $topic_reverse = ''; if (isset($themeDesc) and in_array($topic, $themeDesc)) { $topicDesc = 1; $topic_reverse = "<img src=\"{$main_url}/img/topic_reverse.gif\" align=\"middle\" border=\"0\" alt=\"\" /> "; } if ($page == -1 and $topicDesc == 0) { $page = pageChk($page, $numRows, $viewmaxreplys); } elseif ($page == -1 and $topicDesc == 1) { $page = PAGE1_OFFSET + 1; } if (isset($mod_rewrite) and $mod_rewrite) { $urlp = genTopicURL($main_url, $forum, $forumName, $topic, $topicData[0]); $urlType = 'Topic'; } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; $urlType = 'Gen'; } $pageNav = pageNav($page, $numRows, $urlp, $viewmaxreplys, FALSE, $urlType); if ($pageNav != '') { $mbpn = 'mb'; } $makeLim = makeLim($page, $numRows, $viewmaxreplys);
if (isset($mod_rewrite) and $mod_rewrite and $user_sort == 0 and !isset($_GET['sortBy'])) { $urlp = genForumURL($main_url, $forum, $forumName); $urlType = 'Forum'; } else { if ($user_sort == 0 and !isset($_GET['sortBy'])) { $sburl = ''; } else { $sburl = "&sortBy={$user_sort}"; } $urlp = "{$main_url}/{$indexphp}action=vtopic&forum={$forum}{$sburl}"; $urlType = 'Gen'; } //avoiding duplicated content issues $totalPages = ceil($numRows / $viewmaxtopic); if ($page < PAGE1_OFFSET + 1 or $page - PAGE1_OFFSET > $totalPages) { $realPage = pageChk($page, $numRows, $viewmaxtopic); if (isset($mod_rewrite) and $mod_rewrite and $sortBy == 0) { $urlp = addForumURLPage(genForumURL($main_url, $forum, $forumName), $realPage); } else { $urlp = "{$main_url}/{$indexphp}action=vtopic&forum={$forum}&page={$realPage}"; } header("HTTP/1.1 301 Moved Permanently"); if (isset($metaLocation)) { $meta_relocate = "{$urlp}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { header("Location: {$urlp}"); exit; } }