mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Devices - List: Updates for PHP 8.1
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008 - 2020
|
||||
Portions created by the Initial Developer are Copyright (C) 2008 - 2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -47,7 +47,7 @@
|
||||
$text = $language->get();
|
||||
|
||||
//get posted data
|
||||
if (is_array($_POST['devices'])) {
|
||||
if (!empty($_POST['devices']) && is_array($_POST['devices'])) {
|
||||
$action = $_POST['action'];
|
||||
$devices = $_POST['devices'];
|
||||
}
|
||||
@@ -57,7 +57,7 @@
|
||||
$fields = strtolower($_REQUEST["fields"] ?? '');
|
||||
|
||||
//process the http post data by action
|
||||
if ($action != '' && is_array($devices) && @sizeof($devices) != 0) {
|
||||
if (!empty($action) && !empty($devices) && is_array($devices) && @sizeof($devices) != 0) {
|
||||
switch ($action) {
|
||||
case 'toggle':
|
||||
if (permission_exists('device_edit')) {
|
||||
@@ -78,8 +78,8 @@
|
||||
}
|
||||
|
||||
//get order and order by and sanatize the values
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//set the time zone
|
||||
if (isset($_SESSION['domain']['time_zone']['name'])) {
|
||||
@@ -165,22 +165,22 @@
|
||||
$parameters['search'] = '%'.strtolower($search).'%';
|
||||
}
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$param = '';
|
||||
if ($search) {
|
||||
$param = "&search=".$search;
|
||||
$param .= "&fields=".$fields;
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
$param .= "&show=all";
|
||||
}
|
||||
$page = $_GET['page'];
|
||||
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
|
||||
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);
|
||||
$page = $_GET['page'] ?? 0;
|
||||
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);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
@@ -303,16 +303,16 @@
|
||||
unset($margin_left);
|
||||
}
|
||||
if (permission_exists('device_edit') && $devices) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none; '.$margin_left,'onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none; '.($margin_left ?? null),'onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
unset($margin_left);
|
||||
}
|
||||
if (permission_exists('device_delete') && $devices) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.$margin_left,'onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.($margin_left ?? null),'onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
unset($margin_left);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if (permission_exists('device_all')) {
|
||||
if ($_GET['show'] == 'all') {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
@@ -359,24 +359,24 @@
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('device_edit') || permission_exists('device_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($devices ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($devices) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, null, null, $param);
|
||||
}
|
||||
echo th_order_by('device_mac_address', $text['label-device_mac_address'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('device_label', $text['label-device_label'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('device_mac_address', $text['label-device_mac_address'], $order_by, $order, null, null, $param ?? null);
|
||||
echo th_order_by('device_label', $text['label-device_label'], $order_by, $order, null, null, $param ?? null);
|
||||
if ($device_alternate) {
|
||||
echo th_order_by('device_template', $text['label-device_uuid_alternate'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('device_template', $text['label-device_uuid_alternate'], $order_by, $order, null, null, $param ?? null);
|
||||
}
|
||||
echo th_order_by('device_vendor', $text['label-device_vendor'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('device_template', $text['label-device_template'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('device_vendor', $text['label-device_vendor'], $order_by, $order, null, null, $param ?? null);
|
||||
echo th_order_by('device_template', $text['label-device_template'], $order_by, $order, null, null, $param ?? null);
|
||||
echo "<th>". $text['label-device_profiles']."</th>\n";
|
||||
echo th_order_by('device_enabled', $text['label-device_enabled'], $order_by, $order, null, "class='center'", $param);
|
||||
echo th_order_by('device_provisioned_date', $text['label-device_status'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order, null, "class='hide-sm-dn'", $param);
|
||||
if (permission_exists('device_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo th_order_by('device_enabled', $text['label-device_enabled'], $order_by, $order, null, "class='center'", $param ?? null);
|
||||
echo th_order_by('device_provisioned_date', $text['label-device_status'], $order_by, $order, null, null, $param ?? null);
|
||||
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order, null, "class='hide-sm-dn'", $param ?? null);
|
||||
if (permission_exists('device_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -413,7 +413,7 @@
|
||||
echo " <input type='hidden' name='devices[$x][uuid]' value='".escape($row['device_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||
}
|
||||
echo " <td class='no-wrap'>";
|
||||
@@ -444,7 +444,7 @@
|
||||
echo " </td>\n";
|
||||
echo " <td class='no-link'><a title='".escape($row['device_provisioned_agent'])."' href='javascript:void(0)'>".escape($row['provisioned_date_formatted'])." ".escape($row['provisioned_time_formatted'])."</a> ".escape($device_provisioned_method)." <a href='".escape($device_provisioned_method)."://".escape($row['device_provisioned_ip'])."' target='_blank'>".escape($row['device_provisioned_ip'])."</a> </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['device_description'])." </td>\n";
|
||||
if (permission_exists('device_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('device_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
@@ -466,4 +466,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user