1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-01 18:47:20 +01:00

Fix for page next/prev buttons in mod.php

This commit is contained in:
Savetheinternet 2011-02-22 17:52:26 +11:00
parent 7b90d2f06e
commit 819a03d5ae
2 changed files with 25 additions and 10 deletions

View File

@ -499,22 +499,33 @@
// There is no previous page. // There is no previous page.
$btn['prev'] = 'Previous'; $btn['prev'] = 'Previous';
} else { } else {
$btn['prev'] = '<form action="' . $root . $loc = ($mod ? '?/' . $board['uri'] . '/' : '') .
($num == 1 ? ($num == 1 ?
$config['file_index'] $config['file_index']
: :
sprintf($config['file_page'], $num) sprintf($config['file_page'], $num)
) . );
'" method="' . ($mod ? 'post' : 'get') . '"><input type="submit" value="Previous" /></form>';
$btn['prev'] = '<form action="' . ($mod ? '' : $root . $loc) . '" method="get">' .
($mod ?
'<input type="hidden" name="status" value="301" />' .
'<input type="hidden" name="r" value="' . htmlentities($loc) . '" />'
:'') .
'<input type="submit" value="Previous" /></form>';
} }
if($num == count($pages) - 1) { if($num == count($pages) - 1) {
// There is no next page. // There is no next page.
$btn['next'] = 'Next'; $btn['next'] = 'Next';
} else { } else {
$btn['next'] = '<form action="' . $root . $loc = ($mod ? '?/' . $board['uri'] . '/' : '') . sprintf($config['file_page'], $num + 2);
sprintf($config['file_page'], $num + 2) .
'" method="' . ($mod ? 'post' : 'get') . '"><input type="submit" value="Next" /></form>'; $btn['next'] = '<form action="' . ($mod ? '' : $root . $loc) . '" method="get">' .
($mod ?
'<input type="hidden" name="status" value="301" />' .
'<input type="hidden" name="r" value="' . htmlentities($loc) . '" />'
:'') .
'<input type="submit" value="Next" /></form>';
} }
} }
} }

View File

@ -59,6 +59,10 @@
loginForm(false, false, '?' . $query); loginForm(false, false, '?' . $query);
} }
} else { } else {
// Redirect (for index pages)
if(count($_GET) == 2 && isset($_GET['status']) && isset($_GET['r']))
header('Location: ' . $_GET['r'], true, $_GET['status']);
// A sort of "cache" // A sort of "cache"
// Stops calling preg_quote and str_replace when not needed; only does it once // Stops calling preg_quote and str_replace when not needed; only does it once
$regex = Array( $regex = Array(