forked from leftypol/leftypol
pages.php: better input validation in recent_posts page
This commit is contained in:
parent
8ee3f4c81d
commit
2e1cb7995f
1 changed files with 14 additions and 2 deletions
|
|
@ -3015,8 +3015,20 @@ function mod_recent_posts(Context $ctx, $lim, $board_list = false, $json = false
|
|||
if (!hasPermission($config['mod']['recent']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$limit = (is_numeric($lim))? $lim : 25;
|
||||
$last_time = (isset($_GET['last']) && is_numeric($_GET['last'])) ? $_GET['last'] : 0;
|
||||
$limit = 25;
|
||||
if (\is_numeric($lim)) {
|
||||
$lim = \intval($lim);
|
||||
if ($lim > 0 && $lim < 1000) {
|
||||
$limit = $lim;
|
||||
}
|
||||
}
|
||||
$last_time = 0;
|
||||
if (isset($_GET['last']) && \is_numeric($_GET['last'])) {
|
||||
$last = \intval($_GET['last']);
|
||||
if ($last > 0) {
|
||||
$last_time = $last;
|
||||
}
|
||||
}
|
||||
|
||||
$mod_boards = [];
|
||||
$boards = listBoards();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue