Make history.php pager inherit 'from' parameter

This commit is contained in:
ruan 2015-09-19 14:06:15 +02:00
parent 20416f4f4d
commit 7cfa109b95

View File

@ -73,6 +73,20 @@ $page->name = "Recent Punishments for $name";
$page->print_title(); $page->print_title();
$page->print_page_header(); $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 { try {
$all = array(); $all = array();
$counts = array(); $counts = array();
@ -133,20 +147,18 @@ try {
// print pager // print pager
if ($page->settings->show_pager) { if ($page->settings->show_pager) {
$page->name = "history"; $page->name = "history";
$page->print_pager($total, "&uuid=$uuid"); $args = "&uuid=$uuid";
if ($from !== null) {
$args .= "&from=$from";
}
$page->print_pager($total, $args);
} }
} else { } else {
echo "No punishments found.<br><br>"; echo "No punishments found.<br><br>";
} }
if (isset($_GET['from'])) { if ($from_href !== null) {
// sanitize $_GET['from'] echo "<br><a class=\"btn\" href=\"$from_href\">Return to $from_title</a>";
$info = $page->type_info($_GET['from']);
if ($info['type'] !== null) {
$title = $info['title'];
$href = lcfirst($title) . ".php";
echo "<a class=\"btn\" href=\"$href\">Return to $title</a>";
}
} }
$page->print_footer(); $page->print_footer();