Misc: Mitigate PHP 8.1 warnings.
This commit is contained in:
parent
044b91ec6c
commit
518c32efe6
|
|
@ -234,21 +234,27 @@
|
||||||
//get the variables from inside the { and } brackets
|
//get the variables from inside the { and } brackets
|
||||||
preg_match('/^\{([^}]+)\}/', $bridge_destination, $matches);
|
preg_match('/^\{([^}]+)\}/', $bridge_destination, $matches);
|
||||||
|
|
||||||
//create a variables array from the comma delimitted string
|
if (!empty($matches) && is_array($matches) && @sizeof($matches) != 0) {
|
||||||
$variables = explode(",", $matches[1]);
|
|
||||||
|
|
||||||
//strip the variables from the $bridge_destination variable
|
//create a variables array from the comma delimitted string
|
||||||
$bridge_destination = str_replace("{$matches[0]}", '', $bridge_destination);
|
$variables = explode(",", $matches[1]);
|
||||||
|
|
||||||
|
//strip the variables from the $bridge_destination variable
|
||||||
|
$bridge_destination = str_replace("{$matches[0]}", '', $bridge_destination);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//build a bridge variables data set
|
//build a bridge variables data set
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach($variables as $variable) {
|
if (!empty($variables) && is_array($variables)) {
|
||||||
$pairs = explode("=", $variable);
|
foreach($variables as $variable) {
|
||||||
$database_variables[$x]['name'] = $pairs[0];
|
$pairs = explode("=", $variable);
|
||||||
$database_variables[$x]['value'] = $pairs[1];
|
$database_variables[$x]['name'] = $pairs[0];
|
||||||
$database_variables[$x]['label'] = ucwords(str_replace('_', ' ', $pairs[0]));
|
$database_variables[$x]['value'] = $pairs[1];
|
||||||
$database_variables[$x]['label'] = str_replace('Effective Caller Id', 'Caller ID', $database_variables[$x]['label']);
|
$database_variables[$x]['label'] = ucwords(str_replace('_', ' ', $pairs[0]));
|
||||||
$x++;
|
$database_variables[$x]['label'] = str_replace('Effective Caller Id', 'Caller ID', $database_variables[$x]['label']);
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,9 +316,9 @@
|
||||||
|
|
||||||
//get the gateways
|
//get the gateways
|
||||||
$actions = explode(',', $bridge_destination);
|
$actions = explode(',', $bridge_destination);
|
||||||
foreach($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
$action_array = explode('/',$action);
|
$action_array = explode('/',$action);
|
||||||
if ($action_array[1] == 'gateway') {
|
if (!empty($action_array) && is_array($action_array) && !empty($action_array[1]) && $action_array[1] == 'gateway') {
|
||||||
$bridge_gateways[] = $action_array[2];
|
$bridge_gateways[] = $action_array[2];
|
||||||
$destination_number = $action_array[3];
|
$destination_number = $action_array[3];
|
||||||
}
|
}
|
||||||
|
|
@ -385,9 +391,11 @@
|
||||||
echo " ";
|
echo " ";
|
||||||
echo " }\n";
|
echo " }\n";
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo " window.onload = function() {\n";
|
if (!empty($bridge_action)) {
|
||||||
echo " action_control('".$bridge_action."');\n";
|
echo " window.onload = function() {\n";
|
||||||
echo " };\n";
|
echo " action_control('".$bridge_action."');\n";
|
||||||
|
echo " };\n";
|
||||||
|
}
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
//show the content
|
//show the content
|
||||||
|
|
@ -431,7 +439,7 @@
|
||||||
echo " <option value=''></option>\n";
|
echo " <option value=''></option>\n";
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($bridge_actions as $row) {
|
foreach($bridge_actions as $row) {
|
||||||
echo " <option value='".$row['action']."' ".($bridge_action == $row['action'] ? "selected='selected'" : null).">".$row['label']."</option>\n";
|
echo " <option value='".$row['action']."' ".(!empty($bridge_action) && $bridge_action == $row['action'] ? "selected='selected'" : null).">".$row['label']."</option>\n";
|
||||||
}
|
}
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
|
|
@ -465,7 +473,7 @@
|
||||||
echo " <select class='formfld' name='bridge_profile'>\n";
|
echo " <select class='formfld' name='bridge_profile'>\n";
|
||||||
echo " <option value=''></option>\n";
|
echo " <option value=''></option>\n";
|
||||||
foreach ($sip_profiles as $row) {
|
foreach ($sip_profiles as $row) {
|
||||||
if ($bridge_profile == $row["sip_profile_name"]) {
|
if (!empty($bridge_profile) && $bridge_profile == $row["sip_profile_name"]) {
|
||||||
echo " <option value='".$row['sip_profile_name']."' selected='selected'>".escape($row["sip_profile_name"])."</option>\n";
|
echo " <option value='".$row['sip_profile_name']."' selected='selected'>".escape($row["sip_profile_name"])."</option>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -485,9 +493,9 @@
|
||||||
echo "<td width='70%' class='vtable' style='position: relative;' align='left'>\n";
|
echo "<td width='70%' class='vtable' style='position: relative;' align='left'>\n";
|
||||||
for ($x = 0; $x <= 2; $x++) {
|
for ($x = 0; $x <= 2; $x++) {
|
||||||
if ($x > 0) { echo "<br />\n"; }
|
if ($x > 0) { echo "<br />\n"; }
|
||||||
echo "<select name=\"bridge_gateways[]\" id=\"gateway\" class=\"formfld\" $onchange>\n";
|
echo "<select name='bridge_gateways[]' id='gateway' class='formfld' ".($onchange ?? '').">\n";
|
||||||
echo "<option value=''></option>\n";
|
echo "<option value=''></option>\n";
|
||||||
echo "<optgroup label='".$text['label-gateway']."gateway'>\n";
|
echo "<optgroup label='".$text['label-bridge_gateways']."'>\n";
|
||||||
$previous_domain_uuid = '';
|
$previous_domain_uuid = '';
|
||||||
foreach($gateways as $row) {
|
foreach($gateways as $row) {
|
||||||
if (permission_exists('outbound_route_any_gateway')) {
|
if (permission_exists('outbound_route_any_gateway')) {
|
||||||
|
|
@ -503,7 +511,7 @@
|
||||||
echo "</optgroup>";
|
echo "</optgroup>";
|
||||||
echo "<optgroup label=' ".$domain_name."'>\n";
|
echo "<optgroup label=' ".$domain_name."'>\n";
|
||||||
}
|
}
|
||||||
if ($row['gateway_uuid'] == $bridge_gateways[$x]) {
|
if (!empty($bridge_gateways) && is_array($bridge_gateways) && $row['gateway_uuid'] == $bridge_gateways[$x]) {
|
||||||
echo "<option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n"; //." db:".$row['gateway_uuid']." bg:".$bridge_gateways[$x]
|
echo "<option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n"; //." db:".$row['gateway_uuid']." bg:".$bridge_gateways[$x]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -511,7 +519,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($row['gateway_uuid'] == $bridge_gateways[$x]) {
|
if (!empty($bridge_gateways) && is_array($bridge_gateways) && $row['gateway_uuid'] == $bridge_gateways[$x]) {
|
||||||
echo "<option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" $onchange selected=\"selected\">".escape($row['gateway'])."</option>\n";
|
echo "<option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" $onchange selected=\"selected\">".escape($row['gateway'])."</option>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -538,7 +546,7 @@
|
||||||
echo " ".$text['label-destination_number']."\n";
|
echo " ".$text['label-destination_number']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||||
echo " <textarea class='formfld' name='destination_number'>".escape($destination_number)."</textarea>\n";
|
echo " <textarea class='formfld' name='destination_number'>".escape($destination_number ?? '')."</textarea>\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-destination_number']."\n";
|
echo $text['description-destination_number']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
|
|
|
||||||
|
|
@ -506,7 +506,7 @@ if (!class_exists('destinations')) {
|
||||||
if (isset($destination_key) && $key == $destination_key) {
|
if (isset($destination_key) && $key == $destination_key) {
|
||||||
foreach($value as $k => $row) {
|
foreach($value as $k => $row) {
|
||||||
$selected = ($row['destination'] == $destination_value) ? "selected='selected'" : '';
|
$selected = ($row['destination'] == $destination_value) ? "selected='selected'" : '';
|
||||||
$uuid = isset($row[$this->singular($key).'_uuid']) ? $row[$this->singular($key).'_uuid'] : $row['uuid'];
|
$uuid = isset($row[$this->singular($key).'_uuid']) ? $row[$this->singular($key).'_uuid'] : ($row['uuid'] ?? '');
|
||||||
$response .= " <option id='{$uuid}' value='".$row['destination']."' $selected>".$row['label']."</option>\n";
|
$response .= " <option id='{$uuid}' value='".$row['destination']."' $selected>".$row['label']."</option>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -881,7 +881,7 @@ if (!class_exists('destinations')) {
|
||||||
|
|
||||||
$name = $row['name'];
|
$name = $row['name'];
|
||||||
$label = $row['label'];
|
$label = $row['label'];
|
||||||
$destination = $row['field']['destination'];
|
$destination = $row['field']['destination'] ?? null;
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
|
||||||
|
|
@ -889,7 +889,7 @@ if (!class_exists('destinations')) {
|
||||||
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
|
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
|
if (isset($row['result']) && is_array($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
|
||||||
$label2 = $label;
|
$label2 = $label;
|
||||||
foreach ($row['result']['data'] as $data) {
|
foreach ($row['result']['data'] as $data) {
|
||||||
$select_value = $row['select_value'][$destination_type];
|
$select_value = $row['select_value'][$destination_type];
|
||||||
|
|
@ -920,12 +920,12 @@ if (!class_exists('destinations')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$select_value = str_replace("\${".$key."}", $data[$key], $select_value);
|
$select_value = str_replace("\${".$key."}", ($data[$key] ?? ''), $select_value);
|
||||||
if (empty($data['label'])) {
|
if (empty($data['label'])) {
|
||||||
$select_label = str_replace("\${".$key."}", $data[$key], $select_label);
|
$select_label = str_replace("\${".$key."}", ($data[$key] ?? ''), $select_label);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$label = $data['label'];
|
// $label = $data['label'];
|
||||||
$select_label = str_replace("\${".$key."}", $text2['option-'.$label], $select_label);
|
$select_label = str_replace("\${".$key."}", $text2['option-'.$label], $select_label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -949,7 +949,7 @@ if (!class_exists('destinations')) {
|
||||||
$select_label = str_replace("✉", 'email-icon', $select_label);
|
$select_label = str_replace("✉", 'email-icon', $select_label);
|
||||||
$select_label = escape(trim($select_label));
|
$select_label = escape(trim($select_label));
|
||||||
$select_label = str_replace('email-icon', '✉', $select_label);
|
$select_label = str_replace('email-icon', '✉', $select_label);
|
||||||
if ($select_value == $destination_value) { $selected = "true' "; } else { $selected = 'false'; }
|
if (isset($destination_value) && $select_value == $destination_value) { $selected = "true' "; } else { $selected = 'false'; }
|
||||||
if ($label2 == 'destinations') { $select_label = format_phone($select_label); }
|
if ($label2 == 'destinations') { $select_label = format_phone($select_label); }
|
||||||
|
|
||||||
$array[$name][$i] = $data;
|
$array[$name][$i] = $data;
|
||||||
|
|
@ -959,7 +959,7 @@ if (!class_exists('destinations')) {
|
||||||
//$array[$name][$i]['select_value'] = $select_value;
|
//$array[$name][$i]['select_value'] = $select_value;
|
||||||
//$array[$name][$i]['selected'] = $selected;
|
//$array[$name][$i]['selected'] = $selected;
|
||||||
$array[$name][$i]['destination'] = $select_value;
|
$array[$name][$i]['destination'] = $select_value;
|
||||||
$array[$name][$i]["extension"] = $data["extension"];
|
$array[$name][$i]["extension"] = $data["extension"] ?? null;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
|
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
|
||||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".($_SESSION['domain']['template']['name'] ?? '')."/index.php")) {
|
||||||
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
|
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ if (!class_exists('permissions')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($permissions)) {
|
if (empty($permissions)) {
|
||||||
$permissions = $_SESSION["permissions"];
|
$permissions = $_SESSION["permissions"] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
//set default to false
|
//set default to false
|
||||||
|
|
|
||||||
|
|
@ -1211,7 +1211,7 @@ function number_pad($number,$n) {
|
||||||
else { //rgb(a)
|
else { //rgb(a)
|
||||||
$rgb = implode(',', $color);
|
$rgb = implode(',', $color);
|
||||||
if (!empty($alpha)) { $rgb .= ','.$alpha; $a = 'a'; }
|
if (!empty($alpha)) { $rgb .= ','.$alpha; $a = 'a'; }
|
||||||
if ($wrapper) { $rgb = 'rgb'.$a.'('.$rgb.')'; }
|
if ($wrapper) { $rgb = 'rgb'.($a ?? '').'('.$rgb.')'; }
|
||||||
return $rgb;
|
return $rgb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue