User Logs - Paging Broken with Search

This commit is contained in:
FusionPBX 2022-05-07 09:36:14 -06:00 committed by GitHub
parent f2aba2251f
commit e83885c722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2018 - 2021 Portions created by the Initial Developer are Copyright (C) 2018 - 2022
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
*/ */
@ -89,6 +89,7 @@
//add the search //add the search
if (isset($_GET["search"])) { if (isset($_GET["search"])) {
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
$search = htmlspecialchars($search);
} }
//get the count //get the count
@ -117,8 +118,8 @@
//prepare to page the results //prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = $search ? "&search=".$search : null; $param = $search ? "search=".$search : null;
$param = ($_GET['show'] == 'all' && permission_exists('user_log_all')) ? "&show=all" : null; $param .= ($_GET['show'] == 'all' && permission_exists('user_log_all')) ? "&show=all" : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0; $page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
@ -190,7 +191,7 @@
echo " <input type='hidden' name='show' value='all'>\n"; echo " <input type='hidden' name='show' value='all'>\n";
} }
else { else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']); echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all&search='.$search]);
} }
} }
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>"; echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";