Fixed Errors for Streams & Ring Groups (#6728)

* Fixed Errors streams.php

* Update streams.php

* Update stream_edit.php

* Update ring_groups.php

* Update tones.php

* Update ringbacks.php

* Update ring_group_edit.php
This commit is contained in:
Anthony
2023-05-31 11:00:55 -06:00
committed by GitHub
parent 410f5e6f68
commit f0598117ab
6 changed files with 92 additions and 57 deletions
+30 -17
View File
@@ -48,6 +48,19 @@
$language = new text;
$text = $language->get();
//set the defaults
$ring_group_strategy = '';
$ring_group_name = '';
$ring_group_extension = '';
$ring_group_caller_id_name = '';
$ring_group_caller_id_number = '';
$ring_group_distinctive_ring = '';
$ring_group_missed_call_app = '';
$ring_group_missed_call_data = '';
$ring_group_forward_destination = '';
$ring_group_forward_toll_allow = '';
$ring_group_description = '';
//initialize the destinations object
$destination = new destinations;
@@ -56,11 +69,11 @@
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$total_ring_groups = $database->select($sql, $parameters, 'column');
$total_ring_groups = $database->select($sql, $parameters ?? null, 'column');
unset($sql, $parameters);
//action add or update
if (is_uuid($_REQUEST["id"]) || is_uuid($_REQUEST["ring_group_uuid"])) {
if (!empty($_REQUEST["id"]) || !empty($_REQUEST["ring_group_uuid"])) {
$action = "update";
//get the ring_group_uuid
@@ -89,7 +102,7 @@
//delete the user from the ring group
if (
$_GET["a"] == "delete"
(!empty($_GET["a"])) == "delete"
&& is_uuid($_REQUEST["user_uuid"])
&& permission_exists("ring_group_edit")
) {
@@ -119,7 +132,7 @@
//get total ring group count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['ring_groups']['numeric'] != '') {
if ($_SESSION['limit']['ring_groups']['numeric'] ?? '') {
$sql = "select count(*) from v_ring_groups ";
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -207,7 +220,7 @@
}
//assign the user to the ring group
if (is_uuid($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["id"]) && $_GET["a"] != "delete" && permission_exists("ring_group_edit")) {
if (!empty($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["id"]) && $_GET["a"] != "delete" && permission_exists("ring_group_edit")) {
//set the variables
$user_uuid = $_REQUEST["user_uuid"];
//build array
@@ -464,7 +477,7 @@
}
//pre-populate the form
if (is_uuid($ring_group_uuid)) {
if (!empty($ring_group_uuid)) {
$sql = "select * from v_ring_groups ";
$sql .= "where ring_group_uuid = :ring_group_uuid ";
$parameters['ring_group_uuid'] = $ring_group_uuid;
@@ -519,7 +532,7 @@
$x = 0;
$limit = 5;
}
if (is_uuid($ring_group_uuid)) {
if (!empty($ring_group_uuid)) {
$sql = "select * from v_ring_group_destinations ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and ring_group_uuid = :ring_group_uuid ";
@@ -532,12 +545,12 @@
}
//add an empty row to the options array
if (!is_array($ring_group_destinations) || count($ring_group_destinations) == 0) {
if (!isset($ring_group_destinations) || count($ring_group_destinations) == 0) {
$rows = $_SESSION['ring_group']['destination_add_rows']['numeric'];
$id = 0;
$show_destination_delete = false;
}
if (is_array($ring_group_destinations) && count($ring_group_destinations) > 0) {
if (isset($ring_group_destinations) && count($ring_group_destinations) > 0) {
$rows = $_SESSION['ring_group']['destination_edit_rows']['numeric'];
$id = count($ring_group_destinations)+1;
$show_destination_delete = true;
@@ -551,7 +564,7 @@
}
//get the ring group users
if (is_uuid($ring_group_uuid)) {
if (!empty($ring_group_uuid)) {
$sql = "select u.username, r.user_uuid, r.ring_group_uuid ";
$sql .= "from v_ring_group_users as r, v_users as u ";
$sql .= "where r.user_uuid = u.user_uuid ";
@@ -775,7 +788,7 @@
echo " <tr>\n";
echo " <td class='formfld'>\n";
if (!is_uuid($row['ring_group_destination_uuid'])) { // new record
if (!isset($row['ring_group_destination_uuid'])) { // new record
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
$onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').checked = (this.value != '' ? true : false);\""; // switch
}
@@ -827,7 +840,7 @@
// switch
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='ring_group_destinations_".$x."_destination_enabled' name='ring_group_destinations[".$x."][destination_enabled]' value='true' ".($row['destination_enabled'] == 'true' ? "checked='checked'" : null).">\n";
echo " <input type='checkbox' id='ring_group_destinations_".$x."_destination_enabled' name='ring_group_destinations[".$x."][destination_enabled]' value='true' ".(!empty($row['destination_enabled']) && $row['destination_enabled'] == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
@@ -864,7 +877,7 @@
echo " ".$text['label-timeout_destination']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo $destination->select('dialplan', 'ring_group_timeout_action', $ring_group_timeout_action);
echo $destination->select('dialplan', 'ring_group_timeout_action', $ring_group_timeout_action ?? '');
echo " <br />\n";
echo " ".$text['description-timeout_destination']."\n";
echo "</td>\n";
@@ -877,7 +890,7 @@
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='ring_group_call_timeout' maxlength='255' value='".escape($ring_group_call_timeout)."'>\n";
echo "<br />\n";
echo $text['description-ring_group_call_timeout']." \n";
echo (!empty($text['description-ring_group_call_timeout']))." \n";
echo "</td>\n";
echo "</tr>\n";
@@ -958,7 +971,7 @@
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-user_list']."</td>";
echo " <td class='vtable'>";
if (is_array($ring_group_users) && @sizeof($ring_group_users) != 0) {
if (!empty($ring_group_users)) {
echo " <table width='300px'>\n";
foreach ($ring_group_users as $field) {
echo " <tr>\n";
@@ -1138,10 +1151,10 @@
echo "</table>";
echo "<br><br>";
if (is_uuid($dialplan_uuid)) {
if (!empty($dialplan_uuid)) {
echo "<input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
}
if (is_uuid($ring_group_uuid)) {
if (!empty($ring_group_uuid)) {
echo "<input type='hidden' name='ring_group_uuid' value='".escape($ring_group_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";