From 340765af8e0aa56b3b46c2ffe792f1f2d42c46de Mon Sep 17 00:00:00 2001 From: fusionate Date: Fri, 2 Jun 2023 19:26:58 +0000 Subject: [PATCH] Conference Centers/Rooms: Updates for PHP 8.1 --- .../conference_center_edit.php | 22 ++++++------ app/conference_centers/conference_centers.php | 4 +-- .../conference_room_edit.php | 27 +++++++------- app/conference_centers/conference_rooms.php | 10 +++--- .../resources/classes/conference_centers.php | 35 +++++++++++-------- 5 files changed, 51 insertions(+), 47 deletions(-) diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 03ceb77f92..35fc0848e9 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2018 + Portions created by the Initial Developer are Copyright (C) 2008-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -63,7 +63,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { //delete the conference center - if ($_POST['action'] == 'delete' && permission_exists('conference_center_delete') && is_uuid($conference_center_uuid)) { + if (!empty($_POST['action']) && $_POST['action'] == 'delete' && permission_exists('conference_center_delete') && is_uuid($conference_center_uuid)) { //prepare $array[0]['checked'] = 'true'; $array[0]['uuid'] = $conference_center_uuid; @@ -76,13 +76,13 @@ } //get http post variables and set them to php variables - $conference_center_uuid = $_POST["conference_center_uuid"]; - $dialplan_uuid = $_POST["dialplan_uuid"]; + $conference_center_uuid = $_POST["conference_center_uuid"] ?? null; + $dialplan_uuid = $_POST["dialplan_uuid"] ?? null; $conference_center_name = $_POST["conference_center_name"]; $conference_center_extension = $_POST["conference_center_extension"]; $conference_center_greeting = $_POST["conference_center_greeting"]; $conference_center_pin_length = $_POST["conference_center_pin_length"]; - $conference_center_enabled = $_POST["conference_center_enabled"] ?: 'false'; + $conference_center_enabled = $_POST["conference_center_enabled"] ?? 'false'; $conference_center_description = $_POST["conference_center_description"]; //validate the token @@ -116,12 +116,12 @@ } //add the conference_center_uuid - if (!is_uuid($_POST["conference_center_uuid"])) { + if (empty($_POST["conference_center_uuid"]) || !is_uuid($_POST["conference_center_uuid"])) { $conference_center_uuid = uuid(); } //add the dialplan_uuid - if (!is_uuid($_POST["dialplan_uuid"])) { + if (empty($_POST["dialplan_uuid"]) || !is_uuid($_POST["dialplan_uuid"])) { $dialplan_uuid = uuid(); } @@ -364,7 +364,7 @@ $recording_filename = $row["recording_filename"]; $recording_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; $selected = ''; - if ($conference_center_greeting == $recording_path."/".$recording_filename) { + if (!empty($conference_center_greeting) && $conference_center_greeting == $recording_path."/".$recording_filename) { $selected = "selected='selected'"; } echo " \n"; @@ -376,7 +376,7 @@ if (count($phrases) > 0) { echo "\n"; foreach ($phrases as &$row) { - $selected = ($conference_center_greeting == "phrase:".$row["phrase_uuid"]) ? true : false; + $selected = !empty($conference_center_greeting) && $conference_center_greeting == "phrase:".$row["phrase_uuid"] ? true : false; echo " \n"; if ($selected) { $tmp_selected = true; } } @@ -389,10 +389,10 @@ echo "\n"; foreach ($sound_files as $key => $value) { if (!empty($value)) { - if (substr($conference_center_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { + if (!empty($conference_center_greeting) && substr($conference_center_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $conference_center_greeting = substr($conference_center_greeting, 71); } - $selected = ($conference_center_greeting == $value) ? true : false; + $selected = !empty($conference_center_greeting) && $conference_center_greeting == $value ? true : false; echo " \n"; if ($selected) { $tmp_selected = true; } } diff --git a/app/conference_centers/conference_centers.php b/app/conference_centers/conference_centers.php index f1cb6e2346..6a0e97a9c7 100644 --- a/app/conference_centers/conference_centers.php +++ b/app/conference_centers/conference_centers.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -273,4 +273,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/conference_centers/conference_room_edit.php b/app/conference_centers/conference_room_edit.php index f22b6a42ad..790e8f4891 100644 --- a/app/conference_centers/conference_room_edit.php +++ b/app/conference_centers/conference_room_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2021 + Portions created by the Initial Developer are Copyright (C) 2008-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -82,11 +82,11 @@ $announce_count = $_POST["announce_count"]; $sounds = $_POST["sounds"]; $mute = $_POST["mute"]; - $created = $_POST["created"]; - $created_by = $_POST["created_by"]; - $email_address = $_POST["email_address"]; + $created = $_POST["created"] ?? null; + $created_by = $_POST["created_by"] ?? null; + $email_address = $_POST["email_address"] ?? null; $account_code = $_POST["account_code"]; - $enabled = $_POST["enabled"] ?: 'false'; + $enabled = $_POST["enabled"] ?? 'false'; $description = $_POST["description"]; //remove any pin number formatting @@ -166,10 +166,10 @@ } unset($sql, $parameters); if (empty($moderator_pin)) { - $moderator_pin = get_conference_pin($pin_length, $conference_room_uuid); + $moderator_pin = get_conference_pin($pin_length, $conference_room_uuid ?? null); } if (empty($participant_pin)) { - $participant_pin = get_conference_pin($pin_length, $conference_room_uuid); + $participant_pin = get_conference_pin($pin_length, $conference_room_uuid ?? null); } } @@ -230,7 +230,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $sql .= ") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['moderator_pin'] = $moderator_pin; - $parameters['conference_room_uuid'] = $conference_room_uuid; + $parameters['conference_room_uuid'] = $conference_room_uuid ?? null; $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); if ($num_rows > 0) { @@ -248,7 +248,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $sql .= ") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['participant_pin'] = $participant_pin; - $parameters['conference_room_uuid'] = $conference_room_uuid; + $parameters['conference_room_uuid'] = $conference_room_uuid ?? null; $num_rows = $database->select($sql, $parameters, 'column'); if ($num_rows > 0) { $msg .= $text['message-unique_participant_pin']."
\n"; @@ -597,12 +597,9 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo "".$text['label-conference_name']."\n"; echo "\n"; echo " \n"; diff --git a/app/conference_centers/conference_rooms.php b/app/conference_centers/conference_rooms.php index 5b1eb54378..4eca838f96 100644 --- a/app/conference_centers/conference_rooms.php +++ b/app/conference_centers/conference_rooms.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + 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(); //set additional variables - $search = $_GET["search"] ?? ''; + $search = $_GET["search"] ?? null; //set from session variables $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; @@ -187,7 +187,7 @@ //prepare to page the results $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = $search ? "&search=".$search : null; + $param = !empty($search) ? "&search=".$search : null; if (isset($_GET['page'])) { $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); @@ -197,7 +197,7 @@ //get the conference rooms $conference_center->rows_per_page = $rows_per_page; - $conference_center->offset = $offset ?? ''; + $conference_center->offset = $offset ?? 0; $conference_center->order_by = $order_by; $conference_center->order = $order; if (!empty($search)) { @@ -251,7 +251,7 @@ echo "