$node, 'callsign' => $row[1] ?? '', 'desc' => $row[2] ?? '', 'location' => $row[3] ?? '' ]; } return [ 'node' => $node, 'callsign' => 'Internal' ]; } function fetchNodeInfoIRLP($node) { $db = fetchIRLPDb(); $db = explode("\n", $db); foreach ($db as $row) { $line = str_getcsv($row, "\t"); if ($line[0] != $node) continue; return [ 'node' => $node, 'callsign' => $line[1], 'desc' => $line[15], 'location' => "{$line[2]}, {$line[3]}" ]; } return [ 'node' => $node, 'callsign' => 'Internal', 'desc' => '', 'location' => '' ]; } function fetchAllStarDb() { $dbFile = __DIR__.'/storage/allstar.txt'; if (!file_exists($dbFile) || outdatedFile($dbFile)) { $db = file_get_contents("http://allmondb.allstarlink.org"); file_put_contents($dbFile, $db); return $db; } return file_get_contents($dbFile); } function fetchIRLPDb() { $dbFile = __DIR__.'/storage/irlp.txt'; if (!file_exists($dbFile) || outdatedFile($dbFile)) { $db = file_get_contents("http://status.irlp.net/nohtmlstatus.txt.zip"); file_put_contents("${dbFile}.zip", $db); shell_exec("/usr/bin/unzip -p ${dbFile}.zip > ${dbFile}"); } return file_get_contents($dbFile); } function outdatedFile($path) { return time() - filemtime($path) > 3600; }