From 7cfa109b951b2c90cfaa2ba4e1f8edc0272dd28d Mon Sep 17 00:00:00 2001 From: ruan Date: Sat, 19 Sep 2015 14:06:15 +0200 Subject: [PATCH] Make history.php pager inherit 'from' parameter --- history.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/history.php b/history.php index 3640ce1..20e97d0 100644 --- a/history.php +++ b/history.php @@ -73,6 +73,20 @@ $page->name = "Recent Punishments for $name"; $page->print_title(); $page->print_page_header(); +$from = null; +$from_title = null; +$from_href = null; + +if (isset($_GET['from'])) { + // sanitize $_GET['from'] + $info = $page->type_info($_GET['from']); + if ($info['type'] !== null) { + $from_title = $info['title']; + $from = lcfirst($from_title); + $from_href = "$from.php"; + } +} + try { $all = array(); $counts = array(); @@ -133,20 +147,18 @@ try { // print pager if ($page->settings->show_pager) { $page->name = "history"; - $page->print_pager($total, "&uuid=$uuid"); + $args = "&uuid=$uuid"; + if ($from !== null) { + $args .= "&from=$from"; + } + $page->print_pager($total, $args); } } else { echo "No punishments found.

"; } - if (isset($_GET['from'])) { - // sanitize $_GET['from'] - $info = $page->type_info($_GET['from']); - if ($info['type'] !== null) { - $title = $info['title']; - $href = lcfirst($title) . ".php"; - echo "Return to $title"; - } + if ($from_href !== null) { + echo "
Return to $from_title"; } $page->print_footer();