115 lines
4.6 KiB
PHP
115 lines
4.6 KiB
PHP
<?php
|
|
// Load the language support
|
|
require_once('config/language.php');
|
|
// Load the Pi-Star Release file
|
|
$pistarReleaseConfig = '/etc/pistar-release';
|
|
$configPistarRelease = array();
|
|
$configPistarRelease = parse_ini_file($pistarReleaseConfig, true);
|
|
// Load the Version Info
|
|
require_once('config/version.php');
|
|
|
|
// Sanity Check that this file has been opened correctly
|
|
if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
|
|
|
// Sanity Check Passed.
|
|
header('Cache-Control: no-cache');
|
|
session_start();
|
|
|
|
if (!isset($_GET['ajax'])) {
|
|
unset($_SESSION['offset']);
|
|
//$_SESSION['offset'] = 0;
|
|
}
|
|
|
|
if (isset($_GET['ajax'])) {
|
|
//session_start();
|
|
if (file_exists('/etc/dstar-radio.mmdvmhost')) {
|
|
$logfile = "/var/log/pi-star/MMDVM-".gmdate('Y-m-d').".log";
|
|
}
|
|
elseif (file_exists('/etc/dstar-radio.dstarrepeater')) {
|
|
if (file_exists("/var/log/pi-star/DStarRepeater-".gmdate('Y-m-d').".log")) {$logfile = "/var/log/pi-star/DStarRepeater-".gmdate('Y-m-d').".log";}
|
|
if (file_exists("/var/log/pi-star/dstarrepeaterd-".gmdate('Y-m-d').".log")) {$logfile = "/var/log/pi-star/dstarrepeaterd-".gmdate('Y-m-d').".log";}
|
|
}
|
|
|
|
if (empty($logfile) || !file_exists($logfile)) {
|
|
exit();
|
|
}
|
|
|
|
$handle = fopen($logfile, 'rb');
|
|
if (isset($_SESSION['offset'])) {
|
|
fseek($handle, 0, SEEK_END);
|
|
if ($_SESSION['offset'] > ftell($handle)) //log rotated/truncated
|
|
$_SESSION['offset'] = 0; //continue at beginning of the new log
|
|
$data = stream_get_contents($handle, -1, $_SESSION['offset']);
|
|
$_SESSION['offset'] += strlen($data);
|
|
echo nl2br($data);
|
|
}
|
|
else {
|
|
fseek($handle, 0, SEEK_END);
|
|
$_SESSION['offset'] = ftell($handle);
|
|
}
|
|
exit();
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" lang="en">
|
|
<head>
|
|
<meta name="robots" content="index" />
|
|
<meta name="robots" content="follow" />
|
|
<meta name="language" content="English" />
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
<meta name="Author" content="Andrew Taylor (MW0MWZ)" />
|
|
<meta name="Description" content="CDN Update" />
|
|
<meta name="KeyWords" content="CDN" />
|
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
|
<meta http-equiv="pragma" content="no-cache" />
|
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
|
|
<meta http-equiv="Expires" content="0" />
|
|
<title>CDN - <?php echo $lang['digital_voice']." ".$lang['dashboard']." - ".$lang['live_logs'];?></title>
|
|
<link rel="stylesheet" type="text/css" href="css/pistar-css.php" />
|
|
<script type="text/javascript" src="/jquery.min.js"></script>
|
|
<script type="text/javascript" src="/jquery-timing.min.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
$.repeat(1000, function() {
|
|
$.get('/admin/live_modem_log.php?ajax', function(data) {
|
|
if (data.length < 1) return;
|
|
var objDiv = document.getElementById("tail");
|
|
var isScrolledToBottom = objDiv.scrollHeight - objDiv.clientHeight <= objDiv.scrollTop + 1;
|
|
$('#tail').append(data);
|
|
if (isScrolledToBottom)
|
|
objDiv.scrollTop = objDiv.scrollHeight;
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<div style="font-size: 8px; text-align: right; padding-right: 8px;">CDN:<?php echo $configPistarRelease['Pi-Star']['Version']?> / <?php echo $lang['dashboard'].": ".$version; ?></div>
|
|
<h1>CDN <?php echo $lang['digital_voice']." - ".$lang['live_logs'];?></h1>
|
|
<p style="padding-right: 5px; text-align: right; color: #ffffff;">
|
|
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
|
|
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> |
|
|
<a href="/admin/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> |
|
|
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
|
|
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
|
|
</p>
|
|
</div>
|
|
<div class="contentwide">
|
|
<h2><?php echo $lang['live_logs'];?></h2>
|
|
<div class="settings-card" style="padding-top:16px;">
|
|
<div id="tail">Starting logging, please wait...<br /></div>
|
|
<div class="field-actions">Download the log: <a href="/admin/download_modem_log.php"><?php echo $lang['live_logs'];?> (.log)</a></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
|
|
<?php
|
|
}
|
|
?>
|