Some minor bug fixes

This commit is contained in:
2026-08-25 18:37:42 +02:00
parent 46d4702471
commit 0d4b159ab3
17 changed files with 42 additions and 49 deletions
+10 -11
View File
@@ -30,9 +30,6 @@ class Feed extends PhpObject {
//Timezone
const TIMEZONE_HOOK = 'http://api.geonames.org/timezoneJSON';
const TIMEZONE_PARAM = array(
'username' => Settings::TIMEZONE_USER
);
//DB Tables
const SPOT_TABLE = 'spots';
@@ -235,10 +232,10 @@ class Feed extends PhpObject {
'type' => $asMsg['messageType'],
'latitude' => $asMsg['latitude'],
'longitude' => $asMsg['longitude'],
'iso_time' => $asMsg['dateTime'], //ISO 8601 time (backup)
'site_time' => date(Db::TIMESTAMP_FORMAT, $asMsg['unixTime']), //Conversion to Site Time
'timezone' => $this->getTimeZone(array($asMsg['latitude'], $asMsg['longitude']), $asMsg['unixTime']),
'unix_time' => $asMsg['unixTime'], //UNIX Time (backup)
'iso_time' => $asMsg['dateTime'], //ISO 8601 time (backup)
'site_time' => date(Db::TIMESTAMP_FORMAT, $asMsg['unixTime']), //Conversion to Site Time
'timezone' => $this->getTimeZone($asMsg['latitude'], $asMsg['longitude']), //Get message time zone
'unix_time' => $asMsg['unixTime'], //UNIX Time (backup)
'content' => $asMsg['messageContent'],
'battery_state' => $asMsg['batteryState']
);
@@ -291,10 +288,12 @@ class Feed extends PhpObject {
);
}
private function getTimeZone($asLatLng, $iTimeStamp) {
$asParams = self::TIMEZONE_PARAM;
$asParams['lat'] = $asLatLng[0];
$asParams['lng'] = $asLatLng[1];
private function getTimeZone($iLat, $iLng) {
$asParams = array(
'username' => Settings::TIMEZONE_USER,
'lat' => $iLat,
'lng' => $iLng
);
$sApiUrl = self::TIMEZONE_HOOK.'?'.http_build_query($asParams);
$asTimeZone = json_decode(file_get_contents($sApiUrl), true);