mirror of
https://github.com/nostar/urfd.git
synced 2026-11-08 04:19:39 +00:00
Found an issue where timezone could be incorrect in api if server admin changes server timezeone to localtime instead of UTC.
36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
|
|
/*** Add stations to payload ***/
|
|
for ($i=0;$i<$Reflector->StationCount();$i++) {
|
|
|
|
$tmp = preg_split('/\s+/', $Reflector->Stations[$i]->GetCallSign(), -1, PREG_SPLIT_NO_EMPTY);
|
|
$Callsign = $tmp[0];
|
|
|
|
$tmp = preg_split('/\s+/', $Reflector->Stations[$i]->GetVia(), -1, PREG_SPLIT_NO_EMPTY);
|
|
$CallsignSuffix = $tmp[1];
|
|
|
|
// craft payload array
|
|
$payload['stations'][$i] = array(
|
|
'callsign' => $Callsign,
|
|
'callsignsuffix' => $CallsignSuffix,
|
|
'vianode' => $Reflector->Stations[$i]->GetVia(),
|
|
'onmodule' => $Reflector->Stations[$i]->GetModule(),
|
|
'lastheard' => gmdate('Y-m-d\TH:i:sp', $Reflector->Stations[$i]->GetLastHeardTime())
|
|
);
|
|
|
|
list ($CountryCode, $Country) = $Reflector->GetFlag($Reflector->Stations[$i]->GetCallSign());
|
|
|
|
$payload['stations'][$i]['country'] = array (
|
|
'country' => $Country,
|
|
'countrycode' => $CountryCode
|
|
);
|
|
|
|
}
|
|
|
|
|
|
// json encode payload array
|
|
$records = json_encode($payload);
|
|
|
|
echo $records;
|
|
|
|
?>
|