function pager($rpp, $count, $href, $opts = array(), $pagename = "page") { global $lang_functions, $add_key_shortcut; $pages = ceil($count / $rpp); if (!$opts["lastpagedefault"]) { $pagedefault = 0; } else { $pagedefault = floor(($count - 1) / $rpp); if ($pagedefault < 0) { $pagedefault = 0; } } if (isset($_GET[$pagename])) { $page = 0 + $_GET[$pagename]; if ($page < 0) { $page = $pagedefault; } } else { $page = $pagedefault; } $pager = ""; $mp = $pages - 1; //Opera (Presto) doesn't know about event.altKey $is_presto = strpos($_SERVER['HTTP_USER_AGENT'], 'Presto'); $as = "<b title=\"" . ($is_presto ? $lang_functions['text_shift_pageup_shortcut'] : $lang_functions['text_alt_pageup_shortcut']) . "\"><< " . $lang_functions['text_prev'] . "</b>"; if ($page >= 1) { $pager .= "<a href=\"" . htmlspecialchars($href . $pagename . "=" . ($page - 1)) . "\">"; $pager .= $as; $pager .= "</a>"; } else { $pager .= "<font class=\"gray\">" . $as . "</font>"; } $pager .= " "; $as = "<b title=\"" . ($is_presto ? $lang_functions['text_shift_pagedown_shortcut'] : $lang_functions['text_alt_pagedown_shortcut']) . "\">" . $lang_functions['text_next'] . " >></b>"; if ($page < $mp && $mp >= 0) { $pager .= "<a href=\"" . htmlspecialchars($href . $pagename . "=" . ($page + 1)) . "\">"; $pager .= $as; $pager .= "</a>"; } else { $pager .= "<font class=\"gray\">" . $as . "</font>"; } if ($count) { $pagerarr = array(); $dotted = 0; $dotspace = 3; $dotend = $pages - $dotspace; $curdotend = $page - $dotspace; $curdotstart = $page + $dotspace; for ($i = 0; $i < $pages; $i++) { if ($i >= $dotspace && $i <= $curdotend || $i >= $curdotstart && $i < $dotend) { if (!$dotted) { $pagerarr[] = "..."; } $dotted = 1; continue; } $dotted = 0; $start = $i * $rpp + 1; $end = $start + $rpp - 1; if ($end > $count) { $end = $count; } $text = "{$start} - {$end}"; if ($i != $page) { $pagerarr[] = "<a href=\"" . htmlspecialchars($href . $pagename . "=" . $i) . "\"><b>{$text}</b></a>"; } else { $pagerarr[] = "<font class=\"gray\"><b>{$text}</b></font>"; } } $pagerstr = join(" | ", $pagerarr); $pagertop = "<p align=\"center\">{$pager}<br />{$pagerstr}</p>\n"; $pagerbottom = "<p align=\"center\">{$pagerstr}<br />{$pager}</p>\n"; } else { $pagertop = "<p align=\"center\">{$pager}</p>\n"; $pagerbottom = $pagertop; } $start = $page * $rpp; $add_key_shortcut = key_shortcut($page, $pages - 1); return array($pagertop, $pagerbottom, "LIMIT {$start},{$rpp}"); }
print "</table>\n"; } end_frame(); end_main_frame(); print $pagerbottom; if ($maypost) { print "<br /><table style='border:1px solid #000000;'><tr>" . "<td class=\"text\" align=\"center\"><b>" . $lang_forums['text_quick_reply'] . "</b><br /><br />" . "<form id=\"compose\" name=\"compose\" method=\"post\" action=\"?action=post\" onsubmit=\"return postvalid(this);\">" . "<input type=\"hidden\" name=\"id\" value=\"" . $topicid . "\" /><input type=\"hidden\" name=\"type\" value=\"reply\" /><br />"; quickreply('compose', 'body', $lang_forums['submit_add_reply']); print "</form></td></tr></table>"; print "<p align=\"center\"><a class=\"index\" href=\"" . htmlspecialchars("?action=reply&topicid=" . $topicid) . "\">" . $lang_forums['text_add_reply'] . "</a></p>\n"; } elseif ($locked) { print $lang_forums['text_topic_locked_new_denied']; } else { print $lang_forums['text_unpermitted_posting_here']; } print key_shortcut($page, $pages - 1); stdfoot(); die; } //-------- Action: Move topic if ($action == "movetopic") { $forumid = 0 + $_POST["forumid"]; $topicid = 0 + $_GET["topicid"]; $ismod = is_forum_moderator($topicid, 'topic'); if (!is_valid_id($forumid) || !is_valid_id($topicid) || get_user_class() < $postmanage_class && !$ismod) { permissiondenied(); } // Make sure topic and forum is valid $res = @sql_query("SELECT minclasswrite FROM forums WHERE id={$forumid}") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) != 1) { stderr($lang_forums['std_error'], $lang_forums['std_forum_not_found']);
print($pagerbottom); if ($maypost){ print("<br /><table style='border:1px solid #000000;'><tr>". "<td class=\"text\" align=\"center\"><b>".$lang_forums['text_quick_reply']."</b><br /><br />". "<form id=\"compose\" name=\"compose\" method=\"post\" action=\"?action=post\" onsubmit=\"return postvalid(this);\">". "<input type=\"hidden\" name=\"id\" value=\"".$topicid."\" /><input type=\"hidden\" name=\"type\" value=\"reply\" /><br />"); quickreply('compose', 'body',$lang_forums['submit_add_reply']); print("</form></td></tr></table>"); print("<p align=\"center\"><a class=\"index\" href=\"".htmlspecialchars("?action=reply&topicid=".$topicid)."\">".$lang_forums['text_add_reply']."</a></p>\n"); } elseif ($locked) print($lang_forums['text_topic_locked_new_denied']); else print($lang_forums['text_unpermitted_posting_here']); print(key_shortcut($page,$pages-1)); stdfoot(); die; } //-------- Action: Move topic if ($action == "movetopic") { $forumid = 0+$_POST["forumid"]; $topicid = 0+$_GET["topicid"]; $ismod = is_forum_moderator($topicid,'topic'); if (!is_valid_id($forumid) || !is_valid_id($topicid) || (get_user_class() < $postmanage_class && !$ismod)) permissiondenied();