Code had two file connections use one.

Noticed there were two open connection for the file log. A few other adjustments.
This commit is contained in:
FusionPBX 2022-09-21 13:02:56 -06:00 committed by GitHub
parent bc2b14739c
commit 2900b9fb1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 15 deletions

View File

@ -107,9 +107,9 @@
$file_size = filesize($log_file); $file_size = filesize($log_file);
} }
//read the log //open the log file
if (file_exists($log_file)) { if (file_exists($log_file)) {
$file_handle = fopen($log_file, "r"); $file = fopen($log_file, "r") or exit($text['error-open_file']);
} }
//include the header //include the header
@ -197,6 +197,8 @@
$array_filter[6]['type'] = 'bold'; $array_filter[6]['type'] = 'bold';
$array_filter[6]['font'] = 'monospace'; $array_filter[6]['font'] = 'monospace';
$file_size = filesize($log_file);
/* /*
// removed: duplicate of above // removed: duplicate of above
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
@ -243,8 +245,8 @@
else { else {
//open the file //open the file
$byte_count ='0'; $byte_count ='0';
if ($file_handle) { if ($file) {
fseek($file_handle, 0); fseek($file, 0);
} }
echo "<br>".$text['label-open_file']."<br>"; echo "<br>".$text['label-open_file']."<br>";
} }
@ -267,9 +269,9 @@
//start processing //start processing
$byte_count = 0; $byte_count = 0;
if ($file_handle) { if ($file) {
while(!feof($file_handle)) { while(!feof($file)) {
$log_line = escape(fgets($file_handle)); $log_line = escape(fgets($file));
$byte_count++; $byte_count++;
$noprint = false; $noprint = false;
@ -337,8 +339,8 @@
require_once "resources/footer.php"; require_once "resources/footer.php";
//close the file //close the file
if ($file_handle) { if ($file) {
fclose($file_handle); fclose($file);
} }
?> ?>