mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Dashboard - Switch Status: Updates for PHP 8.1
This commit is contained in:
@@ -71,7 +71,7 @@ if (!class_exists('registrations')) {
|
|||||||
}
|
}
|
||||||
$sql .= "and sip_profile_enabled = 'true' ";
|
$sql .= "and sip_profile_enabled = 'true' ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$sip_profiles = $database->select($sql, $parameters, 'all');
|
$sip_profiles = $database->select($sql, $parameters ?? null, 'all');
|
||||||
if (is_array($sip_profiles) && @sizeof($sip_profiles) != 0) {
|
if (is_array($sip_profiles) && @sizeof($sip_profiles) != 0) {
|
||||||
foreach ($sip_profiles as $field) {
|
foreach ($sip_profiles as $field) {
|
||||||
|
|
||||||
@@ -100,33 +100,33 @@ if (!class_exists('registrations')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//normalize the array
|
//normalize the array
|
||||||
if (is_array($array) && !is_array($array['registrations']['registration'][0])) {
|
if (!empty($array) && is_array($array) && (!isset($array['registrations']['registration'][0]) || !is_array($array['registrations']['registration'][0]))) {
|
||||||
$row = $array['registrations']['registration'];
|
$row = $array['registrations']['registration'];
|
||||||
unset($array['registrations']['registration']);
|
unset($array['registrations']['registration']);
|
||||||
$array['registrations']['registration'][0] = $row;
|
$array['registrations']['registration'][0] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the registrations array
|
//set the registrations array
|
||||||
if (is_array($array)) {
|
if (!empty($array) && is_array($array)) {
|
||||||
foreach ($array['registrations']['registration'] as $row) {
|
foreach ($array['registrations']['registration'] as $row) {
|
||||||
|
|
||||||
//build the registrations array
|
//build the registrations array
|
||||||
//$registrations[0] = $row;
|
//$registrations[0] = $row;
|
||||||
$user_array = explode('@', $row['user']);
|
$user_array = explode('@', $row['user'] ?? '');
|
||||||
$registrations[$id]['user'] = $row['user'] ?: '';
|
$registrations[$id]['user'] = $row['user'] ?? '';
|
||||||
$registrations[$id]['call-id'] = $row['call-id'] ?: '';
|
$registrations[$id]['call-id'] = $row['call-id'] ?? '';
|
||||||
$registrations[$id]['contact'] = $row['contact'] ?: '';
|
$registrations[$id]['contact'] = $row['contact'] ?? '';
|
||||||
$registrations[$id]['sip-auth-user'] = $row['sip-auth-user'] ?: '';
|
$registrations[$id]['sip-auth-user'] = $row['sip-auth-user'] ?? '';
|
||||||
$registrations[$id]['agent'] = $row['agent'] ?: '';
|
$registrations[$id]['agent'] = $row['agent'] ?? '';
|
||||||
$registrations[$id]['host'] = $row['host'] ?: '';
|
$registrations[$id]['host'] = $row['host'] ?? '';
|
||||||
$registrations[$id]['network-ip'] = $row['network-ip'] ?: '';
|
$registrations[$id]['network-ip'] = $row['network-ip'] ?? '';
|
||||||
$registrations[$id]['network-port'] = $row['network-port'] ?: '';
|
$registrations[$id]['network-port'] = $row['network-port'] ?? '';
|
||||||
$registrations[$id]['sip-auth-user'] = $row['sip-auth-user'] ?: '';
|
$registrations[$id]['sip-auth-user'] = $row['sip-auth-user'] ?? '';
|
||||||
$registrations[$id]['sip-auth-realm'] = $row['sip-auth-realm'] ?: '';
|
$registrations[$id]['sip-auth-realm'] = $row['sip-auth-realm'] ?? '';
|
||||||
$registrations[$id]['mwi-account'] = $row['mwi-account'] ?: '';
|
$registrations[$id]['mwi-account'] = $row['mwi-account'] ?? '';
|
||||||
$registrations[$id]['status'] = $row['status'] ?: '';
|
$registrations[$id]['status'] = $row['status'] ?? '';
|
||||||
$registrations[$id]['ping-time'] = $row['ping-time'] ?: '';
|
$registrations[$id]['ping-time'] = $row['ping-time'] ?? '';
|
||||||
$registrations[$id]['ping-status'] = $row['ping-status'] ?: '';
|
$registrations[$id]['ping-status'] = $row['ping-status'] ?? '';
|
||||||
$registrations[$id]['sip_profile_name'] = $field['sip_profile_name'];
|
$registrations[$id]['sip_profile_name'] = $field['sip_profile_name'];
|
||||||
|
|
||||||
//get network-ip to url or blank
|
//get network-ip to url or blank
|
||||||
@@ -138,7 +138,7 @@ if (!class_exists('registrations')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get the LAN IP address if it exists replace the external ip
|
//get the LAN IP address if it exists replace the external ip
|
||||||
$call_id_array = explode('@', $row['call-id']);
|
$call_id_array = explode('@', $row['call-id'] ?? '');
|
||||||
if (isset($call_id_array[1])) {
|
if (isset($call_id_array[1])) {
|
||||||
$agent = $row['agent'];
|
$agent = $row['agent'];
|
||||||
$lan_ip = $call_id_array[1];
|
$lan_ip = $call_id_array[1];
|
||||||
@@ -154,7 +154,7 @@ if (!class_exists('registrations')) {
|
|||||||
}
|
}
|
||||||
$registrations[$id]['lan-ip'] = $lan_ip;
|
$registrations[$id]['lan-ip'] = $lan_ip;
|
||||||
}
|
}
|
||||||
else if (preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $row['contact'], $ip_match)) {
|
else if (preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $row['contact'] ?? '', $ip_match)) {
|
||||||
$lan_ip = preg_replace('/_/', '.', $ip_match[0]);
|
$lan_ip = preg_replace('/_/', '.', $ip_match[0]);
|
||||||
$registrations[$id]['lan-ip'] = "$lan_ip";
|
$registrations[$id]['lan-ip'] = "$lan_ip";
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ if (!class_exists('registrations')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//return the registrations array
|
//return the registrations array
|
||||||
return $registrations;
|
return $registrations ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -166,9 +166,9 @@
|
|||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
$n++;
|
//$n++;
|
||||||
|
|
||||||
echo "<span class='hud_expander' onclick=\"$('#hud_switch_status_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
echo "<span class='hud_expander' onclick=\"$('#hud_switch_status_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user