From 42ecba0214fa9964401cecea8a2c3fe32058e676 Mon Sep 17 00:00:00 2001
From: Alex <40072887+alexdcrane@users.noreply.github.com>
Date: Fri, 2 Jun 2023 14:53:23 -0600
Subject: [PATCH] voicemail edit, log viewer, and sip status php 8.1 changes
(#6738)
* Update voicemail_edit.php
* Update sip_status.php
* Update message.php
* Update log_viewer.php
* Update log_viewer.php
* Update sip_status.php
---
app/log_viewer/log_viewer.php | 13 ++++++++-----
app/sip_status/sip_status.php | 12 ++++++------
app/voicemails/voicemail_edit.php | 11 ++++++-----
resources/classes/message.php | 4 ++--
4 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/app/log_viewer/log_viewer.php b/app/log_viewer/log_viewer.php
index 02fff7fb1a..2b6625f178 100644
--- a/app/log_viewer/log_viewer.php
+++ b/app/log_viewer/log_viewer.php
@@ -200,7 +200,10 @@
$array_filter[6]['type'] = 'bold';
$array_filter[6]['font'] = 'monospace';
- $file_size = filesize($log_file);
+ $file_size = 0;
+ if (file_exists($log_file)) {
+ $file_size = filesize($log_file);
+ }
/*
// removed: duplicate of above
@@ -248,7 +251,7 @@
else {
//open the file
$byte_count ='0';
- if ($file) {
+ if (!empty($file)) {
fseek($file, 0);
}
echo "
".$text['label-open_file']."
";
@@ -272,7 +275,7 @@
//start processing
$byte_count = 0;
- if ($file) {
+ if (!empty($file)) {
while(!feof($file)) {
$log_line = escape(fgets($file));
$byte_count++;
@@ -342,8 +345,8 @@
require_once "resources/footer.php";
//close the file
- if ($file) {
+ if (!empty($file)) {
fclose($file);
}
-?>
\ No newline at end of file
+?>
diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php
index 51c2385a59..20635f51cb 100644
--- a/app/sip_status/sip_status.php
+++ b/app/sip_status/sip_status.php
@@ -67,7 +67,7 @@
}
$sql = "select sip_profile_uuid, sip_profile_name from v_sip_profiles ";
$sql .= "where sip_profile_enabled = 'true' ";
- if ($hostname) {
+ if (!empty($hostname)) {
$sql .= "and (sip_profile_hostname = :sip_profile_hostname ";
$sql .= "or sip_profile_hostname = '' ";
$sql .= "or sip_profile_hostname is null) ";
@@ -75,8 +75,8 @@
}
$sql .= "order by sip_profile_name asc ";
$database = new database;
- $rows = $database->select($sql, $parameters, 'all');
- if (is_array($rows) && @sizeof($rows) != 0) {
+ $rows = $database->select($sql, $parameters ?? null, 'all');
+ if (!empty($rows)) {
foreach ($rows as $row) {
$sip_profiles[$row['sip_profile_name']] = $row['sip_profile_uuid'];
}
@@ -146,7 +146,7 @@
echo "\n";
//profiles
- if ($xml->profile) {
+ if (!empty($xml) && $xml->profile) {
foreach ($xml->profile as $row) {
unset($list_row_url);
$profile_name = (string) $row->name;
@@ -169,7 +169,7 @@
}
//gateways
- if ($xml_gateways->gateway) {
+ if (!empty($xml_gateways) && $xml_gateways->gateway) {
foreach ($xml_gateways->gateway as $row) {
unset($gateway_name, $gateway_domain_name, $list_row_url);
@@ -208,7 +208,7 @@
}
//aliases
- if ($xml->alias) {
+ if (!empty($xml) && $xml->alias) {
foreach ($xml->alias as $row) {
echo "