@@ -7,7 +7,9 @@ discard block |
||
7 | 7 | public function __construct($dbc = null) { |
8 | 8 | $Connection = new Connection($dbc); |
9 | 9 | $this->db = $Connection->db; |
10 | - if ($this->db === null) die('Error: No DB connection.'); |
|
10 | + if ($this->db === null) { |
|
11 | + die('Error: No DB connection.'); |
|
12 | + } |
|
11 | 13 | } |
12 | 14 | |
13 | 15 | public function getAllLocationInfo() { |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | $query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0"; |
73 | 75 | } |
74 | 76 | $query .= " ORDER BY last_seen DESC"; |
75 | - if ($limit) $query .= " LIMIT 400"; |
|
77 | + if ($limit) { |
|
78 | + $query .= " LIMIT 400"; |
|
79 | + } |
|
76 | 80 | $query_values = array(':type' => $type); |
77 | 81 | try { |
78 | 82 | $sth = $this->db->prepare($query); |
@@ -111,7 +115,9 @@ discard block |
||
111 | 115 | } |
112 | 116 | |
113 | 117 | public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
114 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
118 | + if ($last_seen == '') { |
|
119 | + $last_seen = date('Y-m-d H:i:s'); |
|
120 | + } |
|
115 | 121 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
116 | 122 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
117 | 123 | try { |
@@ -123,7 +129,9 @@ discard block |
||
123 | 129 | } |
124 | 130 | |
125 | 131 | public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
126 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
132 | + if ($last_seen == '') { |
|
133 | + $last_seen = date('Y-m-d H:i:s'); |
|
134 | + } |
|
127 | 135 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
128 | 136 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
129 | 137 | try { |
@@ -146,7 +154,9 @@ discard block |
||
146 | 154 | } |
147 | 155 | |
148 | 156 | public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
149 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
157 | + if ($last_seen == '') { |
|
158 | + $last_seen = date('Y-m-d H:i:s'); |
|
159 | + } |
|
150 | 160 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
151 | 161 | $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
152 | 162 | try { |
@@ -163,11 +163,26 @@ discard block |
||
163 | 163 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
164 | 164 | <li><?php echo _("NOTAM scope:"); ?> |
165 | 165 | <select class="selectpicker" onchange="notamscope(this);"> |
166 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
167 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
168 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
169 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
170 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
166 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
167 | + print ' selected'; |
|
168 | +} |
|
169 | +?>>All</option> |
|
170 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
171 | + print ' selected'; |
|
172 | +} |
|
173 | +?>>Airport/Enroute warning</option> |
|
174 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
175 | + print ' selected'; |
|
176 | +} |
|
177 | +?>>Airport warning</option> |
|
178 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
179 | + print ' selected'; |
|
180 | +} |
|
181 | +?>>Navigation warning</option> |
|
182 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
183 | + print ' selected'; |
|
184 | +} |
|
185 | +?>>Enroute warning</option> |
|
171 | 186 | </select |
172 | 187 | </li> |
173 | 188 | </ul> |
@@ -195,7 +210,12 @@ discard block |
||
195 | 210 | <div class="form-group"> |
196 | 211 | <label>From (UTC):</label> |
197 | 212 | <div class='input-group date' id='datetimepicker1'> |
198 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
213 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
214 | + print $_POST['start_date']; |
|
215 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
216 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
217 | +} |
|
218 | +?>" required /> |
|
199 | 219 | <span class="input-group-addon"> |
200 | 220 | <span class="glyphicon glyphicon-calendar"></span> |
201 | 221 | </span> |
@@ -204,7 +224,12 @@ discard block |
||
204 | 224 | <div class="form-group"> |
205 | 225 | <label>To (UTC):</label> |
206 | 226 | <div class='input-group date' id='datetimepicker2'> |
207 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
227 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
228 | + print $_POST['end_date']; |
|
229 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
230 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
231 | +} |
|
232 | +?>" /> |
|
208 | 233 | <span class="input-group-addon"> |
209 | 234 | <span class="glyphicon glyphicon-calendar"></span> |
210 | 235 | </span> |
@@ -229,8 +254,20 @@ discard block |
||
229 | 254 | </script> |
230 | 255 | <li><?php echo _("Playback speed:"); ?> |
231 | 256 | <div class="range"> |
232 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
233 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
257 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
258 | + print $_POST['archivespeed']; |
|
259 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
260 | + print $_COOKIE['archive_speed']; |
|
261 | +} else { |
|
262 | + print '1'; |
|
263 | +} |
|
264 | +?>"> |
|
265 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
266 | + print $_COOKIE['archive_speed']; |
|
267 | +} else { |
|
268 | + print '1'; |
|
269 | +} |
|
270 | +?></output> |
|
234 | 271 | </div> |
235 | 272 | </li> |
236 | 273 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -252,15 +289,27 @@ discard block |
||
252 | 289 | <li><?php echo _("Type of Map:"); ?> |
253 | 290 | <select class="selectpicker" onchange="mapType(this);"> |
254 | 291 | <?php |
255 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
256 | - else $MapType = $_COOKIE['MapType']; |
|
292 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
293 | + $MapType = $globalMapProvider; |
|
294 | + } else { |
|
295 | + $MapType = $_COOKIE['MapType']; |
|
296 | + } |
|
257 | 297 | ?> |
258 | 298 | <?php |
259 | 299 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
260 | 300 | ?> |
261 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
262 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
263 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
301 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
302 | + print ' selected'; |
|
303 | +} |
|
304 | +?>>Bing-Aerial</option> |
|
305 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
306 | + print ' selected'; |
|
307 | +} |
|
308 | +?>>Bing-Hybrid</option> |
|
309 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
310 | + print ' selected'; |
|
311 | +} |
|
312 | +?>>Bing-Road</option> |
|
264 | 313 | <?php |
265 | 314 | } |
266 | 315 | ?> |
@@ -270,56 +319,131 @@ discard block |
||
270 | 319 | <?php |
271 | 320 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
272 | 321 | ?> |
273 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
274 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
275 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
322 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
323 | + print ' selected'; |
|
324 | +} |
|
325 | +?>>Here-Aerial</option> |
|
326 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
327 | + print ' selected'; |
|
328 | +} |
|
329 | +?>>Here-Hybrid</option> |
|
330 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
331 | + print ' selected'; |
|
332 | +} |
|
333 | +?>>Here-Road</option> |
|
276 | 334 | <?php |
277 | 335 | } |
278 | 336 | ?> |
279 | 337 | <?php |
280 | 338 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
281 | 339 | ?> |
282 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
283 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
284 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
285 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
340 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
341 | + print ' selected'; |
|
342 | +} |
|
343 | +?>>Google Roadmap</option> |
|
344 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
345 | + print ' selected'; |
|
346 | +} |
|
347 | +?>>Google Satellite</option> |
|
348 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
349 | + print ' selected'; |
|
350 | +} |
|
351 | +?>>Google Hybrid</option> |
|
352 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
353 | + print ' selected'; |
|
354 | +} |
|
355 | +?>>Google Terrain</option> |
|
286 | 356 | <?php |
287 | 357 | } |
288 | 358 | ?> |
289 | 359 | <?php |
290 | 360 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
291 | 361 | ?> |
292 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
293 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
294 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
362 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
363 | + print ' selected'; |
|
364 | +} |
|
365 | +?>>MapQuest-OSM</option> |
|
366 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
367 | + print ' selected'; |
|
368 | +} |
|
369 | +?>>MapQuest-Aerial</option> |
|
370 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
371 | + print ' selected'; |
|
372 | +} |
|
373 | +?>>MapQuest-Hybrid</option> |
|
295 | 374 | <?php |
296 | 375 | } |
297 | 376 | ?> |
298 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
377 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
378 | + print ' selected'; |
|
379 | +} |
|
380 | +?>>Yandex</option> |
|
299 | 381 | <?php |
300 | 382 | } |
301 | 383 | ?> |
302 | 384 | <?php |
303 | 385 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
304 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
305 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
386 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
387 | + $MapBoxId = 'default'; |
|
388 | + } else { |
|
389 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
390 | + } |
|
306 | 391 | ?> |
307 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
308 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
309 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
310 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
311 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
312 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
313 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
314 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
315 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
316 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
317 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
318 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
392 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
393 | + print ' selected'; |
|
394 | +} |
|
395 | +?>>Mapbox default</option> |
|
396 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
397 | + print ' selected'; |
|
398 | +} |
|
399 | +?>>Mapbox streets</option> |
|
400 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
401 | + print ' selected'; |
|
402 | +} |
|
403 | +?>>Mapbox light</option> |
|
404 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
405 | + print ' selected'; |
|
406 | +} |
|
407 | +?>>Mapbox dark</option> |
|
408 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
409 | + print ' selected'; |
|
410 | +} |
|
411 | +?>>Mapbox satellite</option> |
|
412 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
413 | + print ' selected'; |
|
414 | +} |
|
415 | +?>>Mapbox streets-satellite</option> |
|
416 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
417 | + print ' selected'; |
|
418 | +} |
|
419 | +?>>Mapbox streets-basic</option> |
|
420 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
421 | + print ' selected'; |
|
422 | +} |
|
423 | +?>>Mapbox comic</option> |
|
424 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
425 | + print ' selected'; |
|
426 | +} |
|
427 | +?>>Mapbox outdoors</option> |
|
428 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
429 | + print ' selected'; |
|
430 | +} |
|
431 | +?>>Mapbox pencil</option> |
|
432 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
433 | + print ' selected'; |
|
434 | +} |
|
435 | +?>>Mapbox pirates</option> |
|
436 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
437 | + print ' selected'; |
|
438 | +} |
|
439 | +?>>Mapbox emerald</option> |
|
319 | 440 | <?php |
320 | 441 | } |
321 | 442 | ?> |
322 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
443 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
444 | + print ' selected'; |
|
445 | +} |
|
446 | +?>>OpenStreetMap</option> |
|
323 | 447 | </select> |
324 | 448 | </li> |
325 | 449 | <?php |
@@ -327,10 +451,22 @@ discard block |
||
327 | 451 | ?> |
328 | 452 | <li><?php echo _("Type of Terrain:"); ?> |
329 | 453 | <select class="selectpicker" onchange="terrainType(this);"> |
330 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
331 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
332 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
333 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
454 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
455 | + print ' selected'; |
|
456 | +} |
|
457 | +?>>stk terrain</option> |
|
458 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
459 | + print ' selected'; |
|
460 | +} |
|
461 | +?>>ellipsoid</option> |
|
462 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
463 | + print ' selected'; |
|
464 | +} |
|
465 | +?>>vr terrain</option> |
|
466 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
467 | + print ' selected'; |
|
468 | +} |
|
469 | +?>>ArticDEM</option> |
|
334 | 470 | </select> |
335 | 471 | </li> |
336 | 472 | <?php |
@@ -342,33 +478,69 @@ discard block |
||
342 | 478 | <?php |
343 | 479 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
344 | 480 | ?> |
345 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
346 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
347 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
348 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
349 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
481 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
482 | + print 'checked'; |
|
483 | +} |
|
484 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
485 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
486 | + print 'checked'; |
|
487 | +} |
|
488 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
489 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) { |
|
490 | + print 'checked'; |
|
491 | +} |
|
492 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
493 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
494 | + print 'checked'; |
|
495 | +} |
|
496 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
497 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
498 | + print 'checked'; |
|
499 | +} |
|
500 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
350 | 501 | <?php |
351 | 502 | } |
352 | 503 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
353 | 504 | ?> |
354 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
505 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
506 | + print 'checked'; |
|
507 | +} |
|
508 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
355 | 509 | <?php |
356 | 510 | } |
357 | 511 | } |
358 | 512 | ?> |
359 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
360 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
361 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
362 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
513 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
514 | + print 'checked'; |
|
515 | +} |
|
516 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
517 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
518 | + print 'checked'; |
|
519 | +} |
|
520 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
521 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
522 | + print 'checked'; |
|
523 | +} |
|
524 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
525 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
526 | + print 'checked'; |
|
527 | +} |
|
528 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
363 | 529 | <?php |
364 | 530 | if (isset($globalMapFires) && $globalMapFires) { |
365 | 531 | ?> |
366 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
532 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
533 | + print 'checked'; |
|
534 | +} |
|
535 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
367 | 536 | <?php |
368 | 537 | } |
369 | 538 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
370 | 539 | ?> |
371 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
540 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
541 | + print 'checked'; |
|
542 | +} |
|
543 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
372 | 544 | <?php |
373 | 545 | } |
374 | 546 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -381,17 +553,25 @@ discard block |
||
381 | 553 | if (function_exists('array_column')) { |
382 | 554 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
383 | 555 | ?> |
384 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
556 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
557 | + print 'checked'; |
|
558 | +} |
|
559 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
385 | 560 | <?php |
386 | 561 | } |
387 | 562 | } elseif (isset($globalSources)) { |
388 | 563 | $dispolar = false; |
389 | 564 | foreach ($globalSources as $testsource) { |
390 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
565 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
566 | + $dispolar = true; |
|
567 | + } |
|
391 | 568 | } |
392 | 569 | if ($dispolar) { |
393 | 570 | ?> |
394 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
571 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
572 | + print 'checked'; |
|
573 | +} |
|
574 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
395 | 575 | <?php |
396 | 576 | } |
397 | 577 | } |
@@ -404,12 +584,22 @@ discard block |
||
404 | 584 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
405 | 585 | if (extension_loaded('gd') && function_exists('gd_info')) { |
406 | 586 | ?> |
407 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
587 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
588 | + print 'checked'; |
|
589 | +} |
|
590 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
408 | 591 | <?php |
409 | 592 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
410 | 593 | ?> |
411 | 594 | <li><?php echo _("Aircraft icon color:"); ?> |
412 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
|
595 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
596 | + print $_COOKIE['IconColor']; |
|
597 | +} elseif (isset($globalAircraftIconColor)) { |
|
598 | + print $globalAircraftIconColor; |
|
599 | +} else { |
|
600 | + print '1a3151'; |
|
601 | +} |
|
602 | +?>"> |
|
413 | 603 | </li> |
414 | 604 | <?php |
415 | 605 | } |
@@ -421,7 +611,14 @@ discard block |
||
421 | 611 | if (extension_loaded('gd') && function_exists('gd_info')) { |
422 | 612 | ?> |
423 | 613 | <li><?php echo _("Marine icon color:"); ?> |
424 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
614 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
615 | + print $_COOKIE['MarineIconColor']; |
|
616 | +} elseif (isset($globalMarineIconColor)) { |
|
617 | + print $globalMarineIconColor; |
|
618 | +} else { |
|
619 | + print '1a3151'; |
|
620 | +} |
|
621 | +?>"> |
|
425 | 622 | </li> |
426 | 623 | <?php |
427 | 624 | } |
@@ -432,7 +629,14 @@ discard block |
||
432 | 629 | if (extension_loaded('gd') && function_exists('gd_info')) { |
433 | 630 | ?> |
434 | 631 | <li><?php echo _("Tracker icon color:"); ?> |
435 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
632 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
633 | + print $_COOKIE['TrackerIconColor']; |
|
634 | +} elseif (isset($globalTrackerIconColor)) { |
|
635 | + print $globalTrackerIconColor; |
|
636 | +} else { |
|
637 | + print '1a3151'; |
|
638 | +} |
|
639 | +?>"> |
|
436 | 640 | </li> |
437 | 641 | <?php |
438 | 642 | } |
@@ -443,8 +647,22 @@ discard block |
||
443 | 647 | ?> |
444 | 648 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
445 | 649 | <div class="range"> |
446 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
447 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
650 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
651 | + print $_COOKIE['AirportZoom']; |
|
652 | +} elseif (isset($globalAirportZoom)) { |
|
653 | + print $globalAirportZoom; |
|
654 | +} else { |
|
655 | + print '7'; |
|
656 | +} |
|
657 | +?>"> |
|
658 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
659 | + print $_COOKIE['AirportZoom']; |
|
660 | +} elseif (isset($globalAirportZoom)) { |
|
661 | + print $globalAirportZoom; |
|
662 | +} else { |
|
663 | + print '7'; |
|
664 | +} |
|
665 | +?></output> |
|
448 | 666 | </div> |
449 | 667 | </li> |
450 | 668 | <?php |
@@ -456,9 +674,19 @@ discard block |
||
456 | 674 | <?php |
457 | 675 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
458 | 676 | ?> |
459 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li> |
|
677 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
678 | + print 'checked'; |
|
679 | +} |
|
680 | +?> ><?php echo _("Force Aircraft color"); ?></li> |
|
460 | 681 | <li><?php echo _("Aircraft icon color:"); ?> |
461 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
682 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
683 | + print $_COOKIE['IconColor']; |
|
684 | +} elseif (isset($globalAircraftIconColor)) { |
|
685 | + print $globalAircraftIconColor; |
|
686 | +} else { |
|
687 | + print 'ff0000'; |
|
688 | +} |
|
689 | +?>"> |
|
462 | 690 | </li> |
463 | 691 | <?php |
464 | 692 | } |
@@ -466,9 +694,19 @@ discard block |
||
466 | 694 | <?php |
467 | 695 | if (isset($globalMarine) && $globalMarine === TRUE) { |
468 | 696 | ?> |
469 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li> |
|
697 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
698 | + print 'checked'; |
|
699 | +} |
|
700 | +?> ><?php echo _("Force Marine color"); ?></li> |
|
470 | 701 | <li><?php echo _("Marine icon color:"); ?> |
471 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
702 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
703 | + print $_COOKIE['MarineIconColor']; |
|
704 | +} elseif (isset($globalMarineIconColor)) { |
|
705 | + print $globalMarineIconColor; |
|
706 | +} else { |
|
707 | + print 'ff0000'; |
|
708 | +} |
|
709 | +?>"> |
|
472 | 710 | </li> |
473 | 711 | <?php |
474 | 712 | } |
@@ -476,9 +714,19 @@ discard block |
||
476 | 714 | <?php |
477 | 715 | if (isset($globalTracker) && $globalTracker === TRUE) { |
478 | 716 | ?> |
479 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li> |
|
717 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
718 | + print 'checked'; |
|
719 | +} |
|
720 | +?> ><?php echo _("Force Tracker color"); ?></li> |
|
480 | 721 | <li><?php echo _("Tracker icon color:"); ?> |
481 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
722 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
723 | + print $_COOKIE['TrackerIconColor']; |
|
724 | +} elseif (isset($globalTrackerIconColor)) { |
|
725 | + print $globalTrackerIconColor; |
|
726 | +} else { |
|
727 | + print 'ff0000'; |
|
728 | +} |
|
729 | +?>"> |
|
482 | 730 | </li> |
483 | 731 | <?php |
484 | 732 | } |
@@ -486,22 +734,46 @@ discard block |
||
486 | 734 | ?> |
487 | 735 | <li><?php echo _("Distance unit:"); ?> |
488 | 736 | <select class="selectpicker" onchange="unitdistance(this);"> |
489 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
490 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
491 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
737 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
738 | + echo ' selected'; |
|
739 | +} |
|
740 | +?>>km</option> |
|
741 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
742 | + echo ' selected'; |
|
743 | +} |
|
744 | +?>>nm</option> |
|
745 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
746 | + echo ' selected'; |
|
747 | +} |
|
748 | +?>>mi</option> |
|
492 | 749 | </select> |
493 | 750 | </li> |
494 | 751 | <li><?php echo _("Altitude unit:"); ?> |
495 | 752 | <select class="selectpicker" onchange="unitaltitude(this);"> |
496 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
497 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
753 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
754 | + echo ' selected'; |
|
755 | +} |
|
756 | +?>>m</option> |
|
757 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
758 | + echo ' selected'; |
|
759 | +} |
|
760 | +?>>feet</option> |
|
498 | 761 | </select> |
499 | 762 | </li> |
500 | 763 | <li><?php echo _("Speed unit:"); ?> |
501 | 764 | <select class="selectpicker" onchange="unitspeed(this);"> |
502 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
503 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
504 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
765 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
766 | + echo ' selected'; |
|
767 | +} |
|
768 | +?>>km/h</option> |
|
769 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
770 | + echo ' selected'; |
|
771 | +} |
|
772 | +?>>mph</option> |
|
773 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
774 | + echo ' selected'; |
|
775 | +} |
|
776 | +?>>knots</option> |
|
505 | 777 | </select> |
506 | 778 | </li> |
507 | 779 | |
@@ -519,9 +791,18 @@ discard block |
||
519 | 791 | <?php |
520 | 792 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
521 | 793 | ?> |
522 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
523 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
524 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
794 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
795 | + print 'checked'; |
|
796 | +} |
|
797 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
798 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
799 | + print 'checked'; |
|
800 | +} |
|
801 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
802 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
803 | + print 'checked'; |
|
804 | +} |
|
805 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
525 | 806 | <?php |
526 | 807 | } |
527 | 808 | ?> |
@@ -529,10 +810,16 @@ discard block |
||
529 | 810 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
530 | 811 | ?> |
531 | 812 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
532 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
813 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
814 | + print 'checked'; |
|
815 | +} |
|
816 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
533 | 817 | <?php } ?> |
534 | 818 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
535 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
819 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
820 | + print 'checked'; |
|
821 | +} |
|
822 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
536 | 823 | <?php } ?> |
537 | 824 | <?php |
538 | 825 | } |
@@ -549,7 +836,9 @@ discard block |
||
549 | 836 | } |
550 | 837 | foreach($allairlinenames as $airline) { |
551 | 838 | $airline_name = $airline['airline_name']; |
552 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
839 | + if (strlen($airline_name) > 30) { |
|
840 | + $airline_name = substr($airline_name,0,30).'...'; |
|
841 | + } |
|
553 | 842 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
554 | 843 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
555 | 844 | } else { |
@@ -567,7 +856,10 @@ discard block |
||
567 | 856 | <li><?php echo _("Display alliance:"); ?> |
568 | 857 | <br/> |
569 | 858 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
570 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
859 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
860 | + echo ' selected'; |
|
861 | +} |
|
862 | +?>><?php echo _("All"); ?></option> |
|
571 | 863 | <?php |
572 | 864 | foreach($allalliancenames as $alliance) { |
573 | 865 | $alliance_name = $alliance['alliance']; |
@@ -626,10 +918,22 @@ discard block |
||
626 | 918 | ?> |
627 | 919 | <li><?php echo _("Display airlines of type:"); ?><br/> |
628 | 920 | <select class="selectpicker" onchange="airlinestype(this);"> |
629 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
630 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
631 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
632 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
921 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
922 | + echo ' selected'; |
|
923 | +} |
|
924 | +?>><?php echo _("All"); ?></option> |
|
925 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
926 | + echo ' selected'; |
|
927 | +} |
|
928 | +?>><?php echo _("Passenger"); ?></option> |
|
929 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
930 | + echo ' selected'; |
|
931 | +} |
|
932 | +?>><?php echo _("Cargo"); ?></option> |
|
933 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
934 | + echo ' selected'; |
|
935 | +} |
|
936 | +?>><?php echo _("Military"); ?></option> |
|
633 | 937 | </select> |
634 | 938 | </li> |
635 | 939 | <?php |
@@ -637,7 +941,10 @@ discard block |
||
637 | 941 | ?> |
638 | 942 | <li> |
639 | 943 | <?php echo _("Display flight with ident:"); ?> |
640 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
944 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
945 | + print $_COOKIE['filter_ident']; |
|
946 | +} |
|
947 | +?>" /> |
|
641 | 948 | </li> |
642 | 949 | <?php |
643 | 950 | } |
@@ -656,7 +963,10 @@ discard block |
||
656 | 963 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
657 | 964 | <form> |
658 | 965 | <ul> |
659 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
966 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
967 | + print 'checked'; |
|
968 | +} |
|
969 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
660 | 970 | <li><?php echo _("Type:"); ?> |
661 | 971 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
662 | 972 | <?php |
@@ -664,25 +974,45 @@ discard block |
||
664 | 974 | $types = $Satellite->get_tle_types(); |
665 | 975 | foreach ($types as $type) { |
666 | 976 | $type_name = $type['tle_type']; |
667 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
668 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
669 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
670 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
671 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
672 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
673 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
674 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
675 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
676 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
677 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
678 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
679 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
680 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
681 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
682 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
683 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
684 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
685 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
977 | + if ($type_name == 'musson') { |
|
978 | + $type_name = 'Russian LEO Navigation'; |
|
979 | + } else if ($type_name == 'nnss') { |
|
980 | + $type_name = 'Navi Navigation Satellite System'; |
|
981 | + } else if ($type_name == 'sbas') { |
|
982 | + $type_name = 'Satellite-Based Augmentation System'; |
|
983 | + } else if ($type_name == 'glo-ops') { |
|
984 | + $type_name = 'Glonass Operational'; |
|
985 | + } else if ($type_name == 'gps-ops') { |
|
986 | + $type_name = 'GPS Operational'; |
|
987 | + } else if ($type_name == 'argos') { |
|
988 | + $type_name = 'ARGOS Data Collection System'; |
|
989 | + } else if ($type_name == 'tdrss') { |
|
990 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
991 | + } else if ($type_name == 'sarsat') { |
|
992 | + $type_name = 'Search & Rescue'; |
|
993 | + } else if ($type_name == 'dmc') { |
|
994 | + $type_name = 'Disaster Monitoring'; |
|
995 | + } else if ($type_name == 'resource') { |
|
996 | + $type_name = 'Earth Resources'; |
|
997 | + } else if ($type_name == 'stations') { |
|
998 | + $type_name = 'Space Stations'; |
|
999 | + } else if ($type_name == 'geo') { |
|
1000 | + $type_name = 'Geostationary'; |
|
1001 | + } else if ($type_name == 'amateur') { |
|
1002 | + $type_name = 'Amateur Radio'; |
|
1003 | + } else if ($type_name == 'x-comm') { |
|
1004 | + $type_name = 'Experimental'; |
|
1005 | + } else if ($type_name == 'other-comm') { |
|
1006 | + $type_name = 'Other Comm'; |
|
1007 | + } else if ($type_name == 'science') { |
|
1008 | + $type_name = 'Space & Earth Science'; |
|
1009 | + } else if ($type_name == 'military') { |
|
1010 | + $type_name = 'Miscellaneous Military'; |
|
1011 | + } else if ($type_name == 'radar') { |
|
1012 | + $type_name = 'Radar Calibration'; |
|
1013 | + } else if ($type_name == 'tle-new') { |
|
1014 | + $type_name = 'Last 30 days launches'; |
|
1015 | + } |
|
686 | 1016 | |
687 | 1017 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
688 | 1018 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -8,7 +8,9 @@ discard block |
||
8 | 8 | public function __construct($dbc = null) { |
9 | 9 | $Connection = new Connection($dbc); |
10 | 10 | $this->db = $Connection->db(); |
11 | - if ($this->db === null) die('Error: No DB connection.'); |
|
11 | + if ($this->db === null) { |
|
12 | + die('Error: No DB connection.'); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
30 | 32 | if (isset($filter[0]['source'])) { |
31 | 33 | $filters = array_merge($filters,$filter); |
32 | 34 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) { |
|
36 | + $filter = array_merge($filter,$globalFilter); |
|
37 | + } |
|
34 | 38 | $filter_query_join = ''; |
35 | 39 | $filter_query_where = ''; |
36 | 40 | foreach($filters as $flt) { |
@@ -77,8 +81,11 @@ discard block |
||
77 | 81 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
78 | 82 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
79 | 83 | } |
80 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
81 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
84 | + if ($filter_query_where == '' && $where) { |
|
85 | + $filter_query_where = ' WHERE'; |
|
86 | + } elseif ($filter_query_where != '' && $and) { |
|
87 | + $filter_query_where .= ' AND'; |
|
88 | + } |
|
82 | 89 | if ($filter_query_where != '') { |
83 | 90 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
84 | 91 | } |
@@ -120,7 +127,9 @@ discard block |
||
120 | 127 | } |
121 | 128 | } |
122 | 129 | |
123 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
130 | + if (!isset($globalLiveInterval)) { |
|
131 | + $globalLiveInterval = '200'; |
|
132 | + } |
|
124 | 133 | if ($globalDBdriver == 'mysql') { |
125 | 134 | //$query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; |
126 | 135 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -145,7 +154,9 @@ discard block |
||
145 | 154 | |
146 | 155 | $filter_query = $this->getFilter($filter,true,true); |
147 | 156 | |
148 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
157 | + if (!isset($globalLiveInterval)) { |
|
158 | + $globalLiveInterval = '200'; |
|
159 | + } |
|
149 | 160 | if ($globalDBdriver == 'mysql') { |
150 | 161 | $query = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
151 | 162 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; |
@@ -190,50 +201,74 @@ discard block |
||
190 | 201 | } |
191 | 202 | $filter_query = $this->getFilter($filter,true,true); |
192 | 203 | |
193 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
194 | - if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
|
204 | + if (!isset($globalLiveInterval)) { |
|
205 | + $globalLiveInterval = '200'; |
|
206 | + } |
|
207 | + if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') { |
|
208 | + $globalMap3DTrackersLimit = '300'; |
|
209 | + } |
|
195 | 210 | if ($globalDBdriver == 'mysql') { |
196 | 211 | if (isset($globalArchive) && $globalArchive) { |
197 | 212 | $query = "SELECT * FROM ( |
198 | 213 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
199 | 214 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
200 | - if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
215 | + if ($usecoord) { |
|
216 | + $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
217 | + } |
|
201 | 218 | $query .= "UNION |
202 | 219 | SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
203 | 220 | FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date "; |
204 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
221 | + if ($usecoord) { |
|
222 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
223 | + } |
|
205 | 224 | $query .= ") AS tracker |
206 | 225 | WHERE latitude <> '0' AND longitude <> '0' |
207 | 226 | ORDER BY famtrackid, date"; |
208 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
227 | + if ($limit) { |
|
228 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
229 | + } |
|
209 | 230 | } else { |
210 | 231 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
211 | 232 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date "; |
212 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
233 | + if ($usecoord) { |
|
234 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
235 | + } |
|
213 | 236 | $query .= "AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
214 | 237 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
215 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
238 | + if ($limit) { |
|
239 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
240 | + } |
|
216 | 241 | } |
217 | 242 | } else { |
218 | 243 | if (isset($globalArchive) && $globalArchive) { |
219 | 244 | $query = "SELECT * FROM ( |
220 | 245 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
221 | 246 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
222 | - if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
247 | + if ($usecoord) { |
|
248 | + $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
249 | + } |
|
223 | 250 | $query .= "UNION |
224 | 251 | SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
225 | 252 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date"; |
226 | - if ($usecoord) $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
253 | + if ($usecoord) { |
|
254 | + $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
255 | + } |
|
227 | 256 | $query .= ") AS tracker |
228 | 257 | WHERE latitude <> '0' AND longitude <> '0' |
229 | 258 | ORDER BY famtrackid, date"; |
230 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
259 | + if ($limit) { |
|
260 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
261 | + } |
|
231 | 262 | } else { |
232 | 263 | $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
233 | 264 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' "; |
234 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
265 | + if ($usecoord) { |
|
266 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
267 | + } |
|
235 | 268 | $query .= "ORDER BY tracker_live.famtrackid, tracker_live.date"; |
236 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
269 | + if ($limit) { |
|
270 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
271 | + } |
|
237 | 272 | } |
238 | 273 | } |
239 | 274 | |
@@ -259,7 +294,9 @@ discard block |
||
259 | 294 | global $globalDBdriver, $globalLiveInterval; |
260 | 295 | $filter_query = $this->getFilter($filter,true,true); |
261 | 296 | |
262 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
297 | + if (!isset($globalLiveInterval)) { |
|
298 | + $globalLiveInterval = '200'; |
|
299 | + } |
|
263 | 300 | if ($globalDBdriver == 'mysql') { |
264 | 301 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
265 | 302 | } else { |
@@ -287,7 +324,9 @@ discard block |
||
287 | 324 | { |
288 | 325 | global $globalDBdriver, $globalLiveInterval; |
289 | 326 | $Spotter = new Spotter($this->db); |
290 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
327 | + if (!isset($globalLiveInterval)) { |
|
328 | + $globalLiveInterval = '200'; |
|
329 | + } |
|
291 | 330 | $filter_query = $this->getFilter($filter); |
292 | 331 | |
293 | 332 | if (is_array($coord)) { |
@@ -295,7 +334,9 @@ discard block |
||
295 | 334 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
296 | 335 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
297 | 336 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
298 | - } else return array(); |
|
337 | + } else { |
|
338 | + return array(); |
|
339 | + } |
|
299 | 340 | if ($globalDBdriver == 'mysql') { |
300 | 341 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
301 | 342 | } else { |
@@ -315,7 +356,9 @@ discard block |
||
315 | 356 | { |
316 | 357 | global $globalDBdriver, $globalLiveInterval; |
317 | 358 | $Spotter = new Spotter($this->db); |
318 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
359 | + if (!isset($globalLiveInterval)) { |
|
360 | + $globalLiveInterval = '200'; |
|
361 | + } |
|
319 | 362 | $filter_query = $this->getFilter($filter,true,true); |
320 | 363 | |
321 | 364 | if (is_array($coord)) { |
@@ -323,7 +366,9 @@ discard block |
||
323 | 366 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
324 | 367 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
325 | 368 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
326 | - } else return array(); |
|
369 | + } else { |
|
370 | + return array(); |
|
371 | + } |
|
327 | 372 | /* |
328 | 373 | if ($globalDBdriver == 'mysql') { |
329 | 374 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
@@ -557,11 +602,15 @@ discard block |
||
557 | 602 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
558 | 603 | if ($globalDBdriver == 'mysql') { |
559 | 604 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
560 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
605 | + if ($liveinterval) { |
|
606 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
607 | + } |
|
561 | 608 | $query .= ' ORDER BY date'; |
562 | 609 | } else { |
563 | 610 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
564 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
611 | + if ($liveinterval) { |
|
612 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
613 | + } |
|
565 | 614 | $query .= ' ORDER BY date'; |
566 | 615 | } |
567 | 616 | |
@@ -656,7 +705,9 @@ discard block |
||
656 | 705 | $i++; |
657 | 706 | $j++; |
658 | 707 | if ($j == 30) { |
659 | - if ($globalDebug) echo "."; |
|
708 | + if ($globalDebug) { |
|
709 | + echo "."; |
|
710 | + } |
|
660 | 711 | try { |
661 | 712 | |
662 | 713 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -903,7 +954,9 @@ discard block |
||
903 | 954 | { |
904 | 955 | return false; |
905 | 956 | } |
906 | - } else return ''; |
|
957 | + } else { |
|
958 | + return ''; |
|
959 | + } |
|
907 | 960 | |
908 | 961 | if ($longitude != '') |
909 | 962 | { |
@@ -911,7 +964,9 @@ discard block |
||
911 | 964 | { |
912 | 965 | return false; |
913 | 966 | } |
914 | - } else return ''; |
|
967 | + } else { |
|
968 | + return ''; |
|
969 | + } |
|
915 | 970 | |
916 | 971 | if ($altitude != '') |
917 | 972 | { |
@@ -919,7 +974,9 @@ discard block |
||
919 | 974 | { |
920 | 975 | return false; |
921 | 976 | } |
922 | - } else $altitude = 0; |
|
977 | + } else { |
|
978 | + $altitude = 0; |
|
979 | + } |
|
923 | 980 | |
924 | 981 | if ($heading != '') |
925 | 982 | { |
@@ -927,7 +984,9 @@ discard block |
||
927 | 984 | { |
928 | 985 | return false; |
929 | 986 | } |
930 | - } else $heading = 0; |
|
987 | + } else { |
|
988 | + $heading = 0; |
|
989 | + } |
|
931 | 990 | |
932 | 991 | if ($groundspeed != '') |
933 | 992 | { |
@@ -935,9 +994,13 @@ discard block |
||
935 | 994 | { |
936 | 995 | return false; |
937 | 996 | } |
938 | - } else $groundspeed = 0; |
|
997 | + } else { |
|
998 | + $groundspeed = 0; |
|
999 | + } |
|
939 | 1000 | date_default_timezone_set('UTC'); |
940 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1001 | + if ($date == '') { |
|
1002 | + $date = date("Y-m-d H:i:s", time()); |
|
1003 | + } |
|
941 | 1004 | |
942 | 1005 | |
943 | 1006 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -953,12 +1016,18 @@ discard block |
||
953 | 1016 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
954 | 1017 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
955 | 1018 | |
956 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
957 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1019 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1020 | + $groundspeed = 0; |
|
1021 | + } |
|
1022 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1023 | + $heading = 0; |
|
1024 | + } |
|
958 | 1025 | |
959 | 1026 | $query = ''; |
960 | 1027 | if ($globalArchive) { |
961 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1028 | + if ($globalDebug) { |
|
1029 | + echo '-- Delete previous data -- '; |
|
1030 | + } |
|
962 | 1031 | $query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;'; |
963 | 1032 | } |
964 | 1033 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
@@ -977,10 +1046,14 @@ discard block |
||
977 | 1046 | echo 'noarchive : '.$noarchive."\n"; |
978 | 1047 | */ |
979 | 1048 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
980 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
1049 | + if ($globalDebug) { |
|
1050 | + echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
1051 | + } |
|
981 | 1052 | $TrackerArchive = new TrackerArchive($this->db); |
982 | 1053 | $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
983 | - if ($globalDebug) echo $result.')'; |
|
1054 | + if ($globalDebug) { |
|
1055 | + echo $result.')'; |
|
1056 | + } |
|
984 | 1057 | } |
985 | 1058 | |
986 | 1059 | return "success"; |
@@ -14,13 +14,17 @@ discard block |
||
14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
17 | +if (isset($globalTracker) && $globalTracker) { |
|
18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
19 | +} |
|
18 | 20 | if (isset($globalMarine) && $globalMarine) { |
19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
21 | 23 | } |
22 | 24 | |
23 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
25 | +if (!isset($globalDebug)) { |
|
26 | + $globalDebug = FALSE; |
|
27 | +} |
|
24 | 28 | |
25 | 29 | // Check if schema is at latest version |
26 | 30 | $Connection = new Connection(); |
@@ -59,51 +63,92 @@ discard block |
||
59 | 63 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
60 | 64 | if (isset($options['s'])) { |
61 | 65 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
63 | - else $globalSources[] = array('host' => $options['s']); |
|
64 | -} elseif (isset($options['source'])) { |
|
66 | + if (isset($options['format'])) { |
|
67 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
68 | + } else { |
|
69 | + $globalSources[] = array('host' => $options['s']); |
|
70 | + } |
|
71 | + } elseif (isset($options['source'])) { |
|
65 | 72 | $globalSources = array(); |
66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
67 | - else $globalSources[] = array('host' => $options['source']); |
|
68 | -} |
|
73 | + if (isset($options['format'])) { |
|
74 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
75 | + } else { |
|
76 | + $globalSources[] = array('host' => $options['source']); |
|
77 | + } |
|
78 | + } |
|
69 | 79 | if (isset($options['aprsserverhost'])) { |
70 | 80 | $globalServerAPRS = TRUE; |
71 | 81 | $globalServerAPRShost = $options['aprsserverhost']; |
72 | 82 | } |
73 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
74 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
75 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
76 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
77 | -if (isset($options['enable-aircraft'])) $globalAircraft = TRUE; |
|
78 | -if (isset($options['disable-aircraft'])) $globalAircraft = FALSE; |
|
83 | +if (isset($options['aprsserverport'])) { |
|
84 | + $globalServerAPRSport = $options['aprsserverport']; |
|
85 | +} |
|
86 | +if (isset($options['aprsserverssid'])) { |
|
87 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
88 | +} |
|
89 | +if (isset($options['aprsserverpass'])) { |
|
90 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
91 | +} |
|
92 | +if (isset($options['noaprsserver'])) { |
|
93 | + $globalServerAPRS = FALSE; |
|
94 | +} |
|
95 | +if (isset($options['enable-aircraft'])) { |
|
96 | + $globalAircraft = TRUE; |
|
97 | +} |
|
98 | +if (isset($options['disable-aircraft'])) { |
|
99 | + $globalAircraft = FALSE; |
|
100 | +} |
|
79 | 101 | if (isset($options['enable-tracker'])) { |
80 | - if ($globalDebug) echo 'Enable Tracker mode'."\n"; |
|
102 | + if ($globalDebug) { |
|
103 | + echo 'Enable Tracker mode'."\n"; |
|
104 | + } |
|
81 | 105 | $globalTracker = TRUE; |
82 | 106 | } |
83 | -if (isset($options['disable-tracker'])) $globalTracker = FALSE; |
|
84 | -if (isset($options['enable-marine'])) $globalMarine = TRUE; |
|
85 | -if (isset($options['disable-marine'])) $globalMarine = FALSE; |
|
86 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
87 | -if (isset($options['server'])) $globalServer = TRUE; |
|
88 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
89 | -else $id_source = 1; |
|
107 | +if (isset($options['disable-tracker'])) { |
|
108 | + $globalTracker = FALSE; |
|
109 | +} |
|
110 | +if (isset($options['enable-marine'])) { |
|
111 | + $globalMarine = TRUE; |
|
112 | +} |
|
113 | +if (isset($options['disable-marine'])) { |
|
114 | + $globalMarine = FALSE; |
|
115 | +} |
|
116 | +if (isset($options['nodaemon'])) { |
|
117 | + $globalDaemon = FALSE; |
|
118 | +} |
|
119 | +if (isset($options['server'])) { |
|
120 | + $globalServer = TRUE; |
|
121 | +} |
|
122 | +if (isset($options['idsource'])) { |
|
123 | + $id_source = $options['idsource']; |
|
124 | +} else { |
|
125 | + $id_source = 1; |
|
126 | +} |
|
90 | 127 | if (isset($globalServer) && $globalServer) { |
91 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
128 | + if ($globalDebug) { |
|
129 | + echo "Using Server Mode\n"; |
|
130 | + } |
|
92 | 131 | $SI=new SpotterServer(); |
93 | 132 | /* |
94 | 133 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
95 | 134 | $SI = new adsb2aprs(); |
96 | 135 | $SI->connect(); |
97 | 136 | */ |
98 | -} else $SI=new SpotterImport($Connection->db); |
|
137 | +} else { |
|
138 | + $SI=new SpotterImport($Connection->db); |
|
139 | +} |
|
99 | 140 | |
100 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
141 | +if (isset($globalTracker) && $globalTracker) { |
|
142 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
143 | +} |
|
101 | 144 | if (isset($globalMarine) && $globalMarine) { |
102 | 145 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
103 | 146 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
104 | 147 | } |
105 | 148 | |
106 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
149 | +if (isset($globalTracker) && $globalTracker) { |
|
150 | + $TI = new TrackerImport($Connection->db); |
|
151 | +} |
|
107 | 152 | if (isset($globalMarine) && $globalMarine) { |
108 | 153 | $AIS = new AIS(); |
109 | 154 | $MI = new MarineImport($Connection->db); |
@@ -126,7 +171,9 @@ discard block |
||
126 | 171 | } |
127 | 172 | |
128 | 173 | // let's try and connect |
129 | -if ($globalDebug) echo "Connecting...\n"; |
|
174 | +if ($globalDebug) { |
|
175 | + echo "Connecting...\n"; |
|
176 | +} |
|
130 | 177 | $use_aprs = false; |
131 | 178 | $aprs_full = false; |
132 | 179 | $reset = 0; |
@@ -135,7 +182,9 @@ discard block |
||
135 | 182 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
136 | 183 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
137 | 184 | $reset++; |
138 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
185 | + if ($globalDebug) { |
|
186 | + echo 'Connect to all...'."\n"; |
|
187 | + } |
|
139 | 188 | foreach ($hosts as $id => $value) { |
140 | 189 | $host = $value['host']; |
141 | 190 | $globalSources[$id]['last_exec'] = 0; |
@@ -145,22 +194,30 @@ discard block |
||
145 | 194 | //$formats[$id] = 'deltadbtxt'; |
146 | 195 | $globalSources[$id]['format'] = 'deltadbtxt'; |
147 | 196 | //$last_exec['deltadbtxt'] = 0; |
148 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
197 | + if ($globalDebug) { |
|
198 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
199 | + } |
|
149 | 200 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
150 | 201 | //$formats[$id] = 'vatsimtxt'; |
151 | 202 | $globalSources[$id]['format'] = 'vatsimtxt'; |
152 | 203 | //$last_exec['vatsimtxt'] = 0; |
153 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
204 | + if ($globalDebug) { |
|
205 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
206 | + } |
|
154 | 207 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
155 | 208 | //$formats[$id] = 'aircraftlistjson'; |
156 | 209 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
157 | 210 | //$last_exec['aircraftlistjson'] = 0; |
158 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
211 | + if ($globalDebug) { |
|
212 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
213 | + } |
|
159 | 214 | } else if (preg_match('/opensky/i',$host)) { |
160 | 215 | //$formats[$id] = 'aircraftlistjson'; |
161 | 216 | $globalSources[$id]['format'] = 'opensky'; |
162 | 217 | //$last_exec['aircraftlistjson'] = 0; |
163 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
218 | + if ($globalDebug) { |
|
219 | + echo "Connect to opensky source (".$host.")...\n"; |
|
220 | + } |
|
164 | 221 | /* |
165 | 222 | // Disabled for now, site change source format |
166 | 223 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -177,7 +234,9 @@ discard block |
||
177 | 234 | //$formats[$id] = 'planeupdatefaa'; |
178 | 235 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
179 | 236 | //$last_exec['planeupdatefaa'] = 0; |
180 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
237 | + if ($globalDebug) { |
|
238 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
239 | + } |
|
181 | 240 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
182 | 241 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
183 | 242 | exit(0); |
@@ -186,32 +245,46 @@ discard block |
||
186 | 245 | //$formats[$id] = 'phpvmacars'; |
187 | 246 | $globalSources[$id]['format'] = 'phpvmacars'; |
188 | 247 | //$last_exec['phpvmacars'] = 0; |
189 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
248 | + if ($globalDebug) { |
|
249 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
250 | + } |
|
190 | 251 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
191 | 252 | //$formats[$id] = 'phpvmacars'; |
192 | 253 | $globalSources[$id]['format'] = 'vam'; |
193 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
254 | + if ($globalDebug) { |
|
255 | + echo "Connect to Vam source (".$host.")...\n"; |
|
256 | + } |
|
194 | 257 | } else if (preg_match('/whazzup/i',$host)) { |
195 | 258 | //$formats[$id] = 'whazzup'; |
196 | 259 | $globalSources[$id]['format'] = 'whazzup'; |
197 | 260 | //$last_exec['whazzup'] = 0; |
198 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
261 | + if ($globalDebug) { |
|
262 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
263 | + } |
|
199 | 264 | } else if (preg_match('/blitzortung/i',$host)) { |
200 | 265 | $globalSources[$id]['format'] = 'blitzortung'; |
201 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
266 | + if ($globalDebug) { |
|
267 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
268 | + } |
|
202 | 269 | } else if (preg_match('/airwhere/i',$host)) { |
203 | 270 | $globalSources[$id]['format'] = 'airwhere'; |
204 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
271 | + if ($globalDebug) { |
|
272 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
273 | + } |
|
205 | 274 | } else if (preg_match('/recentpireps/i',$host)) { |
206 | 275 | //$formats[$id] = 'pirepsjson'; |
207 | 276 | $globalSources[$id]['format'] = 'pirepsjson'; |
208 | 277 | //$last_exec['pirepsjson'] = 0; |
209 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
278 | + if ($globalDebug) { |
|
279 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
280 | + } |
|
210 | 281 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
211 | 282 | //$formats[$id] = 'fr24json'; |
212 | 283 | $globalSources[$id]['format'] = 'fr24json'; |
213 | 284 | //$last_exec['fr24json'] = 0; |
214 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
285 | + if ($globalDebug) { |
|
286 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
287 | + } |
|
215 | 288 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
216 | 289 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
217 | 290 | exit(0); |
@@ -220,7 +293,9 @@ discard block |
||
220 | 293 | //$formats[$id] = 'fr24json'; |
221 | 294 | $globalSources[$id]['format'] = 'myshiptracking'; |
222 | 295 | //$last_exec['fr24json'] = 0; |
223 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
296 | + if ($globalDebug) { |
|
297 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
298 | + } |
|
224 | 299 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
225 | 300 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
226 | 301 | exit(0); |
@@ -229,17 +304,24 @@ discard block |
||
229 | 304 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
230 | 305 | //$formats[$id] = 'tsv'; |
231 | 306 | $globalSources[$id]['format'] = 'tsv'; |
232 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
307 | + if ($globalDebug) { |
|
308 | + echo "Connect to tsv source (".$host.")...\n"; |
|
309 | + } |
|
233 | 310 | } |
234 | 311 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
235 | 312 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
236 | 313 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
237 | 314 | if ($idf !== false) { |
238 | 315 | $httpfeeds[$id] = $idf; |
239 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
316 | + if ($globalDebug) { |
|
317 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
318 | + } |
|
319 | + } elseif ($globalDebug) { |
|
320 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
240 | 321 | } |
241 | - elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
242 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
322 | + } elseif ($globalDebug) { |
|
323 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
324 | + } |
|
243 | 325 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
244 | 326 | $hostport = explode(':',$host); |
245 | 327 | if (isset($hostport[1])) { |
@@ -279,17 +361,25 @@ discard block |
||
279 | 361 | //$formats[$id] = 'beast'; |
280 | 362 | $globalSources[$id]['format'] = 'beast'; |
281 | 363 | //} else $formats[$id] = 'sbs'; |
282 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
364 | + } else { |
|
365 | + $globalSources[$id]['format'] = 'sbs'; |
|
366 | + } |
|
283 | 367 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
284 | 368 | } |
285 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
369 | + if ($globalDebug) { |
|
370 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
371 | + } |
|
286 | 372 | } else { |
287 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
373 | + if ($globalDebug) { |
|
374 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
375 | + } |
|
288 | 376 | } |
289 | 377 | } |
290 | 378 | } |
291 | 379 | } |
292 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
380 | +if (!isset($globalMinFetch)) { |
|
381 | + $globalMinFetch = 15; |
|
382 | +} |
|
293 | 383 | |
294 | 384 | // Initialize all |
295 | 385 | $status = array(); |
@@ -298,13 +388,19 @@ discard block |
||
298 | 388 | $formats = array(); |
299 | 389 | $last_exec = array(); |
300 | 390 | $time = time(); |
301 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
302 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
303 | -else $timeout = 20; |
|
391 | +if (isset($globalSourcesTimeout)) { |
|
392 | + $timeout = $globalSourcesTimeOut; |
|
393 | +} else if (isset($globalSBS1TimeOut)) { |
|
394 | + $timeout = $globalSBS1TimeOut; |
|
395 | +} else { |
|
396 | + $timeout = 20; |
|
397 | +} |
|
304 | 398 | $errno = ''; |
305 | 399 | $errstr=''; |
306 | 400 | |
307 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
401 | +if (!isset($globalDaemon)) { |
|
402 | + $globalDaemon = TRUE; |
|
403 | +} |
|
308 | 404 | /* Initiate connections to all the hosts simultaneously */ |
309 | 405 | //connect_all($hosts); |
310 | 406 | //connect_all($globalSources); |
@@ -333,7 +429,9 @@ discard block |
||
333 | 429 | if (isset($source['format']) && $source['format'] == 'aprs') { |
334 | 430 | $aprs_connect = 0; |
335 | 431 | $use_aprs = true; |
336 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
432 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
433 | + $aprs_full = true; |
|
434 | + } |
|
337 | 435 | break; |
338 | 436 | } |
339 | 437 | } |
@@ -344,25 +442,48 @@ discard block |
||
344 | 442 | $aprs_connect = 0; |
345 | 443 | $aprs_keep = 120; |
346 | 444 | $aprs_last_tx = time(); |
347 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
348 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
349 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
350 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
351 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
352 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
353 | - if ($aprs_full) $aprs_filter = ''; |
|
354 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
355 | - else $aprs_pass = '-1'; |
|
445 | + if (isset($globalAPRSversion)) { |
|
446 | + $aprs_version = $globalAPRSversion; |
|
447 | + } else { |
|
448 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
449 | + } |
|
450 | + if (isset($globalAPRSssid)) { |
|
451 | + $aprs_ssid = $globalAPRSssid; |
|
452 | + } else { |
|
453 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
454 | + } |
|
455 | + if (isset($globalAPRSfilter)) { |
|
456 | + $aprs_filter = $globalAPRSfilter; |
|
457 | + } else { |
|
458 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
459 | + } |
|
460 | + if ($aprs_full) { |
|
461 | + $aprs_filter = ''; |
|
462 | + } |
|
463 | + if (isset($globalAPRSpass)) { |
|
464 | + $aprs_pass = $globalAPRSpass; |
|
465 | + } else { |
|
466 | + $aprs_pass = '-1'; |
|
467 | + } |
|
356 | 468 | |
357 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
358 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
359 | -} |
|
469 | + if ($aprs_filter != '') { |
|
470 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
471 | + } else { |
|
472 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
473 | + } |
|
474 | + } |
|
360 | 475 | |
361 | 476 | // connected - lets do some work |
362 | -if ($globalDebug) echo "Connected!\n"; |
|
477 | +if ($globalDebug) { |
|
478 | + echo "Connected!\n"; |
|
479 | +} |
|
363 | 480 | sleep(1); |
364 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
365 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
481 | +if ($globalDebug) { |
|
482 | + echo "SCAN MODE \n\n"; |
|
483 | +} |
|
484 | +if (!isset($globalCronEnd)) { |
|
485 | + $globalCronEnd = 60; |
|
486 | +} |
|
366 | 487 | $endtime = time()+$globalCronEnd; |
367 | 488 | $i = 1; |
368 | 489 | $tt = array(); |
@@ -376,20 +497,28 @@ discard block |
||
376 | 497 | |
377 | 498 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
378 | 499 | while ($i > 0) { |
379 | - if (!$globalDaemon) $i = $endtime-time(); |
|
500 | + if (!$globalDaemon) { |
|
501 | + $i = $endtime-time(); |
|
502 | + } |
|
380 | 503 | // Delete old ATC |
381 | 504 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
382 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
505 | + if ($globalDebug) { |
|
506 | + echo 'Delete old ATC...'."\n"; |
|
507 | + } |
|
383 | 508 | $ATC->deleteOldATC(); |
384 | 509 | } |
385 | 510 | |
386 | 511 | if (count($last_exec) == count($globalSources)) { |
387 | 512 | $max = $globalMinFetch; |
388 | 513 | foreach ($last_exec as $last) { |
389 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
514 | + if ((time() - $last['last']) < $max) { |
|
515 | + $max = time() - $last['last']; |
|
516 | + } |
|
390 | 517 | } |
391 | 518 | if ($max != $globalMinFetch) { |
392 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
519 | + if ($globalDebug) { |
|
520 | + echo 'Sleeping...'."\n"; |
|
521 | + } |
|
393 | 522 | sleep($globalMinFetch-$max+2); |
394 | 523 | } |
395 | 524 | } |
@@ -399,7 +528,9 @@ discard block |
||
399 | 528 | foreach ($globalSources as $id => $value) { |
400 | 529 | date_default_timezone_set('UTC'); |
401 | 530 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
402 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
531 | + if (!isset($last_exec[$id]['last'])) { |
|
532 | + $last_exec[$id]['last'] = 0; |
|
533 | + } |
|
403 | 534 | if ($value['format'] == 'deltadbtxt' && |
404 | 535 | ( |
405 | 536 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -408,7 +539,9 @@ discard block |
||
408 | 539 | ) { |
409 | 540 | //$buffer = $Common->getData($hosts[$id]); |
410 | 541 | $buffer = $Common->getData($value['host']); |
411 | - if ($buffer != '') $reset = 0; |
|
542 | + if ($buffer != '') { |
|
543 | + $reset = 0; |
|
544 | + } |
|
412 | 545 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
413 | 546 | $buffer = explode('\n',$buffer); |
414 | 547 | foreach ($buffer as $line) { |
@@ -417,20 +550,41 @@ discard block |
||
417 | 550 | $data = array(); |
418 | 551 | $data['hex'] = $line[1]; // hex |
419 | 552 | $data['ident'] = $line[2]; // ident |
420 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
421 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
422 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
423 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
424 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
553 | + if (isset($line[3])) { |
|
554 | + $data['altitude'] = $line[3]; |
|
555 | + } |
|
556 | + // altitude |
|
557 | + if (isset($line[4])) { |
|
558 | + $data['speed'] = $line[4]; |
|
559 | + } |
|
560 | + // speed |
|
561 | + if (isset($line[5])) { |
|
562 | + $data['heading'] = $line[5]; |
|
563 | + } |
|
564 | + // heading |
|
565 | + if (isset($line[6])) { |
|
566 | + $data['latitude'] = $line[6]; |
|
567 | + } |
|
568 | + // lat |
|
569 | + if (isset($line[7])) { |
|
570 | + $data['longitude'] = $line[7]; |
|
571 | + } |
|
572 | + // long |
|
425 | 573 | $data['verticalrate'] = ''; // vertical rate |
426 | 574 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
427 | 575 | $data['emergency'] = ''; // emergency |
428 | 576 | $data['datetime'] = date('Y-m-d H:i:s'); |
429 | 577 | $data['format_source'] = 'deltadbtxt'; |
430 | 578 | $data['id_source'] = $id_source; |
431 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
432 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
433 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
579 | + if (isset($value['name']) && $value['name'] != '') { |
|
580 | + $data['source_name'] = $value['name']; |
|
581 | + } |
|
582 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
583 | + $data['noarchive'] = true; |
|
584 | + } |
|
585 | + if (isset($value['sourcestats'])) { |
|
586 | + $data['sourcestats'] = $value['sourcestats']; |
|
587 | + } |
|
434 | 588 | $SI->add($data); |
435 | 589 | unset($data); |
436 | 590 | } |
@@ -445,7 +599,9 @@ discard block |
||
445 | 599 | date_default_timezone_set('CET'); |
446 | 600 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
447 | 601 | date_default_timezone_set('UTC'); |
448 | - if ($buffer != '') $reset = 0; |
|
602 | + if ($buffer != '') { |
|
603 | + $reset = 0; |
|
604 | + } |
|
449 | 605 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
450 | 606 | $buffer = explode('\n',$buffer); |
451 | 607 | foreach ($buffer as $line) { |
@@ -454,16 +610,36 @@ discard block |
||
454 | 610 | $add = false; |
455 | 611 | $ais_data = $AIS->parse_line(trim($line)); |
456 | 612 | $data = array(); |
457 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
458 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
459 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
460 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
461 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
462 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
463 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
464 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
465 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
466 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
613 | + if (isset($ais_data['ident'])) { |
|
614 | + $data['ident'] = $ais_data['ident']; |
|
615 | + } |
|
616 | + if (isset($ais_data['mmsi'])) { |
|
617 | + $data['mmsi'] = $ais_data['mmsi']; |
|
618 | + } |
|
619 | + if (isset($ais_data['speed'])) { |
|
620 | + $data['speed'] = $ais_data['speed']; |
|
621 | + } |
|
622 | + if (isset($ais_data['heading'])) { |
|
623 | + $data['heading'] = $ais_data['heading']; |
|
624 | + } |
|
625 | + if (isset($ais_data['latitude'])) { |
|
626 | + $data['latitude'] = $ais_data['latitude']; |
|
627 | + } |
|
628 | + if (isset($ais_data['longitude'])) { |
|
629 | + $data['longitude'] = $ais_data['longitude']; |
|
630 | + } |
|
631 | + if (isset($ais_data['status'])) { |
|
632 | + $data['status'] = $ais_data['status']; |
|
633 | + } |
|
634 | + if (isset($ais_data['type'])) { |
|
635 | + $data['type'] = $ais_data['type']; |
|
636 | + } |
|
637 | + if (isset($ais_data['imo'])) { |
|
638 | + $data['imo'] = $ais_data['imo']; |
|
639 | + } |
|
640 | + if (isset($ais_data['callsign'])) { |
|
641 | + $data['callsign'] = $ais_data['callsign']; |
|
642 | + } |
|
467 | 643 | if (isset($ais_data['timestamp'])) { |
468 | 644 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
469 | 645 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -477,8 +653,12 @@ discard block |
||
477 | 653 | $data['format_source'] = 'aisnmeatxt'; |
478 | 654 | $data['id_source'] = $id_source; |
479 | 655 | //print_r($data); |
480 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
481 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
656 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
657 | + $data['noarchive'] = true; |
|
658 | + } |
|
659 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
660 | + $MI->add($data); |
|
661 | + } |
|
482 | 662 | unset($data); |
483 | 663 | } |
484 | 664 | } |
@@ -498,20 +678,48 @@ discard block |
||
498 | 678 | if ($line != '') { |
499 | 679 | $ais_data = $AIS->parse_line(trim($line)); |
500 | 680 | $data = array(); |
501 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
502 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
503 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
504 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
505 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
506 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
507 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
508 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
509 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
510 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
511 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
512 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
513 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
514 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
681 | + if (isset($ais_data['ident'])) { |
|
682 | + $data['ident'] = $ais_data['ident']; |
|
683 | + } |
|
684 | + if (isset($ais_data['mmsi'])) { |
|
685 | + $data['mmsi'] = $ais_data['mmsi']; |
|
686 | + } |
|
687 | + if (isset($ais_data['speed'])) { |
|
688 | + $data['speed'] = $ais_data['speed']; |
|
689 | + } |
|
690 | + if (isset($ais_data['heading'])) { |
|
691 | + $data['heading'] = $ais_data['heading']; |
|
692 | + } |
|
693 | + if (isset($ais_data['latitude'])) { |
|
694 | + $data['latitude'] = $ais_data['latitude']; |
|
695 | + } |
|
696 | + if (isset($ais_data['longitude'])) { |
|
697 | + $data['longitude'] = $ais_data['longitude']; |
|
698 | + } |
|
699 | + if (isset($ais_data['status'])) { |
|
700 | + $data['status'] = $ais_data['status']; |
|
701 | + } |
|
702 | + if (isset($ais_data['statusid'])) { |
|
703 | + $data['status_id'] = $ais_data['statusid']; |
|
704 | + } |
|
705 | + if (isset($ais_data['type'])) { |
|
706 | + $data['type'] = $ais_data['type']; |
|
707 | + } |
|
708 | + if (isset($ais_data['typeid'])) { |
|
709 | + $data['type_id'] = $ais_data['typeid']; |
|
710 | + } |
|
711 | + if (isset($ais_data['imo'])) { |
|
712 | + $data['imo'] = $ais_data['imo']; |
|
713 | + } |
|
714 | + if (isset($ais_data['callsign'])) { |
|
715 | + $data['callsign'] = $ais_data['callsign']; |
|
716 | + } |
|
717 | + if (isset($ais_data['destination'])) { |
|
718 | + $data['arrival_code'] = $ais_data['destination']; |
|
719 | + } |
|
720 | + if (isset($ais_data['eta_ts'])) { |
|
721 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
722 | + } |
|
515 | 723 | if (isset($ais_data['timestamp'])) { |
516 | 724 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
517 | 725 | } else { |
@@ -519,18 +727,27 @@ discard block |
||
519 | 727 | } |
520 | 728 | $data['format_source'] = 'aisnmeahttp'; |
521 | 729 | $data['id_source'] = $id_source; |
522 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
523 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
730 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
731 | + $data['noarchive'] = true; |
|
732 | + } |
|
733 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
734 | + $MI->add($data); |
|
735 | + } |
|
524 | 736 | unset($data); |
525 | 737 | } |
526 | 738 | } |
527 | 739 | } |
528 | 740 | } else { |
529 | 741 | $format = $value['format']; |
530 | - if (isset($tt[$format])) $tt[$format]++; |
|
531 | - else $tt[$format] = 0; |
|
742 | + if (isset($tt[$format])) { |
|
743 | + $tt[$format]++; |
|
744 | + } else { |
|
745 | + $tt[$format] = 0; |
|
746 | + } |
|
532 | 747 | if ($tt[$format] > 30) { |
533 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
748 | + if ($globalDebug) { |
|
749 | + echo 'Reconnect...'."\n"; |
|
750 | + } |
|
534 | 751 | sleep(2); |
535 | 752 | $sourceeen[] = $value; |
536 | 753 | connect_all($sourceeen); |
@@ -565,7 +782,9 @@ discard block |
||
565 | 782 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
566 | 783 | $data['format_source'] = 'myshiptracking'; |
567 | 784 | $data['id_source'] = $id_source; |
568 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
785 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
786 | + $data['noarchive'] = true; |
|
787 | + } |
|
569 | 788 | $MI->add($data); |
570 | 789 | unset($data); |
571 | 790 | } |
@@ -590,7 +809,9 @@ discard block |
||
590 | 809 | $data['callsign'] = $line['callsign']; |
591 | 810 | $data['mmsi'] = $line['mmsi']; |
592 | 811 | $data['speed'] = $line['sog']; |
593 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
812 | + if ($line['heading'] != '511') { |
|
813 | + $data['heading'] = $line['heading']; |
|
814 | + } |
|
594 | 815 | $data['latitude'] = $line['latitude']; |
595 | 816 | $data['longitude'] = $line['longitude']; |
596 | 817 | $data['type_id'] = $line['shiptype']; |
@@ -598,7 +819,9 @@ discard block |
||
598 | 819 | $data['datetime'] = $line['time']; |
599 | 820 | $data['format_source'] = 'boatbeaconapp'; |
600 | 821 | $data['id_source'] = $id_source; |
601 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
822 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
823 | + $data['noarchive'] = true; |
|
824 | + } |
|
602 | 825 | $MI->add($data); |
603 | 826 | unset($data); |
604 | 827 | } |
@@ -619,22 +842,44 @@ discard block |
||
619 | 842 | if (isset($all_data['features'][0]['id'])) { |
620 | 843 | foreach ($all_data['features'] as $line) { |
621 | 844 | $data = array(); |
622 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
623 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
624 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi']; |
|
625 | - if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo']; |
|
626 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
627 | - if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading']; |
|
845 | + if (isset($line['properties']['name'])) { |
|
846 | + $data['ident'] = $line['properties']['name']; |
|
847 | + } |
|
848 | + if (isset($line['properties']['callsign'])) { |
|
849 | + $data['callsign'] = $line['properties']['callsign']; |
|
850 | + } |
|
851 | + if (isset($line['properties']['mmsi'])) { |
|
852 | + $data['mmsi'] = $line['properties']['mmsi']; |
|
853 | + } |
|
854 | + if (isset($line['properties']['imo'])) { |
|
855 | + $data['mmsi'] = $line['properties']['imo']; |
|
856 | + } |
|
857 | + if (isset($line['properties']['speed'])) { |
|
858 | + $data['speed'] = $line['properties']['speed']; |
|
859 | + } |
|
860 | + if (isset($line['properties']['heading'])) { |
|
861 | + $data['heading'] = $line['properties']['heading']; |
|
862 | + } |
|
628 | 863 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
629 | 864 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
630 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
631 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
632 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
865 | + if (isset($line['properties']['vesselType'])) { |
|
866 | + $data['type'] = $line['properties']['vesselType']; |
|
867 | + } |
|
868 | + if (isset($line['properties']['destination'])) { |
|
869 | + $data['arrival_code'] = $line['properties']['destination']; |
|
870 | + } |
|
871 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
872 | + $data['arrival_date'] = $line['properties']['eta']; |
|
873 | + } |
|
633 | 874 | $data['format_source'] = 'boatnerd'; |
634 | 875 | $data['id_source'] = $id_source; |
635 | 876 | $data['datetime'] = date('Y-m-d H:i:s'); |
636 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
637 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
877 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
878 | + $data['noarchive'] = true; |
|
879 | + } |
|
880 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
881 | + $MI->add($data); |
|
882 | + } |
|
638 | 883 | unset($data); |
639 | 884 | } |
640 | 885 | } |
@@ -650,7 +895,9 @@ discard block |
||
650 | 895 | echo 'download...'; |
651 | 896 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
652 | 897 | echo 'done !'."\n"; |
653 | - if ($buffer != '') $reset = 0; |
|
898 | + if ($buffer != '') { |
|
899 | + $reset = 0; |
|
900 | + } |
|
654 | 901 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
655 | 902 | $buffer = explode('\n',$buffer); |
656 | 903 | foreach ($buffer as $line) { |
@@ -675,7 +922,9 @@ discard block |
||
675 | 922 | //$data['etaTime'] = substr($line,135,5); |
676 | 923 | $data['format_source'] = 'shipplotter'; |
677 | 924 | $data['id_source'] = $id_source; |
678 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
925 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
926 | + $data['noarchive'] = true; |
|
927 | + } |
|
679 | 928 | //print_r($data); |
680 | 929 | echo 'Add...'."\n"; |
681 | 930 | $MI->add($data); |
@@ -709,16 +958,28 @@ discard block |
||
709 | 958 | $line = explode(':', $line); |
710 | 959 | if (count($line) > 30 && $line[0] != 'callsign') { |
711 | 960 | $data = array(); |
712 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
713 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
961 | + if (isset($line[37]) && $line[37] != '') { |
|
962 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
963 | + } else { |
|
964 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
965 | + } |
|
714 | 966 | $data['pilot_id'] = $line[1]; |
715 | 967 | $data['pilot_name'] = $line[2]; |
716 | 968 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
717 | 969 | $data['ident'] = $line[0]; // ident |
718 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
970 | + if ($line[7] != '' && $line[7] != 0) { |
|
971 | + $data['altitude'] = $line[7]; |
|
972 | + } |
|
973 | + // altitude |
|
719 | 974 | $data['speed'] = $line[8]; // speed |
720 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
721 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
975 | + if (isset($line[45])) { |
|
976 | + $data['heading'] = $line[45]; |
|
977 | + } |
|
978 | + // heading |
|
979 | + elseif (isset($line[38])) { |
|
980 | + $data['heading'] = $line[38]; |
|
981 | + } |
|
982 | + // heading |
|
722 | 983 | $data['latitude'] = $line[5]; // lat |
723 | 984 | $data['longitude'] = $line[6]; // long |
724 | 985 | $data['verticalrate'] = ''; // vertical rate |
@@ -734,7 +995,9 @@ discard block |
||
734 | 995 | $data['frequency'] = $line[4]; |
735 | 996 | $data['type'] = $line[18]; |
736 | 997 | $data['range'] = $line[19]; |
737 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
998 | + if (isset($line[35])) { |
|
999 | + $data['info'] = $line[35]; |
|
1000 | + } |
|
738 | 1001 | $data['id_source'] = $id_source; |
739 | 1002 | //$data['arrival_airport_time'] = ; |
740 | 1003 | if ($line[9] != '') { |
@@ -748,27 +1011,47 @@ discard block |
||
748 | 1011 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
749 | 1012 | */ |
750 | 1013 | $data['format_source'] = $value['format']; |
751 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
752 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
753 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
754 | - elseif ($line[3] == 'ATC') { |
|
1014 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1015 | + $data['noarchive'] = true; |
|
1016 | + } |
|
1017 | + if (isset($value['name']) && $value['name'] != '') { |
|
1018 | + $data['source_name'] = $value['name']; |
|
1019 | + } |
|
1020 | + if ($line[3] == 'PILOT') { |
|
1021 | + $SI->add($data); |
|
1022 | + } elseif ($line[3] == 'ATC') { |
|
755 | 1023 | //print_r($data); |
756 | 1024 | $data['info'] = str_replace('^§','<br />',$data['info']); |
757 | 1025 | $data['info'] = str_replace('&sect;','',$data['info']); |
758 | 1026 | $typec = substr($data['ident'],-3); |
759 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
760 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
761 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
762 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
763 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
764 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
765 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
766 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
767 | - elseif ($data['type'] == '') $data['type'] = 'Observer'; |
|
768 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
1027 | + if ($typec == 'APP') { |
|
1028 | + $data['type'] = 'Approach'; |
|
1029 | + } elseif ($typec == 'TWR') { |
|
1030 | + $data['type'] = 'Tower'; |
|
1031 | + } elseif ($typec == 'OBS') { |
|
1032 | + $data['type'] = 'Observer'; |
|
1033 | + } elseif ($typec == 'GND') { |
|
1034 | + $data['type'] = 'Ground'; |
|
1035 | + } elseif ($typec == 'DEL') { |
|
1036 | + $data['type'] = 'Delivery'; |
|
1037 | + } elseif ($typec == 'DEP') { |
|
1038 | + $data['type'] = 'Departure'; |
|
1039 | + } elseif ($typec == 'FSS') { |
|
1040 | + $data['type'] = 'Flight Service Station'; |
|
1041 | + } elseif ($typec == 'CTR') { |
|
1042 | + $data['type'] = 'Control Radar or Centre'; |
|
1043 | + } elseif ($data['type'] == '') { |
|
1044 | + $data['type'] = 'Observer'; |
|
1045 | + } |
|
1046 | + if (!isset($data['source_name'])) { |
|
1047 | + $data['source_name'] = ''; |
|
1048 | + } |
|
769 | 1049 | if (isset($ATC)) { |
770 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
771 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1050 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
1051 | + echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1052 | + } else { |
|
1053 | + echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1054 | + } |
|
772 | 1055 | } |
773 | 1056 | } |
774 | 1057 | unset($data); |
@@ -795,14 +1078,20 @@ discard block |
||
795 | 1078 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
796 | 1079 | $data['latitude'] = (float)$line['pktLatitude']; |
797 | 1080 | $data['longitude'] = (float)$line['pktLongitude']; |
798 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
799 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
1081 | + if ((float)$line['pktTrack'] != 0) { |
|
1082 | + $data['heading'] = (float)$line['pktTrack']; |
|
1083 | + } |
|
1084 | + if ((int)$line['pktSpeed'] != 0) { |
|
1085 | + $data['speed'] = (int)$line['pktSpeed']; |
|
1086 | + } |
|
800 | 1087 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
801 | 1088 | $data['altitude_relative'] = 'AMSL'; |
802 | 1089 | $data['pilot_id'] = (int)$line['pktPilotID']; |
803 | 1090 | $data['aircraft_icao'] = 'PARAGLIDER'; |
804 | 1091 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
805 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
1092 | + if (isset($pilot_data[4])) { |
|
1093 | + $data['pilot_name'] = $pilot_data[4]; |
|
1094 | + } |
|
806 | 1095 | $data['format_source'] = $value['format']; |
807 | 1096 | $SI->add($data); |
808 | 1097 | unset($data); |
@@ -850,25 +1139,59 @@ discard block |
||
850 | 1139 | foreach ($all_data['acList'] as $line) { |
851 | 1140 | $data = array(); |
852 | 1141 | $data['hex'] = $line['Icao']; // hex |
853 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
854 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
855 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
856 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
857 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
858 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
1142 | + if (isset($line['Call'])) { |
|
1143 | + $data['ident'] = $line['Call']; |
|
1144 | + } |
|
1145 | + // ident |
|
1146 | + if (isset($line['Alt'])) { |
|
1147 | + $data['altitude'] = $line['Alt']; |
|
1148 | + } |
|
1149 | + // altitude |
|
1150 | + if (isset($line['Spd'])) { |
|
1151 | + $data['speed'] = $line['Spd']; |
|
1152 | + } |
|
1153 | + // speed |
|
1154 | + if (isset($line['Trak'])) { |
|
1155 | + $data['heading'] = $line['Trak']; |
|
1156 | + } |
|
1157 | + // heading |
|
1158 | + if (isset($line['Lat'])) { |
|
1159 | + $data['latitude'] = $line['Lat']; |
|
1160 | + } |
|
1161 | + // lat |
|
1162 | + if (isset($line['Long'])) { |
|
1163 | + $data['longitude'] = $line['Long']; |
|
1164 | + } |
|
1165 | + // long |
|
859 | 1166 | //$data['verticalrate'] = $line['']; // verticale rate |
860 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
1167 | + if (isset($line['Sqk'])) { |
|
1168 | + $data['squawk'] = $line['Sqk']; |
|
1169 | + } |
|
1170 | + // squawk |
|
861 | 1171 | $data['emergency'] = ''; // emergency |
862 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
863 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
864 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1172 | + if (isset($line['Reg'])) { |
|
1173 | + $data['registration'] = $line['Reg']; |
|
1174 | + } |
|
1175 | + if (isset($line['PosTime'])) { |
|
1176 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1177 | + } else { |
|
1178 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1179 | + } |
|
865 | 1180 | //$data['datetime'] = date('Y-m-d H:i:s'); |
866 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
1181 | + if (isset($line['Type'])) { |
|
1182 | + $data['aircraft_icao'] = $line['Type']; |
|
1183 | + } |
|
867 | 1184 | $data['format_source'] = 'aircraftlistjson'; |
868 | 1185 | $data['id_source'] = $id_source; |
869 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
870 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
871 | - if (isset($data['latitude'])) $SI->add($data); |
|
1186 | + if (isset($value['name']) && $value['name'] != '') { |
|
1187 | + $data['source_name'] = $value['name']; |
|
1188 | + } |
|
1189 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1190 | + $data['noarchive'] = true; |
|
1191 | + } |
|
1192 | + if (isset($data['latitude'])) { |
|
1193 | + $SI->add($data); |
|
1194 | + } |
|
872 | 1195 | unset($data); |
873 | 1196 | } |
874 | 1197 | } elseif (is_array($all_data)) { |
@@ -885,17 +1208,26 @@ discard block |
||
885 | 1208 | $data['verticalrate'] = $line['vrt']; // verticale rate |
886 | 1209 | $data['squawk'] = $line['squawk']; // squawk |
887 | 1210 | $data['emergency'] = ''; // emergency |
888 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
889 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1211 | + if (isset($line['PosTime'])) { |
|
1212 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1213 | + } else { |
|
1214 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1215 | + } |
|
890 | 1216 | $data['format_source'] = 'aircraftlistjson'; |
891 | 1217 | $data['id_source'] = $id_source; |
892 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
893 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1218 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1219 | + $data['noarchive'] = true; |
|
1220 | + } |
|
1221 | + if (isset($value['name']) && $value['name'] != '') { |
|
1222 | + $data['source_name'] = $value['name']; |
|
1223 | + } |
|
894 | 1224 | $SI->add($data); |
895 | 1225 | unset($data); |
896 | 1226 | } |
897 | 1227 | } |
898 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
1228 | + } elseif ($globalDebug) { |
|
1229 | + echo 'No data'."\n"; |
|
1230 | + } |
|
899 | 1231 | //$last_exec['aircraftlistjson'] = time(); |
900 | 1232 | $last_exec[$id]['last'] = time(); |
901 | 1233 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -931,8 +1263,12 @@ discard block |
||
931 | 1263 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
932 | 1264 | $data['format_source'] = 'planeupdatefaa'; |
933 | 1265 | $data['id_source'] = $id_source; |
934 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
935 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1266 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1267 | + $data['noarchive'] = true; |
|
1268 | + } |
|
1269 | + if (isset($value['name']) && $value['name'] != '') { |
|
1270 | + $data['source_name'] = $value['name']; |
|
1271 | + } |
|
936 | 1272 | $SI->add($data); |
937 | 1273 | unset($data); |
938 | 1274 | } |
@@ -966,7 +1302,9 @@ discard block |
||
966 | 1302 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
967 | 1303 | $data['format_source'] = 'opensky'; |
968 | 1304 | $data['id_source'] = $id_source; |
969 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1305 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1306 | + $data['noarchive'] = true; |
|
1307 | + } |
|
970 | 1308 | $SI->add($data); |
971 | 1309 | unset($data); |
972 | 1310 | } |
@@ -983,7 +1321,9 @@ discard block |
||
983 | 1321 | //$buffer = $Common->getData($hosts[$id]); |
984 | 1322 | $buffer = $Common->getData($value['host']); |
985 | 1323 | $all_data = json_decode($buffer,true); |
986 | - if (!empty($all_data)) $reset = 0; |
|
1324 | + if (!empty($all_data)) { |
|
1325 | + $reset = 0; |
|
1326 | + } |
|
987 | 1327 | foreach ($all_data as $key => $line) { |
988 | 1328 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
989 | 1329 | $data = array(); |
@@ -1004,8 +1344,12 @@ discard block |
||
1004 | 1344 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
1005 | 1345 | $data['format_source'] = 'fr24json'; |
1006 | 1346 | $data['id_source'] = $id_source; |
1007 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1008 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1347 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1348 | + $data['noarchive'] = true; |
|
1349 | + } |
|
1350 | + if (isset($value['name']) && $value['name'] != '') { |
|
1351 | + $data['source_name'] = $value['name']; |
|
1352 | + } |
|
1009 | 1353 | $SI->add($data); |
1010 | 1354 | unset($data); |
1011 | 1355 | } |
@@ -1034,24 +1378,42 @@ discard block |
||
1034 | 1378 | if (isset($line['inf'])) { |
1035 | 1379 | $data = array(); |
1036 | 1380 | $data['hex'] = $line['inf']['ia']; |
1037 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
1381 | + if (isset($line['inf']['cs'])) { |
|
1382 | + $data['ident'] = $line['inf']['cs']; |
|
1383 | + } |
|
1384 | + //$line[13] |
|
1038 | 1385 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
1039 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
1040 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
1386 | + if (isset($line['inf']['gs'])) { |
|
1387 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
1388 | + } |
|
1389 | + // speed |
|
1390 | + if (isset($line['inf']['tr'])) { |
|
1391 | + $data['heading'] = $line['inf']['tr']; |
|
1392 | + } |
|
1393 | + // heading |
|
1041 | 1394 | $data['latitude'] = $line['pt'][0]; // lat |
1042 | 1395 | $data['longitude'] = $line['pt'][1]; // long |
1043 | 1396 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
1044 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
1397 | + if (isset($line['inf']['sq'])) { |
|
1398 | + $data['squawk'] = $line['inf']['sq']; |
|
1399 | + } |
|
1400 | + // squawk |
|
1045 | 1401 | //$data['aircraft_icao'] = $line[8]; |
1046 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
1402 | + if (isset($line['inf']['rc'])) { |
|
1403 | + $data['registration'] = $line['inf']['rc']; |
|
1404 | + } |
|
1047 | 1405 | //$data['departure_airport_iata'] = $line[11]; |
1048 | 1406 | //$data['arrival_airport_iata'] = $line[12]; |
1049 | 1407 | //$data['emergency'] = ''; // emergency |
1050 | 1408 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
1051 | 1409 | $data['format_source'] = 'radarvirtueljson'; |
1052 | 1410 | $data['id_source'] = $id_source; |
1053 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1054 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1411 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1412 | + $data['noarchive'] = true; |
|
1413 | + } |
|
1414 | + if (isset($value['name']) && $value['name'] != '') { |
|
1415 | + $data['source_name'] = $value['name']; |
|
1416 | + } |
|
1055 | 1417 | $SI->add($data); |
1056 | 1418 | unset($data); |
1057 | 1419 | } |
@@ -1077,30 +1439,65 @@ discard block |
||
1077 | 1439 | $data['id'] = $line['id']; |
1078 | 1440 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
1079 | 1441 | $data['ident'] = $line['callsign']; // ident |
1080 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
1081 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
1082 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
1083 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
1084 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
1085 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1442 | + if (isset($line['pilotid'])) { |
|
1443 | + $data['pilot_id'] = $line['pilotid']; |
|
1444 | + } |
|
1445 | + // pilot id |
|
1446 | + if (isset($line['name'])) { |
|
1447 | + $data['pilot_name'] = $line['name']; |
|
1448 | + } |
|
1449 | + // pilot name |
|
1450 | + if (isset($line['alt'])) { |
|
1451 | + $data['altitude'] = $line['alt']; |
|
1452 | + } |
|
1453 | + // altitude |
|
1454 | + if (isset($line['gs'])) { |
|
1455 | + $data['speed'] = $line['gs']; |
|
1456 | + } |
|
1457 | + // speed |
|
1458 | + if (isset($line['heading'])) { |
|
1459 | + $data['heading'] = $line['heading']; |
|
1460 | + } |
|
1461 | + // heading |
|
1462 | + if (isset($line['route'])) { |
|
1463 | + $data['waypoints'] = $line['route']; |
|
1464 | + } |
|
1465 | + // route |
|
1086 | 1466 | $data['latitude'] = $line['lat']; // lat |
1087 | 1467 | $data['longitude'] = $line['lon']; // long |
1088 | 1468 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
1089 | 1469 | //$data['squawk'] = $line['squawk']; // squawk |
1090 | 1470 | //$data['emergency'] = ''; // emergency |
1091 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
1092 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
1093 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
1471 | + if (isset($line['depicao'])) { |
|
1472 | + $data['departure_airport_icao'] = $line['depicao']; |
|
1473 | + } |
|
1474 | + if (isset($line['deptime'])) { |
|
1475 | + $data['departure_airport_time'] = $line['deptime']; |
|
1476 | + } |
|
1477 | + if (isset($line['arricao'])) { |
|
1478 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
1479 | + } |
|
1094 | 1480 | //$data['arrival_airport_time'] = $line['arrtime']; |
1095 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
1096 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
1097 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
1098 | - else $data['info'] = ''; |
|
1481 | + if (isset($line['aircraft'])) { |
|
1482 | + $data['aircraft_icao'] = $line['aircraft']; |
|
1483 | + } |
|
1484 | + if (isset($line['transponder'])) { |
|
1485 | + $data['squawk'] = $line['transponder']; |
|
1486 | + } |
|
1487 | + if (isset($line['atis'])) { |
|
1488 | + $data['info'] = $line['atis']; |
|
1489 | + } else { |
|
1490 | + $data['info'] = ''; |
|
1491 | + } |
|
1099 | 1492 | $data['format_source'] = 'pireps'; |
1100 | 1493 | $data['id_source'] = $id_source; |
1101 | 1494 | $data['datetime'] = date('Y-m-d H:i:s'); |
1102 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1103 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1495 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1496 | + $data['noarchive'] = true; |
|
1497 | + } |
|
1498 | + if (isset($value['name']) && $value['name'] != '') { |
|
1499 | + $data['source_name'] = $value['name']; |
|
1500 | + } |
|
1104 | 1501 | if ($line['icon'] == 'plane') { |
1105 | 1502 | $SI->add($data); |
1106 | 1503 | // print_r($data); |
@@ -1109,16 +1506,28 @@ discard block |
||
1109 | 1506 | $data['info'] = str_replace('&sect;','',$data['info']); |
1110 | 1507 | $typec = substr($data['ident'],-3); |
1111 | 1508 | $data['type'] = ''; |
1112 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
1113 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
1114 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
1115 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
1116 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
1117 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
1118 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
1119 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
1120 | - else $data['type'] = 'Observer'; |
|
1121 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1509 | + if ($typec == 'APP') { |
|
1510 | + $data['type'] = 'Approach'; |
|
1511 | + } elseif ($typec == 'TWR') { |
|
1512 | + $data['type'] = 'Tower'; |
|
1513 | + } elseif ($typec == 'OBS') { |
|
1514 | + $data['type'] = 'Observer'; |
|
1515 | + } elseif ($typec == 'GND') { |
|
1516 | + $data['type'] = 'Ground'; |
|
1517 | + } elseif ($typec == 'DEL') { |
|
1518 | + $data['type'] = 'Delivery'; |
|
1519 | + } elseif ($typec == 'DEP') { |
|
1520 | + $data['type'] = 'Departure'; |
|
1521 | + } elseif ($typec == 'FSS') { |
|
1522 | + $data['type'] = 'Flight Service Station'; |
|
1523 | + } elseif ($typec == 'CTR') { |
|
1524 | + $data['type'] = 'Control Radar or Centre'; |
|
1525 | + } else { |
|
1526 | + $data['type'] = 'Observer'; |
|
1527 | + } |
|
1528 | + if (isset($ATC)) { |
|
1529 | + echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1530 | + } |
|
1122 | 1531 | } |
1123 | 1532 | unset($data); |
1124 | 1533 | } |
@@ -1133,7 +1542,9 @@ discard block |
||
1133 | 1542 | ) |
1134 | 1543 | ) { |
1135 | 1544 | //$buffer = $Common->getData($hosts[$id]); |
1136 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1545 | + if ($globalDebug) { |
|
1546 | + echo 'Get Data...'."\n"; |
|
1547 | + } |
|
1137 | 1548 | $buffer = $Common->getData($value['host']); |
1138 | 1549 | $all_data = json_decode($buffer,true); |
1139 | 1550 | if ($buffer != '' && is_array($all_data)) { |
@@ -1141,10 +1552,16 @@ discard block |
||
1141 | 1552 | foreach ($all_data as $line) { |
1142 | 1553 | $data = array(); |
1143 | 1554 | //$data['id'] = $line['id']; // id not usable |
1144 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
1555 | + if (isset($line['pilotid'])) { |
|
1556 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
1557 | + } |
|
1145 | 1558 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
1146 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
1147 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
1559 | + if (isset($line['pilotname'])) { |
|
1560 | + $data['pilot_name'] = $line['pilotname']; |
|
1561 | + } |
|
1562 | + if (isset($line['pilotid'])) { |
|
1563 | + $data['pilot_id'] = $line['pilotid']; |
|
1564 | + } |
|
1148 | 1565 | $data['ident'] = $line['flightnum']; // ident |
1149 | 1566 | $data['altitude'] = $line['alt']; // altitude |
1150 | 1567 | $data['speed'] = $line['gs']; // speed |
@@ -1160,34 +1577,52 @@ discard block |
||
1160 | 1577 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
1161 | 1578 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1162 | 1579 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1163 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1580 | + } else { |
|
1581 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1582 | + } |
|
1164 | 1583 | $data['departure_airport_icao'] = $line['depicao']; |
1165 | 1584 | $data['departure_airport_time'] = $line['deptime']; |
1166 | 1585 | $data['arrival_airport_icao'] = $line['arricao']; |
1167 | 1586 | $data['arrival_airport_time'] = $line['arrtime']; |
1168 | 1587 | $data['registration'] = $line['aircraft']; |
1169 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1170 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1588 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1589 | + $data['noarchive'] = true; |
|
1590 | + } |
|
1591 | + if (isset($line['route'])) { |
|
1592 | + $data['waypoints'] = $line['route']; |
|
1593 | + } |
|
1594 | + // route |
|
1171 | 1595 | if (isset($line['aircraftname'])) { |
1172 | 1596 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1173 | 1597 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
1174 | 1598 | $aircraft_data = explode('-',$line['aircraftname']); |
1175 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
1176 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
1177 | - else { |
|
1599 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
1600 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
1601 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
1602 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
1603 | + } else { |
|
1178 | 1604 | $aircraft_data = explode(' ',$line['aircraftname']); |
1179 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1180 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1605 | + if (isset($aircraft_data[1])) { |
|
1606 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1607 | + } else { |
|
1608 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1609 | + } |
|
1181 | 1610 | } |
1182 | 1611 | } |
1183 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
1612 | + if (isset($line['route'])) { |
|
1613 | + $data['waypoints'] = $line['route']; |
|
1614 | + } |
|
1184 | 1615 | $data['id_source'] = $id_source; |
1185 | 1616 | $data['format_source'] = 'phpvmacars'; |
1186 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1617 | + if (isset($value['name']) && $value['name'] != '') { |
|
1618 | + $data['source_name'] = $value['name']; |
|
1619 | + } |
|
1187 | 1620 | $SI->add($data); |
1188 | 1621 | unset($data); |
1189 | 1622 | } |
1190 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
1623 | + if ($globalDebug) { |
|
1624 | + echo 'No more data...'."\n"; |
|
1625 | + } |
|
1191 | 1626 | unset($buffer); |
1192 | 1627 | unset($all_data); |
1193 | 1628 | } |
@@ -1200,7 +1635,9 @@ discard block |
||
1200 | 1635 | ) |
1201 | 1636 | ) { |
1202 | 1637 | //$buffer = $Common->getData($hosts[$id]); |
1203 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1638 | + if ($globalDebug) { |
|
1639 | + echo 'Get Data...'."\n"; |
|
1640 | + } |
|
1204 | 1641 | $buffer = $Common->getData($value['host']); |
1205 | 1642 | $all_data = json_decode($buffer,true); |
1206 | 1643 | if ($buffer != '' && is_array($all_data)) { |
@@ -1229,16 +1666,25 @@ discard block |
||
1229 | 1666 | $data['arrival_airport_icao'] = $line['arrival']; |
1230 | 1667 | //$data['arrival_airport_time'] = $line['arrival_time']; |
1231 | 1668 | //$data['registration'] = $line['aircraft']; |
1232 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1669 | + if (isset($line['route'])) { |
|
1670 | + $data['waypoints'] = $line['route']; |
|
1671 | + } |
|
1672 | + // route |
|
1233 | 1673 | $data['aircraft_icao'] = $line['plane_type']; |
1234 | 1674 | $data['id_source'] = $id_source; |
1235 | 1675 | $data['format_source'] = 'vam'; |
1236 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1237 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1676 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1677 | + $data['noarchive'] = true; |
|
1678 | + } |
|
1679 | + if (isset($value['name']) && $value['name'] != '') { |
|
1680 | + $data['source_name'] = $value['name']; |
|
1681 | + } |
|
1238 | 1682 | $SI->add($data); |
1239 | 1683 | unset($data); |
1240 | 1684 | } |
1241 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
1685 | + if ($globalDebug) { |
|
1686 | + echo 'No more data...'."\n"; |
|
1687 | + } |
|
1242 | 1688 | unset($buffer); |
1243 | 1689 | unset($all_data); |
1244 | 1690 | } |
@@ -1251,7 +1697,9 @@ discard block |
||
1251 | 1697 | ) |
1252 | 1698 | ) { |
1253 | 1699 | //$buffer = $Common->getData($hosts[$id]); |
1254 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1700 | + if ($globalDebug) { |
|
1701 | + echo 'Get Data...'."\n"; |
|
1702 | + } |
|
1255 | 1703 | $buffer = $Common->getData($value['host']); |
1256 | 1704 | $all_data = json_decode($buffer,true); |
1257 | 1705 | if ($buffer != '') { |
@@ -1269,18 +1717,24 @@ discard block |
||
1269 | 1717 | $data['id_source'] = $id_source; |
1270 | 1718 | $data['format_source'] = 'blitzortung'; |
1271 | 1719 | $SI->add($data); |
1272 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
1720 | + if ($globalDebug) { |
|
1721 | + echo '☈ Lightning added'."\n"; |
|
1722 | + } |
|
1273 | 1723 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
1274 | 1724 | unset($data); |
1275 | 1725 | } |
1276 | 1726 | } |
1277 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
1727 | + if ($globalDebug) { |
|
1728 | + echo 'No more data...'."\n"; |
|
1729 | + } |
|
1278 | 1730 | unset($buffer); |
1279 | 1731 | } |
1280 | 1732 | $last_exec[$id]['last'] = time(); |
1281 | 1733 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
1282 | 1734 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') { |
1283 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
1735 | + if (function_exists('pcntl_fork')) { |
|
1736 | + pcntl_signal_dispatch(); |
|
1737 | + } |
|
1284 | 1738 | //$last_exec[$id]['last'] = time(); |
1285 | 1739 | |
1286 | 1740 | //$read = array( $sockets[$id] ); |
@@ -1288,7 +1742,9 @@ discard block |
||
1288 | 1742 | $write = NULL; |
1289 | 1743 | $e = NULL; |
1290 | 1744 | $n = socket_select($read, $write, $e, $timeout); |
1291 | - if ($e != NULL) var_dump($e); |
|
1745 | + if ($e != NULL) { |
|
1746 | + var_dump($e); |
|
1747 | + } |
|
1292 | 1748 | if ($n > 0) { |
1293 | 1749 | $reset = 0; |
1294 | 1750 | foreach ($read as $nb => $r) { |
@@ -1309,12 +1765,16 @@ discard block |
||
1309 | 1765 | //$SI::del(); |
1310 | 1766 | if ($format == 'vrstcp') { |
1311 | 1767 | $buffer = explode('},{',$buffer); |
1312 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1768 | + } else { |
|
1769 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1770 | + } |
|
1313 | 1771 | // SBS format is CSV format |
1314 | 1772 | if ($buffer !== FALSE && $buffer != '') { |
1315 | 1773 | $tt[$format] = 0; |
1316 | 1774 | if ($format == 'acarssbs3') { |
1317 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1775 | + if ($globalDebug) { |
|
1776 | + echo 'ACARS : '.$buffer."\n"; |
|
1777 | + } |
|
1318 | 1778 | $ACARS->add(trim($buffer)); |
1319 | 1779 | $ACARS->deleteLiveAcarsData(); |
1320 | 1780 | } elseif ($format == 'raw') { |
@@ -1323,30 +1783,70 @@ discard block |
||
1323 | 1783 | if (is_array($data)) { |
1324 | 1784 | $data['datetime'] = date('Y-m-d H:i:s'); |
1325 | 1785 | $data['format_source'] = 'raw'; |
1326 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1327 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1328 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1329 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1786 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
1787 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
1788 | + } |
|
1789 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
1790 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1791 | + } |
|
1792 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1793 | + $data['noarchive'] = true; |
|
1794 | + } |
|
1795 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1796 | + $SI->add($data); |
|
1797 | + } |
|
1330 | 1798 | } |
1331 | 1799 | } elseif ($format == 'ais') { |
1332 | 1800 | $ais_data = $AIS->parse_line(trim($buffer)); |
1333 | 1801 | $data = array(); |
1334 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
1335 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
1336 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
1337 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
1338 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
1339 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
1340 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
1341 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
1342 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
1343 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
1344 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
1345 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
1346 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1347 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1348 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1349 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1802 | + if (isset($ais_data['ident'])) { |
|
1803 | + $data['ident'] = $ais_data['ident']; |
|
1804 | + } |
|
1805 | + if (isset($ais_data['mmsi'])) { |
|
1806 | + $data['mmsi'] = $ais_data['mmsi']; |
|
1807 | + } |
|
1808 | + if (isset($ais_data['speed'])) { |
|
1809 | + $data['speed'] = $ais_data['speed']; |
|
1810 | + } |
|
1811 | + if (isset($ais_data['heading'])) { |
|
1812 | + $data['heading'] = $ais_data['heading']; |
|
1813 | + } |
|
1814 | + if (isset($ais_data['latitude'])) { |
|
1815 | + $data['latitude'] = $ais_data['latitude']; |
|
1816 | + } |
|
1817 | + if (isset($ais_data['longitude'])) { |
|
1818 | + $data['longitude'] = $ais_data['longitude']; |
|
1819 | + } |
|
1820 | + if (isset($ais_data['status'])) { |
|
1821 | + $data['status'] = $ais_data['status']; |
|
1822 | + } |
|
1823 | + if (isset($ais_data['statusid'])) { |
|
1824 | + $data['status_id'] = $ais_data['statusid']; |
|
1825 | + } |
|
1826 | + if (isset($ais_data['type'])) { |
|
1827 | + $data['type'] = $ais_data['type']; |
|
1828 | + } |
|
1829 | + if (isset($ais_data['imo'])) { |
|
1830 | + $data['imo'] = $ais_data['imo']; |
|
1831 | + } |
|
1832 | + if (isset($ais_data['callsign'])) { |
|
1833 | + $data['callsign'] = $ais_data['callsign']; |
|
1834 | + } |
|
1835 | + if (isset($ais_data['destination'])) { |
|
1836 | + $data['arrival_code'] = $ais_data['destination']; |
|
1837 | + } |
|
1838 | + if (isset($ais_data['eta_ts'])) { |
|
1839 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1840 | + } |
|
1841 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1842 | + $data['noarchive'] = true; |
|
1843 | + } |
|
1844 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
1845 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
1846 | + } |
|
1847 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
1848 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1849 | + } |
|
1350 | 1850 | |
1351 | 1851 | if (isset($ais_data['timestamp'])) { |
1352 | 1852 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1355,7 +1855,9 @@ discard block |
||
1355 | 1855 | } |
1356 | 1856 | $data['format_source'] = 'aisnmea'; |
1357 | 1857 | $data['id_source'] = $id_source; |
1358 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
1858 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
1859 | + $MI->add($data); |
|
1860 | + } |
|
1359 | 1861 | unset($data); |
1360 | 1862 | } elseif ($format == 'flightgearsp') { |
1361 | 1863 | //echo $buffer."\n"; |
@@ -1373,12 +1875,18 @@ discard block |
||
1373 | 1875 | $data['speed'] = round($line[5]*1.94384); |
1374 | 1876 | $data['datetime'] = date('Y-m-d H:i:s'); |
1375 | 1877 | $data['format_source'] = 'flightgearsp'; |
1376 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1377 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1878 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1879 | + $data['noarchive'] = true; |
|
1880 | + } |
|
1881 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1882 | + $SI->add($data); |
|
1883 | + } |
|
1378 | 1884 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
1379 | 1885 | } |
1380 | 1886 | } elseif ($format == 'acars') { |
1381 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1887 | + if ($globalDebug) { |
|
1888 | + echo 'ACARS : '.$buffer."\n"; |
|
1889 | + } |
|
1382 | 1890 | $ACARS->add(trim($buffer)); |
1383 | 1891 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
1384 | 1892 | $ACARS->deleteLiveAcarsData(); |
@@ -1399,8 +1907,12 @@ discard block |
||
1399 | 1907 | $aircraft_type = $line[10]; |
1400 | 1908 | $aircraft_type = preg_split(':/:',$aircraft_type); |
1401 | 1909 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
1402 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1403 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1910 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1911 | + $data['noarchive'] = true; |
|
1912 | + } |
|
1913 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1914 | + $SI->add($data); |
|
1915 | + } |
|
1404 | 1916 | } |
1405 | 1917 | } |
1406 | 1918 | } elseif ($format == 'beast') { |
@@ -1410,28 +1922,62 @@ discard block |
||
1410 | 1922 | foreach($buffer as $all_data) { |
1411 | 1923 | $line = json_decode('{'.$all_data.'}',true); |
1412 | 1924 | $data = array(); |
1413 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
1414 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
1415 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
1416 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
1417 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
1418 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
1419 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
1925 | + if (isset($line['Icao'])) { |
|
1926 | + $data['hex'] = $line['Icao']; |
|
1927 | + } |
|
1928 | + // hex |
|
1929 | + if (isset($line['Call'])) { |
|
1930 | + $data['ident'] = $line['Call']; |
|
1931 | + } |
|
1932 | + // ident |
|
1933 | + if (isset($line['Alt'])) { |
|
1934 | + $data['altitude'] = $line['Alt']; |
|
1935 | + } |
|
1936 | + // altitude |
|
1937 | + if (isset($line['Spd'])) { |
|
1938 | + $data['speed'] = $line['Spd']; |
|
1939 | + } |
|
1940 | + // speed |
|
1941 | + if (isset($line['Trak'])) { |
|
1942 | + $data['heading'] = $line['Trak']; |
|
1943 | + } |
|
1944 | + // heading |
|
1945 | + if (isset($line['Lat'])) { |
|
1946 | + $data['latitude'] = $line['Lat']; |
|
1947 | + } |
|
1948 | + // lat |
|
1949 | + if (isset($line['Long'])) { |
|
1950 | + $data['longitude'] = $line['Long']; |
|
1951 | + } |
|
1952 | + // long |
|
1420 | 1953 | //$data['verticalrate'] = $line['']; // verticale rate |
1421 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
1954 | + if (isset($line['Sqk'])) { |
|
1955 | + $data['squawk'] = $line['Sqk']; |
|
1956 | + } |
|
1957 | + // squawk |
|
1422 | 1958 | $data['emergency'] = ''; // emergency |
1423 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
1959 | + if (isset($line['Reg'])) { |
|
1960 | + $data['registration'] = $line['Reg']; |
|
1961 | + } |
|
1424 | 1962 | /* |
1425 | 1963 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
1426 | 1964 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1427 | 1965 | */ |
1428 | 1966 | $data['datetime'] = date('Y-m-d H:i:s'); |
1429 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
1967 | + if (isset($line['Type'])) { |
|
1968 | + $data['aircraft_icao'] = $line['Type']; |
|
1969 | + } |
|
1430 | 1970 | $data['format_source'] = 'vrstcp'; |
1431 | 1971 | $data['id_source'] = $id_source; |
1432 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1433 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1434 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
1972 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1973 | + $data['noarchive'] = true; |
|
1974 | + } |
|
1975 | + if (isset($value['name']) && $value['name'] != '') { |
|
1976 | + $data['source_name'] = $value['name']; |
|
1977 | + } |
|
1978 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
1979 | + $SI->add($data); |
|
1980 | + } |
|
1435 | 1981 | unset($data); |
1436 | 1982 | } |
1437 | 1983 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
@@ -1444,22 +1990,46 @@ discard block |
||
1444 | 1990 | $data['hex'] = $lined['hexid']; |
1445 | 1991 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1446 | 1992 | $data['datetime'] = date('Y-m-d H:i:s');; |
1447 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
1448 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
1449 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
1450 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
1451 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
1452 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
1453 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
1993 | + if (isset($lined['ident'])) { |
|
1994 | + $data['ident'] = $lined['ident']; |
|
1995 | + } |
|
1996 | + if (isset($lined['lat'])) { |
|
1997 | + $data['latitude'] = $lined['lat']; |
|
1998 | + } |
|
1999 | + if (isset($lined['lon'])) { |
|
2000 | + $data['longitude'] = $lined['lon']; |
|
2001 | + } |
|
2002 | + if (isset($lined['speed'])) { |
|
2003 | + $data['speed'] = $lined['speed']; |
|
2004 | + } |
|
2005 | + if (isset($lined['squawk'])) { |
|
2006 | + $data['squawk'] = $lined['squawk']; |
|
2007 | + } |
|
2008 | + if (isset($lined['alt'])) { |
|
2009 | + $data['altitude'] = $lined['alt']; |
|
2010 | + } |
|
2011 | + if (isset($lined['heading'])) { |
|
2012 | + $data['heading'] = $lined['heading']; |
|
2013 | + } |
|
1454 | 2014 | $data['id_source'] = $id_source; |
1455 | 2015 | $data['format_source'] = 'tsv'; |
1456 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1457 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1458 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1459 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
2016 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
2017 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
2018 | + } |
|
2019 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
2020 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
2021 | + } |
|
2022 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
2023 | + $data['noarchive'] = true; |
|
2024 | + } |
|
2025 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
2026 | + $SI->add($data); |
|
2027 | + } |
|
1460 | 2028 | unset($lined); |
1461 | 2029 | unset($data); |
1462 | - } else $error = true; |
|
2030 | + } else { |
|
2031 | + $error = true; |
|
2032 | + } |
|
1463 | 2033 | } elseif ($format == 'aprs' && $use_aprs) { |
1464 | 2034 | if ($aprs_connect == 0) { |
1465 | 2035 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1484,62 +2054,120 @@ discard block |
||
1484 | 2054 | $aprs_last_tx = time(); |
1485 | 2055 | $data = array(); |
1486 | 2056 | //print_r($line); |
1487 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
1488 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
1489 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
1490 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
1491 | - if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; |
|
1492 | - if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
|
1493 | - if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
|
1494 | - if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
|
1495 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1496 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
2057 | + if (isset($line['address'])) { |
|
2058 | + $data['hex'] = $line['address']; |
|
2059 | + } |
|
2060 | + if (isset($line['mmsi'])) { |
|
2061 | + $data['mmsi'] = $line['mmsi']; |
|
2062 | + } |
|
2063 | + if (isset($line['imo'])) { |
|
2064 | + $data['imo'] = $line['imo']; |
|
2065 | + } |
|
2066 | + if (isset($line['squawk'])) { |
|
2067 | + $data['squawk'] = $line['squawk']; |
|
2068 | + } |
|
2069 | + if (isset($line['arrival_code'])) { |
|
2070 | + $data['arrical_code'] = $line['arrival_code']; |
|
2071 | + } |
|
2072 | + if (isset($line['arrival_date'])) { |
|
2073 | + $data['arrical_date'] = $line['arrival_date']; |
|
2074 | + } |
|
2075 | + if (isset($line['type_id'])) { |
|
2076 | + $data['type_id'] = $line['typeid']; |
|
2077 | + } |
|
2078 | + if (isset($line['status_id'])) { |
|
2079 | + $data['status_id'] = $line['statusid']; |
|
2080 | + } |
|
2081 | + if (isset($line['timestamp'])) { |
|
2082 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
2083 | + } else { |
|
2084 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
2085 | + } |
|
1497 | 2086 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1498 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
2087 | + if (isset($line['ident'])) { |
|
2088 | + $data['ident'] = $line['ident']; |
|
2089 | + } |
|
1499 | 2090 | $data['latitude'] = $line['latitude']; |
1500 | 2091 | $data['longitude'] = $line['longitude']; |
1501 | 2092 | //$data['verticalrate'] = $line[16]; |
1502 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
2093 | + if (isset($line['speed'])) { |
|
2094 | + $data['speed'] = $line['speed']; |
|
2095 | + } |
|
1503 | 2096 | //else $data['speed'] = 0; |
1504 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
1505 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
1506 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
2097 | + if (isset($line['altitude'])) { |
|
2098 | + $data['altitude'] = $line['altitude']; |
|
2099 | + } |
|
2100 | + if (isset($line['comment'])) { |
|
2101 | + $data['comment'] = $line['comment']; |
|
2102 | + } |
|
2103 | + if (isset($line['symbol'])) { |
|
2104 | + $data['type'] = $line['symbol']; |
|
2105 | + } |
|
1507 | 2106 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
1508 | 2107 | |
1509 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
2108 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
2109 | + $data['heading'] = $line['heading']; |
|
2110 | + } |
|
1510 | 2111 | //else echo 'No heading...'."\n"; |
1511 | 2112 | //else $data['heading'] = 0; |
1512 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
2113 | + if (isset($line['stealth'])) { |
|
2114 | + $data['aircraft_type'] = $line['stealth']; |
|
2115 | + } |
|
1513 | 2116 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
1514 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
1515 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
1516 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1517 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
2117 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
2118 | + $data['noarchive'] = true; |
|
2119 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
2120 | + $data['noarchive'] = false; |
|
2121 | + } |
|
2122 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
2123 | + $data['noarchive'] = true; |
|
2124 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
2125 | + $data['noarchive'] = false; |
|
2126 | + } |
|
1518 | 2127 | $data['id_source'] = $id_source; |
1519 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
1520 | - else $data['format_source'] = 'aprs'; |
|
2128 | + if (isset($line['format_source'])) { |
|
2129 | + $data['format_source'] = $line['format_source']; |
|
2130 | + } else { |
|
2131 | + $data['format_source'] = 'aprs'; |
|
2132 | + } |
|
1521 | 2133 | $data['source_name'] = $line['source']; |
1522 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
1523 | - else $data['source_type'] = 'flarm'; |
|
1524 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
2134 | + if (isset($line['source_type'])) { |
|
2135 | + $data['source_type'] = $line['source_type']; |
|
2136 | + } else { |
|
2137 | + $data['source_type'] = 'flarm'; |
|
2138 | + } |
|
2139 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
2140 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
2141 | + } |
|
1525 | 2142 | $currentdate = date('Y-m-d H:i:s'); |
1526 | 2143 | $aprsdate = strtotime($data['datetime']); |
1527 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
2144 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
2145 | + $data['altitude_relative'] = 'AMSL'; |
|
2146 | + } |
|
1528 | 2147 | // Accept data if time <= system time + 20s |
1529 | 2148 | //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
1530 | 2149 | if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
1531 | 2150 | $send = $SI->add($data); |
1532 | 2151 | } elseif ($data['source_type'] == 'ais') { |
1533 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
2152 | + if (isset($globalMarine) && $globalMarine) { |
|
2153 | + $send = $MI->add($data); |
|
2154 | + } |
|
1534 | 2155 | } elseif (isset($line['stealth'])) { |
1535 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
1536 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
2156 | + if ($line['stealth'] != 0) { |
|
2157 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
2158 | + } else { |
|
2159 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
2160 | + } |
|
1537 | 2161 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
1538 | 2162 | //$line['symbol'] == 'Balloon' || |
1539 | 2163 | $line['symbol'] == 'Glider' || |
1540 | 2164 | $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
1541 | - if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
1542 | - if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
2165 | + if ($line['symbol'] == 'Ballon') { |
|
2166 | + $data['aircraft_icao'] = 'BALL'; |
|
2167 | + } |
|
2168 | + if ($line['symbol'] == 'Glider') { |
|
2169 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
2170 | + } |
|
1543 | 2171 | $send = $SI->add($data); |
1544 | 2172 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
1545 | 2173 | $line['symbol'] == 'Yacht (Sail)' || |
@@ -1570,9 +2198,13 @@ discard block |
||
1570 | 2198 | //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
1571 | 2199 | // } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
1572 | 2200 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
1573 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
2201 | + if (isset($globalTracker) && $globalTracker) { |
|
2202 | + $send = $TI->add($data); |
|
2203 | + } |
|
1574 | 2204 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
1575 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
2205 | + if (!isset($data['altitude'])) { |
|
2206 | + $data['altitude'] = 0; |
|
2207 | + } |
|
1576 | 2208 | $Source->deleteOldLocationByType('gs'); |
1577 | 2209 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
1578 | 2210 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1581,7 +2213,9 @@ discard block |
||
1581 | 2213 | } |
1582 | 2214 | } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
1583 | 2215 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1584 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
2216 | + if ($globalDebug) { |
|
2217 | + echo '# Weather Station added'."\n"; |
|
2218 | + } |
|
1585 | 2219 | $Source->deleteOldLocationByType('wx'); |
1586 | 2220 | $weather_data = json_encode($line); |
1587 | 2221 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1591,7 +2225,9 @@ discard block |
||
1591 | 2225 | } |
1592 | 2226 | } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) { |
1593 | 2227 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1594 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
2228 | + if ($globalDebug) { |
|
2229 | + echo '☈ Lightning added'."\n"; |
|
2230 | + } |
|
1595 | 2231 | $Source->deleteOldLocationByType('lightning'); |
1596 | 2232 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
1597 | 2233 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1603,8 +2239,7 @@ discard block |
||
1603 | 2239 | print_r($line); |
1604 | 2240 | } |
1605 | 2241 | unset($data); |
1606 | - } |
|
1607 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
2242 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
1608 | 2243 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
1609 | 2244 | } |
1610 | 2245 | /* |
@@ -1613,7 +2248,9 @@ discard block |
||
1613 | 2248 | } |
1614 | 2249 | */ |
1615 | 2250 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
1616 | - elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
2251 | + elseif ($line == true && $globalDebug) { |
|
2252 | + echo '!! Failed : '.$buffer."!!\n"; |
|
2253 | + } |
|
1617 | 2254 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
1618 | 2255 | $Source->deleteOldLocationByType('lightning'); |
1619 | 2256 | $Source->deleteOldLocationByType('wx'); |
@@ -1649,26 +2286,45 @@ discard block |
||
1649 | 2286 | $data['ground'] = $line[21]; |
1650 | 2287 | $data['emergency'] = $line[19]; |
1651 | 2288 | $data['format_source'] = 'sbs'; |
1652 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1653 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1654 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
2289 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
2290 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
2291 | + } |
|
2292 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
2293 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
2294 | + } |
|
2295 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
2296 | + $data['noarchive'] = true; |
|
2297 | + } |
|
1655 | 2298 | $data['id_source'] = $id_source; |
1656 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
1657 | - else $error = true; |
|
2299 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
2300 | + $send = $SI->add($data); |
|
2301 | + } else { |
|
2302 | + $error = true; |
|
2303 | + } |
|
1658 | 2304 | unset($data); |
1659 | - } else $error = true; |
|
2305 | + } else { |
|
2306 | + $error = true; |
|
2307 | + } |
|
1660 | 2308 | if ($error) { |
1661 | 2309 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
1662 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
2310 | + if ($globalDebug) { |
|
2311 | + echo "Not a message. Ignoring... \n"; |
|
2312 | + } |
|
1663 | 2313 | } else { |
1664 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
2314 | + if ($globalDebug) { |
|
2315 | + echo "Wrong line format. Ignoring... \n"; |
|
2316 | + } |
|
1665 | 2317 | if ($globalDebug) { |
1666 | 2318 | echo $buffer; |
1667 | 2319 | //print_r($line); |
1668 | 2320 | } |
1669 | 2321 | //socket_close($r); |
1670 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
1671 | - if ($format == 'aprs') $aprs_connect = 0; |
|
2322 | + if ($globalDebug) { |
|
2323 | + echo "Reconnect after an error...\n"; |
|
2324 | + } |
|
2325 | + if ($format == 'aprs') { |
|
2326 | + $aprs_connect = 0; |
|
2327 | + } |
|
1672 | 2328 | $sourceer[$nb] = $globalSources[$nb]; |
1673 | 2329 | connect_all($sourceer); |
1674 | 2330 | $sourceer = array(); |
@@ -1676,10 +2332,14 @@ discard block |
||
1676 | 2332 | } |
1677 | 2333 | } |
1678 | 2334 | // Sleep for xxx microseconds |
1679 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
2335 | + if (isset($globalSBSSleep)) { |
|
2336 | + usleep($globalSBSSleep); |
|
2337 | + } |
|
1680 | 2338 | } else { |
1681 | 2339 | if ($format == 'flightgearmp') { |
1682 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
2340 | + if ($globalDebug) { |
|
2341 | + echo "Reconnect FlightGear MP..."; |
|
2342 | + } |
|
1683 | 2343 | //@socket_close($r); |
1684 | 2344 | sleep($globalMinFetch); |
1685 | 2345 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1688,10 +2348,15 @@ discard block |
||
1688 | 2348 | break; |
1689 | 2349 | |
1690 | 2350 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
1691 | - if (isset($tt[$format])) $tt[$format]++; |
|
1692 | - else $tt[$format] = 0; |
|
2351 | + if (isset($tt[$format])) { |
|
2352 | + $tt[$format]++; |
|
2353 | + } else { |
|
2354 | + $tt[$format] = 0; |
|
2355 | + } |
|
1693 | 2356 | if ($tt[$format] > 30) { |
1694 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
2357 | + if ($globalDebug) { |
|
2358 | + echo "ERROR : Reconnect ".$format."..."; |
|
2359 | + } |
|
1695 | 2360 | //@socket_close($r); |
1696 | 2361 | sleep(2); |
1697 | 2362 | $aprs_connect = 0; |
@@ -1708,11 +2373,17 @@ discard block |
||
1708 | 2373 | } else { |
1709 | 2374 | $error = socket_strerror(socket_last_error()); |
1710 | 2375 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1711 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1712 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
2376 | + if ($globalDebug) { |
|
2377 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
2378 | + } |
|
2379 | + if (isset($globalDebug)) { |
|
2380 | + echo "Restarting...\n"; |
|
2381 | + } |
|
1713 | 2382 | // Restart the script if possible |
1714 | 2383 | if (is_array($sockets)) { |
1715 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
2384 | + if ($globalDebug) { |
|
2385 | + echo "Shutdown all sockets..."; |
|
2386 | + } |
|
1716 | 2387 | |
1717 | 2388 | foreach ($sockets as $sock) { |
1718 | 2389 | @socket_shutdown($sock,2); |
@@ -1720,25 +2391,45 @@ discard block |
||
1720 | 2391 | } |
1721 | 2392 | |
1722 | 2393 | } |
1723 | - if ($globalDebug) echo "Waiting..."; |
|
2394 | + if ($globalDebug) { |
|
2395 | + echo "Waiting..."; |
|
2396 | + } |
|
1724 | 2397 | sleep(2); |
1725 | 2398 | $time = time(); |
1726 | 2399 | //connect_all($hosts); |
1727 | 2400 | $aprs_connect = 0; |
1728 | - if ($reset%5 == 0) sleep(20); |
|
1729 | - if ($reset%10 == 0) sleep(100); |
|
1730 | - if ($reset%20 == 0) sleep(200); |
|
1731 | - if ($reset > 100) exit('Too many attempts...'); |
|
1732 | - if ($globalDebug) echo "Restart all connections..."; |
|
2401 | + if ($reset%5 == 0) { |
|
2402 | + sleep(20); |
|
2403 | + } |
|
2404 | + if ($reset%10 == 0) { |
|
2405 | + sleep(100); |
|
2406 | + } |
|
2407 | + if ($reset%20 == 0) { |
|
2408 | + sleep(200); |
|
2409 | + } |
|
2410 | + if ($reset > 100) { |
|
2411 | + exit('Too many attempts...'); |
|
2412 | + } |
|
2413 | + if ($globalDebug) { |
|
2414 | + echo "Restart all connections..."; |
|
2415 | + } |
|
1733 | 2416 | connect_all($globalSources); |
1734 | 2417 | } |
1735 | 2418 | } |
1736 | 2419 | } |
1737 | 2420 | if ($globalDaemon === false) { |
1738 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
1739 | - if (isset($SI)) $SI->checkAll(); |
|
1740 | - if (isset($TI)) $TI->checkAll(); |
|
1741 | - if (isset($MI)) $MI->checkAll(); |
|
2421 | + if ($globalDebug) { |
|
2422 | + echo 'Check all...'."\n"; |
|
2423 | + } |
|
2424 | + if (isset($SI)) { |
|
2425 | + $SI->checkAll(); |
|
2426 | + } |
|
2427 | + if (isset($TI)) { |
|
2428 | + $TI->checkAll(); |
|
2429 | + } |
|
2430 | + if (isset($MI)) { |
|
2431 | + $MI->checkAll(); |
|
2432 | + } |
|
1742 | 2433 | } |
1743 | 2434 | } |
1744 | 2435 | } |