showing active YSFReflectors made functional again in new style of YSFHosts.txt

This commit is contained in:
dg9vh 2016-09-30 21:17:02 +00:00
parent 0853d3fd9c
commit f5344bc86f
4 changed files with 26 additions and 20 deletions

View file

@ -499,6 +499,18 @@ function getActualReflector($logLines, $mode) {
return "Reflector not linked"; return "Reflector not linked";
} }
function getActiveYSFReflectors() {
$reflectorlist = Array();
$file = fopen(YSFHOSTSPATH."/".YSFHOSTSFILENAME, 'r');
while (($line = fgetcsv($file, 1000, ";")) !== FALSE) {
//$line is an array of the csv elements
// print_r($line);
array_push($reflectorlist, array($line[1], $line[2], $line[0], $line[5]));
}
fclose($file);
return $reflectorlist;
}
/*
function getActiveYSFReflectors($logLines) { function getActiveYSFReflectors($logLines) {
// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122 // 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
@ -528,7 +540,7 @@ function getActiveYSFReflectors($logLines) {
array_multisort($reflectorlist); array_multisort($reflectorlist);
return $reflectorlist; return $reflectorlist;
} }
*/
function getYSFReflectorById($id, $reflectors) { function getYSFReflectorById($id, $reflectors) {
if ($id ==-1) { if ($id ==-1) {
return "not linked"; return "not linked";

View file

@ -20,7 +20,7 @@
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<!-- Standard-Panel-Inhalt --> <!-- Standard-Panel-Inhalt -->
<div class="panel-heading">YSFReflectors reported active last 2 hours</div> <div class="panel-heading">YSFReflectors reported active</div>
<!-- Tabelle --> <!-- Tabelle -->
<div class="table-responsive"> <div class="table-responsive">
<table id="ysfGateways" class="table table-condensed table-striped table-hover"> <table id="ysfGateways" class="table table-condensed table-striped table-hover">
@ -36,29 +36,15 @@
<th>Description</th> <th>Description</th>
<th>ID</th> <th>ID</th>
<th>Connections</th> <th>Connections</th>
<th>Last info of</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
$counter = 1; $counter = 1;
foreach ($activeYSFReflectors as $reflector) { foreach ($activeYSFReflectors as $reflector) {
$timestamp = $reflector[4]; echo "<tr>";
$timestamp2 = new DateTime($timestamp);
$now = new DateTime();
$timestamp2->add(new DateInterval('PT60M'));
if ($now->format('U') >= $timestamp2->format('U')) {
echo "<tr class=\"danger\">";
} else {
$timestamp2 = new DateTime($timestamp);
$timestamp2->add(new DateInterval('PT30M'));
if ($now->format('U') >= $timestamp2->format('U')) {
echo "<tr class=\"warning\">";
} else {echo "<tr>";
}
}
echo "<td>$counter</td>"; echo "<td>$counter</td>";
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 4; $i++) {
echo"<td>$reflector[$i]</td>"; echo"<td>$reflector[$i]</td>";
} }
echo "</tr>\n"; echo "</tr>\n";

View file

@ -79,7 +79,7 @@ include "include/tools.php";
<div class="panel-body"><input type="checkbox" name="ENABLEXTDLOOKUP" <?php if (defined("ENABLEXTDLOOKUP")) echo "checked" ?>></div> <div class="panel-body"><input type="checkbox" name="ENABLEXTDLOOKUP" <?php if (defined("ENABLEXTDLOOKUP")) echo "checked" ?>></div>
</div> </div>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" id="DMRIDDATPATH" style="width: 300px">Path to DMR-ID-Database-File</span> <span class="input-group-addon" id="DMRIDDATPATH" style="width: 300px">Path to DMR-ID-Database-File (including filename)</span>
<input type="text" value="<?php echo constant("DMRIDDATPATH") ?>" name="DMRIDDATPATH" class="form-control" placeholder="/var/mmdvm/DMRIDs.dat" aria-describedby="DMRIDDATPATH"> <input type="text" value="<?php echo constant("DMRIDDATPATH") ?>" name="DMRIDDATPATH" class="form-control" placeholder="/var/mmdvm/DMRIDs.dat" aria-describedby="DMRIDDATPATH">
</div> </div>
</div> </div>
@ -105,6 +105,14 @@ include "include/tools.php";
<span class="input-group-addon" id="YSFGATEWAYINIFILENAME" style="width: 300px">YSFGateway.ini-filename</span> <span class="input-group-addon" id="YSFGATEWAYINIFILENAME" style="width: 300px">YSFGateway.ini-filename</span>
<input type="text" value="<?php echo constant("YSFGATEWAYINIFILENAME") ?>" name="YSFGATEWAYINIFILENAME" class="form-control" placeholder="YSFGateway.ini" aria-describedby="YSFGATEWAYINIFILENAME"> <input type="text" value="<?php echo constant("YSFGATEWAYINIFILENAME") ?>" name="YSFGATEWAYINIFILENAME" class="form-control" placeholder="YSFGateway.ini" aria-describedby="YSFGATEWAYINIFILENAME">
</div> </div>
<div class="input-group">
<span class="input-group-addon" id="YSFHOSTSPATH" style="width: 300px">Path to YSFHosts.txt</span>
<input type="text" value="<?php echo constant("YSFHOSTSPATH") ?>" name="YSFHOSTSPATH" class="form-control" placeholder="/etc/YSFGateway/" aria-describedby="YSFHOSTSPATH">
</div>
<div class="input-group">
<span class="input-group-addon" id="YSFHOSTSFILENAME" style="width: 300px">YSFGateway.ini-filename</span>
<input type="text" value="<?php echo constant("YSFHOSTSFILENAME") ?>" name="YSFHOSTSFILENAME" class="form-control" placeholder="YSFHosts.txt" aria-describedby="YSFHOSTSFILENAME">
</div>
</div> </div>
<div class="container"> <div class="container">
<h2>ircddbgateway-Configuration</h2> <h2>ircddbgateway-Configuration</h2>

View file

@ -1,3 +1,3 @@
<?php <?php
define("VERSION", "20160930-1"); define("VERSION", "20160930-2");
?> ?>