Conference Centers/Rooms: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-06-02 19:26:58 +00:00
parent 75da594fea
commit 340765af8e
No known key found for this signature in database
5 changed files with 51 additions and 47 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) 2008-2018 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -63,7 +63,7 @@
if (!empty($_POST) && empty($_POST["persistformvar"])) { if (!empty($_POST) && empty($_POST["persistformvar"])) {
//delete the conference center //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 //prepare
$array[0]['checked'] = 'true'; $array[0]['checked'] = 'true';
$array[0]['uuid'] = $conference_center_uuid; $array[0]['uuid'] = $conference_center_uuid;
@ -76,13 +76,13 @@
} }
//get http post variables and set them to php variables //get http post variables and set them to php variables
$conference_center_uuid = $_POST["conference_center_uuid"]; $conference_center_uuid = $_POST["conference_center_uuid"] ?? null;
$dialplan_uuid = $_POST["dialplan_uuid"]; $dialplan_uuid = $_POST["dialplan_uuid"] ?? null;
$conference_center_name = $_POST["conference_center_name"]; $conference_center_name = $_POST["conference_center_name"];
$conference_center_extension = $_POST["conference_center_extension"]; $conference_center_extension = $_POST["conference_center_extension"];
$conference_center_greeting = $_POST["conference_center_greeting"]; $conference_center_greeting = $_POST["conference_center_greeting"];
$conference_center_pin_length = $_POST["conference_center_pin_length"]; $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"]; $conference_center_description = $_POST["conference_center_description"];
//validate the token //validate the token
@ -116,12 +116,12 @@
} }
//add the conference_center_uuid //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(); $conference_center_uuid = uuid();
} }
//add the dialplan_uuid //add the dialplan_uuid
if (!is_uuid($_POST["dialplan_uuid"])) { if (empty($_POST["dialplan_uuid"]) || !is_uuid($_POST["dialplan_uuid"])) {
$dialplan_uuid = uuid(); $dialplan_uuid = uuid();
} }
@ -364,7 +364,7 @@
$recording_filename = $row["recording_filename"]; $recording_filename = $row["recording_filename"];
$recording_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; $recording_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'];
$selected = ''; $selected = '';
if ($conference_center_greeting == $recording_path."/".$recording_filename) { if (!empty($conference_center_greeting) && $conference_center_greeting == $recording_path."/".$recording_filename) {
$selected = "selected='selected'"; $selected = "selected='selected'";
} }
echo " <option value='".escape($recording_path)."/".escape($recording_filename)."' ".escape($selected).">".escape($recording_name)."</option>\n"; echo " <option value='".escape($recording_path)."/".escape($recording_filename)."' ".escape($selected).">".escape($recording_name)."</option>\n";
@ -376,7 +376,7 @@
if (count($phrases) > 0) { if (count($phrases) > 0) {
echo "<optgroup label='".$text['label-phrases']."'>\n"; echo "<optgroup label='".$text['label-phrases']."'>\n";
foreach ($phrases as &$row) { 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 " <option value='phrase:".escape($row["phrase_uuid"])."' ".(($selected) ? "selected='selected'" : null).">".escape($row["phrase_name"])."</option>\n"; echo " <option value='phrase:".escape($row["phrase_uuid"])."' ".(($selected) ? "selected='selected'" : null).">".escape($row["phrase_name"])."</option>\n";
if ($selected) { $tmp_selected = true; } if ($selected) { $tmp_selected = true; }
} }
@ -389,10 +389,10 @@
echo "<optgroup label='".$text['label-sounds']."'>\n"; echo "<optgroup label='".$text['label-sounds']."'>\n";
foreach ($sound_files as $key => $value) { foreach ($sound_files as $key => $value) {
if (!empty($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); $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 " <option value='".escape($value)."' ".(($selected) ? "selected='selected'" : null).">".escape($value)."</option>\n"; echo " <option value='".escape($value)."' ".(($selected) ? "selected='selected'" : null).">".escape($value)."</option>\n";
if ($selected) { $tmp_selected = true; } if ($selected) { $tmp_selected = true; }
} }

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) 2008-2019 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -273,4 +273,4 @@
//include the footer //include the footer
require_once "resources/footer.php"; require_once "resources/footer.php";
?> ?>

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) 2008-2021 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -82,11 +82,11 @@
$announce_count = $_POST["announce_count"]; $announce_count = $_POST["announce_count"];
$sounds = $_POST["sounds"]; $sounds = $_POST["sounds"];
$mute = $_POST["mute"]; $mute = $_POST["mute"];
$created = $_POST["created"]; $created = $_POST["created"] ?? null;
$created_by = $_POST["created_by"]; $created_by = $_POST["created_by"] ?? null;
$email_address = $_POST["email_address"]; $email_address = $_POST["email_address"] ?? null;
$account_code = $_POST["account_code"]; $account_code = $_POST["account_code"];
$enabled = $_POST["enabled"] ?: 'false'; $enabled = $_POST["enabled"] ?? 'false';
$description = $_POST["description"]; $description = $_POST["description"];
//remove any pin number formatting //remove any pin number formatting
@ -166,10 +166,10 @@
} }
unset($sql, $parameters); unset($sql, $parameters);
if (empty($moderator_pin)) { 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)) { 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 .= ") "; $sql .= ") ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['moderator_pin'] = $moderator_pin; $parameters['moderator_pin'] = $moderator_pin;
$parameters['conference_room_uuid'] = $conference_room_uuid; $parameters['conference_room_uuid'] = $conference_room_uuid ?? null;
$database = new database; $database = new database;
$num_rows = $database->select($sql, $parameters, 'column'); $num_rows = $database->select($sql, $parameters, 'column');
if ($num_rows > 0) { if ($num_rows > 0) {
@ -248,7 +248,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
$sql .= ") "; $sql .= ") ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['participant_pin'] = $participant_pin; $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'); $num_rows = $database->select($sql, $parameters, 'column');
if ($num_rows > 0) { if ($num_rows > 0) {
$msg .= $text['message-unique_participant_pin']."<br />\n"; $msg .= $text['message-unique_participant_pin']."<br />\n";
@ -597,12 +597,9 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>".$text['label-conference_name']."</td>\n"; echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>".$text['label-conference_name']."</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n"; echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_center_uuid'>\n"; echo " <select class='formfld' name='conference_center_uuid'>\n";
foreach ($conference_centers as $row) { if (!empty($conference_centers) && is_array($conference_centers) && @sizeof($conference_centers) != 0) {
if ($conference_center_uuid == $row["conference_center_uuid"]) { foreach ($conference_centers as $row) {
echo " <option value='".escape($row["conference_center_uuid"])."' selected='selected'>".escape($row["conference_center_name"])."</option>\n"; echo " <option value='".escape($row["conference_center_uuid"])."' ".(!empty($conference_center_uuid) && $conference_center_uuid == $row["conference_center_uuid"] ? "selected='selected'" : null).">".escape($row["conference_center_name"])."</option>\n";
}
else {
echo " <option value='".escape($row["conference_center_uuid"])."'>".escape($row["conference_center_name"])."</option>\n";
} }
} }
echo " </select>\n"; echo " </select>\n";

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) 2008-2019 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -47,7 +47,7 @@
$text = $language->get(); $text = $language->get();
//set additional variables //set additional variables
$search = $_GET["search"] ?? ''; $search = $_GET["search"] ?? null;
//set from session variables //set from session variables
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; $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 //prepare to page the results
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $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'])) { if (isset($_GET['page'])) {
$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);
@ -197,7 +197,7 @@
//get the conference rooms //get the conference rooms
$conference_center->rows_per_page = $rows_per_page; $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_by = $order_by;
$conference_center->order = $order; $conference_center->order = $order;
if (!empty($search)) { if (!empty($search)) {
@ -251,7 +251,7 @@
echo "<form id='form_search' class='inline' method='get'>\n"; echo "<form id='form_search' class='inline' method='get'>\n";
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>"; echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null)]); echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($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'=>(empty($search) ? 'display: none;' : null)]); echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'conference_rooms.php','style'=>(empty($search) ? 'display: none;' : null)]);
if (!empty($paging_controls_mini)) { if (!empty($paging_controls_mini)) {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n"; echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
} }

View File

@ -17,7 +17,7 @@ The Original Code is FusionPBX
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) 2008-2021 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -146,10 +146,17 @@ if (!class_exists('conference_centers')) {
$sql .= "and u.user_uuid = :user_uuid "; $sql .= "and u.user_uuid = :user_uuid ";
$parameters['user_uuid'] = $_SESSION["user_uuid"]; $parameters['user_uuid'] = $_SESSION["user_uuid"];
} }
//if (is_numeric($this->search)) { if (!empty($this->search)) {
// $sql .= "and p.member_pin = '".$this->search."' "; $sql .= "and (";
// $parameters['domain_uuid'] = $this->domain_uuid; $sql .= "lower(r.conference_room_name) like :search or ";
//} $sql .= "lower(r.moderator_pin) like :search or ";
$sql .= "lower(r.participant_pin) like :search or ";
$sql .= "lower(r.account_code) like :search or ";
$sql .= "lower(r.description) like :search ";
$sql .= ") ";
$parameters['search'] = '%'.strtolower($this->search).'%';
$parameters['domain_uuid'] = $this->domain_uuid;
}
if (isset($this->created_by)) { if (isset($this->created_by)) {
$sql .= "and r.created_by = :created_by "; $sql .= "and r.created_by = :created_by ";
$parameters['created_by'] = $this->created_by; $parameters['created_by'] = $this->created_by;
@ -187,8 +194,8 @@ if (!class_exists('conference_centers')) {
$result[$x]["record"] = $row["record"]; $result[$x]["record"] = $row["record"];
$result[$x]["sounds"] = $row["sounds"]; $result[$x]["sounds"] = $row["sounds"];
$result[$x]["profile"] = $row["profile"]; $result[$x]["profile"] = $row["profile"];
$result[$x]["conference_room_user_uuid"] = $row["conference_room_user_uuid"]; $result[$x]["conference_room_user_uuid"] = $row["conference_room_user_uuid"] ?? null;
$result[$x]["user_uuid"] = $row["user_uuid"]; $result[$x]["user_uuid"] = $row["user_uuid"] ?? null;
$result[$x]["moderator_pin"] = $row["moderator_pin"]; $result[$x]["moderator_pin"] = $row["moderator_pin"];
$result[$x]["participant_pin"] = $row["participant_pin"]; $result[$x]["participant_pin"] = $row["participant_pin"];
$result[$x]["created"] = $row["created"]; $result[$x]["created"] = $row["created"];
@ -316,7 +323,7 @@ if (!class_exists('conference_centers')) {
//build the delete array //build the delete array
foreach ($records as $x => $record) { foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
//get the dialplan uuid //get the dialplan uuid
$sql = "select dialplan_uuid from v_conference_centers "; $sql = "select dialplan_uuid from v_conference_centers ";
@ -404,7 +411,7 @@ if (!class_exists('conference_centers')) {
//build the delete array //build the delete array
foreach ($records as $x => $record) { foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
//create array //create array
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
@ -537,7 +544,7 @@ if (!class_exists('conference_centers')) {
//get current toggle state //get current toggle state
foreach($records as $x => $record) { foreach($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'"; $uuids[] = "'".$record['uuid']."'";
} }
} }
@ -640,9 +647,9 @@ if (!class_exists('conference_centers')) {
//get current toggle state //get current toggle state
foreach($records as $x => $record) { foreach($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[$x] = "'".$record['uuid']."'"; $uuids[$x] = "'".$record['uuid']."'";
if (($this->toggle_field == 'record' || $this->toggle_field == 'enabled') && is_uuid($record['meeting_uuid'])) { if (($this->toggle_field == 'record' || $this->toggle_field == 'enabled') && !empty($record['meeting_uuid']) && is_uuid($record['meeting_uuid'])) {
$meeting_uuid[$record['uuid']] = $record['meeting_uuid']; $meeting_uuid[$record['uuid']] = $record['meeting_uuid'];
} }
} }
@ -742,7 +749,7 @@ if (!class_exists('conference_centers')) {
//get checked records //get checked records
foreach($records as $x => $record) { foreach($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'"; $uuids[] = "'".$record['uuid']."'";
} }
} }
@ -808,4 +815,4 @@ if (!class_exists('conference_centers')) {
print_r($result); print_r($result);
*/ */
?> ?>