@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
10 | 10 | exec("ps ux", $output, $result); |
11 | 11 | $j = 0; |
12 | - foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++; |
|
12 | + foreach ($output as $line) { |
|
13 | + if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++; |
|
14 | + } |
|
13 | 15 | if ($j > 1) { |
14 | 16 | echo "Script is already runnning..."; |
15 | 17 | die(); |
@@ -29,14 +31,18 @@ discard block |
||
29 | 31 | $update_db->update_notam(); |
30 | 32 | } |
31 | 33 | $update_db->insert_last_notam_update(); |
32 | - } elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n"; |
|
34 | + } elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) { |
|
35 | + echo "NOTAM are only updated once a day.\n"; |
|
36 | + } |
|
33 | 37 | if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
34 | 38 | $update_db->update_all(); |
35 | 39 | // require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
36 | 40 | // $Spotter = new Spotter(); |
37 | 41 | // $Spotter->updateFieldsFromOtherTables(); |
38 | 42 | $update_db->insert_last_update(); |
39 | - } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n"; |
|
43 | + } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) { |
|
44 | + echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n"; |
|
45 | + } |
|
40 | 46 | if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) { |
41 | 47 | echo "Check if new airspace version exist..."; |
42 | 48 | echo $update_db->update_airspace_fam(); |
@@ -45,8 +51,11 @@ discard block |
||
45 | 51 | if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) { |
46 | 52 | echo "Check if new geoid version exist..."; |
47 | 53 | $error = $update_db->update_geoid_fam(); |
48 | - if ($error == '') $update_db->insert_last_geoid_update(); |
|
49 | - else echo $error; |
|
54 | + if ($error == '') { |
|
55 | + $update_db->insert_last_geoid_update(); |
|
56 | + } else { |
|
57 | + echo $error; |
|
58 | + } |
|
50 | 59 | } |
51 | 60 | if (isset($globalMarine) && $globalMarine && $update_db->check_last_marine_identity_update()) { |
52 | 61 | echo "Check if new marine identity version exist..."; |
@@ -64,13 +73,17 @@ discard block |
||
64 | 73 | //echo "Done"; |
65 | 74 | } |
66 | 75 | $update_db->insert_last_owner_update(); |
67 | - } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n"; |
|
76 | + } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
|
77 | + echo "Owner are only updated every 15 days.\n"; |
|
78 | + } |
|
68 | 79 | |
69 | 80 | if ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
70 | 81 | echo "Updating airlines...\n"; |
71 | 82 | echo $update_db->update_airlines_fam(); |
72 | 83 | $update_db->insert_last_airlines_update(); |
73 | - } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n"; |
|
84 | + } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
|
85 | + echo "Airlines are only updated every 15 days.\n"; |
|
86 | + } |
|
74 | 87 | |
75 | 88 | if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
76 | 89 | require_once(dirname(__FILE__).'/../require/class.Accident.php'); |
@@ -79,7 +92,9 @@ discard block |
||
79 | 92 | if ($Accident->check_last_accidents_update()) { |
80 | 93 | $Accident->download_update(); |
81 | 94 | $Accident->insert_last_accidents_update(); |
82 | - } else echo "Accidents are updated once a day.\n"; |
|
95 | + } else { |
|
96 | + echo "Accidents are updated once a day.\n"; |
|
97 | + } |
|
83 | 98 | } |
84 | 99 | |
85 | 100 | } |
@@ -92,7 +107,9 @@ discard block |
||
92 | 107 | if ($METAR->check_last_update()) { |
93 | 108 | $METAR->addMETARCycle(); |
94 | 109 | $METAR->insert_last_update(); |
95 | - } else echo "METAR are only updated every 30 minutes.\n"; |
|
110 | + } else { |
|
111 | + echo "METAR are only updated every 30 minutes.\n"; |
|
112 | + } |
|
96 | 113 | } |
97 | 114 | |
98 | 115 | if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
@@ -100,8 +117,10 @@ discard block |
||
100 | 117 | //$update_db->update_oneworld(); |
101 | 118 | $update_db->update_skyteam(); |
102 | 119 | $update_db->insert_last_schedules_update(); |
103 | - } elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n"; |
|
104 | -} |
|
120 | + } elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
|
121 | + echo "Schedules are only updated every 15 days.\n"; |
|
122 | + } |
|
123 | + } |
|
105 | 124 | |
106 | 125 | if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) { |
107 | 126 | echo "Updating statistics and archive old data...\n"; |
@@ -5,21 +5,30 @@ discard block |
||
5 | 5 | |
6 | 6 | document.cookie = 'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
7 | 7 | <?php |
8 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
9 | - else $MapType = $globalMapProvider; |
|
8 | + if (isset($_COOKIE['MapType'])) { |
|
9 | + $MapType = $_COOKIE['MapType']; |
|
10 | + } else { |
|
11 | + $MapType = $globalMapProvider; |
|
12 | + } |
|
10 | 13 | |
11 | 14 | // unset($_COOKIE['MapType']); |
12 | 15 | if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline') { |
13 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial'; |
|
14 | - else $MapType = 'OpenStreetMap'; |
|
16 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
17 | + $MapType = 'Bing-Aerial'; |
|
18 | + } else { |
|
19 | + $MapType = 'OpenStreetMap'; |
|
20 | + } |
|
15 | 21 | } |
16 | 22 | if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) { |
17 | 23 | $MapType = 'OpenStreetMap'; |
18 | 24 | } |
19 | 25 | if ($MapType == 'Mapbox') { |
20 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
21 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
22 | -?> |
|
26 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
27 | + $MapBoxId = $globalMapboxId; |
|
28 | + } else { |
|
29 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
30 | + } |
|
31 | + ?> |
|
23 | 32 | var imProv = Cesium.MapboxImageryProvider({ |
24 | 33 | credit: 'Map data © OpenStreetMap contributors, ' + |
25 | 34 | 'CC-BY-SA, ' + |
@@ -126,13 +135,23 @@ discard block |
||
126 | 135 | */ |
127 | 136 | ?> |
128 | 137 | <?php |
129 | - } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
138 | + } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
130 | 139 | $customid = $MapType; |
131 | 140 | ?> |
132 | 141 | var imProv = Cesium.createOpenStreetMapImageryProvider({ |
133 | 142 | url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>', |
134 | - maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>, |
|
135 | - minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
143 | + maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
144 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
145 | +} else { |
|
146 | + print '99'; |
|
147 | +} |
|
148 | +?>, |
|
149 | + minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
150 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
151 | +} else { |
|
152 | + print '0'; |
|
153 | +} |
|
154 | +?>, |
|
136 | 155 | credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
137 | 156 | }); |
138 | 157 | <?php |
@@ -459,8 +478,11 @@ discard block |
||
459 | 478 | if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) { |
460 | 479 | if (isset($_COOKIE['lastcentercoord'])) { |
461 | 480 | $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
462 | - if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0; |
|
463 | - else $zoom = $lastcentercoord[3]; |
|
481 | + if (!isset($lastcentercoord[3])) { |
|
482 | + $zoom = $lastcentercoord[2]*1000000.0; |
|
483 | + } else { |
|
484 | + $zoom = $lastcentercoord[3]; |
|
485 | + } |
|
464 | 486 | $viewcenterlatitude = $lastcentercoord[0]; |
465 | 487 | $viewcenterlongitude = $lastcentercoord[1]; |
466 | 488 | } else { |
@@ -582,7 +604,12 @@ discard block |
||
582 | 604 | ?> |
583 | 605 | |
584 | 606 | update_locationsLayer(); |
585 | -setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
607 | +setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) { |
|
608 | + print $globalMapRefresh*1000*2; |
|
609 | +} else { |
|
610 | + print '60000'; |
|
611 | +} |
|
612 | +?>); |
|
586 | 613 | /* |
587 | 614 | var handlera = new Cesium.ScreenSpaceEventHandler(viewer.canvas, false); |
588 | 615 | handlera.setInputAction( |
@@ -49,7 +49,10 @@ discard block |
||
49 | 49 | <?php |
50 | 50 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
51 | 51 | ?> |
52 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
52 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
53 | + print '?tsk='.$tsk; |
|
54 | +} |
|
55 | +?>"></script> |
|
53 | 56 | <?php |
54 | 57 | if (!isset($globalAircraft) || $globalAircraft) { |
55 | 58 | ?> |
@@ -163,11 +166,26 @@ discard block |
||
163 | 166 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
164 | 167 | <li><?php echo _("NOTAM scope:"); ?> |
165 | 168 | <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> |
|
169 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
170 | + print ' selected'; |
|
171 | +} |
|
172 | +?>>All</option> |
|
173 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
174 | + print ' selected'; |
|
175 | +} |
|
176 | +?>>Airport/Enroute warning</option> |
|
177 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
178 | + print ' selected'; |
|
179 | +} |
|
180 | +?>>Airport warning</option> |
|
181 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
182 | + print ' selected'; |
|
183 | +} |
|
184 | +?>>Navigation warning</option> |
|
185 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
186 | + print ' selected'; |
|
187 | +} |
|
188 | +?>>Enroute warning</option> |
|
171 | 189 | </select |
172 | 190 | </li> |
173 | 191 | </ul> |
@@ -195,7 +213,12 @@ discard block |
||
195 | 213 | <div class="form-group"> |
196 | 214 | <label>From (UTC):</label> |
197 | 215 | <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 /> |
|
216 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
217 | + print $_POST['start_date']; |
|
218 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
219 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
220 | +} |
|
221 | +?>" required /> |
|
199 | 222 | <span class="input-group-addon"> |
200 | 223 | <span class="glyphicon glyphicon-calendar"></span> |
201 | 224 | </span> |
@@ -204,7 +227,12 @@ discard block |
||
204 | 227 | <div class="form-group"> |
205 | 228 | <label>To (UTC):</label> |
206 | 229 | <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']); ?>" /> |
|
230 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
231 | + print $_POST['end_date']; |
|
232 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
233 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
234 | +} |
|
235 | +?>" /> |
|
208 | 236 | <span class="input-group-addon"> |
209 | 237 | <span class="glyphicon glyphicon-calendar"></span> |
210 | 238 | </span> |
@@ -229,8 +257,20 @@ discard block |
||
229 | 257 | </script> |
230 | 258 | <li><?php echo _("Playback speed:"); ?> |
231 | 259 | <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> |
|
260 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
261 | + print $_POST['archivespeed']; |
|
262 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
263 | + print $_COOKIE['archive_speed']; |
|
264 | +} else { |
|
265 | + print '1'; |
|
266 | +} |
|
267 | +?>"> |
|
268 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
269 | + print $_COOKIE['archive_speed']; |
|
270 | +} else { |
|
271 | + print '1'; |
|
272 | +} |
|
273 | +?></output> |
|
234 | 274 | </div> |
235 | 275 | </li> |
236 | 276 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -252,25 +292,43 @@ discard block |
||
252 | 292 | <li><?php echo _("Type of Map:"); ?> |
253 | 293 | <select class="selectpicker" onchange="mapType(this);"> |
254 | 294 | <?php |
255 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
256 | - else $MapType = $_COOKIE['MapType']; |
|
295 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
296 | + $MapType = $globalMapProvider; |
|
297 | + } else { |
|
298 | + $MapType = $_COOKIE['MapType']; |
|
299 | + } |
|
257 | 300 | ?> |
258 | 301 | <?php |
259 | 302 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
260 | 303 | ?> |
261 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
304 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
305 | + print ' selected'; |
|
306 | +} |
|
307 | +?>>Natural Earth (local)</option> |
|
262 | 308 | <?php |
263 | 309 | } else { |
264 | 310 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
265 | 311 | ?> |
266 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
312 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
313 | + print ' selected'; |
|
314 | +} |
|
315 | +?>>Natural Earth (local)</option> |
|
267 | 316 | <?php |
268 | 317 | } |
269 | 318 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
270 | 319 | ?> |
271 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
272 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
273 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
320 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
321 | + print ' selected'; |
|
322 | +} |
|
323 | +?>>Bing-Aerial</option> |
|
324 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
325 | + print ' selected'; |
|
326 | +} |
|
327 | +?>>Bing-Hybrid</option> |
|
328 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
329 | + print ' selected'; |
|
330 | +} |
|
331 | +?>>Bing-Road</option> |
|
274 | 332 | <?php |
275 | 333 | } |
276 | 334 | ?> |
@@ -280,58 +338,139 @@ discard block |
||
280 | 338 | <?php |
281 | 339 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
282 | 340 | ?> |
283 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
284 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
285 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
341 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
342 | + print ' selected'; |
|
343 | +} |
|
344 | +?>>Here-Aerial</option> |
|
345 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
346 | + print ' selected'; |
|
347 | +} |
|
348 | +?>>Here-Hybrid</option> |
|
349 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
350 | + print ' selected'; |
|
351 | +} |
|
352 | +?>>Here-Road</option> |
|
286 | 353 | <?php |
287 | 354 | } |
288 | 355 | ?> |
289 | 356 | <?php |
290 | 357 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
291 | 358 | ?> |
292 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
293 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
294 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
295 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
359 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
360 | + print ' selected'; |
|
361 | +} |
|
362 | +?>>Google Roadmap</option> |
|
363 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
364 | + print ' selected'; |
|
365 | +} |
|
366 | +?>>Google Satellite</option> |
|
367 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
368 | + print ' selected'; |
|
369 | +} |
|
370 | +?>>Google Hybrid</option> |
|
371 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
372 | + print ' selected'; |
|
373 | +} |
|
374 | +?>>Google Terrain</option> |
|
296 | 375 | <?php |
297 | 376 | } |
298 | 377 | ?> |
299 | 378 | <?php |
300 | 379 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
301 | 380 | ?> |
302 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
303 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
304 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
381 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
382 | + print ' selected'; |
|
383 | +} |
|
384 | +?>>MapQuest-OSM</option> |
|
385 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
386 | + print ' selected'; |
|
387 | +} |
|
388 | +?>>MapQuest-Aerial</option> |
|
389 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
390 | + print ' selected'; |
|
391 | +} |
|
392 | +?>>MapQuest-Hybrid</option> |
|
305 | 393 | <?php |
306 | 394 | } |
307 | 395 | ?> |
308 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
309 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
396 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
397 | + print ' selected'; |
|
398 | +} |
|
399 | +?>>Yandex</option> |
|
400 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
401 | + print ' selected'; |
|
402 | +} |
|
403 | +?>>Natural Earth</option> |
|
310 | 404 | <?php |
311 | 405 | } |
312 | 406 | ?> |
313 | 407 | <?php |
314 | 408 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
315 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
316 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
409 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
410 | + $MapBoxId = 'default'; |
|
411 | + } else { |
|
412 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
413 | + } |
|
317 | 414 | ?> |
318 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
319 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
320 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
321 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
322 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
323 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
324 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
325 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
326 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
327 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
328 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
329 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
330 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
415 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
416 | + print ' selected'; |
|
417 | +} |
|
418 | +?>>Mapbox GL</option> |
|
419 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
420 | + print ' selected'; |
|
421 | +} |
|
422 | +?>>Mapbox default</option> |
|
423 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
424 | + print ' selected'; |
|
425 | +} |
|
426 | +?>>Mapbox streets</option> |
|
427 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
428 | + print ' selected'; |
|
429 | +} |
|
430 | +?>>Mapbox light</option> |
|
431 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
432 | + print ' selected'; |
|
433 | +} |
|
434 | +?>>Mapbox dark</option> |
|
435 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
436 | + print ' selected'; |
|
437 | +} |
|
438 | +?>>Mapbox satellite</option> |
|
439 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
440 | + print ' selected'; |
|
441 | +} |
|
442 | +?>>Mapbox streets-satellite</option> |
|
443 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
444 | + print ' selected'; |
|
445 | +} |
|
446 | +?>>Mapbox streets-basic</option> |
|
447 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
448 | + print ' selected'; |
|
449 | +} |
|
450 | +?>>Mapbox comic</option> |
|
451 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
452 | + print ' selected'; |
|
453 | +} |
|
454 | +?>>Mapbox outdoors</option> |
|
455 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
456 | + print ' selected'; |
|
457 | +} |
|
458 | +?>>Mapbox pencil</option> |
|
459 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
460 | + print ' selected'; |
|
461 | +} |
|
462 | +?>>Mapbox pirates</option> |
|
463 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
464 | + print ' selected'; |
|
465 | +} |
|
466 | +?>>Mapbox emerald</option> |
|
331 | 467 | <?php |
332 | 468 | } |
333 | 469 | ?> |
334 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
470 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
471 | + print ' selected'; |
|
472 | +} |
|
473 | +?>>OpenStreetMap</option> |
|
335 | 474 | <?php |
336 | 475 | } |
337 | 476 | ?> |
@@ -342,10 +481,22 @@ discard block |
||
342 | 481 | ?> |
343 | 482 | <li><?php echo _("Type of Terrain:"); ?> |
344 | 483 | <select class="selectpicker" onchange="terrainType(this);"> |
345 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
346 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
347 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
348 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
484 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
485 | + print ' selected'; |
|
486 | +} |
|
487 | +?>>stk terrain</option> |
|
488 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
489 | + print ' selected'; |
|
490 | +} |
|
491 | +?>>ellipsoid</option> |
|
492 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
493 | + print ' selected'; |
|
494 | +} |
|
495 | +?>>vr terrain</option> |
|
496 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
497 | + print ' selected'; |
|
498 | +} |
|
499 | +?>>ArticDEM</option> |
|
349 | 500 | </select> |
350 | 501 | </li> |
351 | 502 | <?php |
@@ -354,38 +505,77 @@ discard block |
||
354 | 505 | <?php |
355 | 506 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
356 | 507 | ?> |
357 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if ((isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') || (!isset($_COOKIE['Map2DBuildings']))) print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
508 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if ((isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') || (!isset($_COOKIE['Map2DBuildings']))) { |
|
509 | + print 'checked'; |
|
510 | +} |
|
511 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
358 | 512 | |
359 | 513 | <?php |
360 | 514 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
361 | 515 | ?> |
362 | - <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> |
|
363 | - <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> |
|
364 | - <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> |
|
365 | - <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> |
|
366 | - <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> |
|
516 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
517 | + print 'checked'; |
|
518 | +} |
|
519 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
520 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
521 | + print 'checked'; |
|
522 | +} |
|
523 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
524 | + <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)) { |
|
525 | + print 'checked'; |
|
526 | +} |
|
527 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
528 | + <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)) { |
|
529 | + print 'checked'; |
|
530 | +} |
|
531 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
532 | + <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)) { |
|
533 | + print 'checked'; |
|
534 | +} |
|
535 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
367 | 536 | <?php |
368 | 537 | } |
369 | 538 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
370 | 539 | ?> |
371 | - <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> |
|
540 | + <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)) { |
|
541 | + print 'checked'; |
|
542 | +} |
|
543 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
372 | 544 | <?php |
373 | 545 | } |
374 | 546 | } |
375 | 547 | ?> |
376 | - <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> |
|
377 | - <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> |
|
378 | - <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> |
|
379 | - <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> |
|
548 | + <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'])) { |
|
549 | + print 'checked'; |
|
550 | +} |
|
551 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
552 | + <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))) { |
|
553 | + print 'checked'; |
|
554 | +} |
|
555 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
556 | + <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))) { |
|
557 | + print 'checked'; |
|
558 | +} |
|
559 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
560 | + <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))) { |
|
561 | + print 'checked'; |
|
562 | +} |
|
563 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
380 | 564 | <?php |
381 | 565 | if (isset($globalFires)) { |
382 | 566 | ?> |
383 | - <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> |
|
567 | + <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))) { |
|
568 | + print 'checked'; |
|
569 | +} |
|
570 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
384 | 571 | <?php |
385 | 572 | } |
386 | 573 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
387 | 574 | ?> |
388 | - <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> |
|
575 | + <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')) { |
|
576 | + print 'checked'; |
|
577 | +} |
|
578 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
389 | 579 | <?php |
390 | 580 | } |
391 | 581 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -398,17 +588,25 @@ discard block |
||
398 | 588 | if (function_exists('array_column')) { |
399 | 589 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
400 | 590 | ?> |
401 | - <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> |
|
591 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
592 | + print 'checked'; |
|
593 | +} |
|
594 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
402 | 595 | <?php |
403 | 596 | } |
404 | 597 | } elseif (isset($globalSources)) { |
405 | 598 | $dispolar = false; |
406 | 599 | foreach ($globalSources as $testsource) { |
407 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
600 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
601 | + $dispolar = true; |
|
602 | + } |
|
408 | 603 | } |
409 | 604 | if ($dispolar) { |
410 | 605 | ?> |
411 | - <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> |
|
606 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
607 | + print 'checked'; |
|
608 | +} |
|
609 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
412 | 610 | <?php |
413 | 611 | } |
414 | 612 | } |
@@ -421,12 +619,22 @@ discard block |
||
421 | 619 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
422 | 620 | if (extension_loaded('gd') && function_exists('gd_info')) { |
423 | 621 | ?> |
424 | - <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> |
|
622 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
623 | + print 'checked'; |
|
624 | +} |
|
625 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
425 | 626 | <?php |
426 | 627 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
427 | 628 | ?> |
428 | 629 | <li><?php echo _("Aircraft icon color:"); ?> |
429 | - <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'; ?>"> |
|
630 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
631 | + print $_COOKIE['IconColor']; |
|
632 | +} elseif (isset($globalAircraftIconColor)) { |
|
633 | + print $globalAircraftIconColor; |
|
634 | +} else { |
|
635 | + print '1a3151'; |
|
636 | +} |
|
637 | +?>"> |
|
430 | 638 | </li> |
431 | 639 | <?php |
432 | 640 | } |
@@ -438,7 +646,14 @@ discard block |
||
438 | 646 | if (extension_loaded('gd') && function_exists('gd_info')) { |
439 | 647 | ?> |
440 | 648 | <li><?php echo _("Marine icon color:"); ?> |
441 | - <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'; ?>"> |
|
649 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
650 | + print $_COOKIE['MarineIconColor']; |
|
651 | +} elseif (isset($globalMarineIconColor)) { |
|
652 | + print $globalMarineIconColor; |
|
653 | +} else { |
|
654 | + print '1a3151'; |
|
655 | +} |
|
656 | +?>"> |
|
442 | 657 | </li> |
443 | 658 | <?php |
444 | 659 | } |
@@ -449,7 +664,14 @@ discard block |
||
449 | 664 | if (extension_loaded('gd') && function_exists('gd_info')) { |
450 | 665 | ?> |
451 | 666 | <li><?php echo _("Tracker icon color:"); ?> |
452 | - <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'; ?>"> |
|
667 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
668 | + print $_COOKIE['TrackerIconColor']; |
|
669 | +} elseif (isset($globalTrackerIconColor)) { |
|
670 | + print $globalTrackerIconColor; |
|
671 | +} else { |
|
672 | + print '1a3151'; |
|
673 | +} |
|
674 | +?>"> |
|
453 | 675 | </li> |
454 | 676 | <?php |
455 | 677 | } |
@@ -460,8 +682,22 @@ discard block |
||
460 | 682 | ?> |
461 | 683 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
462 | 684 | <div class="range"> |
463 | - <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'; ?>"> |
|
464 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
685 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
686 | + print $_COOKIE['AirportZoom']; |
|
687 | +} elseif (isset($globalAirportZoom)) { |
|
688 | + print $globalAirportZoom; |
|
689 | +} else { |
|
690 | + print '7'; |
|
691 | +} |
|
692 | +?>"> |
|
693 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
694 | + print $_COOKIE['AirportZoom']; |
|
695 | +} elseif (isset($globalAirportZoom)) { |
|
696 | + print $globalAirportZoom; |
|
697 | +} else { |
|
698 | + print '7'; |
|
699 | +} |
|
700 | +?></output> |
|
465 | 701 | </div> |
466 | 702 | </li> |
467 | 703 | <?php |
@@ -473,10 +709,23 @@ discard block |
||
473 | 709 | <?php |
474 | 710 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
475 | 711 | ?> |
476 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li> |
|
477 | - <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> |
|
712 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
713 | + print 'checked'; |
|
714 | +} |
|
715 | +?> ><?php echo _("Use airlines liveries"); ?></li> |
|
716 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
717 | + print 'checked'; |
|
718 | +} |
|
719 | +?> ><?php echo _("Force Aircraft color"); ?></li> |
|
478 | 720 | <li><?php echo _("Aircraft icon color:"); ?> |
479 | - <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'; ?>"> |
|
721 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
722 | + print $_COOKIE['IconColor']; |
|
723 | +} elseif (isset($globalAircraftIconColor)) { |
|
724 | + print $globalAircraftIconColor; |
|
725 | +} else { |
|
726 | + print 'ff0000'; |
|
727 | +} |
|
728 | +?>"> |
|
480 | 729 | </li> |
481 | 730 | <?php |
482 | 731 | } |
@@ -484,9 +733,19 @@ discard block |
||
484 | 733 | <?php |
485 | 734 | if (isset($globalMarine) && $globalMarine === TRUE) { |
486 | 735 | ?> |
487 | - <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> |
|
736 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
737 | + print 'checked'; |
|
738 | +} |
|
739 | +?> ><?php echo _("Force Marine color"); ?></li> |
|
488 | 740 | <li><?php echo _("Marine icon color:"); ?> |
489 | - <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'; ?>"> |
|
741 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
742 | + print $_COOKIE['MarineIconColor']; |
|
743 | +} elseif (isset($globalMarineIconColor)) { |
|
744 | + print $globalMarineIconColor; |
|
745 | +} else { |
|
746 | + print 'ff0000'; |
|
747 | +} |
|
748 | +?>"> |
|
490 | 749 | </li> |
491 | 750 | <?php |
492 | 751 | } |
@@ -494,9 +753,19 @@ discard block |
||
494 | 753 | <?php |
495 | 754 | if (isset($globalTracker) && $globalTracker === TRUE) { |
496 | 755 | ?> |
497 | - <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> |
|
756 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
757 | + print 'checked'; |
|
758 | +} |
|
759 | +?> ><?php echo _("Force Tracker color"); ?></li> |
|
498 | 760 | <li><?php echo _("Tracker icon color:"); ?> |
499 | - <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'; ?>"> |
|
761 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
762 | + print $_COOKIE['TrackerIconColor']; |
|
763 | +} elseif (isset($globalTrackerIconColor)) { |
|
764 | + print $globalTrackerIconColor; |
|
765 | +} else { |
|
766 | + print 'ff0000'; |
|
767 | +} |
|
768 | +?>"> |
|
500 | 769 | </li> |
501 | 770 | <?php |
502 | 771 | } |
@@ -504,22 +773,46 @@ discard block |
||
504 | 773 | ?> |
505 | 774 | <li><?php echo _("Distance unit:"); ?> |
506 | 775 | <select class="selectpicker" onchange="unitdistance(this);"> |
507 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
508 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
509 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
776 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
777 | + echo ' selected'; |
|
778 | +} |
|
779 | +?>>km</option> |
|
780 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
781 | + echo ' selected'; |
|
782 | +} |
|
783 | +?>>nm</option> |
|
784 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
785 | + echo ' selected'; |
|
786 | +} |
|
787 | +?>>mi</option> |
|
510 | 788 | </select> |
511 | 789 | </li> |
512 | 790 | <li><?php echo _("Altitude unit:"); ?> |
513 | 791 | <select class="selectpicker" onchange="unitaltitude(this);"> |
514 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
515 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
792 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
793 | + echo ' selected'; |
|
794 | +} |
|
795 | +?>>m</option> |
|
796 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
797 | + echo ' selected'; |
|
798 | +} |
|
799 | +?>>feet</option> |
|
516 | 800 | </select> |
517 | 801 | </li> |
518 | 802 | <li><?php echo _("Speed unit:"); ?> |
519 | 803 | <select class="selectpicker" onchange="unitspeed(this);"> |
520 | - <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> |
|
521 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
522 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
804 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
805 | + echo ' selected'; |
|
806 | +} |
|
807 | +?>>km/h</option> |
|
808 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
809 | + echo ' selected'; |
|
810 | +} |
|
811 | +?>>mph</option> |
|
812 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
813 | + echo ' selected'; |
|
814 | +} |
|
815 | +?>>knots</option> |
|
523 | 816 | </select> |
524 | 817 | </li> |
525 | 818 | |
@@ -537,9 +830,18 @@ discard block |
||
537 | 830 | <?php |
538 | 831 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
539 | 832 | ?> |
540 | - <?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 } ?> |
|
541 | - <?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 } ?> |
|
542 | - <?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 } ?> |
|
833 | + <?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'])) { |
|
834 | + print 'checked'; |
|
835 | +} |
|
836 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
837 | + <?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'])) { |
|
838 | + print 'checked'; |
|
839 | +} |
|
840 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
841 | + <?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'])) { |
|
842 | + print 'checked'; |
|
843 | +} |
|
844 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
543 | 845 | <?php |
544 | 846 | } |
545 | 847 | ?> |
@@ -547,10 +849,16 @@ discard block |
||
547 | 849 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
548 | 850 | ?> |
549 | 851 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
550 | - <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> |
|
852 | + <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'])) { |
|
853 | + print 'checked'; |
|
854 | +} |
|
855 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
551 | 856 | <?php } ?> |
552 | 857 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
553 | - <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> |
|
858 | + <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'])) { |
|
859 | + print 'checked'; |
|
860 | +} |
|
861 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
554 | 862 | <?php } ?> |
555 | 863 | <?php |
556 | 864 | } |
@@ -567,7 +875,9 @@ discard block |
||
567 | 875 | } |
568 | 876 | foreach($allairlinenames as $airline) { |
569 | 877 | $airline_name = $airline['airline_name']; |
570 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
878 | + if (strlen($airline_name) > 30) { |
|
879 | + $airline_name = substr($airline_name,0,30).'...'; |
|
880 | + } |
|
571 | 881 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
572 | 882 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
573 | 883 | } else { |
@@ -585,7 +895,10 @@ discard block |
||
585 | 895 | <li><?php echo _("Display alliance:"); ?> |
586 | 896 | <br/> |
587 | 897 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
588 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
898 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
899 | + echo ' selected'; |
|
900 | +} |
|
901 | +?>><?php echo _("All"); ?></option> |
|
589 | 902 | <?php |
590 | 903 | foreach($allalliancenames as $alliance) { |
591 | 904 | $alliance_name = $alliance['alliance']; |
@@ -644,10 +957,22 @@ discard block |
||
644 | 957 | ?> |
645 | 958 | <li><?php echo _("Display airlines of type:"); ?><br/> |
646 | 959 | <select class="selectpicker" onchange="airlinestype(this);"> |
647 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
648 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
649 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
650 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
960 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
961 | + echo ' selected'; |
|
962 | +} |
|
963 | +?>><?php echo _("All"); ?></option> |
|
964 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
965 | + echo ' selected'; |
|
966 | +} |
|
967 | +?>><?php echo _("Passenger"); ?></option> |
|
968 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
969 | + echo ' selected'; |
|
970 | +} |
|
971 | +?>><?php echo _("Cargo"); ?></option> |
|
972 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
973 | + echo ' selected'; |
|
974 | +} |
|
975 | +?>><?php echo _("Military"); ?></option> |
|
651 | 976 | </select> |
652 | 977 | </li> |
653 | 978 | <?php |
@@ -661,14 +986,20 @@ discard block |
||
661 | 986 | ?> |
662 | 987 | <li> |
663 | 988 | <?php echo _("Display vessels with MMSI:"); ?> |
664 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
989 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
990 | + print $_COOKIE['filter_mmsi']; |
|
991 | +} |
|
992 | +?>" /> |
|
665 | 993 | </li> |
666 | 994 | <?php |
667 | 995 | } |
668 | 996 | ?> |
669 | 997 | <li> |
670 | 998 | <?php echo _("Display with ident:"); ?> |
671 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
999 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
1000 | + print $_COOKIE['filter_ident']; |
|
1001 | +} |
|
1002 | +?>" /> |
|
672 | 1003 | </li> |
673 | 1004 | </ul> |
674 | 1005 | </form> |
@@ -684,7 +1015,10 @@ discard block |
||
684 | 1015 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
685 | 1016 | <form> |
686 | 1017 | <ul> |
687 | - <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> |
|
1018 | + <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'])) { |
|
1019 | + print 'checked'; |
|
1020 | +} |
|
1021 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
688 | 1022 | <li><?php echo _("Type:"); ?> |
689 | 1023 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
690 | 1024 | <?php |
@@ -692,25 +1026,45 @@ discard block |
||
692 | 1026 | $types = $Satellite->get_tle_types(); |
693 | 1027 | foreach ($types as $type) { |
694 | 1028 | $type_name = $type['tle_type']; |
695 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
696 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
697 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
698 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
699 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
700 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
701 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
702 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
703 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
704 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
705 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
706 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
707 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
708 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
709 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
710 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
711 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
712 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
713 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
1029 | + if ($type_name == 'musson') { |
|
1030 | + $type_name = 'Russian LEO Navigation'; |
|
1031 | + } else if ($type_name == 'nnss') { |
|
1032 | + $type_name = 'Navi Navigation Satellite System'; |
|
1033 | + } else if ($type_name == 'sbas') { |
|
1034 | + $type_name = 'Satellite-Based Augmentation System'; |
|
1035 | + } else if ($type_name == 'glo-ops') { |
|
1036 | + $type_name = 'Glonass Operational'; |
|
1037 | + } else if ($type_name == 'gps-ops') { |
|
1038 | + $type_name = 'GPS Operational'; |
|
1039 | + } else if ($type_name == 'argos') { |
|
1040 | + $type_name = 'ARGOS Data Collection System'; |
|
1041 | + } else if ($type_name == 'tdrss') { |
|
1042 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
1043 | + } else if ($type_name == 'sarsat') { |
|
1044 | + $type_name = 'Search & Rescue'; |
|
1045 | + } else if ($type_name == 'dmc') { |
|
1046 | + $type_name = 'Disaster Monitoring'; |
|
1047 | + } else if ($type_name == 'resource') { |
|
1048 | + $type_name = 'Earth Resources'; |
|
1049 | + } else if ($type_name == 'stations') { |
|
1050 | + $type_name = 'Space Stations'; |
|
1051 | + } else if ($type_name == 'geo') { |
|
1052 | + $type_name = 'Geostationary'; |
|
1053 | + } else if ($type_name == 'amateur') { |
|
1054 | + $type_name = 'Amateur Radio'; |
|
1055 | + } else if ($type_name == 'x-comm') { |
|
1056 | + $type_name = 'Experimental'; |
|
1057 | + } else if ($type_name == 'other-comm') { |
|
1058 | + $type_name = 'Other Comm'; |
|
1059 | + } else if ($type_name == 'science') { |
|
1060 | + $type_name = 'Space & Earth Science'; |
|
1061 | + } else if ($type_name == 'military') { |
|
1062 | + $type_name = 'Miscellaneous Military'; |
|
1063 | + } else if ($type_name == 'radar') { |
|
1064 | + $type_name = 'Radar Calibration'; |
|
1065 | + } else if ($type_name == 'tle-new') { |
|
1066 | + $type_name = 'Last 30 days launches'; |
|
1067 | + } |
|
714 | 1068 | |
715 | 1069 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
716 | 1070 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | public function __construct($dbc = null) { |
10 | 10 | $Connection = new Connection($dbc); |
11 | 11 | $this->db = $Connection->db(); |
12 | - if ($this->db === null) die('Error: No DB connection. (Image)'); |
|
12 | + if ($this->db === null) { |
|
13 | + die('Error: No DB connection. (Image)'); |
|
14 | + } |
|
13 | 15 | } |
14 | 16 | |
15 | 17 | /** |
@@ -24,7 +26,9 @@ discard block |
||
24 | 26 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
25 | 27 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
26 | 28 | $reg = $registration; |
27 | - if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
|
29 | + if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') { |
|
30 | + $reg = $aircraft_icao.$airline_icao; |
|
31 | + } |
|
28 | 32 | $reg = trim($reg); |
29 | 33 | $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
30 | 34 | FROM spotter_image |
@@ -32,9 +36,13 @@ discard block |
||
32 | 36 | $sth = $this->db->prepare($query); |
33 | 37 | $sth->execute(array(':registration' => $reg)); |
34 | 38 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
35 | - if (!empty($result)) return $result; |
|
36 | - elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
37 | - else return array(); |
|
39 | + if (!empty($result)) { |
|
40 | + return $result; |
|
41 | + } elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) { |
|
42 | + return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
43 | + } else { |
|
44 | + return array(); |
|
45 | + } |
|
38 | 46 | } |
39 | 47 | |
40 | 48 | /** |
@@ -77,8 +85,11 @@ discard block |
||
77 | 85 | public function getExifCopyright($url) { |
78 | 86 | $exif = exif_read_data($url); |
79 | 87 | $copyright = ''; |
80 | - if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
|
81 | - elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
|
88 | + if (isset($exif['COMPUTED']['copyright'])) { |
|
89 | + $copyright = $exif['COMPUTED']['copyright']; |
|
90 | + } elseif (isset($exif['copyright'])) { |
|
91 | + $copyright = $exif['copyright']; |
|
92 | + } |
|
82 | 93 | if ($copyright != '') { |
83 | 94 | $copyright = str_replace('Copyright ','',$copyright); |
84 | 95 | $copyright = str_replace('© ','',$copyright); |
@@ -96,17 +107,27 @@ discard block |
||
96 | 107 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
97 | 108 | { |
98 | 109 | global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
99 | - if ((isset($globalAircraftImageFetch) && $globalAircraftImageFetch === FALSE) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
|
110 | + if ((isset($globalAircraftImageFetch) && $globalAircraftImageFetch === FALSE) || (isset($globalOffline) && $globalOffline === TRUE)) { |
|
111 | + return ''; |
|
112 | + } |
|
100 | 113 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
101 | 114 | $registration = trim($registration); |
102 | 115 | //getting the aircraft image |
103 | - if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
|
104 | - elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
105 | - elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
116 | + if ($globalDebug && $registration != '') { |
|
117 | + echo 'Try to find an aircraft image for '.$registration.'...'; |
|
118 | + } elseif ($globalDebug && $aircraft_icao != '') { |
|
119 | + echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
120 | + } elseif ($globalDebug && $airline_icao != '') { |
|
121 | + echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
122 | + } |
|
106 | 123 | $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
107 | - if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
|
124 | + if ($registration == '' && $aircraft_icao != '') { |
|
125 | + $registration = $aircraft_icao.$airline_icao; |
|
126 | + } |
|
108 | 127 | if ($image_url['original'] != '') { |
109 | - if ($globalDebug) echo 'Found !'."\n"; |
|
128 | + if ($globalDebug) { |
|
129 | + echo 'Found !'."\n"; |
|
130 | + } |
|
110 | 131 | $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
111 | 132 | try { |
112 | 133 | $sth = $this->db->prepare($query); |
@@ -115,7 +136,9 @@ discard block |
||
115 | 136 | echo $e->getMessage()."\n"; |
116 | 137 | return "error"; |
117 | 138 | } |
118 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
139 | + } elseif ($globalDebug) { |
|
140 | + echo "Not found :'(\n"; |
|
141 | + } |
|
119 | 142 | return "success"; |
120 | 143 | } |
121 | 144 | |
@@ -128,7 +151,9 @@ discard block |
||
128 | 151 | public function addMarineImage($mmsi,$imo = '',$name = '') |
129 | 152 | { |
130 | 153 | global $globalDebug,$globalMarineImageFetch, $globalOffline; |
131 | - if ((isset($globalMarineImageFetch) && !$globalMarineImageFetch) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
|
154 | + if ((isset($globalMarineImageFetch) && !$globalMarineImageFetch) || (isset($globalOffline) && $globalOffline === TRUE)) { |
|
155 | + return ''; |
|
156 | + } |
|
132 | 157 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
133 | 158 | $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
134 | 159 | $name = filter_var($name,FILTER_SANITIZE_STRING); |
@@ -138,16 +163,22 @@ discard block |
||
138 | 163 | $identity = $Marine->getIdentity($mmsi); |
139 | 164 | if (isset($identity[0]['mmsi'])) { |
140 | 165 | $imo = $identity[0]['imo']; |
141 | - if ($identity[0]['ship_name'] != '') $name = $identity[0]['ship_name']; |
|
166 | + if ($identity[0]['ship_name'] != '') { |
|
167 | + $name = $identity[0]['ship_name']; |
|
168 | + } |
|
142 | 169 | } |
143 | 170 | } |
144 | 171 | unset($Marine); |
145 | 172 | |
146 | 173 | //getting the aircraft image |
147 | - if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
|
174 | + if ($globalDebug && $name != '') { |
|
175 | + echo 'Try to find an vessel image for '.$name.'...'; |
|
176 | + } |
|
148 | 177 | $image_url = $this->findMarineImage($mmsi,$imo,$name); |
149 | 178 | if ($image_url['original'] != '') { |
150 | - if ($globalDebug) echo 'Found !'."\n"; |
|
179 | + if ($globalDebug) { |
|
180 | + echo 'Found !'."\n"; |
|
181 | + } |
|
151 | 182 | $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
152 | 183 | try { |
153 | 184 | $sth = $this->db->prepare($query); |
@@ -156,7 +187,9 @@ discard block |
||
156 | 187 | echo $e->getMessage()."\n"; |
157 | 188 | return "error"; |
158 | 189 | } |
159 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
190 | + } elseif ($globalDebug) { |
|
191 | + echo "Not found :'(\n"; |
|
192 | + } |
|
160 | 193 | return "success"; |
161 | 194 | } |
162 | 195 | |
@@ -171,41 +204,85 @@ discard block |
||
171 | 204 | { |
172 | 205 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
173 | 206 | $Spotter = new Spotter($this->db); |
174 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
207 | + if (!isset($globalIVAO)) { |
|
208 | + $globalIVAO = FALSE; |
|
209 | + } |
|
175 | 210 | $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
176 | 211 | if ($aircraft_registration != '' && $aircraft_registration != 'NA' && (!isset($globalVA) || $globalVA !== TRUE)) { |
177 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
212 | + if (strpos($aircraft_registration,'/') !== false) { |
|
213 | + return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
214 | + } |
|
178 | 215 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
179 | 216 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
180 | - if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
181 | - else $aircraft_name = ''; |
|
182 | - if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
183 | - else $aircraft_icao = ''; |
|
184 | - if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao']; |
|
185 | - else $airline_icao = ''; |
|
217 | + if (isset($aircraft_info[0]['aircraft_name'])) { |
|
218 | + $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
219 | + } else { |
|
220 | + $aircraft_name = ''; |
|
221 | + } |
|
222 | + if (isset($aircraft_info[0]['aircraft_icao'])) { |
|
223 | + $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
224 | + } else { |
|
225 | + $aircraft_icao = ''; |
|
226 | + } |
|
227 | + if (isset($aircraft_info[0]['airline_icao'])) { |
|
228 | + $airline_icao = $aircraft_info[0]['airline_icao']; |
|
229 | + } else { |
|
230 | + $airline_icao = ''; |
|
231 | + } |
|
186 | 232 | } elseif ($aircraft_icao != '') { |
187 | 233 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
188 | - if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
|
189 | - else $aircraft_name = ''; |
|
234 | + if (isset($aircraft_info[0]['type'])) { |
|
235 | + $aircraft_name = $aircraft_info[0]['type']; |
|
236 | + } else { |
|
237 | + $aircraft_name = ''; |
|
238 | + } |
|
190 | 239 | $aircraft_registration = $aircraft_icao; |
191 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
240 | + } else { |
|
241 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
242 | + } |
|
192 | 243 | unset($Spotter); |
193 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
244 | + if (!isset($globalAircraftImageSources)) { |
|
245 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
246 | + } |
|
194 | 247 | foreach ($globalAircraftImageSources as $source) { |
195 | 248 | $source = strtolower($source); |
196 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
197 | - if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
198 | - if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
199 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
200 | - if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
201 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
202 | - if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
203 | - if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
204 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
205 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
206 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
207 | - } |
|
208 | - if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
|
249 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') { |
|
250 | + $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
251 | + } |
|
252 | + if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) { |
|
253 | + $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
254 | + } |
|
255 | + if ($source == 'flickr' && extension_loaded('simplexml')) { |
|
256 | + $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
257 | + } |
|
258 | + if ($source == 'bing') { |
|
259 | + $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
260 | + } |
|
261 | + if ($source == 'deviantart' && extension_loaded('simplexml')) { |
|
262 | + $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
263 | + } |
|
264 | + if ($source == 'wikimedia') { |
|
265 | + $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
266 | + } |
|
267 | + if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) { |
|
268 | + $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
269 | + } |
|
270 | + if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) { |
|
271 | + $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
272 | + } |
|
273 | + if ($source == 'airportdata' && !$globalIVAO) { |
|
274 | + $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
275 | + } |
|
276 | + if ($source == 'customsources') { |
|
277 | + $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
278 | + } |
|
279 | + if (isset($images_array) && $images_array['original'] != '') { |
|
280 | + return $images_array; |
|
281 | + } |
|
282 | + } |
|
283 | + if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) { |
|
284 | + return $this->findAircraftImage($aircraft_icao); |
|
285 | + } |
|
209 | 286 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
210 | 287 | } |
211 | 288 | |
@@ -225,7 +302,9 @@ discard block |
||
225 | 302 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
226 | 303 | $name = filter_var($name,FILTER_SANITIZE_STRING); |
227 | 304 | $name = trim($name); |
228 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
305 | + if (strlen($name) < 4) { |
|
306 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
307 | + } |
|
229 | 308 | /* |
230 | 309 | $Marine = new Marine($this->db); |
231 | 310 | if ($imo == '' || $name == '') { |
@@ -237,15 +316,29 @@ discard block |
||
237 | 316 | } |
238 | 317 | unset($Marine); |
239 | 318 | */ |
240 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
319 | + if (!isset($globalMarineImageSources)) { |
|
320 | + $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
321 | + } |
|
241 | 322 | foreach ($globalMarineImageSources as $source) { |
242 | 323 | $source = strtolower($source); |
243 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
244 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
245 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
246 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
247 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
248 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
324 | + if ($source == 'flickr') { |
|
325 | + $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
326 | + } |
|
327 | + if ($source == 'bing') { |
|
328 | + $images_array = $this->fromBing('marine',$mmsi,$name); |
|
329 | + } |
|
330 | + if ($source == 'deviantart') { |
|
331 | + $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
332 | + } |
|
333 | + if ($source == 'wikimedia') { |
|
334 | + $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
335 | + } |
|
336 | + if ($source == 'customsources') { |
|
337 | + $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
338 | + } |
|
339 | + if (isset($images_array) && $images_array['original'] != '') { |
|
340 | + return $images_array; |
|
341 | + } |
|
249 | 342 | } |
250 | 343 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
251 | 344 | } |
@@ -268,7 +361,9 @@ discard block |
||
268 | 361 | $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
269 | 362 | } |
270 | 363 | $data = $Common->getData($url); |
271 | - if (substr($data, 0, 5) != "<?xml") return false; |
|
364 | + if (substr($data, 0, 5) != "<?xml") { |
|
365 | + return false; |
|
366 | + } |
|
272 | 367 | if ($xml = simplexml_load_string($data)) { |
273 | 368 | if (isset($xml->channel->item)) { |
274 | 369 | $image_url = array(); |
@@ -307,7 +402,9 @@ discard block |
||
307 | 402 | $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
308 | 403 | } |
309 | 404 | $data = $Common->getData($url); |
310 | - if (substr($data, 0, 5) != "<?xml") return false; |
|
405 | + if (substr($data, 0, 5) != "<?xml") { |
|
406 | + return false; |
|
407 | + } |
|
311 | 408 | if ($xml = simplexml_load_string($data)) { |
312 | 409 | if (isset($xml->channel->item->link)) { |
313 | 410 | $image_url = array(); |
@@ -411,14 +508,22 @@ discard block |
||
411 | 508 | public function fromFlickr($type,$registration,$name='') { |
412 | 509 | $Common = new Common(); |
413 | 510 | if ($type == 'aircraft') { |
414 | - if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
|
415 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft'; |
|
511 | + if ($name != '') { |
|
512 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
|
513 | + } else { |
|
514 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft'; |
|
515 | + } |
|
416 | 516 | } elseif ($type == 'marine') { |
417 | - if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name); |
|
418 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
|
517 | + if ($name != '') { |
|
518 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name); |
|
519 | + } else { |
|
520 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
|
521 | + } |
|
419 | 522 | } |
420 | 523 | $data = $Common->getData($url); |
421 | - if (substr($data, 0, 5) != "<?xml") return false; |
|
524 | + if (substr($data, 0, 5) != "<?xml") { |
|
525 | + return false; |
|
526 | + } |
|
422 | 527 | if ($xml = simplexml_load_string($data)) { |
423 | 528 | if (isset($xml->channel->item)) { |
424 | 529 | $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
@@ -461,13 +566,21 @@ discard block |
||
461 | 566 | public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
462 | 567 | global $globalImageBingKey; |
463 | 568 | $Common = new Common(); |
464 | - if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
|
569 | + if (!isset($globalImageBingKey) || $globalImageBingKey == '') { |
|
570 | + return false; |
|
571 | + } |
|
465 | 572 | if ($type == 'aircraft') { |
466 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
467 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
573 | + if ($aircraft_name != '') { |
|
574 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
575 | + } else { |
|
576 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
577 | + } |
|
468 | 578 | } elseif ($type == 'marine') { |
469 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
|
470 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
|
579 | + if ($aircraft_name != '') { |
|
580 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
|
581 | + } else { |
|
582 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
|
583 | + } |
|
471 | 584 | } |
472 | 585 | $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
473 | 586 | $data = $Common->getData($url,'get','',$headers); |
@@ -523,17 +636,25 @@ discard block |
||
523 | 636 | public function fromWikimedia($type,$registration,$name='') { |
524 | 637 | $Common = new Common(); |
525 | 638 | if ($type == 'aircraft') { |
526 | - if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
|
527 | - else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
|
639 | + if ($name != '') { |
|
640 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
|
641 | + } else { |
|
642 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
|
643 | + } |
|
528 | 644 | } elseif ($type == 'marine') { |
529 | - if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
|
530 | - else return false; |
|
645 | + if ($name != '') { |
|
646 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
|
647 | + } else { |
|
648 | + return false; |
|
649 | + } |
|
531 | 650 | } |
532 | 651 | $data = $Common->getData($url); |
533 | 652 | $result = json_decode($data); |
534 | 653 | if (isset($result->query->search[0]->title)) { |
535 | 654 | $fileo = $result->query->search[0]->title; |
536 | - if (substr($fileo,-3) == 'pdf') return false; |
|
655 | + if (substr($fileo,-3) == 'pdf') { |
|
656 | + return false; |
|
657 | + } |
|
537 | 658 | $file = urlencode($fileo); |
538 | 659 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
539 | 660 | $data2 = $Common->getData($url2); |
@@ -604,18 +725,27 @@ discard block |
||
604 | 725 | $image_url = array(); |
605 | 726 | $image_url['thumbnail'] = $url_thumbnail; |
606 | 727 | $image_url['original'] = $url; |
607 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
608 | - else $exifCopyright = ''; |
|
609 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
610 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
611 | - else $image_url['copyright'] = $source['source_website']; |
|
728 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
729 | + $exifCopyright = $this->getExifCopyright($url); |
|
730 | + } else { |
|
731 | + $exifCopyright = ''; |
|
732 | + } |
|
733 | + if ($exifCopyright != '') { |
|
734 | + $image_url['copyright'] = $exifCopyright; |
|
735 | + } elseif (isset($source['copyright'])) { |
|
736 | + $image_url['copyright'] = $source['copyright']; |
|
737 | + } else { |
|
738 | + $image_url['copyright'] = $source['source_website']; |
|
739 | + } |
|
612 | 740 | $image_url['source_website'] = $source['source_website']; |
613 | 741 | $image_url['source'] = $source['source']; |
614 | 742 | return $image_url; |
615 | 743 | } |
616 | 744 | } |
617 | 745 | return false; |
618 | - } else return false; |
|
746 | + } else { |
|
747 | + return false; |
|
748 | + } |
|
619 | 749 | if (!empty($globalMarineImageCustomSources) && $type == 'marine') { |
620 | 750 | $customsources = array(); |
621 | 751 | if (!isset($globalMarineImageCustomSources[0])) { |
@@ -640,18 +770,27 @@ discard block |
||
640 | 770 | $image_url = array(); |
641 | 771 | $image_url['thumbnail'] = $url_thumbnail; |
642 | 772 | $image_url['original'] = $url; |
643 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
644 | - else $exifCopyright = ''; |
|
645 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
646 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
647 | - else $image_url['copyright'] = $source['source_website']; |
|
773 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
774 | + $exifCopyright = $this->getExifCopyright($url); |
|
775 | + } else { |
|
776 | + $exifCopyright = ''; |
|
777 | + } |
|
778 | + if ($exifCopyright != '') { |
|
779 | + $image_url['copyright'] = $exifCopyright; |
|
780 | + } elseif (isset($source['copyright'])) { |
|
781 | + $image_url['copyright'] = $source['copyright']; |
|
782 | + } else { |
|
783 | + $image_url['copyright'] = $source['source_website']; |
|
784 | + } |
|
648 | 785 | $image_url['source_website'] = $source['source_website']; |
649 | 786 | $image_url['source'] = $source['source']; |
650 | 787 | return $image_url; |
651 | 788 | } |
652 | 789 | } |
653 | 790 | return false; |
654 | - } else return false; |
|
791 | + } else { |
|
792 | + return false; |
|
793 | + } |
|
655 | 794 | } |
656 | 795 | } |
657 | 796 |
@@ -4,10 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | -if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
|
7 | +if (!isset($globalOpenWeatherMapKey)) { |
|
8 | + $globalOpenWeatherMapKey = ''; |
|
9 | +} |
|
8 | 10 | // Compressed GeoJson is used if true |
9 | -if (!isset($globalJsonCompress)) $compress = true; |
|
10 | -else $compress = $globalJsonCompress; |
|
11 | +if (!isset($globalJsonCompress)) { |
|
12 | + $compress = true; |
|
13 | +} else { |
|
14 | + $compress = $globalJsonCompress; |
|
15 | +} |
|
11 | 16 | if (isset($_GET['archive'])) { |
12 | 17 | $archive = true; |
13 | 18 | //$archiveupdatetime = 50; |
@@ -18,8 +23,11 @@ discard block |
||
18 | 23 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
19 | 24 | //$lastupd = 20; |
20 | 25 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
22 | - else $enddate = time(); |
|
26 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
27 | + $enddate = $_GET['enddate']; |
|
28 | + } else { |
|
29 | + $enddate = time(); |
|
30 | + } |
|
23 | 31 | setcookie("archive_begin",$begindate); |
24 | 32 | setcookie("archive_end",$enddate); |
25 | 33 | setcookie("archive_update",$lastupd); |
@@ -107,7 +115,17 @@ discard block |
||
107 | 115 | } |
108 | 116 | |
109 | 117 | //create the map |
110 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
118 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
119 | + print $latitude; |
|
120 | +} else { |
|
121 | + print $globalCenterLatitude; |
|
122 | +} |
|
123 | +?>,<?php if (isset($longitude)) { |
|
124 | + print $longitude; |
|
125 | +} else { |
|
126 | + print $globalCenterLongitude; |
|
127 | +} |
|
128 | +?>], zoom); |
|
111 | 129 | <?php |
112 | 130 | } else { |
113 | 131 | if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) { |
@@ -133,9 +151,21 @@ discard block |
||
133 | 151 | || navigator.userAgent.match(/BlackBerry/i) |
134 | 152 | || navigator.userAgent.match(/Windows Phone/i)) |
135 | 153 | { |
136 | - var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
154 | + var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) { |
|
155 | + print $viewzoom-1; |
|
156 | +} elseif (isset($viewzoom)) { |
|
157 | + print $viewzoom; |
|
158 | +} else { |
|
159 | + print '8'; |
|
160 | +} |
|
161 | +?>; |
|
137 | 162 | } else { |
138 | - var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>; |
|
163 | + var zoom = <?php if (isset($viewzoom)) { |
|
164 | + print $viewzoom; |
|
165 | +} else { |
|
166 | + print '9'; |
|
167 | +} |
|
168 | +?>; |
|
139 | 169 | } |
140 | 170 | |
141 | 171 | //create the map |
@@ -161,16 +191,27 @@ discard block |
||
161 | 191 | bounds = L.latLngBounds(southWest,northEast); |
162 | 192 | //a few title layers |
163 | 193 | <?php |
164 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
165 | - else $MapType = $globalMapProvider; |
|
194 | + if (isset($_COOKIE['MapType'])) { |
|
195 | + $MapType = $_COOKIE['MapType']; |
|
196 | + } else { |
|
197 | + $MapType = $globalMapProvider; |
|
198 | + } |
|
166 | 199 | |
167 | 200 | if ($MapType == 'Mapbox') { |
168 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
169 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
170 | -?> |
|
201 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
202 | + $MapBoxId = $globalMapboxId; |
|
203 | + } else { |
|
204 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
205 | + } |
|
206 | + ?> |
|
171 | 207 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
172 | 208 | maxZoom: 18, |
173 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
209 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
210 | + print 'false'; |
|
211 | +} else { |
|
212 | + print 'true'; |
|
213 | +} |
|
214 | +?>, |
|
174 | 215 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
175 | 216 | '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
176 | 217 | 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
@@ -193,7 +234,12 @@ discard block |
||
193 | 234 | ?> |
194 | 235 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
195 | 236 | maxZoom: 18, |
196 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
237 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
238 | + print 'false'; |
|
239 | +} else { |
|
240 | + print 'true'; |
|
241 | +} |
|
242 | +?>, |
|
197 | 243 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
198 | 244 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
199 | 245 | }).addTo(map); |
@@ -239,20 +285,26 @@ discard block |
||
239 | 285 | map.addLayer(yandexLayer); |
240 | 286 | <?php |
241 | 287 | } elseif ($MapType == 'Bing-Aerial') { |
242 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
243 | -?> |
|
288 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
289 | + setcookie('MapType','OpenStreetMap'); |
|
290 | + } |
|
291 | + ?> |
|
244 | 292 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
245 | 293 | map.addLayer(bingLayer); |
246 | 294 | <?php |
247 | 295 | } elseif ($MapType == 'Bing-Hybrid') { |
248 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
249 | -?> |
|
296 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
297 | + setcookie('MapType','OpenStreetMap'); |
|
298 | + } |
|
299 | + ?> |
|
250 | 300 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
251 | 301 | map.addLayer(bingLayer); |
252 | 302 | <?php |
253 | 303 | } elseif ($MapType == 'Bing-Road') { |
254 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
255 | -?> |
|
304 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
305 | + setcookie('MapType','OpenStreetMap'); |
|
306 | + } |
|
307 | + ?> |
|
256 | 308 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
257 | 309 | map.addLayer(bingLayer); |
258 | 310 | <?php |
@@ -281,7 +333,12 @@ discard block |
||
281 | 333 | maxZoom: 5, |
282 | 334 | tms : true, |
283 | 335 | zindex : 3, |
284 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
336 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
337 | + print 'false'; |
|
338 | +} else { |
|
339 | + print 'true'; |
|
340 | +} |
|
341 | +?>, |
|
285 | 342 | attribution: 'Natural Earth' |
286 | 343 | }).addTo(map); |
287 | 344 | <?php |
@@ -289,9 +346,24 @@ discard block |
||
289 | 346 | $customid = $MapType; |
290 | 347 | ?> |
291 | 348 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
292 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
293 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
294 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
349 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
350 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
351 | +} else { |
|
352 | + print '18'; |
|
353 | +} |
|
354 | +?>, |
|
355 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
356 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
357 | +} else { |
|
358 | + print '0'; |
|
359 | +} |
|
360 | +?>, |
|
361 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
362 | + print 'false'; |
|
363 | +} else { |
|
364 | + print 'true'; |
|
365 | +} |
|
366 | +?>, |
|
295 | 367 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
296 | 368 | }).addTo(map); |
297 | 369 | |
@@ -331,7 +403,12 @@ discard block |
||
331 | 403 | } |
332 | 404 | } elseif ($globalBounding == 'circle') { |
333 | 405 | ?> |
334 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
406 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
407 | + print $globalBoundingCircleSize; |
|
408 | +} else { |
|
409 | + print '70000'; |
|
410 | +} |
|
411 | +?>,{ |
|
335 | 412 | color: '#92C7D1', |
336 | 413 | fillColor: '#92C7D1', |
337 | 414 | fillOpacity: 0.3, |
@@ -423,7 +500,12 @@ discard block |
||
423 | 500 | createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2); |
424 | 501 | }); |
425 | 502 | update_locationsLayer(); |
426 | -setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
503 | +setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) { |
|
504 | + print $globalMapRefresh*1000*2; |
|
505 | +} else { |
|
506 | + print '60000'; |
|
507 | +} |
|
508 | +?>); |
|
427 | 509 | |
428 | 510 | <?php |
429 | 511 | // Add support for custom json via $globalMapJson |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
75 | 75 | $sth->closeCursor(); |
76 | - if ($row['nb'] > 0) return false; |
|
77 | - else return true; |
|
76 | + if ($row['nb'] > 0) { |
|
77 | + return false; |
|
78 | + } else { |
|
79 | + return true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | /* |
@@ -104,29 +107,48 @@ discard block |
||
104 | 107 | //$pieces = explode(' ',$data); |
105 | 108 | $pieces = preg_split('/\s/',$data); |
106 | 109 | $pos = 0; |
107 | - if ($pieces[0] == 'METAR') $pos++; |
|
108 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
109 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
110 | + if ($pieces[0] == 'METAR') { |
|
111 | + $pos++; |
|
112 | + } elseif ($pieces[0] == 'SPECI') { |
|
113 | + $pos++; |
|
114 | + } |
|
115 | + if (strlen($pieces[$pos]) != 4) { |
|
116 | + $pos++; |
|
117 | + } |
|
110 | 118 | $result = array(); |
111 | - if (!isset($pieces[$pos])) return $result; |
|
119 | + if (!isset($pieces[$pos])) { |
|
120 | + return $result; |
|
121 | + } |
|
112 | 122 | $result['location'] = $pieces[$pos]; |
113 | 123 | $pos++; |
114 | - if (!isset($pieces[$pos])) return $result; |
|
124 | + if (!isset($pieces[$pos])) { |
|
125 | + return $result; |
|
126 | + } |
|
115 | 127 | $result['dayofmonth'] = substr($pieces[$pos],0,2); |
116 | 128 | $result['time'] = substr($pieces[$pos],2,4); |
117 | 129 | $c = count($pieces); |
118 | 130 | for($pos++; $pos < $c; $pos++) { |
119 | 131 | $piece = $pieces[$pos]; |
120 | - if ($piece == 'RMK') break; |
|
121 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
122 | - if ($piece == 'COR') $result['correction'] = true; |
|
132 | + if ($piece == 'RMK') { |
|
133 | + break; |
|
134 | + } |
|
135 | + if ($piece == 'AUTO') { |
|
136 | + $result['auto'] = true; |
|
137 | + } |
|
138 | + if ($piece == 'COR') { |
|
139 | + $result['correction'] = true; |
|
140 | + } |
|
123 | 141 | // Wind Speed |
124 | 142 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | 143 | $result['wind']['direction'] = (float)$matches[1]; |
126 | 144 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
145 | + if ($result['wind']['unit'] == 'KT') { |
|
146 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
147 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
148 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
149 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
150 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
151 | + } |
|
130 | 152 | $result['wind']['gust'] = (float)$matches[3]; |
131 | 153 | $result['wind']['unit'] = $matches[4]; |
132 | 154 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -209,14 +231,23 @@ discard block |
||
209 | 231 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
210 | 232 | $type = $matches[1]; |
211 | 233 | $cloud = array(); |
212 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
213 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
214 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
215 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
216 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
217 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
218 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
219 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
234 | + if ($type == 'SKC') { |
|
235 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
236 | + } elseif ($type == 'CLR') { |
|
237 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
238 | + } elseif ($type == 'NSC') { |
|
239 | + $cloud['type'] = 'No significant cloud'; |
|
240 | + } elseif ($type == 'FEW') { |
|
241 | + $cloud['type'] = 'Few'; |
|
242 | + } elseif ($type == 'SCT') { |
|
243 | + $cloud['type'] = 'Scattered'; |
|
244 | + } elseif ($type == 'BKN') { |
|
245 | + $cloud['type'] = 'Broken'; |
|
246 | + } elseif ($type == 'OVC') { |
|
247 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
248 | + } elseif ($type == 'VV') { |
|
249 | + $cloud['type'] = 'Vertical visibility'; |
|
250 | + } |
|
220 | 251 | $cloud['type_code'] = $type; |
221 | 252 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
222 | 253 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
@@ -242,8 +273,11 @@ discard block |
||
242 | 273 | $result['RVR']['friction'] = $matches[5]; |
243 | 274 | } |
244 | 275 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
245 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
246 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
276 | + if (isset($matches[5])) { |
|
277 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
278 | + } else { |
|
279 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
280 | + } |
|
247 | 281 | if (isset($matches[3])) { |
248 | 282 | $range = Array( |
249 | 283 | 'from' => (float)$matches[2], |
@@ -276,8 +310,11 @@ discard block |
||
276 | 310 | if (isset($matches[3])) { |
277 | 311 | $text[] = $this->texts[$matches[3]]; |
278 | 312 | } |
279 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
280 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
313 | + if (!isset($result['weather'])) { |
|
314 | + $result['weather'] = implode(' ', $text); |
|
315 | + } else { |
|
316 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
317 | + } |
|
281 | 318 | } |
282 | 319 | } |
283 | 320 | return $result; |
@@ -293,8 +330,11 @@ discard block |
||
293 | 330 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
294 | 331 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
295 | 332 | } else { |
296 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
297 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
333 | + if ($globalDBdriver == 'mysql') { |
|
334 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
335 | + } else { |
|
336 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
337 | + } |
|
298 | 338 | } |
299 | 339 | $query_values = array(':icao' => $icao); |
300 | 340 | try { |
@@ -366,7 +406,9 @@ discard block |
||
366 | 406 | */ |
367 | 407 | public function addMETARCycle() { |
368 | 408 | global $globalDebug, $globalIVAO, $globalTransaction; |
369 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
409 | + if (isset($globalDebug) && $globalDebug) { |
|
410 | + echo "Downloading METAR cycle..."; |
|
411 | + } |
|
370 | 412 | date_default_timezone_set("UTC"); |
371 | 413 | $Common = new Common(); |
372 | 414 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -377,26 +419,40 @@ discard block |
||
377 | 419 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
378 | 420 | } |
379 | 421 | if ($handle) { |
380 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
422 | + if (isset($globalDebug) && $globalDebug) { |
|
423 | + echo "Done - Updating DB..."; |
|
424 | + } |
|
381 | 425 | $date = ''; |
382 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
426 | + if ($globalTransaction) { |
|
427 | + $this->db->beginTransaction(); |
|
428 | + } |
|
383 | 429 | while(($line = fgets($handle,4096)) !== false) { |
384 | 430 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
385 | 431 | $date = $line; |
386 | 432 | } elseif ($line != '') { |
387 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
433 | + if ($date == '') { |
|
434 | + $date = date('Y/m/d H:m'); |
|
435 | + } |
|
388 | 436 | $pos = 0; |
389 | 437 | $pieces = preg_split('/\s/',$line); |
390 | - if ($pieces[0] == 'METAR') $pos++; |
|
391 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
438 | + if ($pieces[0] == 'METAR') { |
|
439 | + $pos++; |
|
440 | + } |
|
441 | + if (strlen($pieces[$pos]) != 4) { |
|
442 | + $pos++; |
|
443 | + } |
|
392 | 444 | $location = $pieces[$pos]; |
393 | 445 | echo $this->addMETAR($location,$line,$date); |
394 | 446 | } |
395 | 447 | } |
396 | 448 | fclose($handle); |
397 | - if ($globalTransaction) $this->db->commit(); |
|
449 | + if ($globalTransaction) { |
|
450 | + $this->db->commit(); |
|
451 | + } |
|
452 | + } |
|
453 | + if (isset($globalDebug) && $globalDebug) { |
|
454 | + echo "Done\n"; |
|
398 | 455 | } |
399 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
400 | 456 | } |
401 | 457 | |
402 | 458 | /* |
@@ -406,7 +462,9 @@ discard block |
||
406 | 462 | */ |
407 | 463 | public function downloadMETAR($icao) { |
408 | 464 | global $globalMETARurl; |
409 | - if ($globalMETARurl == '') return array(); |
|
465 | + if ($globalMETARurl == '') { |
|
466 | + return array(); |
|
467 | + } |
|
410 | 468 | date_default_timezone_set("UTC"); |
411 | 469 | $Common = new Common(); |
412 | 470 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -417,16 +475,24 @@ discard block |
||
417 | 475 | $date = $line; |
418 | 476 | } |
419 | 477 | if ($line != '') { |
420 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
478 | + if ($date == '') { |
|
479 | + $date = date('Y/m/d H:m'); |
|
480 | + } |
|
421 | 481 | $pos = 0; |
422 | 482 | $pieces = preg_split('/\s/',$line); |
423 | - if ($pieces[0] == 'METAR') $pos++; |
|
424 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
483 | + if ($pieces[0] == 'METAR') { |
|
484 | + $pos++; |
|
485 | + } |
|
486 | + if (strlen($pieces[$pos]) != 4) { |
|
487 | + $pos++; |
|
488 | + } |
|
425 | 489 | $location = $pieces[$pos]; |
426 | 490 | if (strlen($location == 4)) { |
427 | 491 | $this->addMETAR($location,$line,$date); |
428 | 492 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
429 | - } else return array(); |
|
493 | + } else { |
|
494 | + return array(); |
|
495 | + } |
|
430 | 496 | } |
431 | 497 | } |
432 | 498 | return array(); |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | public function checkAll() { |
44 | 44 | global $globalDebug; |
45 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
45 | + if ($globalDebug) { |
|
46 | + echo "Update last seen tracked data...\n"; |
|
47 | + } |
|
46 | 48 | foreach ($this->all_tracked as $key => $flight) { |
47 | 49 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -55,12 +57,16 @@ discard block |
||
55 | 57 | public function del() { |
56 | 58 | global $globalDebug; |
57 | 59 | // Delete old infos |
58 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
60 | + if ($globalDebug) { |
|
61 | + echo 'Delete old values and update latest data...'."\n"; |
|
62 | + } |
|
59 | 63 | foreach ($this->all_tracked as $key => $flight) { |
60 | 64 | if (isset($flight['lastupdate'])) { |
61 | 65 | if ($flight['lastupdate'] < (time()-3000)) { |
62 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
67 | + if ($globalDebug) { |
|
68 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
69 | + } |
|
64 | 70 | /* |
65 | 71 | $TrackerLive = new TrackerLive(); |
66 | 72 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
@@ -70,7 +76,9 @@ discard block |
||
70 | 76 | $Tracker = new Tracker($this->db); |
71 | 77 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | 78 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
73 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
79 | + if ($globalDebug && $result != 'success') { |
|
80 | + echo '!!! ERROR : '.$result."\n"; |
|
81 | + } |
|
74 | 82 | } |
75 | 83 | // Put in archive |
76 | 84 | // $Tracker->db = null; |
@@ -83,7 +91,9 @@ discard block |
||
83 | 91 | |
84 | 92 | public function add($line) { |
85 | 93 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | - if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
|
94 | + if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') { |
|
95 | + $globalCoordMinChangeTracker = '0.015'; |
|
96 | + } |
|
87 | 97 | date_default_timezone_set('UTC'); |
88 | 98 | $dataFound = false; |
89 | 99 | $send = false; |
@@ -97,19 +107,29 @@ discard block |
||
97 | 107 | // Increment message number |
98 | 108 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | 109 | $current_date = date('Y-m-d'); |
100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | - else $source = ''; |
|
102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
110 | + if (isset($line['source_name'])) { |
|
111 | + $source = $line['source_name']; |
|
112 | + } else { |
|
113 | + $source = ''; |
|
114 | + } |
|
115 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
116 | + $source = $line['format_source']; |
|
117 | + } |
|
103 | 118 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
104 | 119 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
105 | 120 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
121 | + } else { |
|
122 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
123 | + } |
|
107 | 124 | } |
108 | 125 | |
109 | 126 | |
110 | 127 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
128 | + if (!isset($line['id'])) { |
|
129 | + $id = trim($line['ident']); |
|
130 | + } else { |
|
131 | + $id = trim($line['id']); |
|
132 | + } |
|
113 | 133 | |
114 | 134 | if (!isset($this->all_tracked[$id])) { |
115 | 135 | $this->all_tracked[$id] = array(); |
@@ -117,31 +137,46 @@ discard block |
||
117 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
118 | 138 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
119 | 139 | if (!isset($line['id'])) { |
120 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
140 | + if (!isset($globalDaemon)) { |
|
141 | + $globalDaemon = TRUE; |
|
142 | + } |
|
121 | 143 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
144 | + } else { |
|
145 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
146 | + } |
|
147 | + if ($globalAllTracked !== FALSE) { |
|
148 | + $dataFound = true; |
|
149 | + } |
|
124 | 150 | } |
125 | 151 | |
126 | 152 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | 153 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | 154 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | 155 | } else { |
130 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
131 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
156 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
157 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
158 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
159 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
160 | + } |
|
132 | 161 | return ''; |
133 | 162 | } |
134 | 163 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
135 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
164 | + if ($globalDebug) { |
|
165 | + echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
166 | + } |
|
136 | 167 | return ''; |
137 | 168 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
138 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
169 | + if ($globalDebug) { |
|
170 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
171 | + } |
|
139 | 172 | return ''; |
140 | 173 | } elseif (!isset($line['datetime'])) { |
141 | 174 | date_default_timezone_set('UTC'); |
142 | 175 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
143 | 176 | } else { |
144 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
177 | + if ($globalDebug) { |
|
178 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
179 | + } |
|
145 | 180 | return ''; |
146 | 181 | } |
147 | 182 | |
@@ -153,11 +188,17 @@ discard block |
||
153 | 188 | $Tracker = new Tracker($this->db); |
154 | 189 | $fromsource = NULL; |
155 | 190 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
156 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
191 | + if ($globalDebug && $result != 'success') { |
|
192 | + echo '!!! ERROR : '.$result."\n"; |
|
193 | + } |
|
157 | 194 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
195 | + if ($globalDebugTimeElapsed) { |
|
196 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
197 | + } |
|
198 | + } |
|
199 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
159 | 201 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 202 | } |
162 | 203 | |
163 | 204 | if (isset($line['speed']) && $line['speed'] != '') { |
@@ -168,14 +209,21 @@ discard block |
||
168 | 209 | if ($distance > 100 && $distance < 10000) { |
169 | 210 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 211 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
172 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
212 | + if ($speed < 1000) { |
|
213 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
214 | + } |
|
215 | + if ($globalDebug) { |
|
216 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
217 | + } |
|
173 | 218 | } |
174 | 219 | } |
175 | 220 | |
176 | 221 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | - else unset($timediff); |
|
222 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
223 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
224 | + } else { |
|
225 | + unset($timediff); |
|
226 | + } |
|
179 | 227 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
180 | 228 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | 229 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
@@ -183,20 +231,30 @@ discard block |
||
183 | 231 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 232 | $this->all_tracked[$id]['putinarchive'] = true; |
185 | 233 | |
186 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
234 | + if ($globalDebug) { |
|
235 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
236 | + } |
|
187 | 237 | $timeelapsed = microtime(true); |
188 | 238 | $Tracker = new Tracker($this->db); |
189 | 239 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
190 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
240 | + if (!empty($all_country)) { |
|
241 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
242 | + } |
|
191 | 243 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
244 | + if ($globalDebugTimeElapsed) { |
|
245 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
246 | + } |
|
193 | 247 | $this->tmd = 0; |
194 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
248 | + if ($globalDebug) { |
|
249 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
250 | + } |
|
195 | 251 | } |
196 | 252 | } |
197 | 253 | |
198 | 254 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
255 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
256 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
257 | + } |
|
200 | 258 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
201 | 259 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 260 | $dataFound = true; |
@@ -205,8 +263,12 @@ discard block |
||
205 | 263 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
206 | 264 | } |
207 | 265 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
266 | + if ($line['longitude'] > 180) { |
|
267 | + $line['longitude'] = $line['longitude'] - 360; |
|
268 | + } |
|
269 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
270 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
271 | + } |
|
210 | 272 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
211 | 273 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 274 | $dataFound = true; |
@@ -226,7 +288,9 @@ discard block |
||
226 | 288 | } |
227 | 289 | } |
228 | 290 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
291 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
292 | + $dataFound = true; |
|
293 | + } |
|
230 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
231 | 295 | } |
232 | 296 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -246,7 +310,9 @@ discard block |
||
246 | 310 | |
247 | 311 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 312 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
313 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { |
|
314 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | + } |
|
250 | 316 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 317 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 318 | //$dataFound = true; |
@@ -258,15 +324,21 @@ discard block |
||
258 | 324 | } |
259 | 325 | |
260 | 326 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
327 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
328 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
329 | + } |
|
262 | 330 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
263 | 331 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
264 | 332 | //$dataFound = true; |
265 | 333 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | 334 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
267 | 335 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
336 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
337 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
338 | + } |
|
339 | + if ($globalDebug) { |
|
340 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
341 | + } |
|
270 | 342 | } |
271 | 343 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
272 | 344 | |
@@ -275,20 +347,31 @@ discard block |
||
275 | 347 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | 348 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
277 | 349 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
350 | + if ($globalDebug) { |
|
351 | + echo "Check if aircraft is already in DB..."; |
|
352 | + } |
|
279 | 353 | $timeelapsed = microtime(true); |
280 | 354 | $TrackerLive = new TrackerLive($this->db); |
281 | 355 | if (isset($line['id'])) { |
282 | 356 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
357 | + if ($globalDebugTimeElapsed) { |
|
358 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
359 | + } |
|
284 | 360 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 361 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
287 | - } else $recent_ident = ''; |
|
362 | + if ($globalDebugTimeElapsed) { |
|
363 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
364 | + } |
|
365 | + } else { |
|
366 | + $recent_ident = ''; |
|
367 | + } |
|
288 | 368 | $TrackerLive->db=null; |
289 | 369 | |
290 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
291 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
370 | + if ($globalDebug && $recent_ident == '') { |
|
371 | + echo " Not in DB.\n"; |
|
372 | + } elseif ($globalDebug && $recent_ident != '') { |
|
373 | + echo " Already in DB.\n"; |
|
374 | + } |
|
292 | 375 | } else { |
293 | 376 | $recent_ident = ''; |
294 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -296,27 +379,41 @@ discard block |
||
296 | 379 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | 380 | if($recent_ident == "") |
298 | 381 | { |
299 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
382 | + if ($globalDebug) { |
|
383 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
384 | + } |
|
300 | 385 | //adds the spotter data for the archive |
301 | 386 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
387 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
388 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
389 | + } |
|
303 | 390 | $timeelapsed = microtime(true); |
304 | 391 | $Tracker = new Tracker($this->db); |
305 | 392 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
306 | 393 | $Tracker->db = null; |
307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
394 | + if ($globalDebug && isset($result)) { |
|
395 | + echo $result."\n"; |
|
396 | + } |
|
397 | + if ($globalDebugTimeElapsed) { |
|
398 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
399 | + } |
|
309 | 400 | |
310 | 401 | |
311 | 402 | // Add source stat in DB |
312 | 403 | $Stats = new Stats($this->db); |
313 | 404 | if (!empty($this->stats)) { |
314 | - if ($globalDebug) echo 'Add source stats : '; |
|
405 | + if ($globalDebug) { |
|
406 | + echo 'Add source stats : '; |
|
407 | + } |
|
315 | 408 | foreach($this->stats as $date => $data) { |
316 | 409 | foreach($data as $source => $sourced) { |
317 | 410 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
411 | + if (isset($sourced['polar'])) { |
|
412 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
413 | + } |
|
414 | + if (isset($sourced['hist'])) { |
|
415 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
416 | + } |
|
320 | 417 | if (isset($sourced['msg'])) { |
321 | 418 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 419 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -329,7 +426,9 @@ discard block |
||
329 | 426 | unset($this->stats[$date]); |
330 | 427 | } |
331 | 428 | } |
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
429 | + if ($globalDebug) { |
|
430 | + echo 'Done'."\n"; |
|
431 | + } |
|
333 | 432 | |
334 | 433 | } |
335 | 434 | $Stats->db = null; |
@@ -339,12 +438,16 @@ discard block |
||
339 | 438 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 439 | //print_r($this->all_tracked[$id]); |
341 | 440 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
441 | + if ($globalDebug) { |
|
442 | + echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
443 | + } |
|
343 | 444 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 445 | $TrackerLive = new TrackerLive($this->db); |
345 | 446 | $TrackerLive->deleteLiveTrackerData(); |
346 | 447 | $TrackerLive->db=null; |
347 | - if ($globalDebug) echo " Done\n"; |
|
448 | + if ($globalDebug) { |
|
449 | + echo " Done\n"; |
|
450 | + } |
|
348 | 451 | $this->last_delete = time(); |
349 | 452 | } |
350 | 453 | } else { |
@@ -367,19 +470,25 @@ discard block |
||
367 | 470 | |
368 | 471 | if (!$ignoreImport) { |
369 | 472 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
370 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
473 | + if ($globalDebug) { |
|
474 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
475 | + } |
|
371 | 476 | $timeelapsed = microtime(true); |
372 | 477 | $TrackerLive = new TrackerLive($this->db); |
373 | 478 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
374 | 479 | $TrackerLive->db = null; |
375 | 480 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
481 | + if ($globalDebugTimeElapsed) { |
|
482 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
483 | + } |
|
377 | 484 | |
378 | 485 | // Put statistics in $this->stats variable |
379 | 486 | |
380 | 487 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
381 | 488 | $source = $this->all_tracked[$id]['source_name']; |
382 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
489 | + if ($source == '') { |
|
490 | + $source = $this->all_tracked[$id]['format_source']; |
|
491 | + } |
|
383 | 492 | if (!isset($this->source_location[$source])) { |
384 | 493 | $Location = new Source($this->db); |
385 | 494 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -400,7 +509,9 @@ discard block |
||
400 | 509 | $stats_heading = round($stats_heading/22.5); |
401 | 510 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
402 | 511 | $current_date = date('Y-m-d'); |
403 | - if ($stats_heading == 16) $stats_heading = 0; |
|
512 | + if ($stats_heading == 16) { |
|
513 | + $stats_heading = 0; |
|
514 | + } |
|
404 | 515 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 516 | for ($i=0;$i<=15;$i++) { |
406 | 517 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -418,7 +529,9 @@ discard block |
||
418 | 529 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 530 | end($this->stats[$current_date][$source]['hist']); |
420 | 531 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
421 | - } else $mini = 0; |
|
532 | + } else { |
|
533 | + $mini = 0; |
|
534 | + } |
|
422 | 535 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | 536 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 537 | } |
@@ -429,19 +542,29 @@ discard block |
||
429 | 542 | } |
430 | 543 | |
431 | 544 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
433 | - if ($globalDebug) echo $result."\n"; |
|
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
545 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
546 | + $send = true; |
|
547 | + } |
|
548 | + if ($globalDebug) { |
|
549 | + echo $result."\n"; |
|
550 | + } |
|
551 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
552 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
553 | + } |
|
435 | 554 | //$this->del(); |
436 | 555 | |
437 | 556 | |
438 | 557 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
558 | + if ($globalDebug) { |
|
559 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
560 | + } |
|
440 | 561 | $TrackerLive = new TrackerLive($this->db); |
441 | 562 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
442 | 563 | $TrackerLive->db = null; |
443 | 564 | //TrackerLive->deleteLiveTrackerData(); |
444 | - if ($globalDebug) echo " Done\n"; |
|
565 | + if ($globalDebug) { |
|
566 | + echo " Done\n"; |
|
567 | + } |
|
445 | 568 | $this->last_delete_hourly = time(); |
446 | 569 | } |
447 | 570 | |
@@ -449,7 +572,9 @@ discard block |
||
449 | 572 | //$ignoreImport = false; |
450 | 573 | } |
451 | 574 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | - if ($send) return $this->all_tracked[$id]; |
|
575 | + if ($send) { |
|
576 | + return $this->all_tracked[$id]; |
|
577 | + } |
|
453 | 578 | } |
454 | 579 | } |
455 | 580 | } |
@@ -196,16 +196,22 @@ discard block |
||
196 | 196 | |
197 | 197 | /* Check that end was found and body has at least one byte. */ |
198 | 198 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
199 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
199 | + if ($globalDebug) { |
|
200 | + echo '!!! APRS invalid : '.$input."\n"; |
|
201 | + } |
|
200 | 202 | return false; |
201 | 203 | } |
202 | 204 | |
203 | - if ($debug) echo 'input : '.$input."\n"; |
|
205 | + if ($debug) { |
|
206 | + echo 'input : '.$input."\n"; |
|
207 | + } |
|
204 | 208 | /* Save header and body. */ |
205 | 209 | $body = substr($input,$splitpos+1,$input_len); |
206 | 210 | $body_len = strlen($body); |
207 | 211 | $header = substr($input,0,$splitpos); |
208 | - if ($debug) echo 'header : '.$header."\n"; |
|
212 | + if ($debug) { |
|
213 | + echo 'header : '.$header."\n"; |
|
214 | + } |
|
209 | 215 | |
210 | 216 | /* Parse source, target and path. */ |
211 | 217 | //FLRDF0A52>APRS,qAS,LSTB |
@@ -219,11 +225,15 @@ discard block |
||
219 | 225 | $result['format_source'] = 'famaprs'; |
220 | 226 | $result['source_type'] = 'ais'; |
221 | 227 | } else { |
222 | - if ($debug) echo 'ident : '.$ident."\n"; |
|
228 | + if ($debug) { |
|
229 | + echo 'ident : '.$ident."\n"; |
|
230 | + } |
|
223 | 231 | $result['ident'] = $ident; |
224 | 232 | } |
225 | 233 | } else { |
226 | - if ($debug) 'No ident'."\n"; |
|
234 | + if ($debug) { |
|
235 | + 'No ident'."\n"; |
|
236 | + } |
|
227 | 237 | return false; |
228 | 238 | } |
229 | 239 | $elements = explode(',',$all_elements); |
@@ -233,7 +243,9 @@ discard block |
||
233 | 243 | if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
234 | 244 | //if ($element == 'TCPIP*') return false; |
235 | 245 | } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
236 | - if ($debug) echo 'element : '.$element."\n"; |
|
246 | + if ($debug) { |
|
247 | + echo 'element : '.$element."\n"; |
|
248 | + } |
|
237 | 249 | return false; |
238 | 250 | } |
239 | 251 | /* |
@@ -246,13 +258,17 @@ discard block |
||
246 | 258 | } |
247 | 259 | |
248 | 260 | $type = substr($body,0,1); |
249 | - if ($debug) echo 'type : '.$type."\n"; |
|
261 | + if ($debug) { |
|
262 | + echo 'type : '.$type."\n"; |
|
263 | + } |
|
250 | 264 | if ($type == ';') { |
251 | 265 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
252 | 266 | $result['address'] = trim(substr($body,1,9)); |
253 | 267 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
254 | 268 | $result['mmsi'] = trim(substr($body,1,9)); |
255 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
269 | + } else { |
|
270 | + $result['ident'] = trim(substr($body,1,9)); |
|
271 | + } |
|
256 | 272 | } elseif ($type == ',') { |
257 | 273 | // Invalid data or test data |
258 | 274 | return false; |
@@ -309,7 +325,9 @@ discard block |
||
309 | 325 | //$symbol_table = $matches[4]; |
310 | 326 | $lat = intval($lat_deg); |
311 | 327 | $lon = intval($lon_deg); |
312 | - if ($lat > 89 || $lon > 179) return false; |
|
328 | + if ($lat > 89 || $lon > 179) { |
|
329 | + return false; |
|
330 | + } |
|
313 | 331 | /* |
314 | 332 | $tmp_5b = str_replace('.','',$lat_min); |
315 | 333 | if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) { |
@@ -318,8 +336,12 @@ discard block |
||
318 | 336 | */ |
319 | 337 | $latitude = $lat + floatval($lat_min)/60; |
320 | 338 | $longitude = $lon + floatval($lon_min)/60; |
321 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
322 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
339 | + if ($sind == 'S') { |
|
340 | + $latitude = 0-$latitude; |
|
341 | + } |
|
342 | + if ($wind == 'W') { |
|
343 | + $longitude = 0-$longitude; |
|
344 | + } |
|
323 | 345 | $result['latitude'] = $latitude; |
324 | 346 | $result['longitude'] = $longitude; |
325 | 347 | $body_parse = substr($body_parse,18); |
@@ -344,22 +366,29 @@ discard block |
||
344 | 366 | if ($find) { |
345 | 367 | $body_split = str_split($body_parse); |
346 | 368 | $symbol_code = $body_split[0]; |
347 | - if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code; |
|
348 | - else $symbol_code = '\\'.$symbol_code; |
|
369 | + if (!isset($symbolll) || $symbolll == '/') { |
|
370 | + $symbol_code = '/'.$symbol_code; |
|
371 | + } else { |
|
372 | + $symbol_code = '\\'.$symbol_code; |
|
373 | + } |
|
349 | 374 | //' |
350 | 375 | //if ($type != ';' && $type != '>') { |
351 | 376 | if ($type != '') { |
352 | 377 | $body_parse = substr($body_parse,1); |
353 | 378 | $body_parse_len = strlen($body_parse); |
354 | 379 | $result['symbol_code'] = $symbol_code; |
355 | - if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
|
380 | + if (isset($this->symbols[$symbol_code])) { |
|
381 | + $result['symbol'] = $this->symbols[$symbol_code]; |
|
382 | + } |
|
356 | 383 | if ($symbol_code != '_') { |
357 | 384 | } |
358 | 385 | if ($body_parse_len >= 7) { |
359 | 386 | if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
360 | 387 | $course = substr($body_parse,0,3); |
361 | 388 | $tmp_s = intval($course); |
362 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
389 | + if ($tmp_s >= 1 && $tmp_s <= 360) { |
|
390 | + $result['heading'] = intval($course); |
|
391 | + } |
|
363 | 392 | $speed = substr($body_parse,4,3); |
364 | 393 | if ($speed != '...') { |
365 | 394 | $result['speed'] = intval($speed); |
@@ -394,10 +423,16 @@ discard block |
||
394 | 423 | $dao_split = str_split($dao); |
395 | 424 | $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
396 | 425 | $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
397 | - if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
|
398 | - else $result['latitude'] += $lat_off; |
|
399 | - if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
|
400 | - else $result['longitude'] += $lon_off; |
|
426 | + if ($result['latitude'] < 0) { |
|
427 | + $result['latitude'] -= $lat_off; |
|
428 | + } else { |
|
429 | + $result['latitude'] += $lat_off; |
|
430 | + } |
|
431 | + if ($result['longitude'] < 0) { |
|
432 | + $result['longitude'] -= $lon_off; |
|
433 | + } else { |
|
434 | + $result['longitude'] += $lon_off; |
|
435 | + } |
|
401 | 436 | } |
402 | 437 | $body_parse = substr($body_parse,6); |
403 | 438 | } |
@@ -435,27 +470,48 @@ discard block |
||
435 | 470 | //$mode = substr($id,0,2); |
436 | 471 | $address = substr($id,2); |
437 | 472 | $addressType = (intval(substr($id,0,2),16))&3; |
438 | - if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
|
439 | - elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
|
440 | - elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
|
441 | - elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
|
473 | + if ($addressType == 0) { |
|
474 | + $result['addresstype'] = "RANDOM"; |
|
475 | + } elseif ($addressType == 1) { |
|
476 | + $result['addresstype'] = "ICAO"; |
|
477 | + } elseif ($addressType == 2) { |
|
478 | + $result['addresstype'] = "FLARM"; |
|
479 | + } elseif ($addressType == 3) { |
|
480 | + $result['addresstype'] = "OGN"; |
|
481 | + } |
|
442 | 482 | $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
443 | 483 | $result['aircrafttype_code'] = $aircraftType; |
444 | - if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
|
445 | - elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
|
446 | - elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE"; |
|
447 | - elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
448 | - elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE"; |
|
449 | - elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE"; |
|
450 | - elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER"; |
|
451 | - elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER"; |
|
452 | - elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
453 | - elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
454 | - elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO"; |
|
455 | - elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON"; |
|
456 | - elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
|
457 | - elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
|
458 | - elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
|
484 | + if ($aircraftType == 0) { |
|
485 | + $result['aircrafttype'] = "UNKNOWN"; |
|
486 | + } elseif ($aircraftType == 1) { |
|
487 | + $result['aircrafttype'] = "GLIDER"; |
|
488 | + } elseif ($aircraftType == 2) { |
|
489 | + $result['aircrafttype'] = "TOW_PLANE"; |
|
490 | + } elseif ($aircraftType == 3) { |
|
491 | + $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
492 | + } elseif ($aircraftType == 4) { |
|
493 | + $result['aircrafttype'] = "PARACHUTE"; |
|
494 | + } elseif ($aircraftType == 5) { |
|
495 | + $result['aircrafttype'] = "DROP_PLANE"; |
|
496 | + } elseif ($aircraftType == 6) { |
|
497 | + $result['aircrafttype'] = "HANG_GLIDER"; |
|
498 | + } elseif ($aircraftType == 7) { |
|
499 | + $result['aircrafttype'] = "PARA_GLIDER"; |
|
500 | + } elseif ($aircraftType == 8) { |
|
501 | + $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
502 | + } elseif ($aircraftType == 9) { |
|
503 | + $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
504 | + } elseif ($aircraftType == 10) { |
|
505 | + $result['aircrafttype'] = "UFO"; |
|
506 | + } elseif ($aircraftType == 11) { |
|
507 | + $result['aircrafttype'] = "BALLOON"; |
|
508 | + } elseif ($aircraftType == 12) { |
|
509 | + $result['aircrafttype'] = "AIRSHIP"; |
|
510 | + } elseif ($aircraftType == 13) { |
|
511 | + $result['aircrafttype'] = "UAV"; |
|
512 | + } elseif ($aircraftType == 15) { |
|
513 | + $result['aircrafttype'] = "STATIC_OBJECT"; |
|
514 | + } |
|
459 | 515 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
460 | 516 | $result['stealth'] = $stealth; |
461 | 517 | $result['address'] = $address; |
@@ -490,77 +546,181 @@ discard block |
||
490 | 546 | //g012t088r000p000P000h38b10110 |
491 | 547 | //g011t086r000p000P000h29b10198 |
492 | 548 | if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
493 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
494 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
495 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
496 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
497 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
498 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
499 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
549 | + if ($matches[1] != '...') { |
|
550 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | + } |
|
552 | + if ($matches[2] != '...') { |
|
553 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
554 | + } |
|
555 | + if ($matches[3] != '...') { |
|
556 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
557 | + } |
|
558 | + if ($matches[4] != '...') { |
|
559 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
560 | + } |
|
561 | + if ($matches[5] != '...') { |
|
562 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
563 | + } |
|
564 | + if ($matches[6] != '...') { |
|
565 | + $result['humidity'] = intval($matches[6]); |
|
566 | + } |
|
567 | + if ($matches[7] != '...') { |
|
568 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
569 | + } |
|
500 | 570 | $body_parse = substr($body_parse,strlen($matches[0])); |
501 | 571 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
502 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
503 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
504 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
505 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
506 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
507 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
508 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
572 | + if ($matches[1] != '...') { |
|
573 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
574 | + } |
|
575 | + if ($matches[2] != '...') { |
|
576 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
577 | + } |
|
578 | + if ($matches[3] != '...') { |
|
579 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
580 | + } |
|
581 | + if ($matches[5] != '...') { |
|
582 | + $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
583 | + } |
|
584 | + if ($matches[4] != '...') { |
|
585 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
586 | + } |
|
587 | + if ($matches[6] != '...') { |
|
588 | + $result['humidity'] = intval($matches[6]); |
|
589 | + } |
|
590 | + if ($matches[7] != '...') { |
|
591 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
592 | + } |
|
509 | 593 | $body_parse = substr($body_parse,strlen($matches[0])); |
510 | 594 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
511 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
512 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
513 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
514 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
515 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
516 | - if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
|
517 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
595 | + if ($matches[1] != '...') { |
|
596 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
597 | + } |
|
598 | + if ($matches[2] != '...') { |
|
599 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
600 | + } |
|
601 | + if ($matches[3] != '...') { |
|
602 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
603 | + } |
|
604 | + if ($matches[4] != '...') { |
|
605 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
606 | + } |
|
607 | + if ($matches[5] != '...') { |
|
608 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
609 | + } |
|
610 | + if ($matches[7] != '...') { |
|
611 | + $result['humidity'] = intval($matches[7]); |
|
612 | + } |
|
613 | + if ($matches[6] != '...') { |
|
614 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
615 | + } |
|
518 | 616 | $body_parse = substr($body_parse,strlen($matches[0])); |
519 | 617 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
525 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
618 | + if ($matches[1] != '...') { |
|
619 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
620 | + } |
|
621 | + if ($matches[2] != '...') { |
|
622 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
623 | + } |
|
624 | + if ($matches[3] != '...') { |
|
625 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
626 | + } |
|
627 | + if ($matches[4] != '...') { |
|
628 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
629 | + } |
|
630 | + if ($matches[6] != '...') { |
|
631 | + $result['humidity'] = intval($matches[6]); |
|
632 | + } |
|
633 | + if ($matches[5] != '...') { |
|
634 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
635 | + } |
|
526 | 636 | $body_parse = substr($body_parse,strlen($matches[0])); |
527 | 637 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
528 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
529 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
530 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
531 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
532 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
533 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
638 | + if ($matches[1] != '...') { |
|
639 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
640 | + } |
|
641 | + if ($matches[2] != '...') { |
|
642 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
643 | + } |
|
644 | + if ($matches[3] != '...') { |
|
645 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
646 | + } |
|
647 | + if ($matches[4] != '...') { |
|
648 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
649 | + } |
|
650 | + if ($matches[6] != '...') { |
|
651 | + $result['humidity'] = intval($matches[6]); |
|
652 | + } |
|
653 | + if ($matches[5] != '...') { |
|
654 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
655 | + } |
|
534 | 656 | $body_parse = substr($body_parse,strlen($matches[0])); |
535 | 657 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
536 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
537 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
538 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
539 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
540 | - if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
|
541 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
658 | + if ($matches[1] != '...') { |
|
659 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
660 | + } |
|
661 | + if ($matches[2] != '...') { |
|
662 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
663 | + } |
|
664 | + if ($matches[3] != '...') { |
|
665 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
666 | + } |
|
667 | + if ($matches[4] != '...') { |
|
668 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
669 | + } |
|
670 | + if ($matches[5] != '...') { |
|
671 | + $result['humidity'] = intval($matches[5]); |
|
672 | + } |
|
673 | + if ($matches[6] != '...') { |
|
674 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
675 | + } |
|
542 | 676 | $body_parse = substr($body_parse,strlen($matches[0])); |
543 | 677 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
544 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
545 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
546 | - if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
|
547 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
678 | + if ($matches[1] != '...') { |
|
679 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
680 | + } |
|
681 | + if ($matches[2] != '...') { |
|
682 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
683 | + } |
|
684 | + if ($matches[2] != '...') { |
|
685 | + $result['humidity'] = intval($matches[3]); |
|
686 | + } |
|
687 | + if ($matches[4] != '...') { |
|
688 | + $result['pressure'] = round((intval($matches[4])/10),1); |
|
689 | + } |
|
548 | 690 | $body_parse = substr($body_parse,strlen($matches[0])); |
549 | 691 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
550 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
552 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
553 | - if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
|
554 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
692 | + if ($matches[1] != '...') { |
|
693 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
694 | + } |
|
695 | + if ($matches[2] != '...') { |
|
696 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
697 | + } |
|
698 | + if ($matches[3] != '...') { |
|
699 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
700 | + } |
|
701 | + if ($matches[4] != '...') { |
|
702 | + $result['humidity'] = intval($matches[4]); |
|
703 | + } |
|
704 | + if ($matches[5] != '...') { |
|
705 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
706 | + } |
|
555 | 707 | $body_parse = substr($body_parse,strlen($matches[0])); |
556 | 708 | } |
557 | 709 | $result['comment'] = trim($body_parse); |
558 | 710 | } |
559 | - } else $result['comment'] = trim($body_parse); |
|
711 | + } else { |
|
712 | + $result['comment'] = trim($body_parse); |
|
713 | + } |
|
714 | + } |
|
715 | + if (isset($result['latitude'])) { |
|
716 | + $result['latitude'] = round($result['latitude'],4); |
|
717 | + } |
|
718 | + if (isset($result['longitude'])) { |
|
719 | + $result['longitude'] = round($result['longitude'],4); |
|
720 | + } |
|
721 | + if ($debug) { |
|
722 | + print_r($result); |
|
560 | 723 | } |
561 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
562 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
563 | - if ($debug) print_r($result); |
|
564 | 724 | return $result; |
565 | 725 | } |
566 | 726 | |
@@ -572,12 +732,21 @@ discard block |
||
572 | 732 | $aprs_connect = 0; |
573 | 733 | $aprs_keep = 120; |
574 | 734 | $aprs_last_tx = time(); |
575 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
576 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
577 | - if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
|
578 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
579 | - if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
|
580 | - else $aprs_pass = '-1'; |
|
735 | + if (isset($globalAPRSversion)) { |
|
736 | + $aprs_version = $globalAPRSversion; |
|
737 | + } else { |
|
738 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
739 | + } |
|
740 | + if (isset($globalServerAPRSssid)) { |
|
741 | + $aprs_ssid = $globalServerAPRSssid; |
|
742 | + } else { |
|
743 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
744 | + } |
|
745 | + if (isset($globalServerAPRSpass)) { |
|
746 | + $aprs_pass = $globalServerAPRSpass; |
|
747 | + } else { |
|
748 | + $aprs_pass = '-1'; |
|
749 | + } |
|
581 | 750 | $aprs_filter = ''; |
582 | 751 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
583 | 752 | $Common = new Common(); |
@@ -616,10 +785,14 @@ discard block |
||
616 | 785 | */ |
617 | 786 | public function send($data) { |
618 | 787 | global $globalDebug; |
619 | - if ($this->connected === false) $this->connect(); |
|
788 | + if ($this->connected === false) { |
|
789 | + $this->connect(); |
|
790 | + } |
|
620 | 791 | $send = socket_send( $this->socket , $data , strlen($data),0); |
621 | 792 | if ($send === FALSE) { |
622 | - if ($globalDebug) echo 'Reconnect...'; |
|
793 | + if ($globalDebug) { |
|
794 | + echo 'Reconnect...'; |
|
795 | + } |
|
623 | 796 | socket_close($this->socket); |
624 | 797 | $this->connect(); |
625 | 798 | } |
@@ -642,22 +815,32 @@ discard block |
||
642 | 815 | //$w = '00'; |
643 | 816 | $custom = ''; |
644 | 817 | if ($ident != '') { |
645 | - if ($custom != '') $custom .= '/'; |
|
818 | + if ($custom != '') { |
|
819 | + $custom .= '/'; |
|
820 | + } |
|
646 | 821 | $custom .= 'CS='.$ident; |
647 | 822 | } |
648 | 823 | if ($squawk != '') { |
649 | - if ($custom != '') $custom .= '/'; |
|
824 | + if ($custom != '') { |
|
825 | + $custom .= '/'; |
|
826 | + } |
|
650 | 827 | $custom .= 'SQ='.$squawk; |
651 | 828 | } |
652 | 829 | if ($verticalrate != '') { |
653 | - if ($custom != '') $custom .= '/'; |
|
830 | + if ($custom != '') { |
|
831 | + $custom .= '/'; |
|
832 | + } |
|
654 | 833 | $custom .= 'VR='.$verticalrate; |
655 | 834 | } |
656 | 835 | if ($aircraft_icao != '' && $aircraft_icao != 'NA') { |
657 | - if ($custom != '') $custom .= '/'; |
|
836 | + if ($custom != '') { |
|
837 | + $custom .= '/'; |
|
838 | + } |
|
658 | 839 | $custom .= 'AI='.$aircraft_icao; |
659 | 840 | } |
660 | - if ($custom != '') $custom = ' '.$custom; |
|
841 | + if ($custom != '') { |
|
842 | + $custom = ' '.$custom; |
|
843 | + } |
|
661 | 844 | /* |
662 | 845 | // Use AMSL altitude |
663 | 846 | $GeoidClass = new GeoidHeight(); |
@@ -682,30 +865,44 @@ discard block |
||
682 | 865 | //$w = '00'; |
683 | 866 | $custom = ''; |
684 | 867 | if ($ident != '') { |
685 | - if ($custom != '') $custom .= '/'; |
|
868 | + if ($custom != '') { |
|
869 | + $custom .= '/'; |
|
870 | + } |
|
686 | 871 | $custom .= 'CS='.str_replace(' ','_',$ident); |
687 | 872 | } |
688 | 873 | if ($typeid != '') { |
689 | - if ($custom != '') $custom .= '/'; |
|
874 | + if ($custom != '') { |
|
875 | + $custom .= '/'; |
|
876 | + } |
|
690 | 877 | $custom .= 'TI='.$typeid; |
691 | 878 | } |
692 | 879 | if ($statusid != '') { |
693 | - if ($custom != '') $custom .= '/'; |
|
880 | + if ($custom != '') { |
|
881 | + $custom .= '/'; |
|
882 | + } |
|
694 | 883 | $custom .= 'SI='.$statusid; |
695 | 884 | } |
696 | 885 | if ($imo != '') { |
697 | - if ($custom != '') $custom .= '/'; |
|
886 | + if ($custom != '') { |
|
887 | + $custom .= '/'; |
|
888 | + } |
|
698 | 889 | $custom .= 'IMO='.$imo; |
699 | 890 | } |
700 | 891 | if ($arrival_date != '') { |
701 | - if ($custom != '') $custom .= '/'; |
|
892 | + if ($custom != '') { |
|
893 | + $custom .= '/'; |
|
894 | + } |
|
702 | 895 | $custom .= 'AD='.strtotime($arrival_date); |
703 | 896 | } |
704 | 897 | if ($arrival_code != '') { |
705 | - if ($custom != '') $custom .= '/'; |
|
898 | + if ($custom != '') { |
|
899 | + $custom .= '/'; |
|
900 | + } |
|
706 | 901 | $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
707 | 902 | } |
708 | - if ($custom != '') $custom = ' '.$custom; |
|
903 | + if ($custom != '') { |
|
904 | + $custom = ' '.$custom; |
|
905 | + } |
|
709 | 906 | $altitude = 0; |
710 | 907 | $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
711 | 908 | } |
@@ -1036,8 +1036,11 @@ discard block |
||
1036 | 1036 | public function parseNOTAMtextFile($filename) { |
1037 | 1037 | $data = file_get_contents($filename); |
1038 | 1038 | preg_match_all("/%%(.+?)%%/is", $data, $matches); |
1039 | - if (isset($matches[1])) return $matches[1]; |
|
1040 | - else return array(); |
|
1039 | + if (isset($matches[1])) { |
|
1040 | + return $matches[1]; |
|
1041 | + } else { |
|
1042 | + return array(); |
|
1043 | + } |
|
1041 | 1044 | } |
1042 | 1045 | public function getAllNOTAMbyScope($scope) { |
1043 | 1046 | global $globalDBdriver; |
@@ -1073,7 +1076,9 @@ discard block |
||
1073 | 1076 | $minlong = $maxlong; |
1074 | 1077 | $maxlong = $tmplong; |
1075 | 1078 | } |
1076 | - } else return array(); |
|
1079 | + } else { |
|
1080 | + return array(); |
|
1081 | + } |
|
1077 | 1082 | if ($globalDBdriver == 'mysql') { |
1078 | 1083 | $query = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()'; |
1079 | 1084 | } else { |
@@ -1096,7 +1101,9 @@ discard block |
||
1096 | 1101 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1097 | 1102 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1098 | 1103 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1099 | - } else return array(); |
|
1104 | + } else { |
|
1105 | + return array(); |
|
1106 | + } |
|
1100 | 1107 | if ($globalDBdriver == 'mysql') { |
1101 | 1108 | $query = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope'; |
1102 | 1109 | } else { |
@@ -1122,8 +1129,11 @@ discard block |
||
1122 | 1129 | return "error : ".$e->getMessage(); |
1123 | 1130 | } |
1124 | 1131 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1125 | - if (isset($all[0])) return $all[0]; |
|
1126 | - else return array(); |
|
1132 | + if (isset($all[0])) { |
|
1133 | + return $all[0]; |
|
1134 | + } else { |
|
1135 | + return array(); |
|
1136 | + } |
|
1127 | 1137 | } |
1128 | 1138 | |
1129 | 1139 | public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) { |
@@ -1201,7 +1211,9 @@ discard block |
||
1201 | 1211 | foreach ($alldata as $initial_data) { |
1202 | 1212 | $data = $this->parse($initial_data); |
1203 | 1213 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1204 | - if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1214 | + if (count($notamref) == 0) { |
|
1215 | + $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1216 | + } |
|
1205 | 1217 | } |
1206 | 1218 | } |
1207 | 1219 | } |
@@ -1214,7 +1226,9 @@ discard block |
||
1214 | 1226 | foreach ($alldata as $initial_data) { |
1215 | 1227 | $data = $this->parse($initial_data); |
1216 | 1228 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1217 | - if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1229 | + if (!isset($notamref['notam_id'])) { |
|
1230 | + $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1231 | + } |
|
1218 | 1232 | } |
1219 | 1233 | } |
1220 | 1234 | } |
@@ -1226,11 +1240,15 @@ discard block |
||
1226 | 1240 | foreach (array_chunk($allairports,20) as $airport) { |
1227 | 1241 | $airports_icao = array(); |
1228 | 1242 | foreach($airport as $icao) { |
1229 | - if (isset($icao['icao'])) $airports_icao[] = $icao['icao']; |
|
1243 | + if (isset($icao['icao'])) { |
|
1244 | + $airports_icao[] = $icao['icao']; |
|
1245 | + } |
|
1230 | 1246 | } |
1231 | 1247 | $airport_icao = implode(',',$airports_icao); |
1232 | 1248 | $alldata = $this->downloadNOTAM($airport_icao); |
1233 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
1249 | + if ($globalTransaction) { |
|
1250 | + $this->db->beginTransaction(); |
|
1251 | + } |
|
1234 | 1252 | if (count($alldata) > 0) { |
1235 | 1253 | foreach ($alldata as $initial_data) { |
1236 | 1254 | //print_r($initial_data); |
@@ -1239,14 +1257,23 @@ discard block |
||
1239 | 1257 | if (isset($data['ref'])) { |
1240 | 1258 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1241 | 1259 | if (count($notamref) == 0) { |
1242 | - if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']); |
|
1243 | - if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']); |
|
1244 | - elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1260 | + if (isset($data['ref_replaced'])) { |
|
1261 | + $this->deleteNOTAMbyRef($data['ref_replaced']); |
|
1262 | + } |
|
1263 | + if (isset($data['ref_cancelled'])) { |
|
1264 | + $this->deleteNOTAMbyRef($data['ref_cancelled']); |
|
1265 | + } elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) { |
|
1266 | + echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1267 | + } |
|
1245 | 1268 | } |
1246 | 1269 | } |
1247 | 1270 | } |
1248 | - } else echo 'Error on download. Nothing matches for '.$airport_icao."\n"; |
|
1249 | - if ($globalTransaction) $this->db->commit(); |
|
1271 | + } else { |
|
1272 | + echo 'Error on download. Nothing matches for '.$airport_icao."\n"; |
|
1273 | + } |
|
1274 | + if ($globalTransaction) { |
|
1275 | + $this->db->commit(); |
|
1276 | + } |
|
1250 | 1277 | sleep(5); |
1251 | 1278 | } |
1252 | 1279 | } |
@@ -1259,8 +1286,11 @@ discard block |
||
1259 | 1286 | $data = $Common->getData($url); |
1260 | 1287 | preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches); |
1261 | 1288 | //print_r($matches); |
1262 | - if (isset($matches[1])) return $matches[1]; |
|
1263 | - else return array(); |
|
1289 | + if (isset($matches[1])) { |
|
1290 | + return $matches[1]; |
|
1291 | + } else { |
|
1292 | + return array(); |
|
1293 | + } |
|
1264 | 1294 | } |
1265 | 1295 | |
1266 | 1296 | public function parse($data) { |
@@ -1291,99 +1321,156 @@ discard block |
||
1291 | 1321 | $rules = str_split($matches[3]); |
1292 | 1322 | foreach ($rules as $rule) { |
1293 | 1323 | if ($rule == 'I') { |
1294 | - if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR'; |
|
1295 | - else $result['rules'] = 'IFR'; |
|
1324 | + if (isset($result['rules'])) { |
|
1325 | + $result['rules'] = $result['rules'].'/IFR'; |
|
1326 | + } else { |
|
1327 | + $result['rules'] = 'IFR'; |
|
1328 | + } |
|
1296 | 1329 | } elseif ($rule == 'V') { |
1297 | - if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR'; |
|
1298 | - else $result['rules'] = 'VFR'; |
|
1330 | + if (isset($result['rules'])) { |
|
1331 | + $result['rules'] = $result['rules'].'/VFR'; |
|
1332 | + } else { |
|
1333 | + $result['rules'] = 'VFR'; |
|
1334 | + } |
|
1299 | 1335 | } elseif ($rule == 'K') { |
1300 | - if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist'; |
|
1301 | - else $result['rules'] = 'Checklist'; |
|
1336 | + if (isset($result['rules'])) { |
|
1337 | + $result['rules'] = $result['rules'].'/Checklist'; |
|
1338 | + } else { |
|
1339 | + $result['rules'] = 'Checklist'; |
|
1340 | + } |
|
1302 | 1341 | } |
1303 | 1342 | } |
1304 | 1343 | $attentions = str_split($matches[4]); |
1305 | 1344 | foreach ($attentions as $attention) { |
1306 | 1345 | if ($attention == 'N') { |
1307 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention'; |
|
1308 | - else $result['rules'] = 'Immediate attention'; |
|
1346 | + if (isset($result['attention'])) { |
|
1347 | + $result['attention'] = $result['attention'].' / Immediate attention'; |
|
1348 | + } else { |
|
1349 | + $result['rules'] = 'Immediate attention'; |
|
1350 | + } |
|
1309 | 1351 | } elseif ($attention == 'B') { |
1310 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance'; |
|
1311 | - else $result['rules'] = 'Operational significance'; |
|
1352 | + if (isset($result['attention'])) { |
|
1353 | + $result['attention'] = $result['attention'].' / Operational significance'; |
|
1354 | + } else { |
|
1355 | + $result['rules'] = 'Operational significance'; |
|
1356 | + } |
|
1312 | 1357 | } elseif ($attention == 'O') { |
1313 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations'; |
|
1314 | - else $result['rules'] = 'Flight operations'; |
|
1358 | + if (isset($result['attention'])) { |
|
1359 | + $result['attention'] = $result['attention'].' / Flight operations'; |
|
1360 | + } else { |
|
1361 | + $result['rules'] = 'Flight operations'; |
|
1362 | + } |
|
1315 | 1363 | } elseif ($attention == 'M') { |
1316 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc'; |
|
1317 | - else $result['rules'] = 'Misc'; |
|
1364 | + if (isset($result['attention'])) { |
|
1365 | + $result['attention'] = $result['attention'].' / Misc'; |
|
1366 | + } else { |
|
1367 | + $result['rules'] = 'Misc'; |
|
1368 | + } |
|
1318 | 1369 | } elseif ($attention == 'K') { |
1319 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist'; |
|
1320 | - else $result['rules'] = 'Checklist'; |
|
1370 | + if (isset($result['attention'])) { |
|
1371 | + $result['attention'] = $result['attention'].' / Checklist'; |
|
1372 | + } else { |
|
1373 | + $result['rules'] = 'Checklist'; |
|
1374 | + } |
|
1321 | 1375 | } |
1322 | 1376 | } |
1323 | - if ($matches[5] == 'A') $result['scope'] = 'Airport warning'; |
|
1324 | - elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning'; |
|
1325 | - elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning'; |
|
1326 | - elseif ($matches[5] == 'K') $result['scope'] = 'Checklist'; |
|
1327 | - elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning'; |
|
1328 | - elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning'; |
|
1377 | + if ($matches[5] == 'A') { |
|
1378 | + $result['scope'] = 'Airport warning'; |
|
1379 | + } elseif ($matches[5] == 'E') { |
|
1380 | + $result['scope'] = 'Enroute warning'; |
|
1381 | + } elseif ($matches[5] == 'W') { |
|
1382 | + $result['scope'] = 'Navigation warning'; |
|
1383 | + } elseif ($matches[5] == 'K') { |
|
1384 | + $result['scope'] = 'Checklist'; |
|
1385 | + } elseif ($matches[5] == 'AE') { |
|
1386 | + $result['scope'] = 'Airport/Enroute warning'; |
|
1387 | + } elseif ($matches[5] == 'AW') { |
|
1388 | + $result['scope'] = 'Airport/Navigation warning'; |
|
1389 | + } |
|
1329 | 1390 | $result['lower_limit'] = $matches[6]; |
1330 | 1391 | $result['upper_limit'] = $matches[7]; |
1331 | 1392 | $latitude = $Common->convertDec($matches[8],'latitude'); |
1332 | - if ($matches[9] == 'S') $latitude = -$latitude; |
|
1393 | + if ($matches[9] == 'S') { |
|
1394 | + $latitude = -$latitude; |
|
1395 | + } |
|
1333 | 1396 | $longitude = $Common->convertDec($matches[10],'longitude'); |
1334 | - if ($matches[11] == 'W') $longitude = -$longitude; |
|
1397 | + if ($matches[11] == 'W') { |
|
1398 | + $longitude = -$longitude; |
|
1399 | + } |
|
1335 | 1400 | $result['latitude'] = $latitude; |
1336 | 1401 | $result['longitude'] = $longitude; |
1337 | - if ($matches[12] != '') $result['radius'] = intval($matches[12]); |
|
1338 | - else $result['radius'] = 0; |
|
1402 | + if ($matches[12] != '') { |
|
1403 | + $result['radius'] = intval($matches[12]); |
|
1404 | + } else { |
|
1405 | + $result['radius'] = 0; |
|
1406 | + } |
|
1339 | 1407 | $q = true; |
1340 | 1408 | } elseif ($globalDebug) { |
1341 | 1409 | echo 'NOTAM error : '.$result['full_notam']."\n"; |
1342 | 1410 | echo "Can't parse : ".$line."\n"; |
1343 | 1411 | } |
1344 | - } |
|
1345 | - elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) { |
|
1412 | + } elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) { |
|
1346 | 1413 | $result['icao'] = $matches[2]; |
1347 | 1414 | $a = true; |
1348 | - } |
|
1349 | - elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) { |
|
1350 | - if ($matches[1] > 50) $year = '19'.$matches[2]; |
|
1351 | - else $year = '20'.$matches[2]; |
|
1415 | + } elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) { |
|
1416 | + if ($matches[1] > 50) { |
|
1417 | + $year = '19'.$matches[2]; |
|
1418 | + } else { |
|
1419 | + $year = '20'.$matches[2]; |
|
1420 | + } |
|
1352 | 1421 | $result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1353 | 1422 | $b = true; |
1354 | - } |
|
1355 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) { |
|
1356 | - if ($matches[2] > 50) $year = '19'.$matches[2]; |
|
1357 | - else $year = '20'.$matches[2]; |
|
1423 | + } elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) { |
|
1424 | + if ($matches[2] > 50) { |
|
1425 | + $year = '19'.$matches[2]; |
|
1426 | + } else { |
|
1427 | + $year = '20'.$matches[2]; |
|
1428 | + } |
|
1358 | 1429 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1359 | 1430 | $result['permanent'] = 0; |
1360 | 1431 | $c = true; |
1361 | - } |
|
1362 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1363 | - if ($matches[2] > 50) $year = '19'.$matches[2]; |
|
1364 | - else $year = '20'.$matches[2]; |
|
1432 | + } elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1433 | + if ($matches[2] > 50) { |
|
1434 | + $year = '19'.$matches[2]; |
|
1435 | + } else { |
|
1436 | + $year = '20'.$matches[2]; |
|
1437 | + } |
|
1365 | 1438 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1366 | - if ($matches[7] == 'EST') $result['estimated'] = 1; |
|
1367 | - else $result['estimated'] = 0; |
|
1368 | - if ($matches[7] == 'PERM') $result['permanent'] = 1; |
|
1369 | - else $result['permanent'] = 0; |
|
1439 | + if ($matches[7] == 'EST') { |
|
1440 | + $result['estimated'] = 1; |
|
1441 | + } else { |
|
1442 | + $result['estimated'] = 0; |
|
1443 | + } |
|
1444 | + if ($matches[7] == 'PERM') { |
|
1445 | + $result['permanent'] = 1; |
|
1446 | + } else { |
|
1447 | + $result['permanent'] = 0; |
|
1448 | + } |
|
1370 | 1449 | $c = true; |
1371 | - } |
|
1372 | - elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1450 | + } elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1373 | 1451 | $result['date_end'] = '2030/12/20 12:00'; |
1374 | - if ($matches[2] == 'EST') $result['estimated'] = 1; |
|
1375 | - else $result['estimated'] = 0; |
|
1376 | - if ($matches[2] == 'PERM') $result['permanent'] = 1; |
|
1377 | - else $result['permanent'] = 0; |
|
1452 | + if ($matches[2] == 'EST') { |
|
1453 | + $result['estimated'] = 1; |
|
1454 | + } else { |
|
1455 | + $result['estimated'] = 0; |
|
1456 | + } |
|
1457 | + if ($matches[2] == 'PERM') { |
|
1458 | + $result['permanent'] = 1; |
|
1459 | + } else { |
|
1460 | + $result['permanent'] = 0; |
|
1461 | + } |
|
1378 | 1462 | $c = true; |
1379 | - } |
|
1380 | - elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) { |
|
1463 | + } elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) { |
|
1381 | 1464 | $rtext = array(); |
1382 | 1465 | $text = explode(' ',$matches[2]); |
1383 | 1466 | foreach ($text as $word) { |
1384 | - if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]); |
|
1385 | - elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
1386 | - else $rtext[] = $word; |
|
1467 | + if (isset($this->abbr[$word])) { |
|
1468 | + $rtext[] = strtoupper($this->abbr[$word]); |
|
1469 | + } elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) { |
|
1470 | + $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
1471 | + } else { |
|
1472 | + $rtext[] = $word; |
|
1473 | + } |
|
1387 | 1474 | } |
1388 | 1475 | $result['text'] = implode(' ',$rtext); |
1389 | 1476 | $e = true; |
@@ -1392,7 +1479,9 @@ discard block |
||
1392 | 1479 | } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) { |
1393 | 1480 | $text = explode(' ',$line); |
1394 | 1481 | $result['ref'] = $text[0]; |
1395 | - if ($matches[1] == 'NOTAMN') $result['type'] = 'new'; |
|
1482 | + if ($matches[1] == 'NOTAMN') { |
|
1483 | + $result['type'] = 'new'; |
|
1484 | + } |
|
1396 | 1485 | if ($matches[1] == 'NOTAMC') { |
1397 | 1486 | $result['type'] = 'cancel'; |
1398 | 1487 | $result['ref_cancelled'] = $text[2]; |
@@ -1414,69 +1503,101 @@ discard block |
||
1414 | 1503 | switch ($code[1]) { |
1415 | 1504 | case 'A': |
1416 | 1505 | $result = 'Airspace organization '; |
1417 | - if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp]; |
|
1506 | + if (isset($this->code_airspace[$code_fp])) { |
|
1507 | + $result .= $this->code_airspace[$code_fp]; |
|
1508 | + } |
|
1418 | 1509 | break; |
1419 | 1510 | case 'C': |
1420 | 1511 | $result = 'Communications and radar facilities '; |
1421 | - if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp]; |
|
1512 | + if (isset($this->code_comradar[$code_fp])) { |
|
1513 | + $result .= $this->code_comradar[$code_fp]; |
|
1514 | + } |
|
1422 | 1515 | break; |
1423 | 1516 | case 'F': |
1424 | 1517 | $result = 'Facilities and services '; |
1425 | - if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp]; |
|
1518 | + if (isset($this->code_facilities[$code_fp])) { |
|
1519 | + $result .= $this->code_facilities[$code_fp]; |
|
1520 | + } |
|
1426 | 1521 | break; |
1427 | 1522 | case 'I': |
1428 | 1523 | $result = 'Instrument and Microwave Landing System '; |
1429 | - if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp]; |
|
1524 | + if (isset($this->code_instrumentlanding[$code_fp])) { |
|
1525 | + $result .= $this->code_instrumentlanding[$code_fp]; |
|
1526 | + } |
|
1430 | 1527 | break; |
1431 | 1528 | case 'L': |
1432 | 1529 | $result = 'Lighting facilities '; |
1433 | - if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp]; |
|
1530 | + if (isset($this->code_lightingfacilities[$code_fp])) { |
|
1531 | + $result .= $this->code_lightingfacilities[$code_fp]; |
|
1532 | + } |
|
1434 | 1533 | break; |
1435 | 1534 | case 'M': |
1436 | 1535 | $result = 'Movement and landing areas '; |
1437 | - if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp]; |
|
1536 | + if (isset($this->code_movementareas[$code_fp])) { |
|
1537 | + $result .= $this->code_movementareas[$code_fp]; |
|
1538 | + } |
|
1438 | 1539 | break; |
1439 | 1540 | case 'N': |
1440 | 1541 | $result = 'Terminal and En Route Navigation Facilities '; |
1441 | - if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp]; |
|
1542 | + if (isset($this->code_terminalfacilities[$code_fp])) { |
|
1543 | + $result .= $this->code_terminalfacilities[$code_fp]; |
|
1544 | + } |
|
1442 | 1545 | break; |
1443 | 1546 | case 'O': |
1444 | 1547 | $result = 'Other information '; |
1445 | - if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp]; |
|
1548 | + if (isset($this->code_information[$code_fp])) { |
|
1549 | + $result .= $this->code_information[$code_fp]; |
|
1550 | + } |
|
1446 | 1551 | break; |
1447 | 1552 | case 'P': |
1448 | 1553 | $result = 'Air Traffic procedures '; |
1449 | - if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp]; |
|
1554 | + if (isset($this->code_airtraffic[$code_fp])) { |
|
1555 | + $result .= $this->code_airtraffic[$code_fp]; |
|
1556 | + } |
|
1450 | 1557 | break; |
1451 | 1558 | case 'R': |
1452 | 1559 | $result = 'Navigation Warnings: Airspace Restrictions '; |
1453 | - if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp]; |
|
1560 | + if (isset($this->code_navigationw[$code_fp])) { |
|
1561 | + $result .= $this->code_navigationw[$code_fp]; |
|
1562 | + } |
|
1454 | 1563 | break; |
1455 | 1564 | case 'S': |
1456 | 1565 | $result = 'Air Traffic and VOLMET Services '; |
1457 | - if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp]; |
|
1566 | + if (isset($this->code_volmet[$code_fp])) { |
|
1567 | + $result .= $this->code_volmet[$code_fp]; |
|
1568 | + } |
|
1458 | 1569 | break; |
1459 | 1570 | case 'W': |
1460 | 1571 | $result = 'Navigation Warnings: Warnings '; |
1461 | - if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp]; |
|
1572 | + if (isset($this->code_warnings[$code_fp])) { |
|
1573 | + $result .= $this->code_warnings[$code_fp]; |
|
1574 | + } |
|
1462 | 1575 | break; |
1463 | 1576 | } |
1464 | 1577 | switch ($code[3]) { |
1465 | 1578 | case 'A': |
1466 | 1579 | // Availability |
1467 | - if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp]; |
|
1580 | + if (isset($this->code_sp_availabity[$code_sp])) { |
|
1581 | + $result .= ' '.$this->code_sp_availabity[$code_sp]; |
|
1582 | + } |
|
1468 | 1583 | break; |
1469 | 1584 | case 'C': |
1470 | 1585 | // Changes |
1471 | - if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp]; |
|
1586 | + if (isset($this->code_sp_changes[$code_sp])) { |
|
1587 | + $result .= ' '.$this->code_sp_changes[$code_sp]; |
|
1588 | + } |
|
1472 | 1589 | break; |
1473 | 1590 | case 'H': |
1474 | 1591 | // Hazardous conditions |
1475 | - if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp]; |
|
1592 | + if (isset($this->code_sp_hazardous[$code_sp])) { |
|
1593 | + $result .= ' '.$this->code_sp_hazardous[$code_sp]; |
|
1594 | + } |
|
1476 | 1595 | break; |
1477 | 1596 | case 'L': |
1478 | 1597 | // Limitations |
1479 | - if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp]; |
|
1598 | + if (isset($this->code_sp_limitations[$code_sp])) { |
|
1599 | + $result .= ' '.$this->code_sp_limitations[$code_sp]; |
|
1600 | + } |
|
1480 | 1601 | break; |
1481 | 1602 | case 'X': |
1482 | 1603 | // Other Information |