From fae05e53413bc4d029f8c55efe8f4f5cc4191187 Mon Sep 17 00:00:00 2001 From: Anthony <96078404+AntoniusDC@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:37:30 -0600 Subject: [PATCH] Fixed Warnings for Recordings, Ring Group Edit and Operator Panel (#6739) * Update ring_group_edit.php * Update recordings.php * Update recording_edit.php * Update content.php --- app/basic_operator_panel/resources/content.php | 2 +- app/recordings/recording_edit.php | 2 +- app/recordings/recordings.php | 4 ++-- app/ring_groups/ring_group_edit.php | 13 +++++++------ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/basic_operator_panel/resources/content.php b/app/basic_operator_panel/resources/content.php index 5c48c8f263..93c29c4227 100644 --- a/app/basic_operator_panel/resources/content.php +++ b/app/basic_operator_panel/resources/content.php @@ -111,7 +111,7 @@ if ($fp) { } //prevent warnings -if (!is_array($_SESSION['user']['extensions'])) { +if (empty($_SESSION['user']['extensions'])) { $_SESSION['user']['extensions'] = array(); } diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index 7a7b1f7f6e..f98ced4ebb 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -150,7 +150,7 @@ if (count($_POST) > 0 && empty($_POST["persistformvar"])) { } //pre-populate the form - if (count($_GET)>0 && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && empty($_POST["persistformvar"])) { $recording_uuid = $_GET["id"]; $sql = "select recording_name, recording_filename, recording_description from v_recordings "; $sql .= "where domain_uuid = :domain_uuid "; diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index 8cd79b5ad8..fbed11783f 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -315,7 +315,7 @@ } $sql .= $sql_search; $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; @@ -340,7 +340,7 @@ $sql .= order_by($order_by, $order, 'recording_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; - $recordings = $database->select($sql, $parameters, 'all'); + $recordings = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //get current recordings password diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php index c95f766b8a..015f1c1bc2 100644 --- a/app/ring_groups/ring_group_edit.php +++ b/app/ring_groups/ring_group_edit.php @@ -60,6 +60,7 @@ $ring_group_forward_destination = ''; $ring_group_forward_toll_allow = ''; $ring_group_description = ''; + $onkeyup = ''; //initialize the destinations object $destination = new destinations; @@ -78,7 +79,7 @@ //get the ring_group_uuid $ring_group_uuid = $_REQUEST["id"]; - if (is_uuid($_REQUEST["ring_group_uuid"])) { + if (!empty($_REQUEST["ring_group_uuid"])) { $ring_group_uuid = $_REQUEST["ring_group_uuid"]; } @@ -655,12 +656,12 @@ echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'ring_groups.php']); if ($action == 'update') { $button_margin = 'margin-left: 15px;'; - if (permission_exists('ring_group_add') && (!is_numeric($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) { + if (permission_exists('ring_group_add') && (!isset($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) { echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','style'=>$button_margin,'onclick'=>"modal_open('modal-copy','btn_copy');"]); unset($button_margin); } if (permission_exists('ring_group_delete') || permission_exists('ring_group_destination_delete')) { - echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>$button_margin,'onclick'=>"modal_open('modal-delete','btn_delete');"]); + echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>$button_margin ?? '','onclick'=>"modal_open('modal-delete','btn_delete');"]); unset($button_margin); } } @@ -670,7 +671,7 @@ echo "\n"; if ($action == "update") { - if (permission_exists('ring_group_add') && (!is_numeric($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) { + if (permission_exists('ring_group_add') && (!isset($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) { echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'copy','onclick'=>"modal_close();"])]); } if (permission_exists('ring_group_delete') || permission_exists('ring_group_destination_delete')) { @@ -782,7 +783,7 @@ if (empty($row['destination_delay'])) { $row['destination_delay'] = "0"; } if (empty($row['destination_timeout'])) { $row['destination_timeout'] = "30"; } - if (!empty($row['ring_group_destination_uuid'])) { + if (!empty($row['ring_group_destination_uuid']) && is_uuid($row['ring_group_destination_uuid'])) { echo " \n"; } @@ -853,7 +854,7 @@ } echo " \n"; if ($show_destination_delete && permission_exists('ring_group_destination_delete')) { - if (is_uuid($row['ring_group_destination_uuid'])) { + if (!empty($row['ring_group_destination_uuid']) && is_uuid($row['ring_group_destination_uuid'])) { echo " "; echo " \n"; echo " \n";