Bridges - List: Update for PHP 8.1

This commit is contained in:
fusionate 2023-05-09 22:52:32 +00:00
parent 5f2a3fde90
commit be4bf7fa7f
No known key found for this signature in database
1 changed files with 13 additions and 13 deletions

View File

@ -47,14 +47,14 @@
$text = $language->get(); $text = $language->get();
//get the http post data //get the http post data
if (is_array($_POST['bridges'])) { if (isset($_POST['bridges']) && is_array($_POST['bridges'])) {
$action = $_POST['action']; $action = $_POST['action'];
$search = $_POST['search']; $search = $_POST['search'];
$bridges = $_POST['bridges']; $bridges = $_POST['bridges'];
} }
//process the http post data by action //process the http post data by action
if ($action != '' && is_array($bridges) && @sizeof($bridges) != 0) { if (isset($action) && $action != '' && is_array($bridges) && @sizeof($bridges) != 0) {
switch ($action) { switch ($action) {
case 'copy': case 'copy':
if (permission_exists('bridge_add')) { if (permission_exists('bridge_add')) {
@ -81,8 +81,8 @@
} }
//get order and order by //get order and order by
$order_by = $_GET["order_by"]; $order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"]; $order = $_GET["order"] ?? '';
//add the search string //add the search string
if (isset($_GET["search"])) { if (isset($_GET["search"])) {
@ -98,7 +98,7 @@
//get the count //get the count
$sql = "select count(bridge_uuid) from v_bridges "; $sql = "select count(bridge_uuid) from v_bridges ";
if ($_GET['show'] == "all" && permission_exists('bridge_all')) { if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('bridge_all')) {
if (isset($sql_search)) { if (isset($sql_search)) {
$sql .= "where ".$sql_search; $sql .= "where ".$sql_search;
} }
@ -115,9 +115,9 @@
//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 = !empty($search) ? "&search=".$search : null;
$param = ($_GET['show'] == 'all' && permission_exists('bridge_all')) ? "&show=all" : null; $param = (isset($_GET['show']) && $_GET['show'] == 'all' && permission_exists('bridge_all')) ? "&show=all" : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0; $page = isset($_GET['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);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -156,14 +156,14 @@
} }
echo "<form id='form_search' class='inline' method='get'>\n"; echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('bridge_all')) { if (permission_exists('bridge_all')) {
if ($_GET['show'] == 'all') { if (isset($_GET['show']) && $_GET['show'] == 'all') {
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']);
} }
} }
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=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']); echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]); //echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') { if ($paging_controls_mini != '') {
@ -189,7 +189,7 @@
echo "<form id='form_list' method='post'>\n"; echo "<form id='form_list' method='post'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n"; echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n"; echo "<input type='hidden' name='search' value=\"".escape($search ?? '')."\">\n";
echo "<table class='list'>\n"; echo "<table class='list'>\n";
echo "<tr class='list-header'>\n"; echo "<tr class='list-header'>\n";
@ -198,14 +198,14 @@
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($bridges ?: "style='visibility: hidden;'").">\n"; echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($bridges ?: "style='visibility: hidden;'").">\n";
echo " </th>\n"; echo " </th>\n";
} }
if ($_GET['show'] == 'all' && permission_exists('bridge_all')) { if (isset($_GET['show']) && $_GET['show'] == 'all' && permission_exists('bridge_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order); echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
} }
echo th_order_by('bridge_name', $text['label-bridge_name'], $order_by, $order); echo th_order_by('bridge_name', $text['label-bridge_name'], $order_by, $order);
echo th_order_by('bridge_destination', $text['label-bridge_destination'], $order_by, $order); echo th_order_by('bridge_destination', $text['label-bridge_destination'], $order_by, $order);
echo th_order_by('bridge_enabled', $text['label-bridge_enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('bridge_enabled', $text['label-bridge_enabled'], $order_by, $order, null, "class='center'");
echo " <th class='hide-sm-dn'>".$text['label-bridge_description']."</th>\n"; echo " <th class='hide-sm-dn'>".$text['label-bridge_description']."</th>\n";
if (permission_exists('bridge_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { if (permission_exists('bridge_edit') && isset($_SESSION['theme']['list_row_edit_button']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n"; echo " <td class='action-button'>&nbsp;</td>\n";
} }
echo "</tr>\n"; echo "</tr>\n";