main
This commit is contained in:
@@ -1,33 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* D-Star reflector link status — one row per repeater module (A-D).
|
||||
*
|
||||
* AJAX-loaded partial; refreshed every 15 seconds by /index.php. Used
|
||||
* in BOTH MMDVMHost mode (when D-Star Network is enabled) and
|
||||
* dstarrepeater mode.
|
||||
*
|
||||
* For each `repeaterBand1`..`4` configured in /etc/ircddbgateway,
|
||||
* inspects /var/log/pi-star/Links.log for the most recent link state
|
||||
* line (DExtra / DPlus / DCS / CCS) targeting that module's callsign.
|
||||
* Outputs columns: callsign, linked-to reflector, protocol, direction
|
||||
* (Incoming / Outgoing), last-change timestamp.
|
||||
*
|
||||
* The log line shapes this file matches are documented inline as
|
||||
* comments next to each preg_match_all — preserve those samples
|
||||
* verbatim if Links.log format ever drifts.
|
||||
*
|
||||
* AJAX-loaded partial — embeddable variant only. Omits the
|
||||
* X-Frame-Options / frame-ancestors directives that the parent
|
||||
* /index.php already asserts; they apply to iframe ancestry, not
|
||||
* to XHR responses, so emitting them here is just dead bytes.
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
setEmbeddableSecurityHeaders();
|
||||
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
$configs = array();
|
||||
|
||||
if ($configfile = fopen($gatewayConfigPath,'r')) {
|
||||
@@ -62,30 +34,30 @@ $MYCALL=strtoupper($callsign);
|
||||
$ci = 0;
|
||||
$tr = 0;
|
||||
for($i = 1;$i < 5; $i++){
|
||||
$param="repeaterBand" . $i;
|
||||
if((isset($configs[$param])) && strlen($configs[$param]) == 1) {
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
$tr = 1;
|
||||
$module = $configs[$param];
|
||||
$rcall = sprintf("%-7.7s%-1.1s",$MYCALL,$module);
|
||||
$param="repeaterCall" . $i;
|
||||
if(isset($configs[$param])) { $rptrcall=sprintf("%-7.7s%-1.1s",$configs[$param],$module); } else { $rptrcall = $rcall;}
|
||||
print "<td>".str_replace(' ', ' ', substr($rptrcall,0,8))."</td>";
|
||||
$param="reflector" . $i;
|
||||
if(isset($configs[$param])) { print "<td>".str_replace(' ', ' ', substr($configs[$param],0,8))."</td>"; } else { print "<td> </td>";}
|
||||
$param="atStartup" . $i;
|
||||
if($configs[$param] == 1){print "<td>Auto</td>"; } else { print "<td>No</td>"; }
|
||||
$param="reconnect" . $i;
|
||||
if(isset($configs[$param])) { $t = $configs[$param]; } else { $t = 0; }
|
||||
if($t > 12){ $t = 12; }
|
||||
print "<td>$tot[$t]</td>";
|
||||
$j=0;
|
||||
if ($linkLog = @fopen($linkLogPath,'r')) {
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
//$statimg = "<img src=\"images/20red.png\">";
|
||||
$statimg = "Down";
|
||||
$param="repeaterBand" . $i;
|
||||
if((isset($configs[$param])) && strlen($configs[$param]) == 1) {
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
$tr = 1;
|
||||
$module = $configs[$param];
|
||||
$rcall = sprintf("%-7.7s%-1.1s",$MYCALL,$module);
|
||||
$param="repeaterCall" . $i;
|
||||
if(isset($configs[$param])) { $rptrcall=sprintf("%-7.7s%-1.1s",$configs[$param],$module); } else { $rptrcall = $rcall;}
|
||||
print "<td>".str_replace(' ', ' ', substr($rptrcall,0,8))."</td>";
|
||||
$param="reflector" . $i;
|
||||
if(isset($configs[$param])) { print "<td>".str_replace(' ', ' ', substr($configs[$param],0,8))."</td>"; } else { print "<td> </td>";}
|
||||
$param="atStartup" . $i;
|
||||
if($configs[$param] == 1){print "<td>Auto</td>"; } else { print "<td>No</td>"; }
|
||||
$param="reconnect" . $i;
|
||||
if(isset($configs[$param])) { $t = $configs[$param]; } else { $t = 0; }
|
||||
if($t > 12){ $t = 12; }
|
||||
print "<td>$tot[$t]</td>";
|
||||
$j=0;
|
||||
if ($linkLog = fopen($linkLogPath,'r')) {
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
//$statimg = "<img src=\"images/20red.png\">";
|
||||
$statimg = "Down";
|
||||
$linkDate = " ";
|
||||
$protocol = " ";
|
||||
$linkType = " ";
|
||||
@@ -96,83 +68,83 @@ $MYCALL=strtoupper($callsign);
|
||||
// 2012-10-12 17:15:45: DCS link - Type: Repeater Rptr: DB0LJ B Refl: DCS001 L Dir: Outgoing
|
||||
// 2012-10-12 17:56:10: DCS link - Type: Repeater Rptr: DB0RPL B Refl: DCS015 B Dir: Outgoing
|
||||
if(preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*Rptr: (.{8}).*Refl: (.{8}).*Dir: Outgoing$/',$linkLine,$linx) > 0){
|
||||
$statimg = "Up";
|
||||
$linkDate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
$statimg = "Up";
|
||||
$linkDate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
$protocol = $linx[2][0];
|
||||
$linkType = $linx[3][0];
|
||||
$linkRptr = $linx[4][0];
|
||||
$linkRefl = $linx[5][0];
|
||||
if($linkRptr == $rptrcall){
|
||||
print "<td>$statimg</td>";
|
||||
print "<td>".str_replace(' ', ' ', substr($linkRefl,0,8))."</td>";
|
||||
print "<td>$protocol</td>";
|
||||
print "<td>Outgoing</td>";
|
||||
$utc_time = $linkDate;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
print "<td>$local_time</td>";
|
||||
print "</tr>\n";
|
||||
$tr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($linkLog);
|
||||
}
|
||||
if($linkRptr == $rptrcall){
|
||||
print "<td>$statimg</td>";
|
||||
print "<td>".str_replace(' ', ' ', substr($linkRefl,0,8))."</td>";
|
||||
print "<td>$protocol</td>";
|
||||
print "<td>Outgoing</td>";
|
||||
$utc_time = $linkDate;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
print "<td>$local_time</td>";
|
||||
print "</tr>\n";
|
||||
$tr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($linkLog);
|
||||
}
|
||||
|
||||
if ($tr == 1){
|
||||
print"<td>Down</td><td>None</td><td>--</td><td>----</td><td>----</td></tr>\n";
|
||||
}
|
||||
if ($tr == 1){
|
||||
print"<td>Down</td><td>None</td><td>--</td><td>----</td><td>----</td></tr>\n";
|
||||
}
|
||||
// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
|
||||
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
|
||||
// 2012-05-08 21:16:31: DExtra link - Type: Repeater Rptr: DB0LJ A Refl: DB0MYK B Dir: Incoming
|
||||
// 2012-05-08 21:16:31: DPlus link - Type: Dongle User: W1CDG H Dir: Incoming
|
||||
if ($linkLog = @fopen($linkLogPath,'r')) {
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
$statimg = "Down";
|
||||
if ($linkLog = fopen($linkLogPath,'r')) {
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
$statimg = "Down";
|
||||
$linkDate = " ";
|
||||
$protocol = " ";
|
||||
$linkType = " ";
|
||||
$linkRptr = " ";
|
||||
$linkRefl = " ";
|
||||
if(preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*Rptr: (.{8}).*Refl: (.{8}).*Dir: Incoming$/',$linkLine,$linx) > 0){
|
||||
$statimg = "Up";
|
||||
$linkDate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
$statimg = "Up";
|
||||
$linkDate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
$protocol = $linx[2][0];
|
||||
$linkType = $linx[3][0];
|
||||
$linkRptr = $linx[4][0];
|
||||
$linkRefl = $linx[5][0];
|
||||
if($linkRptr == $rptrcall){
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<td>".str_replace(' ', ' ', substr($rptrcall,0,8))."</td>";
|
||||
print "<td> </td><td> </td><td> </td>";
|
||||
print "<td>$statimg</td>";
|
||||
print "<td>".str_replace(' ', ' ', substr($linkRefl,0,8))."</td>";
|
||||
print "<td>$protocol</td>";
|
||||
print "<td>Incoming</td>";
|
||||
$utc_time = $linkDate;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
print "<td>$local_time</td>";
|
||||
print "</tr>\n";
|
||||
//$tr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($linkLog);
|
||||
}
|
||||
if($linkRptr == $rptrcall){
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<td>".str_replace(' ', ' ', substr($rptrcall,0,8))."</td>";
|
||||
print "<td> </td><td> </td><td> </td>";
|
||||
print "<td>$statimg</td>";
|
||||
print "<td>".str_replace(' ', ' ', substr($linkRefl,0,8))."</td>";
|
||||
print "<td>$protocol</td>";
|
||||
print "<td>Incoming</td>";
|
||||
$utc_time = $linkDate;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
print "<td>$local_time</td>";
|
||||
print "</tr>\n";
|
||||
//$tr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($linkLog);
|
||||
}
|
||||
// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
|
||||
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
|
||||
// 2012-05-08 21:16:31: DExtra link - Type: Repeater Rptr: DB0LJ A Refl: DB0MYK B Dir: Incoming
|
||||
// 2012-05-08 21:16:31: DPlus link - Type: Dongle User: W1CDG H Dir: Incoming
|
||||
if ($linkLog = @fopen($linkLogPath,'r')) {
|
||||
if ($linkLog = fopen($linkLogPath,'r')) {
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
$statimg = "Down";
|
||||
$linkDate = " ";
|
||||
@@ -188,7 +160,7 @@ $MYCALL=strtoupper($callsign);
|
||||
$linkRptr = $linx[4][0];
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<tr>";
|
||||
print "<td>".str_replace(' ', ' ', substr($rptrcall,0,8))."</td>";
|
||||
print "<td> </td><td> </td><td> </td>";
|
||||
print "<td>$statimg</td>";
|
||||
@@ -207,8 +179,8 @@ $MYCALL=strtoupper($callsign);
|
||||
}
|
||||
fclose($linkLog);
|
||||
}
|
||||
// End
|
||||
}
|
||||
// End
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,29 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* StarNet groups + active members partial.
|
||||
*
|
||||
* Sub-partial included by css_connections.php when at least one
|
||||
* `starNetCallsign1`..`5` is configured in /etc/ircddbgateway.
|
||||
*
|
||||
* Two tables:
|
||||
* 1. Configured groups — callsign, logoff callsign, info text,
|
||||
* user/group timeouts. Pulled directly from /etc/ircddbgateway.
|
||||
* 2. Active members — parsed from /var/log/pi-star/STARnet.log via
|
||||
* a preg_match_all that walks every "Adding/Removing <call> from
|
||||
* StarNet group <group>" line. We treat the log as the
|
||||
* authoritative state: an "Adding" entry inserts; a "Removing"
|
||||
* entry unsets. The final $groupsx map then holds current members.
|
||||
*
|
||||
* No security_headers call — it's a sub-sub-partial. Flagged for the
|
||||
* security pass.
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
setSecurityHeaders();
|
||||
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
$configs = array();
|
||||
|
||||
if ($configfile = fopen($gatewayConfigPath,'r')) {
|
||||
@@ -53,95 +29,97 @@ $MYCALL=strtoupper($callsign);
|
||||
$i = 0;
|
||||
$stngrp = array();
|
||||
for($i = 1;$i < 6; $i++){
|
||||
$param="starNetCallsign" . $i;
|
||||
if(isset($configs[$param])) {
|
||||
$gname = $configs[$param];
|
||||
$stngrp[$gname] = $i;
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<td align=\"center\">".str_replace(' ', ' ', substr($gname,0,8))."</td>";
|
||||
$param="starNetLogoff" . $i;
|
||||
if(isset($configs[$param])){ $output = str_replace(' ', ' ', substr($configs[$param],0,8)); print "<td align=\"center\">$output</td>";} else { print"<td> </td>";}
|
||||
$param="starNetInfo" . $i;
|
||||
if(isset($configs[$param])){ print "<td colspan=\"3\" align=\"left\">$configs[$param]</td>";} else { print"<td colspan=\"3\"> </td>";}
|
||||
$param="starNetUserTimeout" . $i;
|
||||
if(isset($configs[$param])){ print "<td align=\"center\">$configs[$param]</td>";} else { print"<td> </td>";}
|
||||
$param="starNetGroupTimeout" . $i;
|
||||
if(isset($configs[$param])){ print "<td align=\"center\">$configs[$param]</td>";} else { print"<td> </td>";}
|
||||
print "</tr>\n";
|
||||
}
|
||||
$param="starNetCallsign" . $i;
|
||||
if(isset($configs[$param])) {
|
||||
$gname = $configs[$param];
|
||||
$stngrp[$gname] = $i;
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<td align=\"center\">".str_replace(' ', ' ', substr($gname,0,8))."</td>";
|
||||
$param="starNetLogoff" . $i;
|
||||
if(isset($configs[$param])){ $output = str_replace(' ', ' ', substr($configs[$param],0,8)); print "<td align=\"center\">$output</td>";} else { print"<td> </td>";}
|
||||
$param="starNetInfo" . $i;
|
||||
if(isset($configs[$param])){ print "<td colspan=\"3\" align=\"left\">$configs[$param]</td>";} else { print"<td colspan=\"3\"> </td>";}
|
||||
$param="starNetUserTimeout" . $i;
|
||||
if(isset($configs[$param])){ print "<td align=\"center\">$configs[$param]</td>";} else { print"<td> </td>";}
|
||||
$param="starNetGroupTimeout" . $i;
|
||||
if(isset($configs[$param])){ print "<td align=\"center\">$configs[$param]</td>";} else { print"<td> </td>";}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table><br />
|
||||
|
||||
<?php
|
||||
$groupsx = array();
|
||||
if ($starLog = fopen($starLogPath,'r')) {
|
||||
while($logLine = fgets($starLog)) {
|
||||
preg_match_all('/^(.{19}).*(Adding|Removing) (.{8}).*StarNet group (.{8}).*$/',$logLine,$matches);
|
||||
$groupz = substr($matches[4][0],0,8);
|
||||
$member = substr($matches[3][0],0,8);
|
||||
$action = substr($matches[2][0],0,8);
|
||||
$date = $matches[1][0];
|
||||
$guid = $stngrp[$groupz];
|
||||
if ($action == 'Adding'){
|
||||
$groupsx[$guid][$groupz][$member] = $date;
|
||||
}
|
||||
elseif ($action == 'Removing'){
|
||||
unset($groupsx[$guid][$groupz][$member]);
|
||||
}
|
||||
}
|
||||
fclose($starLog);
|
||||
}
|
||||
$groupsx = array();
|
||||
if ($starLog = fopen($starLogPath,'r')) {
|
||||
while($logLine = fgets($starLog)) {
|
||||
preg_match_all('/^(.{19}).*(Adding|Removing) (.{8}).*StarNet group (.{8}).*$/',$logLine,$matches);
|
||||
$groupz = substr($matches[4][0],0,8);
|
||||
$member = substr($matches[3][0],0,8);
|
||||
$action = substr($matches[2][0],0,8);
|
||||
$date = $matches[1][0];
|
||||
$guid = $stngrp[$groupz];
|
||||
if ($action == 'Adding'){
|
||||
$groupsx[$guid][$groupz][$member] = $date;
|
||||
}
|
||||
elseif ($action == 'Removing'){
|
||||
unset($groupsx[$guid][$groupz][$member]);
|
||||
}
|
||||
}
|
||||
fclose($starLog);
|
||||
}
|
||||
|
||||
//Clean the empty arrays from the multidimensional array
|
||||
$groupsx = array_map('array_filter', $groupsx);
|
||||
//Clean the empty arrays from the multidimensional array
|
||||
$groupsx = array_map('array_filter', $groupsx);
|
||||
|
||||
$active = 0;
|
||||
for ($i = 1;$i < 6; $i++) {
|
||||
if (isset($groupsx[$i])) {
|
||||
$active = $active + count($groupsx[$i]);
|
||||
}
|
||||
}
|
||||
$active = 0;
|
||||
for ($i = 1;$i < 6; $i++) {
|
||||
if (isset($groupsx[$i])) {
|
||||
$active = $active + count($groupsx[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($active >= 1) {
|
||||
if ($active >= 1) {
|
||||
|
||||
echo "<b>".$lang['active_starnet_members']."</b>\n";
|
||||
echo "<table style=\"table-layout: fixed;\">\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th><a class=tooltip href=\"#\">".$lang['time']." (".date('T').")<span><b>Time of Login</b></span></a></th>\n";
|
||||
echo "<th><a class=tooltip href=\"#\">".$lang['group']."<span><b>Starnet Callsign</b></span></a></th>\n";
|
||||
echo "<th><a class=tooltip href=\"#\">".$lang['callsign']."<span><b>Callsign</b></span></a></th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<b>".$lang['active_starnet_members']."</b>\n";
|
||||
echo "<table style=\"table-layout: fixed;\">\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th><a class=tooltip href=\"#\">".$lang['time']." (".date('T').")<span><b>Time of Login</b></span></a></th>\n";
|
||||
echo "<th><a class=tooltip href=\"#\">".$lang['group']."<span><b>Starnet Callsign</b></span></a></th>\n";
|
||||
echo "<th><a class=tooltip href=\"#\">".$lang['callsign']."<span><b>Callsign</b></span></a></th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
$ci = 0;
|
||||
$ulist = array();
|
||||
$glist = array();
|
||||
for($i = 1;$i < 6; $i++){
|
||||
if(isset($groupsx[$i])){
|
||||
$glist = $groupsx[$i];
|
||||
foreach ($glist as $gcall => $ulist){
|
||||
foreach ($ulist as $ucall => $ulogin){
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
$ulogin = date("d-M-Y H:i:s", strtotime(substr($ulogin,0,19)));
|
||||
$utc_time = $ulogin;
|
||||
$ci = 0;
|
||||
$ulist = array();
|
||||
$glist = array();
|
||||
for($i = 1;$i < 6; $i++){
|
||||
if(isset($groupsx[$i])){
|
||||
$glist = $groupsx[$i];
|
||||
foreach ($glist as $gcall => $ulist){
|
||||
foreach ($ulist as $ucall => $ulogin){
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
$ulogin = date("d-M-Y H:i:s", strtotime(substr($ulogin,0,19)));
|
||||
$utc_time = $ulogin;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
$groupz = str_replace(' ', ' ', substr($gcall,0,8));
|
||||
$ucall = str_replace(' ', '', substr($ucall,0,8));
|
||||
print "<tr>";
|
||||
print "<td align=\"left\">$local_time</td>";
|
||||
print "<td align=\"center\">$groupz</td>";
|
||||
print "<td align=\"center\"><a href=\"http://www.qrz.com/db/$ucall\" target=\"_new\" alt=\"Lookup Callsign\">$ucall</a></td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>\n<br />\n";
|
||||
}
|
||||
$groupz = str_replace(' ', ' ', substr($gcall,0,8));
|
||||
$ucall = str_replace(' ', '', substr($ucall,0,8));
|
||||
print "<tr>";
|
||||
print "<td align=\"left\">$local_time</td>";
|
||||
print "<td align=\"center\">$groupz</td>";
|
||||
print "<td align=\"center\"><a href=\"http://www.qrz.com/db/$ucall\" target=\"_new\" alt=\"Lookup Callsign\">$ucall</a></td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>\n<br />\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,24 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* CCS (Connected Community System) connections + StarNet groups partial.
|
||||
*
|
||||
* AJAX-loaded partial; refreshed every 15 seconds by /index.php. Two
|
||||
* sections rendered conditionally:
|
||||
* 1. Active CCS Connections — read from /var/log/pi-star/Links.log,
|
||||
* surfaced only if the log contains at least one "CCS link" line.
|
||||
* 2. StarNet groups — included via active_starnet_groups.php only when
|
||||
* `starNetCallsign1`..`5` are configured in /etc/ircddbgateway.
|
||||
*
|
||||
* AJAX-loaded partial — embeddable variant only. Omits the
|
||||
* X-Frame-Options / frame-ancestors directives the parent already
|
||||
* asserts; they apply to iframe ancestry, not XHR responses.
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
setEmbeddableSecurityHeaders();
|
||||
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
$configs = array();
|
||||
|
||||
if ($configfile = fopen($gatewayConfigPath,'r')) {
|
||||
@@ -50,33 +30,33 @@ if (exec('grep "CCS link" '.$linkLogPath.' | wc -l') >=1) {
|
||||
|
||||
$ci = 0;
|
||||
if ($linkLog = fopen($linkLogPath,'r')) {
|
||||
$i=0;
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
$i=0;
|
||||
while ($linkLine = fgets($linkLog)) {
|
||||
// 2013-02-27 19:49:27: CCS link - Rptr: DB0LJ B Remote: DL5DI Dir: Incoming
|
||||
if(preg_match_all('/^(.{19}).*(C[A-Za-z]*).*Rptr: (.{8}).*Remote: (.{8}).*Dir: (.{8})$/',$linkLine,$linx) > 0){
|
||||
$utc_time = $linx[1][0];
|
||||
$utc_time = $linx[1][0];
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
$linkDate = $local_time;
|
||||
$linkDate = $local_time;
|
||||
$linkType = $linx[2][0];
|
||||
$linkRptr = $linx[3][0];
|
||||
$linkRem = $linx[4][0];
|
||||
$linkDir = $linx[5][0];
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<td>$linkRptr</td>";
|
||||
print "<td>$linkRem</td>";
|
||||
print "<td>CCS</td>";
|
||||
print "<td>$linkDir</td>";
|
||||
print "<td>$linkDate</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
fclose($linkLog);
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
print "<td>$linkRptr</td>";
|
||||
print "<td>$linkRem</td>";
|
||||
print "<td>CCS</td>";
|
||||
print "<td>$linkDir</td>";
|
||||
print "<td>$linkDate</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
fclose($linkLog);
|
||||
}
|
||||
|
||||
print "</table>\n<br />\n";
|
||||
@@ -84,12 +64,13 @@ if (exec('grep "CCS link" '.$linkLogPath.' | wc -l') >=1) {
|
||||
|
||||
$stn_is_set = 0;
|
||||
for($i = 1;$i < 6; $i++){
|
||||
$param="starNetCallsign" . $i;
|
||||
if(isset($configs[$param])) {
|
||||
$stn_is_set = 1;
|
||||
break;
|
||||
}
|
||||
$param="starNetCallsign" . $i;
|
||||
if(isset($configs[$param])) {
|
||||
$stn_is_set = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($stn_is_set > 0){
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/dstarrepeater/active_starnet_groups.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/dstarrepeater/active_starnet_groups.php';
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div class="settings-card">
|
||||
<table>
|
||||
<tr><th>ircDDB Network</th><th>APRS Host</th><th>CCS</th><th>DCS</th><th>DExtra</th><th>DPlus</th><th>D-Rats</th><th>Info</th><th>ircDDB</th><th>Echo</th><th>Log</th></tr>
|
||||
<tr style="background: #ffffff;">
|
||||
<tr>
|
||||
<td><?php print $configs['ircddbHostname']; ?></td>
|
||||
<td><?php if($configs['aprsEnabled'] == 1){ print $configs['aprsHostname']; } else { print "<img src=\"images/20red.png\">";} ?></td>
|
||||
<?php
|
||||
@@ -16,3 +17,4 @@
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
+26
-73
@@ -1,28 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Last-heard list (D-Star repeater mode) — last 20 D-Star transmissions.
|
||||
*
|
||||
* AJAX-loaded partial; refreshed every ~3 seconds by /index.php in
|
||||
* dstarrepeater mode. Renders a 5-column table: time, callsign, target,
|
||||
* Rpt 1, Rpt 2. Each callsign links to the operator's chosen lookup
|
||||
* service (RadioID or QRZ, sourced from /etc/pistar-css.ini's
|
||||
* [Lookup] Service key) and to aprs.fi for dPRS data.
|
||||
*
|
||||
* Data flow: shells out to a `grep|sort|head` pipeline against
|
||||
* `/var/log/pi-star/Headers.log` to build /tmp/lastheard.log, then
|
||||
* regex-parses each line. The "Headers.log sample" comment block
|
||||
* below documents the exact line shape the regex targets — preserve
|
||||
* those examples verbatim if log format ever drifts.
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
// AJAX-loaded partial — embeddable variant only. See the note in
|
||||
// mmdvmhost/lh.php for why the historical double-call was wrong.
|
||||
setEmbeddableSecurityHeaders();
|
||||
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
$configs = array();
|
||||
|
||||
if ($configfile = fopen($gatewayConfigPath,'r')) {
|
||||
@@ -45,8 +22,8 @@ if (file_exists('/etc/pistar-css.ini')) {
|
||||
if (fopen($piStarCssFile,'r')) { $piStarCss = parse_ini_file($piStarCssFile, true); }
|
||||
|
||||
// Set the Values from the config file
|
||||
if (isset($piStarCss['Lookup']['Service'])) { $callsignLookupSvc = $piStarCss['Lookup']['Service']; } // Lookup Service "QRZ" or "RadioID"
|
||||
else { $callsignLookupSvc = "RadioID"; } // Set the default if its missing // Set the default if its missing
|
||||
if (isset($piStarCss['Lookup']['Service'])) { $callsignLookupSvc = $piStarCss['Lookup']['Service']; } // Lookup Service "QRZ" or "RadioID"
|
||||
else { $callsignLookupSvc = "RadioID"; } // Set the default if its missing // Set the default if its missing
|
||||
} else {
|
||||
// Default values
|
||||
$callsignLookupSvc = "RadioID";
|
||||
@@ -80,59 +57,35 @@ if ($callsignLookupSvc == "QRZ") { $callsignLookupUrl = "https://www.qrz.com/db/
|
||||
exec('(grep -v " /TIME" '.$hdrLogPath.'|sort -r -k7,7|sort -u -k7,8|sort -r|head -20 >/tmp/lastheard.log) 2>&1 &');
|
||||
$ci = 0;
|
||||
if ($LastHeardLog = fopen("/tmp/lastheard.log",'r')) {
|
||||
while ($linkLine = fgets($LastHeardLog)) {
|
||||
while ($linkLine = fgets($LastHeardLog)) {
|
||||
if(preg_match_all('/^(.{19}).*My: (.*).*Your: (.*).*Rpt1: (.*).*Rpt2: (.*).*Flags: (.*)$/',$linkLine,$linx) > 0){
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
$QSODate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
|
||||
// Every value below is parsed out of /var/log/pi-star/Headers.log
|
||||
// — log lines produced by RF traffic, where the
|
||||
// transmitting station sets the callsign field. Without
|
||||
// escaping, a hostile callsign lands in the dashboard's
|
||||
// ~3 second AJAX refresh. Normalise once here so each
|
||||
// echo below works on safe values.
|
||||
//
|
||||
// $myCallRaw — raw 8-char callsign window
|
||||
// $myCallHtml — HTML-safe display form
|
||||
// $myCallLink — first whitespace-delimited token (the
|
||||
// callsign without the space-padded
|
||||
// suffix) — used for href URLs
|
||||
// $myCallLinkHtml / $myCallLinkUrl — the URL forms
|
||||
// $myIdHtml — 4-char ID after the `/` (HTML-safe)
|
||||
// $yourCallHtml / $rpt1Html / $rpt2Html — target +
|
||||
// repeaters with ` ` substitution applied AFTER
|
||||
// escaping so the literal entity isn't double-encoded.
|
||||
$myCallRaw = str_replace(' ', '', substr($linx[2][0],0,8));
|
||||
$myCallHtml = htmlspecialchars($myCallRaw, ENT_QUOTES, 'UTF-8');
|
||||
$myCallLink = strtok(substr($linx[2][0],0,8), " ");
|
||||
$myCallLinkUrl = rawurlencode((string)$myCallLink);
|
||||
$myIdHtml = htmlspecialchars(str_replace(' ', '', substr($linx[2][0],9,4)), ENT_QUOTES, 'UTF-8');
|
||||
$yourCallHtml = str_replace(' ', ' ',
|
||||
htmlspecialchars(substr($linx[3][0],0,8), ENT_QUOTES, 'UTF-8'));
|
||||
$rpt1Html = str_replace(' ', ' ',
|
||||
htmlspecialchars(substr($linx[4][0],0,8), ENT_QUOTES, 'UTF-8'));
|
||||
$rpt2Html = str_replace(' ', ' ',
|
||||
htmlspecialchars(substr($linx[5][0],0,8), ENT_QUOTES, 'UTF-8'));
|
||||
|
||||
$utc_time = $QSODate;
|
||||
$MyCall = str_replace(' ', '', substr($linx[2][0],0,8));
|
||||
$MyCallLink = strtok(substr($linx[2][0],0,8), " ");
|
||||
$MyId = str_replace(' ', '', substr($linx[2][0],9,4));
|
||||
$YourCall = str_replace(' ', ' ', substr($linx[3][0],0,8));
|
||||
$Rpt1 = str_replace(' ', ' ', substr($linx[4][0],0,8));
|
||||
$Rpt2 = str_replace(' ', ' ', substr($linx[5][0],0,8));
|
||||
$utc_time = $QSODate;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
print "<tr>";
|
||||
print "<td align=\"left\">$local_time</td>";
|
||||
print "<td align=\"left\" width=\"180\"><div style=\"float:left;\"><a href=\"".$callsignLookupUrl.$myCallLinkUrl."\" target=\"_blank\">$myCallHtml</a>";
|
||||
if($myIdHtml !== '') { print "/$myIdHtml</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$myCallLinkUrl."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
else { print "</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$myCallLinkUrl."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
print "<td align=\"left\" width=\"100\">$yourCallHtml</td>";
|
||||
print "<td align=\"left\" width=\"100\">$rpt1Html</td>";
|
||||
print "<td align=\"left\" width=\"100\">$rpt2Html</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
fclose($LastHeardLog);
|
||||
print "<td align=\"left\">$local_time</td>";
|
||||
print "<td align=\"left\" width=\"180\"><div style=\"float:left;\"><a href=\"".$callsignLookupUrl.$MyCallLink."\" target=\"_blank\">$MyCall</a>";
|
||||
if($MyId) { print "/".$MyId."</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$MyCallLink."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
else { print "</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$MyCallLink."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
print "<td align=\"left\" width=\"100\">$YourCall</td>";
|
||||
print "<td align=\"left\" width=\"100\">$Rpt1</td>";
|
||||
print "<td align=\"left\" width=\"100\">$Rpt2</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
fclose($LastHeardLog);
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
+107
-135
@@ -1,101 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* D-Star reflector link manager — admin-only POST handler + form.
|
||||
*
|
||||
* Loaded inline by /index.php only on the admin path
|
||||
* (`$_SERVER["PHP_SELF"] == "/admin/index.php"` gate at the top).
|
||||
* Two responsibilities:
|
||||
*
|
||||
* 1. POST handler. Accepts form fields:
|
||||
* - Link ("LINK" or "UNLINK")
|
||||
* - RefName (7-char reflector name, e.g. REF001 / DCS007)
|
||||
* - Letter (single-letter reflector module, A-Z)
|
||||
* - Module (8-char repeater callsign+band, e.g. "MW0MWZ B")
|
||||
* Each is validated by a preg_match whitelist (unsetting on bad
|
||||
* input) before being interpolated into a `sudo remotecontrold ...`
|
||||
* shell command. Refer to the security pass for hardening — the
|
||||
* validation is the only barrier to command injection.
|
||||
*
|
||||
* 2. Form rendering. Drop-downs for Module (from repeaterBand1..4),
|
||||
* RefName (DCS_Hosts.txt + DPlus_Hosts.txt + DExtra_Hosts.txt),
|
||||
* Letter (A-Z), and a LINK / UNLINK radio pair. Uses the
|
||||
* alternative `if (...): ... else: ?> ...HTML... <?php endif; ?>`
|
||||
* template syntax — preserve the colons.
|
||||
*
|
||||
* Also surfaces a "PiStar-Keeper Logbook" panel below the form when
|
||||
* /usr/local/sbin/pistar-keeper is running (last 5 entries from
|
||||
* /var/pistar-keeper/pistar-keeper.log + a download link).
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
setSecurityHeaders();
|
||||
|
||||
if ($_SERVER["PHP_SELF"] == "/admin/index.php") {
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
|
||||
if (!empty($_POST) && isset($_POST["dstrMgrSubmit"])):
|
||||
//if (!empty($_POST)):
|
||||
if (preg_match('/[^A-Z]/',$_POST["Link"])) { unset ($_POST["Link"]);}
|
||||
if ($_POST["Link"] == "LINK") {
|
||||
if (preg_match('/[^A-Za-z0-9 ]/',$_POST["RefName"])) { unset ($_POST["RefName"]);}
|
||||
if (preg_match('/[^A-Z]/',$_POST["Letter"])) { unset ($_POST["Letter"]);}
|
||||
if (preg_match('/[^A-Z0-9 ]/',$_POST["Module"])) { unset ($_POST["Module"]);}
|
||||
}
|
||||
if (preg_match('/[^A-Za-z0-9 ]/',$_POST["RefName"])) { unset ($_POST["RefName"]);}
|
||||
if (preg_match('/[^A-Z]/',$_POST["Letter"])) { unset ($_POST["Letter"]);}
|
||||
if (preg_match('/[^A-Z0-9 ]/',$_POST["Module"])) { unset ($_POST["Module"]);}
|
||||
}
|
||||
if ($_POST["Link"] == "UNLINK") {
|
||||
if (preg_match('/[^A-Z0-9 ]/',$_POST["Module"])) { unset ($_POST["Module"]);}
|
||||
}
|
||||
|
||||
if (preg_match('/[^A-Z0-9 ]/',$_POST["Module"])) { unset ($_POST["Module"]);}
|
||||
}
|
||||
|
||||
if (empty($_POST["RefName"]) || empty($_POST["Letter"]) || empty($_POST["Module"])) { echo "Somthing wrong with your input, try again";}
|
||||
|
||||
|
||||
else {
|
||||
if (strlen($_POST["RefName"]) != 7) {
|
||||
$targetRef = str_pad($_POST["RefName"], 7, " ");
|
||||
} else {
|
||||
$targetRef = $_POST["RefName"];
|
||||
}
|
||||
$targetRef = $targetRef.$_POST["Letter"];
|
||||
$targetRef = strtoupper($targetRef);
|
||||
$module = $_POST["Module"];
|
||||
if (strlen($_POST["RefName"]) != 7) {
|
||||
$targetRef = str_pad($_POST["RefName"], 7, " ");
|
||||
} else {
|
||||
$targetRef = $_POST["RefName"];
|
||||
}
|
||||
$targetRef = $targetRef.$_POST["Letter"];
|
||||
$targetRef = strtoupper($targetRef);
|
||||
$module = $_POST["Module"];
|
||||
|
||||
if (strlen($module) != 8) { //Fix the length of the module information
|
||||
$moduleFixedCs = strlen($module) - 1; //Length of the string, -1
|
||||
if (strlen($module) != 8) { //Fix the length of the module information
|
||||
$moduleFixedCs = strlen($module) - 1; //Length of the string, -1
|
||||
$moduleFixedBand = substr($module, -1); //Single Band Letter in the 8th position
|
||||
$moduleFixedCallPad = str_pad(substr($module, 0, $moduleFixedCs), 7); //Pad the callsign area to 7 chars
|
||||
$module = $moduleFixedCallPad.$moduleFixedBand; //Re add the band information
|
||||
};
|
||||
|
||||
$unlinkCommand = "sudo remotecontrold \"".$module."\" unlink";
|
||||
$linkCommand = "sudo remotecontrold \"".$module."\" link never \"".$targetRef."\"";
|
||||
$unlinkCommand = "sudo remotecontrold \"".$module."\" unlink";
|
||||
$linkCommand = "sudo remotecontrold \"".$module."\" link never \"".$targetRef."\"";
|
||||
|
||||
if ($module != $targetRef && $_POST["Link"] == "LINK") { // Sanity check that we are not connecting to ourself
|
||||
echo "<b>D-Star Link Manager</b>\n";
|
||||
echo "<table>\n<tr><th>Command Output</th></tr>\n<tr><td>";
|
||||
echo htmlspecialchars((string)exec($linkCommand), ENT_QUOTES, 'UTF-8');
|
||||
echo "</td></tr>\n</table>\n";
|
||||
}
|
||||
if ($module == $targetRef && $_POST["Link"] == "LINK") { // Sanity Check Failed
|
||||
echo "<b>D-Star Link Manager</b>\n";
|
||||
echo "<table>\n<tr><th>Command Output</th></tr>\n<tr><td>";
|
||||
echo "Cannot link to myself - Aborting link request!";
|
||||
echo "</td></tr>\n</table>\n";
|
||||
}
|
||||
if ($_POST["Link"] == "UNLINK") { // Allow Unlink no matter what
|
||||
echo "<b>D-Star Link Manager</b>\n";
|
||||
echo "<table>\n<tr><th>Command Output</th></tr>\n<tr><td>";
|
||||
echo htmlspecialchars((string)exec($unlinkCommand), ENT_QUOTES, 'UTF-8');
|
||||
echo "</td></tr>\n</table>\n";
|
||||
}
|
||||
}
|
||||
if ($module != $targetRef && $_POST["Link"] == "LINK") { // Sanity check that we are not connecting to ourself
|
||||
echo "<div class=\"settings-card\">\n<b>D-Star Link Manager</b>\n";
|
||||
echo "<table>\n<tr><th>Command Output</th></tr>\n<tr><td>";
|
||||
echo exec($linkCommand);
|
||||
echo "</td></tr>\n</table>\n</div>\n";
|
||||
}
|
||||
if ($module == $targetRef && $_POST["Link"] == "LINK") { // Sanity Check Failed
|
||||
echo "<div class=\"settings-card\">\n<b>D-Star Link Manager</b>\n";
|
||||
echo "<table>\n<tr><th>Command Output</th></tr>\n<tr><td>";
|
||||
echo "Cannot link to myself - Aborting link request!";
|
||||
echo "</td></tr>\n</table>\n</div>\n";
|
||||
}
|
||||
if ($_POST["Link"] == "UNLINK") { // Allow Unlink no matter what
|
||||
echo "<div class=\"settings-card\">\n<b>D-Star Link Manager</b>\n";
|
||||
echo "<table>\n<tr><th>Command Output</th></tr>\n<tr><td>";
|
||||
echo exec($unlinkCommand);
|
||||
echo "</td></tr>\n</table>\n</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
unset($_POST);
|
||||
echo '<script type="text/javascript">setTimeout(function() { window.location=window.location;},2000);</script>';
|
||||
|
||||
else: ?>
|
||||
<div class="settings-card">
|
||||
<b><?php echo $lang['d-star_link_manager'];?></b>
|
||||
<form action="//<?php echo htmlentities($_SERVER['HTTP_HOST']).htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
|
||||
<?php csrf_field(); ?>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="150"><a class="tooltip" href="#">Radio Module<span><b>Radio Module</b></span></a></th>
|
||||
@@ -124,10 +92,10 @@ else: ?>
|
||||
</td>
|
||||
<td>
|
||||
<select name="RefName"
|
||||
onchange="if (this.options[this.selectedIndex].value == 'customOption') {
|
||||
toggleField(this,this.nextSibling);
|
||||
this.selectedIndex='0';
|
||||
} ">
|
||||
onchange="if (this.options[this.selectedIndex].value == 'customOption') {
|
||||
toggleField(this,this.nextSibling);
|
||||
this.selectedIndex='0';
|
||||
} ">
|
||||
<?php
|
||||
$dcsFile = fopen("/usr/local/etc/DCS_Hosts.txt", "r");
|
||||
$dplusFile = fopen("/usr/local/etc/DPlus_Hosts.txt", "r");
|
||||
@@ -137,31 +105,31 @@ echo " <option value=\"".substr($configs['reflector1'], 0, 6)."\" selected=\"
|
||||
echo " <option value=\"customOption\">Text Entry</option>\n";
|
||||
|
||||
while (!feof($dcsFile)) {
|
||||
$dcsLine = fgets($dcsFile);
|
||||
if (strpos($dcsLine, 'DCS') !== FALSE && strpos($dcsLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dcsLine, 0, 6)."\">".substr($dcsLine, 0, 6)."</option>\n";
|
||||
}
|
||||
if (strpos($dcsLine, 'XLX') !== FALSE && strpos($dcsLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dcsLine, 0, 6)."\">".substr($dcsLine, 0, 6)."</option>\n";
|
||||
}
|
||||
$dcsLine = fgets($dcsFile);
|
||||
if (strpos($dcsLine, 'DCS') !== FALSE && strpos($dcsLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dcsLine, 0, 6)."\">".substr($dcsLine, 0, 6)."</option>\n";
|
||||
}
|
||||
if (strpos($dcsLine, 'XLX') !== FALSE && strpos($dcsLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dcsLine, 0, 6)."\">".substr($dcsLine, 0, 6)."</option>\n";
|
||||
}
|
||||
}
|
||||
fclose($dcsFile);
|
||||
|
||||
while (!feof($dplusFile)) {
|
||||
$dplusLine = fgets($dplusFile);
|
||||
if (strpos($dplusLine, 'REF') !== FALSE && strpos($dplusLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dplusLine, 0, 6)."\">".substr($dplusLine, 0, 6)."</option>\n";
|
||||
}
|
||||
if (strpos($dplusLine, 'XRF') !== FALSE && strpos($dplusLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dplusLine, 0, 6)."\">".substr($dplusLine, 0, 6)."</option>\n";
|
||||
}
|
||||
$dplusLine = fgets($dplusFile);
|
||||
if (strpos($dplusLine, 'REF') !== FALSE && strpos($dplusLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dplusLine, 0, 6)."\">".substr($dplusLine, 0, 6)."</option>\n";
|
||||
}
|
||||
if (strpos($dplusLine, 'XRF') !== FALSE && strpos($dplusLine, '#') === FALSE) {
|
||||
echo " <option value=\"".substr($dplusLine, 0, 6)."\">".substr($dplusLine, 0, 6)."</option>\n";
|
||||
}
|
||||
}
|
||||
fclose($dplusFile);
|
||||
|
||||
while (!feof($dextraFile)) {
|
||||
$dextraLine = fgets($dextraFile);
|
||||
if (strpos($dextraLine, 'XRF') !== FALSE && strpos($dextraLine, '#') === FALSE)
|
||||
echo " <option value=\"".substr($dextraLine, 0, 6)."\">".substr($dextraLine, 0, 6)."</option>\n";
|
||||
$dextraLine = fgets($dextraFile);
|
||||
if (strpos($dextraLine, 'XRF') !== FALSE && strpos($dextraLine, '#') === FALSE)
|
||||
echo " <option value=\"".substr($dextraLine, 0, 6)."\">".substr($dextraLine, 0, 6)."</option>\n";
|
||||
}
|
||||
fclose($dextraFile);
|
||||
|
||||
@@ -169,33 +137,33 @@ fclose($dextraFile);
|
||||
</select><input name="RefName" style="display:none;" disabled="disabled" type="text" size="7" maxlength="7"
|
||||
onblur="if(this.value==''){toggleField(this,this.previousSibling);}" />
|
||||
<select name="Letter">
|
||||
<?php echo " <option value=\"".substr($configs['reflector1'], 7)."\" selected=\"selected\">".substr($configs['reflector1'], 7)."</option>\n"; ?>
|
||||
<option>A</option>
|
||||
<option>B</option>
|
||||
<option>C</option>
|
||||
<option>D</option>
|
||||
<option>E</option>
|
||||
<option>F</option>
|
||||
<option>G</option>
|
||||
<option>H</option>
|
||||
<option>I</option>
|
||||
<option>J</option>
|
||||
<option>K</option>
|
||||
<option>L</option>
|
||||
<option>M</option>
|
||||
<option>N</option>
|
||||
<option>O</option>
|
||||
<option>P</option>
|
||||
<option>Q</option>
|
||||
<option>R</option>
|
||||
<option>S</option>
|
||||
<option>T</option>
|
||||
<option>U</option>
|
||||
<option>V</option>
|
||||
<option>W</option>
|
||||
<option>X</option>
|
||||
<option>Y</option>
|
||||
<option>Z</option>
|
||||
<?php echo " <option value=\"".substr($configs['reflector1'], 7)."\" selected=\"selected\">".substr($configs['reflector1'], 7)."</option>\n"; ?>
|
||||
<option>A</option>
|
||||
<option>B</option>
|
||||
<option>C</option>
|
||||
<option>D</option>
|
||||
<option>E</option>
|
||||
<option>F</option>
|
||||
<option>G</option>
|
||||
<option>H</option>
|
||||
<option>I</option>
|
||||
<option>J</option>
|
||||
<option>K</option>
|
||||
<option>L</option>
|
||||
<option>M</option>
|
||||
<option>N</option>
|
||||
<option>O</option>
|
||||
<option>P</option>
|
||||
<option>Q</option>
|
||||
<option>R</option>
|
||||
<option>S</option>
|
||||
<option>T</option>
|
||||
<option>U</option>
|
||||
<option>V</option>
|
||||
<option>W</option>
|
||||
<option>X</option>
|
||||
<option>Y</option>
|
||||
<option>Z</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
@@ -208,26 +176,30 @@ fclose($dextraFile);
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
exec ("pgrep pistar-keeper", $pids);
|
||||
if (!empty($pids))
|
||||
{
|
||||
echo "<br />\n";
|
||||
echo "<b>PiStar-Keeper Logbook</b><input type=button onClick=\"location.href='/admin/pistar-keeper-download.php'\" value=\"Download Logbook\">\n";
|
||||
echo "<table>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th><a class=\"tooltip\" href=\"#\">PiStar-Keeper Log Entries (UTC)<span><b>PiStar-Keeper Log Entries (UTC)</b></span></th>\n";
|
||||
echo " </tr>\n";
|
||||
{
|
||||
echo "<br />\n";
|
||||
echo "<div class=\"settings-card\">\n";
|
||||
echo "<b>PiStar-Keeper Logbook</b><input type=button onClick=\"location.href='/admin/pistar-keeper-download.php'\" value=\"Download Logbook\">\n";
|
||||
echo "<table>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th><a class=\"tooltip\" href=\"#\">PiStar-Keeper Log Entries (UTC)<span><b>PiStar-Keeper Log Entries (UTC)</b></span></th>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
exec ("tail -n 5 /var/pistar-keeper/pistar-keeper.log", $lines);
|
||||
$counter = 0;
|
||||
foreach ($lines as $line) {
|
||||
echo "<tr><td align=\"left\">".$lines[$counter]."</td></tr>\n";
|
||||
$counter++;
|
||||
}
|
||||
exec ("tail -n 5 /var/pistar-keeper/pistar-keeper.log", $lines);
|
||||
$counter = 0;
|
||||
foreach ($lines as $line) {
|
||||
echo "<tr><td align=\"left\">".$lines[$counter]."</td></tr>\n";
|
||||
$counter++;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
+26
-60
@@ -1,30 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Local TX list (D-Star repeater mode) — recent local transmissions
|
||||
* the connected D-Star repeater has worked.
|
||||
*
|
||||
* AJAX-loaded partial; refreshed every ~3 seconds by /index.php in
|
||||
* dstarrepeater mode. Same layout as last_herd.php (time / callsign /
|
||||
* target / Rpt1 / Rpt2) but filters Headers.log by "Repeater header"
|
||||
* lines so it only surfaces RF traffic, not network-side activity.
|
||||
*
|
||||
* Data flow: shells out to grep|sort against /var/log/pi-star/Headers.log
|
||||
* to build /tmp/worked.log, then regex-parses each line. Callsign links
|
||||
* use the operator's chosen lookup service (RadioID or QRZ from
|
||||
* /etc/pistar-css.ini's [Lookup] Service key) plus aprs.fi for dPRS.
|
||||
*
|
||||
* The "Headers.log sample" comment block below documents the exact line
|
||||
* shape the regex targets — preserve those examples verbatim.
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
// AJAX-loaded partial — embeddable variant only. See the note in
|
||||
// mmdvmhost/lh.php for why the historical double-call was wrong.
|
||||
setEmbeddableSecurityHeaders();
|
||||
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
$configs = array();
|
||||
|
||||
if ($configfile = fopen($gatewayConfigPath,'r')) {
|
||||
@@ -47,8 +22,8 @@ if (file_exists('/etc/pistar-css.ini')) {
|
||||
if (fopen($piStarCssFile,'r')) { $piStarCss = parse_ini_file($piStarCssFile, true); }
|
||||
|
||||
// Set the Values from the config file
|
||||
if (isset($piStarCss['Lookup']['Service'])) { $callsignLookupSvc = $piStarCss['Lookup']['Service']; } // Lookup Service "QRZ" or "RadioID"
|
||||
else { $callsignLookupSvc = "RadioID"; } // Set the default if its missing // Set the default if its missing
|
||||
if (isset($piStarCss['Lookup']['Service'])) { $callsignLookupSvc = $piStarCss['Lookup']['Service']; } // Lookup Service "QRZ" or "RadioID"
|
||||
else { $callsignLookupSvc = "RadioID"; } // Set the default if its missing // Set the default if its missing
|
||||
} else {
|
||||
// Default values
|
||||
$callsignLookupSvc = "RadioID";
|
||||
@@ -80,44 +55,35 @@ if ($callsignLookupSvc == "QRZ") { $callsignLookupUrl = "https://www.qrz.com/db/
|
||||
exec('(grep "Repeater header" '.$hdrLogPath.'|sort -r -k7,7|sort -u -k7,8|sort -r >/tmp/worked.log) 2>&1 &');
|
||||
$ci = 0;
|
||||
if ($WorkedLog = fopen("/tmp/worked.log",'r')) {
|
||||
while ($linkLine = fgets($WorkedLog)) {
|
||||
while ($linkLine = fgets($WorkedLog)) {
|
||||
if(preg_match_all('/^(.{19}).*My: (.*).*Your: (.*).*Rpt1: (.*).*Rpt2: (.*).*Flags: (.*)$/',$linkLine,$linx) > 0){
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
$QSODate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
|
||||
// Same normalisation pattern as dstarrepeater/last_herd.php —
|
||||
// see the note in that file for the rationale.
|
||||
$myCallRaw = str_replace(' ', '', substr($linx[2][0],0,8));
|
||||
$myCallHtml = htmlspecialchars($myCallRaw, ENT_QUOTES, 'UTF-8');
|
||||
$myCallLink = strtok(substr($linx[2][0],0,8), " ");
|
||||
$myCallLinkUrl = rawurlencode((string)$myCallLink);
|
||||
$myIdHtml = htmlspecialchars(str_replace(' ', '', substr($linx[2][0],9,4)), ENT_QUOTES, 'UTF-8');
|
||||
$yourCallHtml = str_replace(' ', ' ',
|
||||
htmlspecialchars(substr($linx[3][0],0,8), ENT_QUOTES, 'UTF-8'));
|
||||
$rpt1Html = str_replace(' ', ' ',
|
||||
htmlspecialchars(substr($linx[4][0],0,8), ENT_QUOTES, 'UTF-8'));
|
||||
$rpt2Html = str_replace(' ', ' ',
|
||||
htmlspecialchars(substr($linx[5][0],0,8), ENT_QUOTES, 'UTF-8'));
|
||||
|
||||
$utc_time = $QSODate;
|
||||
$ci++;
|
||||
if($ci > 1) { $ci = 0; }
|
||||
print "<tr>";
|
||||
$QSODate = date("d-M-Y H:i:s", strtotime(substr($linx[1][0],0,19)));
|
||||
$MyCall = str_replace(' ', '', substr($linx[2][0],0,8));
|
||||
$MyCallLink = strtok(substr($linx[2][0],0,8), " ");
|
||||
$MyId = str_replace(' ', '', substr($linx[2][0],9,4));
|
||||
$YourCall = str_replace(' ', ' ', substr($linx[3][0],0,8));
|
||||
$Rpt1 = str_replace(' ', ' ', substr($linx[4][0],0,8));
|
||||
$Rpt2 = str_replace(' ', ' ', substr($linx[5][0],0,8));
|
||||
$utc_time = $QSODate;
|
||||
$utc_tz = new DateTimeZone('UTC');
|
||||
$local_tz = new DateTimeZone(date_default_timezone_get ());
|
||||
$dt = new DateTime($utc_time, $utc_tz);
|
||||
$dt->setTimeZone($local_tz);
|
||||
$local_time = $dt->format('H:i:s M jS');
|
||||
print "<tr>";
|
||||
print "<td align=\"left\">$local_time</td>";
|
||||
print "<td align=\"left\" width=\"180\"><div style=\"float:left;\"><a href=\"".$callsignLookupUrl.$myCallLinkUrl."\" target=\"_blank\">$myCallHtml</a>";
|
||||
if($myIdHtml !== '') { print "/$myIdHtml</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$myCallLinkUrl."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
else { print "</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$myCallLinkUrl."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
print "<td align=\"left\" width=\"100\">$yourCallHtml</td>";
|
||||
print "<td align=\"left\" width=\"100\">$rpt1Html</td>";
|
||||
print "<td align=\"left\" width=\"100\">$rpt2Html</td>";
|
||||
print "<td align=\"left\">$local_time</td>";
|
||||
print "<td align=\"left\" width=\"180\"><div style=\"float:left;\"><a href=\"".$callsignLookupUrl.$MyCallLink."\" target=\"_blank\">$MyCall</a>";
|
||||
if($MyId) { print "/".$MyId."</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$MyCallLink."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
else { print "</div> <div style=\"text-align:right;\">(<a href=\"https://aprs.fi/#!call=".$MyCallLink."*\" target=\"_blank\">dPRS</a>)</div></td>"; }
|
||||
print "<td align=\"left\" width=\"100\">$YourCall</td>";
|
||||
print "<td align=\"left\" width=\"100\">$Rpt1</td>";
|
||||
print "<td align=\"left\" width=\"100\">$Rpt2</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
fclose($WorkedLog);
|
||||
}
|
||||
}
|
||||
fclose($WorkedLog);
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* System info partial — hostname, kernel, platform, CPU load/temp, service
|
||||
* status grid (MMDVMHost / DStarRepeater / ircDDBGateway / TimeServer /
|
||||
* PiStar-Watchdog / PiStar-Remote).
|
||||
*
|
||||
* Loaded inline by /index.php on the admin path and AJAX-refreshed every
|
||||
* 15 seconds via $("#sysInfo").load(...). Used in BOTH MMDVMHost and
|
||||
* DStarRepeater modes (same partial, gated by /index.php).
|
||||
*
|
||||
* Served two ways from /index.php: an inline `include` for the initial
|
||||
* page render, then AJAX `$("#sysInfo").load(...)` for refreshes. On
|
||||
* the inline path the parent has already emitted full security headers
|
||||
* (and the headers_sent() guard inside makes our call idempotent); on
|
||||
* the AJAX path the response is XHR — X-Frame-Options / frame-ancestors
|
||||
* apply to iframe ancestry, not XHR, so the embeddable variant is the
|
||||
* correct choice in both directions.
|
||||
*
|
||||
* Reads /etc/ircddbgateway (flat key=value via the hand-rolled parser)
|
||||
* to surface the gateway callsign in the hardware-info table.
|
||||
*/
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
setEmbeddableSecurityHeaders();
|
||||
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/mmdvmhost/tools.php';
|
||||
$configs = array();
|
||||
|
||||
@@ -43,7 +18,7 @@ $MYCALL=strtoupper($callsign);
|
||||
?>
|
||||
<?php
|
||||
$cpuLoad = sys_getloadavg();
|
||||
$cpuTempCRaw = exec('cat /sys/class/thermal/thermal_zone0/temp');
|
||||
$cpuTempCRaw = floatval(exec('cat /sys/class/thermal/thermal_zone0/temp'));
|
||||
if ($cpuTempCRaw > 1000) { $cpuTempC = round($cpuTempCRaw / 1000, 1); } else { $cpuTempC = round($cpuTempCRaw, 1); }
|
||||
$cpuTempF = round(+$cpuTempC * 9 / 5 + 32, 1);
|
||||
if ($cpuTempC < 50) { $cpuTempHTML = "<td style=\"background: #1d1\">".$cpuTempC."°C / ".$cpuTempF."°F</td>\n"; }
|
||||
@@ -60,9 +35,9 @@ if ($cpuTempC >= 69) { $cpuTempHTML = "<td style=\"background: #f00\">".$cpuTemp
|
||||
<th><a class="tooltip" href="#"><?php echo $lang['cpu_temp'];?><span><b>CPU Temp</b></span></a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php $h = php_uname('n'); if (strlen($h) >= 16) { $h = substr($h, 0, 14) . '..'; } echo htmlspecialchars((string)$h, ENT_QUOTES, 'UTF-8'); ?></td>
|
||||
<td><?php echo htmlspecialchars((string)php_uname('r'), ENT_QUOTES, 'UTF-8');?></td>
|
||||
<td colspan="2"><?php echo htmlspecialchars((string)exec('/usr/local/bin/platformDetect.sh'), ENT_QUOTES, 'UTF-8');?></td>
|
||||
<td><?php if (strlen(php_uname('n')) >= 16) { echo substr(php_uname('n'), 0, 14) . '..'; } else { echo php_uname('n'); } ?></td>
|
||||
<td><?php echo php_uname('r');?></td>
|
||||
<td colspan="2"><?php echo exec('/usr/local/bin/platformDetect.sh');?></td>
|
||||
<td><?php echo number_format($cpuLoad[0],2);?> / <?php echo number_format($cpuLoad[1],2);?> / <?php echo number_format($cpuLoad[2],2);?></td>
|
||||
<?php echo $cpuTempHTML; ?>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user