main
This commit is contained in:
+14
-41
@@ -1,25 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Live modem log viewer.
|
||||
*
|
||||
* AJAX-tails today's /var/log/pi-star/MMDVM-* (or DStarRepeater-*)
|
||||
* log file in real time. Uses a session-stored byte offset so each
|
||||
* `?ajax` call returns only the new bytes since the previous fetch,
|
||||
* resetting if the log appears to have been rotated/truncated.
|
||||
*
|
||||
* Companion to download_modem_log.php (which sends the whole file
|
||||
* in one go).
|
||||
*/
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/config/security_headers.php');
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/config/banner_warnings.inc');
|
||||
setSecurityHeaders();
|
||||
|
||||
// Layer 2 of the default-password protection — see config/banner_warnings.inc.
|
||||
// MUST run BEFORE any output so header('Location: ...') works. Affects
|
||||
// both the wrapper-page render and the ?ajax tail endpoint; the latter
|
||||
// is unreachable in practice unless the parent page already redirected.
|
||||
pistar_warnings_enforce_redirect();
|
||||
|
||||
// Load the language support
|
||||
require_once('config/language.php');
|
||||
// Load the Pi-Star Release file
|
||||
@@ -50,11 +29,11 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
||||
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);
|
||||
@@ -67,10 +46,10 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
||||
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">
|
||||
@@ -81,13 +60,13 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
||||
<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="Pi-Star Update" />
|
||||
<meta name="KeyWords" content="Pi-Star" />
|
||||
<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>Pi-Star - <?php echo $lang['digital_voice']." ".$lang['dashboard']." - ".$lang['live_logs'];?></title>
|
||||
<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>
|
||||
@@ -107,11 +86,10 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<?php pistar_warnings_render(); ?>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<div style="font-size: 8px; text-align: right; padding-right: 8px;">Pi-Star:<?php echo $configPistarRelease['Pi-Star']['Version']?> / <?php echo $lang['dashboard'].": ".$version; ?></div>
|
||||
<h1>Pi-Star <?php echo $lang['digital_voice']." - ".$lang['live_logs'];?></h1>
|
||||
<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> |
|
||||
@@ -121,17 +99,11 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
||||
</p>
|
||||
</div>
|
||||
<div class="contentwide">
|
||||
<table width="100%">
|
||||
<tr><th><?php echo $lang['live_logs'];?></th></tr>
|
||||
<tr><td align="left"><div id="tail">Starting logging, please wait...<br /></div></td></tr>
|
||||
<tr><th>Download the log: <a href="/admin/download_modem_log.php" style="color: #ffffff;">here</a></th></tr>
|
||||
</table>
|
||||
<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 class="footer">
|
||||
Pi-Star web config, © Andy Taylor (MW0MWZ) 2014-<?php echo date("Y"); ?>.<br />
|
||||
Need help? Click <a style="color: #ffffff;" href="https://www.facebook.com/groups/pistarusergroup/" target="_new">here for the Support Group</a><br />
|
||||
Get your copy of Pi-Star from <a style="color: #ffffff;" href="http://www.pistar.uk/downloads/" target="_blank">here</a>.<br />
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -139,3 +111,4 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user