@@ -113,8 +113,11 @@ discard block |
||
113 | 113 | $data = array(); |
114 | 114 | if ($row['registration'] != '') { |
115 | 115 | $image_array = $Image->getSpotterImage($row['registration']); |
116 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
117 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
116 | + if (count($image_array) > 0) { |
|
117 | + $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
118 | + } else { |
|
119 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
120 | + } |
|
118 | 121 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
119 | 122 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
120 | 123 | if (!empty($aircraft_info)) { |
@@ -130,17 +133,30 @@ discard block |
||
130 | 133 | $data['aircraft_base'] = $owner_data['base']; |
131 | 134 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
132 | 135 | } |
133 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
134 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
135 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
136 | + } else { |
|
137 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
138 | + } |
|
139 | + if ($row['registration'] == '') { |
|
140 | + $row['registration'] = 'NA'; |
|
141 | + } |
|
142 | + if ($row['ident'] == '') { |
|
143 | + $row['ident'] = 'NA'; |
|
144 | + } |
|
136 | 145 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
137 | 146 | if (isset($identicao[0])) { |
138 | 147 | if (substr($row['ident'],0,2) == 'AF') { |
139 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
140 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
141 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
148 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
149 | + $icao = $row['ident']; |
|
150 | + } else { |
|
151 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
152 | + } |
|
153 | + } else { |
|
154 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
155 | + } |
|
142 | 156 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
143 | - } else $icao = $row['ident']; |
|
157 | + } else { |
|
158 | + $icao = $row['ident']; |
|
159 | + } |
|
144 | 160 | $icao = $Translation->checkTranslation($icao,false); |
145 | 161 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
146 | 162 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
@@ -155,10 +171,14 @@ discard block |
||
155 | 171 | //else echo 'No data...'."\n"; |
156 | 172 | } |
157 | 173 | $data = array_merge($row,$data); |
158 | - if ($data['ident'] == null) $data['ident'] = $icao; |
|
174 | + if ($data['ident'] == null) { |
|
175 | + $data['ident'] = $icao; |
|
176 | + } |
|
159 | 177 | if ($data['title'] == null) { |
160 | 178 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
161 | - } else $data['message'] = strtolower($data['title']); |
|
179 | + } else { |
|
180 | + $data['message'] = strtolower($data['title']); |
|
181 | + } |
|
162 | 182 | $ids = $Spotter->getAllIDByRegistration($data['registration']); |
163 | 183 | $date = $data['date']; |
164 | 184 | if (isset($ids[$date])) { |
@@ -177,8 +197,9 @@ discard block |
||
177 | 197 | if (isset($result)) { |
178 | 198 | $result[0]['query_number_rows'] = $i; |
179 | 199 | return $result; |
200 | + } else { |
|
201 | + return array(); |
|
180 | 202 | } |
181 | - else return array(); |
|
182 | 203 | } |
183 | 204 | |
184 | 205 | /* |
@@ -222,7 +243,9 @@ discard block |
||
222 | 243 | */ |
223 | 244 | public function import($file) { |
224 | 245 | global $globalTransaction, $globalDebug; |
225 | - if ($globalDebug) echo 'Import '.$file."\n"; |
|
246 | + if ($globalDebug) { |
|
247 | + echo 'Import '.$file."\n"; |
|
248 | + } |
|
226 | 249 | $result = array(); |
227 | 250 | if (file_exists($file)) { |
228 | 251 | if (($handle = fopen($file,'r')) !== FALSE) { |
@@ -233,8 +256,11 @@ discard block |
||
233 | 256 | } |
234 | 257 | fclose($handle); |
235 | 258 | } |
236 | - if (!empty($result)) $this->add($result,true); |
|
237 | - elseif ($globalDebug) echo 'Nothing to import'; |
|
259 | + if (!empty($result)) { |
|
260 | + $this->add($result,true); |
|
261 | + } elseif ($globalDebug) { |
|
262 | + echo 'Nothing to import'; |
|
263 | + } |
|
238 | 264 | } |
239 | 265 | } |
240 | 266 | |
@@ -270,14 +296,23 @@ discard block |
||
270 | 296 | } |
271 | 297 | } |
272 | 298 | fclose($handle); |
273 | - } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
274 | - } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
299 | + } elseif ($globalDebug) { |
|
300 | + echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
301 | + } |
|
302 | + } elseif ($globalDebug) { |
|
303 | + echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
304 | + } |
|
275 | 305 | $result = $Common->arr_diff($all_md5_new,$all_md5); |
276 | - if (empty($result) && $globalDebug) echo 'Nothing to update'; |
|
306 | + if (empty($result) && $globalDebug) { |
|
307 | + echo 'Nothing to update'; |
|
308 | + } |
|
277 | 309 | foreach ($result as $file => $md5) { |
278 | 310 | $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
279 | - if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
280 | - elseif ($globalDebug) echo 'Download '.$file.' failed'; |
|
311 | + if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) { |
|
312 | + $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
313 | + } elseif ($globalDebug) { |
|
314 | + echo 'Download '.$file.' failed'; |
|
315 | + } |
|
281 | 316 | } |
282 | 317 | } |
283 | 318 | |
@@ -294,13 +329,17 @@ discard block |
||
294 | 329 | $Image = new Image(); |
295 | 330 | $Spotter = new Spotter(); |
296 | 331 | |
297 | - if (empty($crash)) return false; |
|
332 | + if (empty($crash)) { |
|
333 | + return false; |
|
334 | + } |
|
298 | 335 | if (!$new) { |
299 | 336 | $query_delete = 'DELETE FROM accidents WHERE source = :source'; |
300 | 337 | $sthd = $Connection->db->prepare($query_delete); |
301 | 338 | $sthd->execute(array(':source' => $crash[0]['source'])); |
302 | 339 | } |
303 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
340 | + if ($globalTransaction) { |
|
341 | + $Connection->db->beginTransaction(); |
|
342 | + } |
|
304 | 343 | $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null); |
305 | 344 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
306 | 345 | $sth_check = $Connection->db->prepare($query_check); |
@@ -315,7 +354,9 @@ discard block |
||
315 | 354 | return $value === "" ? NULL : $value; |
316 | 355 | }, $cr); |
317 | 356 | if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
318 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
357 | + if (strpos($cr['registration'],'-') === FALSE) { |
|
358 | + $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
359 | + } |
|
319 | 360 | $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
320 | 361 | $sth_check->execute($query_check_values); |
321 | 362 | $result_check = $sth_check->fetch(PDO::FETCH_ASSOC); |
@@ -324,13 +365,19 @@ discard block |
||
324 | 365 | $sth->execute($query_values); |
325 | 366 | if ($cr['date'] > time()-(30*86400)) { |
326 | 367 | if (empty($Image->getSpotterImage($cr['registration']))) { |
327 | - if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...'; |
|
368 | + if ($globalDebug) { |
|
369 | + echo "\t".'Get image for '.$cr['registration'].'...'; |
|
370 | + } |
|
328 | 371 | $Image->addSpotterImage($cr['registration']); |
329 | - if ($globalDebug) echo "\t".'Done'."\n"; |
|
372 | + if ($globalDebug) { |
|
373 | + echo "\t".'Done'."\n"; |
|
374 | + } |
|
330 | 375 | } |
331 | 376 | // elseif ($globalDebug) echo 'Image already in DB'."\n"; |
332 | 377 | } |
333 | - if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type']; |
|
378 | + if ($cr['title'] == '') { |
|
379 | + $cr['title'] = $cr['registration'].' '.$cr['type']; |
|
380 | + } |
|
334 | 381 | $Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date'])); |
335 | 382 | } |
336 | 383 | } |
@@ -339,9 +386,13 @@ discard block |
||
339 | 386 | $Connection->db->beginTransaction(); |
340 | 387 | } |
341 | 388 | } |
342 | - if ($globalTransaction) $Connection->db->commit(); |
|
389 | + if ($globalTransaction) { |
|
390 | + $Connection->db->commit(); |
|
391 | + } |
|
343 | 392 | } catch(PDOException $e) { |
344 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
393 | + if ($globalTransaction) { |
|
394 | + $Connection->db->rollBack(); |
|
395 | + } |
|
345 | 396 | echo $e->getMessage(); |
346 | 397 | } |
347 | 398 | $sth_check->closeCursor(); |
@@ -380,8 +431,11 @@ discard block |
||
380 | 431 | return "error : ".$e->getMessage(); |
381 | 432 | } |
382 | 433 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
383 | - if ($row['nb'] > 0) return false; |
|
384 | - else return true; |
|
434 | + if ($row['nb'] > 0) { |
|
435 | + return false; |
|
436 | + } else { |
|
437 | + return true; |
|
438 | + } |
|
385 | 439 | } |
386 | 440 | |
387 | 441 | public static function insert_last_accidents_update() { |
@@ -8,8 +8,12 @@ discard block |
||
8 | 8 | } |
9 | 9 | $tracker = false; |
10 | 10 | $marine = false; |
11 | -if (isset($_GET['tracker'])) $tracker = true; |
|
12 | -if (isset($_GET['marine'])) $marine = true; |
|
11 | +if (isset($_GET['tracker'])) { |
|
12 | + $tracker = true; |
|
13 | +} |
|
14 | +if (isset($_GET['marine'])) { |
|
15 | + $marine = true; |
|
16 | +} |
|
13 | 17 | if ($tracker) { |
14 | 18 | require_once('require/class.Tracker.php'); |
15 | 19 | require_once('require/class.TrackerLive.php'); |
@@ -66,23 +70,46 @@ discard block |
||
66 | 70 | } |
67 | 71 | header('Content-Type: text/javascript'); |
68 | 72 | |
69 | -if (!isset($globalJsonCompress)) $compress = true; |
|
70 | -else $compress = $globalJsonCompress; |
|
73 | +if (!isset($globalJsonCompress)) { |
|
74 | + $compress = true; |
|
75 | +} else { |
|
76 | + $compress = $globalJsonCompress; |
|
77 | +} |
|
71 | 78 | |
72 | 79 | $from_archive = false; |
73 | 80 | $min = false; |
74 | 81 | $allhistory = false; |
75 | 82 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
83 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
84 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
85 | +} |
|
86 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
87 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
88 | +} |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
90 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
91 | +} |
|
92 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
93 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
94 | +} |
|
95 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
96 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
97 | +} |
|
98 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
99 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
100 | +} |
|
101 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
102 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
103 | +} |
|
104 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
105 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
106 | +} |
|
107 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
108 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
109 | +} |
|
110 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
111 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
112 | +} |
|
86 | 113 | /* |
87 | 114 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 115 | $min = true; |
@@ -167,8 +194,12 @@ discard block |
||
167 | 194 | } else { |
168 | 195 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
169 | 196 | } |
170 | - if ($flightcnt == '') $flightcnt = 0; |
|
171 | -} else $flightcnt = 0; |
|
197 | + if ($flightcnt == '') { |
|
198 | + $flightcnt = 0; |
|
199 | + } |
|
200 | + } else { |
|
201 | + $flightcnt = 0; |
|
202 | +} |
|
172 | 203 | |
173 | 204 | $sqltime = round(microtime(true)-$begintime,2); |
174 | 205 | $minitime = time(); |
@@ -192,7 +223,9 @@ discard block |
||
192 | 223 | $j = 0; |
193 | 224 | $prev_flightaware_id = ''; |
194 | 225 | $speed = 1; |
195 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
226 | +if (isset($archivespeed)) { |
|
227 | + $speed = $archivespeed; |
|
228 | +} |
|
196 | 229 | $output = '['; |
197 | 230 | if ($tracker) { |
198 | 231 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -227,9 +260,13 @@ discard block |
||
227 | 260 | $image = "images/placeholder_thumb.png"; |
228 | 261 | } |
229 | 262 | |
230 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
231 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
232 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
263 | + if (isset($spotter_item['flightaware_id'])) { |
|
264 | + $id = $spotter_item['flightaware_id']; |
|
265 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
266 | + $id = $spotter_item['famtrackid']; |
|
267 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
268 | + $id = $spotter_item['fammarine_id']; |
|
269 | + } |
|
233 | 270 | if ($prev_flightaware_id != $id) { |
234 | 271 | if ($prev_flightaware_id != '') { |
235 | 272 | $output .= ']'; |
@@ -271,7 +308,9 @@ discard block |
||
271 | 308 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
272 | 309 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
273 | 310 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
274 | - } else $aircraft_shadow = ''; |
|
311 | + } else { |
|
312 | + $aircraft_shadow = ''; |
|
313 | + } |
|
275 | 314 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
276 | 315 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) { |
277 | 316 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -279,7 +318,9 @@ discard block |
||
279 | 318 | } |
280 | 319 | $output .= '},'; |
281 | 320 | } |
282 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},'; |
|
321 | + } else { |
|
322 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},'; |
|
323 | + } |
|
283 | 324 | } elseif ($one3dmodel) { |
284 | 325 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
285 | 326 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -310,7 +351,9 @@ discard block |
||
310 | 351 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
311 | 352 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
312 | 353 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
313 | - } else $aircraft_shadow = ''; |
|
354 | + } else { |
|
355 | + $aircraft_shadow = ''; |
|
356 | + } |
|
314 | 357 | if ($aircraft_shadow != '') { |
315 | 358 | if (isset($modelsdb[$aircraft_shadow])) { |
316 | 359 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -447,7 +490,9 @@ discard block |
||
447 | 490 | } |
448 | 491 | $output .= '},'; |
449 | 492 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
450 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
493 | + if ($spotter_item['aircraft_icao'] != '') { |
|
494 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
495 | + } |
|
451 | 496 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
452 | 497 | } |
453 | 498 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -469,7 +514,9 @@ discard block |
||
469 | 514 | } |
470 | 515 | $output .= '},'; |
471 | 516 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
472 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
517 | + if ($spotter_item['aircraft_icao'] != '') { |
|
518 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
519 | + } |
|
473 | 520 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
474 | 521 | } |
475 | 522 | } else { |
@@ -482,7 +529,9 @@ discard block |
||
482 | 529 | } |
483 | 530 | $output .= '},'; |
484 | 531 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
485 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
532 | + if ($spotter_item['aircraft_icao'] != '') { |
|
533 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
534 | + } |
|
486 | 535 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
487 | 536 | } |
488 | 537 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -538,8 +587,12 @@ discard block |
||
538 | 587 | // $output .= '"interpolationDegree" : 5,'; |
539 | 588 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
540 | 589 | $output .= '"cartographicDegrees": ['; |
541 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
542 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
590 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
591 | + $minitime = strtotime($spotter_item['date']); |
|
592 | + } |
|
593 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
594 | + $maxitime = strtotime($spotter_item['date']); |
|
595 | + } |
|
543 | 596 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
544 | 597 | $output .= $spotter_item['longitude'].', '; |
545 | 598 | $output .= $spotter_item['latitude']; |
@@ -553,19 +606,26 @@ discard block |
||
553 | 606 | $output .= ', '.round($spotter_item['altitude']*30.48); |
554 | 607 | $prevalt = round($spotter_item['altitude']*30.48); |
555 | 608 | } |
556 | - } else $output .= ', 0'; |
|
609 | + } else { |
|
610 | + $output .= ', 0'; |
|
611 | + } |
|
557 | 612 | //$orientation = '"orientation" : { '; |
558 | 613 | //$orientation .= '"unitQuaternion": ['; |
559 | 614 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
560 | 615 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
561 | 616 | } else { |
562 | 617 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
563 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
618 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
619 | + $maxitime = strtotime($spotter_item['date']); |
|
620 | + } |
|
564 | 621 | if ($spotter_item['ground_speed'] == 0) { |
565 | 622 | $output .= $prevlong.', '; |
566 | 623 | $output .= $prevlat; |
567 | - if (!$tracker && !$marine) $output .= ', '.$prevalt; |
|
568 | - else $output .= ', 0'; |
|
624 | + if (!$tracker && !$marine) { |
|
625 | + $output .= ', '.$prevalt; |
|
626 | + } else { |
|
627 | + $output .= ', 0'; |
|
628 | + } |
|
569 | 629 | } else { |
570 | 630 | $output .= $spotter_item['longitude'].', '; |
571 | 631 | $output .= $spotter_item['latitude']; |
@@ -577,10 +637,15 @@ discard block |
||
577 | 637 | $output .= ', 0'; |
578 | 638 | } |
579 | 639 | } else { |
580 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
581 | - else $output .= ', '.round($spotter_item['altitude']*30.48); |
|
640 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
641 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
642 | + } else { |
|
643 | + $output .= ', '.round($spotter_item['altitude']*30.48); |
|
644 | + } |
|
582 | 645 | } |
583 | - } else $output .= ', 0'; |
|
646 | + } else { |
|
647 | + $output .= ', 0'; |
|
648 | + } |
|
584 | 649 | } |
585 | 650 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
586 | 651 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -593,9 +658,14 @@ discard block |
||
593 | 658 | } |
594 | 659 | $output .= ']'; |
595 | 660 | if (isset($globalArchive) && $globalArchive === TRUE) { |
596 | - if ((time()-$globalLiveInterval) > $minitime) $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
597 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
598 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
661 | + if ((time()-$globalLiveInterval) > $minitime) { |
|
662 | + $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
663 | + } else { |
|
664 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
665 | + } |
|
666 | + } else { |
|
667 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
668 | +} |
|
599 | 669 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
600 | 670 | print $output; |
601 | 671 | ?> |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | { |
58 | 58 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
59 | 59 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
60 | - } else $image = $spotter_item['image_thumbnail']; |
|
60 | + } else { |
|
61 | + $image = $spotter_item['image_thumbnail']; |
|
62 | + } |
|
61 | 63 | |
62 | 64 | } |
63 | 65 | /* else { |
@@ -70,8 +72,12 @@ discard block |
||
70 | 72 | } |
71 | 73 | print '<div class="right">'; |
72 | 74 | print '<div class="callsign-details">'; |
73 | -if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
74 | -if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
75 | +if ($spotter_item['ident'] != 'Not Available') { |
|
76 | + print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
77 | +} |
|
78 | +if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
79 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
80 | +} |
|
75 | 81 | print '</div>'; |
76 | 82 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
77 | 83 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -103,10 +109,16 @@ discard block |
||
103 | 109 | print '</div>'; |
104 | 110 | print '<div id="aircraft">'; |
105 | 111 | print '<span>'._("Aircraft").'</span>'; |
106 | -if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
107 | -if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
108 | -elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
109 | -else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
112 | +if (isset($spotter_item['aircraft_wiki'])) { |
|
113 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
114 | +} |
|
115 | +if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
|
116 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
117 | +} elseif (isset($spotter_item['aircraft_type'])) { |
|
118 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
119 | +} else { |
|
120 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
121 | +} |
|
110 | 122 | print '</div>'; |
111 | 123 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
112 | 124 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
@@ -117,12 +129,18 @@ discard block |
||
117 | 129 | } |
118 | 130 | |
119 | 131 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
120 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
121 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
122 | -} else { |
|
123 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
124 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
125 | -} |
|
132 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
133 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
134 | + } else { |
|
135 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
136 | + } |
|
137 | + } else { |
|
138 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
139 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
140 | + } else { |
|
141 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
142 | + } |
|
143 | + } |
|
126 | 144 | |
127 | 145 | if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) { |
128 | 146 | print '<br>'; |
@@ -136,7 +154,9 @@ discard block |
||
136 | 154 | } |
137 | 155 | |
138 | 156 | print '</div>'; |
139 | -if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
157 | +if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
158 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
159 | +} |
|
140 | 160 | print '<div id="speed"><span>'._("Speed").'</span>'; |
141 | 161 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
142 | 162 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -150,8 +170,11 @@ discard block |
||
150 | 170 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
151 | 171 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
152 | 172 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
153 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
154 | - else print $spotter_item['pilot_name']; |
|
173 | + if (isset($spotter_item['pilot_id'])) { |
|
174 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
175 | + } else { |
|
176 | + print $spotter_item['pilot_name']; |
|
177 | + } |
|
155 | 178 | print '</div>'; |
156 | 179 | } |
157 | 180 | |
@@ -179,10 +202,18 @@ discard block |
||
179 | 202 | print '</div>'; |
180 | 203 | print '</div>'; |
181 | 204 | |
182 | -if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
183 | -if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
184 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
185 | -if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
205 | +if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
206 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
207 | +} |
|
208 | +if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
209 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
210 | +} |
|
211 | +if (isset($spotter_item['acars']['message'])) { |
|
212 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
213 | +} |
|
214 | +if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
215 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
216 | +} |
|
186 | 217 | print '</div>'; |
187 | 218 | ?> |
188 | 219 | </div> |
189 | 220 | \ No newline at end of file |
@@ -1,8 +1,10 @@ discard block |
||
1 | 1 | </section> |
2 | 2 | <div class="pub onmap"> |
3 | 3 | <?php |
4 | - if (isset($globalPub)) print $globalPub; |
|
5 | -?> |
|
4 | + if (isset($globalPub)) { |
|
5 | + print $globalPub; |
|
6 | + } |
|
7 | + ?> |
|
6 | 8 | </div> |
7 | 9 | <footer class="container"> |
8 | 10 | <?php |
@@ -13,7 +15,10 @@ discard block |
||
13 | 15 | <?php |
14 | 16 | } |
15 | 17 | ?> |
16 | - <span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span> |
|
18 | + <span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) { |
|
19 | + print $globalURL; |
|
20 | +} |
|
21 | +?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span> |
|
17 | 22 | </footer> |
18 | 23 | |
19 | 24 | <div class="notifications bottom-left"></div> |
@@ -37,8 +37,11 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
39 | 39 | } |
40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
40 | + if ($timeout == '') { |
|
41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
42 | + } else { |
|
43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
44 | + } |
|
42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
43 | 46 | if ($type == 'post') { |
44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -85,8 +88,9 @@ discard block |
||
85 | 88 | private function curlResponseHeaderCallback($ch, $headerLine) { |
86 | 89 | //global $cookies; |
87 | 90 | $cookies = array(); |
88 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
89 | - $cookies[] = $cookie; |
|
91 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
92 | + $cookies[] = $cookie; |
|
93 | + } |
|
90 | 94 | return strlen($headerLine); // Needed by curl |
91 | 95 | } |
92 | 96 | |
@@ -97,11 +101,15 @@ discard block |
||
97 | 101 | curl_setopt($ch, CURLOPT_URL, $url); |
98 | 102 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
99 | 103 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
100 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
104 | + if ($referer != '') { |
|
105 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
106 | + } |
|
101 | 107 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
102 | 108 | curl_setopt($ch, CURLOPT_FILE, $fp); |
103 | 109 | curl_exec($ch); |
104 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
110 | + if (curl_errno($ch) && $globalDebug) { |
|
111 | + echo 'Download error: '.curl_error($ch); |
|
112 | + } |
|
105 | 113 | curl_close($ch); |
106 | 114 | fclose($fp); |
107 | 115 | } |
@@ -109,12 +117,16 @@ discard block |
||
109 | 117 | public static function gunzip($in_file,$out_file_name = '') { |
110 | 118 | //echo $in_file.' -> '.$out_file_name."\n"; |
111 | 119 | $buffer_size = 4096; // read 4kb at a time |
112 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
120 | + if ($out_file_name == '') { |
|
121 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
122 | + } |
|
113 | 123 | if ($in_file != '' && file_exists($in_file)) { |
114 | 124 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
115 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
116 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
117 | - else { |
|
125 | + if (function_exists('gzopen')) { |
|
126 | + $file = gzopen($in_file,'rb'); |
|
127 | + } elseif (function_exists('gzopen64')) { |
|
128 | + $file = gzopen64($in_file,'rb'); |
|
129 | + } else { |
|
118 | 130 | echo 'gzopen not available'; |
119 | 131 | die; |
120 | 132 | } |
@@ -130,11 +142,14 @@ discard block |
||
130 | 142 | public static function bunzip2($in_file,$out_file_name = '') { |
131 | 143 | //echo $in_file.' -> '.$out_file_name."\n"; |
132 | 144 | $buffer_size = 4096; // read 4kb at a time |
133 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
145 | + if ($out_file_name == '') { |
|
146 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
147 | + } |
|
134 | 148 | if ($in_file != '' && file_exists($in_file)) { |
135 | 149 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
136 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
137 | - else { |
|
150 | + if (function_exists('bzopen')) { |
|
151 | + $file = bzopen($in_file,'rb'); |
|
152 | + } else { |
|
138 | 153 | echo 'bzopen not available'; |
139 | 154 | die; |
140 | 155 | } |
@@ -153,10 +168,16 @@ discard block |
||
153 | 168 | * @return Array array of the tables in HTML page |
154 | 169 | */ |
155 | 170 | public function table2array($data) { |
156 | - if (!is_string($data)) return array(); |
|
157 | - if ($data == '') return array(); |
|
171 | + if (!is_string($data)) { |
|
172 | + return array(); |
|
173 | + } |
|
174 | + if ($data == '') { |
|
175 | + return array(); |
|
176 | + } |
|
158 | 177 | $html = str_get_html($data); |
159 | - if ($html === false) return array(); |
|
178 | + if ($html === false) { |
|
179 | + return array(); |
|
180 | + } |
|
160 | 181 | $tabledata=array(); |
161 | 182 | foreach($html->find('tr') as $element) |
162 | 183 | { |
@@ -191,7 +212,9 @@ discard block |
||
191 | 212 | */ |
192 | 213 | public function text2array($data) { |
193 | 214 | $html = str_get_html($data); |
194 | - if ($html === false) return array(); |
|
215 | + if ($html === false) { |
|
216 | + return array(); |
|
217 | + } |
|
195 | 218 | $tabledata=array(); |
196 | 219 | foreach($html->find('p') as $element) |
197 | 220 | { |
@@ -212,7 +235,9 @@ discard block |
||
212 | 235 | * @return Float Distance in $unit |
213 | 236 | */ |
214 | 237 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
215 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
238 | + if ($lat == $latc && $lon == $lonc) { |
|
239 | + return 0; |
|
240 | + } |
|
216 | 241 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
217 | 242 | if ($unit == "km") { |
218 | 243 | return round($dist * 1.609344); |
@@ -236,10 +261,16 @@ discard block |
||
236 | 261 | public function withinThreshold ($timeDifference, $distance) { |
237 | 262 | $x = abs($timeDifference); |
238 | 263 | $d = abs($distance); |
239 | - if ($x == 0 || $d == 0) return true; |
|
264 | + if ($x == 0 || $d == 0) { |
|
265 | + return true; |
|
266 | + } |
|
240 | 267 | // may be due to Internet jitter; distance is realistic |
241 | - if ($x < 0.7 && $d < 2000) return true; |
|
242 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
268 | + if ($x < 0.7 && $d < 2000) { |
|
269 | + return true; |
|
270 | + } else { |
|
271 | + return $d/$x < 1500*0.27778; |
|
272 | + } |
|
273 | + // 1500 km/h max |
|
243 | 274 | } |
244 | 275 | |
245 | 276 | |
@@ -267,11 +298,17 @@ discard block |
||
267 | 298 | |
268 | 299 | public function convertDM($coord,$latlong) { |
269 | 300 | if ($latlong == 'latitude') { |
270 | - if ($coord < 0) $NSEW = 'S'; |
|
271 | - else $NSEW = 'N'; |
|
301 | + if ($coord < 0) { |
|
302 | + $NSEW = 'S'; |
|
303 | + } else { |
|
304 | + $NSEW = 'N'; |
|
305 | + } |
|
272 | 306 | } elseif ($latlong == 'longitude') { |
273 | - if ($coord < 0) $NSEW = 'W'; |
|
274 | - else $NSEW = 'E'; |
|
307 | + if ($coord < 0) { |
|
308 | + $NSEW = 'W'; |
|
309 | + } else { |
|
310 | + $NSEW = 'E'; |
|
311 | + } |
|
275 | 312 | } |
276 | 313 | $coord = abs($coord); |
277 | 314 | $deg = floor($coord); |
@@ -314,7 +351,9 @@ discard block |
||
314 | 351 | public function hex2str($hex) { |
315 | 352 | $str = ''; |
316 | 353 | $hexln = strlen($hex); |
317 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
354 | + for($i=0;$i<$hexln;$i+=2) { |
|
355 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
356 | + } |
|
318 | 357 | return $str; |
319 | 358 | } |
320 | 359 | |
@@ -351,8 +390,11 @@ discard block |
||
351 | 390 | $b = $lat2 - $lat1; |
352 | 391 | $c = -($a*$lat1+$b*$lon1); |
353 | 392 | $d = $a*$lat3+$b*$lon3+$c; |
354 | - if ($d > -$approx && $d < $approx) return true; |
|
355 | - else return false; |
|
393 | + if ($d > -$approx && $d < $approx) { |
|
394 | + return true; |
|
395 | + } else { |
|
396 | + return false; |
|
397 | + } |
|
356 | 398 | } |
357 | 399 | |
358 | 400 | public function array_merge_noappend() { |
@@ -411,7 +453,9 @@ discard block |
||
411 | 453 | return $result; |
412 | 454 | } |
413 | 455 | $handle = @opendir('./locale'); |
414 | - if ($handle === false) return $result; |
|
456 | + if ($handle === false) { |
|
457 | + return $result; |
|
458 | + } |
|
415 | 459 | while (false !== ($file = readdir($handle))) { |
416 | 460 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
417 | 461 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -478,8 +522,9 @@ discard block |
||
478 | 522 | $error = false; |
479 | 523 | if ($fp_out = gzopen($dest, $mode)) { |
480 | 524 | if ($fp_in = fopen($source,'rb')) { |
481 | - while (!feof($fp_in)) |
|
482 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
525 | + while (!feof($fp_in)) { |
|
526 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
527 | + } |
|
483 | 528 | fclose($fp_in); |
484 | 529 | } else { |
485 | 530 | $error = true; |
@@ -488,14 +533,17 @@ discard block |
||
488 | 533 | } else { |
489 | 534 | $error = true; |
490 | 535 | } |
491 | - if ($error) |
|
492 | - return false; |
|
493 | - else |
|
494 | - return $dest; |
|
536 | + if ($error) { |
|
537 | + return false; |
|
538 | + } else { |
|
539 | + return $dest; |
|
540 | + } |
|
495 | 541 | } |
496 | 542 | |
497 | 543 | public function remove_accents($string) { |
498 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
544 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
545 | + return $string; |
|
546 | + } |
|
499 | 547 | $chars = array( |
500 | 548 | // Decompositions for Latin-1 Supplement |
501 | 549 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -619,7 +667,9 @@ discard block |
||
619 | 667 | $ip = gethostbyname($host); |
620 | 668 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
621 | 669 | $r = @socket_connect($s, $ip, $port); |
622 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
670 | + if (!socket_set_nonblock($s)) { |
|
671 | + echo "Unable to set nonblock on socket\n"; |
|
672 | + } |
|
623 | 673 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
624 | 674 | return $s; |
625 | 675 | } |
@@ -131,45 +131,72 @@ discard block |
||
131 | 131 | </div> |
132 | 132 | <p> |
133 | 133 | <label for="dbhost">Database hostname</label> |
134 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
134 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
135 | + print $globalDBhost; |
|
136 | +} |
|
137 | +?>" /> |
|
135 | 138 | </p> |
136 | 139 | <p> |
137 | 140 | <label for="dbport">Database port</label> |
138 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
141 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
142 | + print $globalDBport; |
|
143 | +} |
|
144 | +?>" /> |
|
139 | 145 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
140 | 146 | </p> |
141 | 147 | <p> |
142 | 148 | <label for="dbname">Database name</label> |
143 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
149 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
150 | + print $globalDBname; |
|
151 | +} |
|
152 | +?>" /> |
|
144 | 153 | </p> |
145 | 154 | <p> |
146 | 155 | <label for="dbuser">Database user</label> |
147 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
156 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
157 | + print $globalDBuser; |
|
158 | +} |
|
159 | +?>" /> |
|
148 | 160 | </p> |
149 | 161 | <p> |
150 | 162 | <label for="dbuserpass">Database user password</label> |
151 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
163 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
164 | + print $globalDBpass; |
|
165 | +} |
|
166 | +?>" /> |
|
152 | 167 | </p> |
153 | 168 | </fieldset> |
154 | 169 | <fieldset id="site"> |
155 | 170 | <legend>Site configuration</legend> |
156 | 171 | <p> |
157 | 172 | <label for="sitename">Site name</label> |
158 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
173 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
174 | + print $globalName; |
|
175 | +} |
|
176 | +?>" /> |
|
159 | 177 | </p> |
160 | 178 | <p> |
161 | 179 | <label for="siteurl">Site directory</label> |
162 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
180 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
181 | + print $globalURL; |
|
182 | +} |
|
183 | +?>" /> |
|
163 | 184 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
164 | 185 | </p> |
165 | 186 | <p> |
166 | 187 | <label for="timezone">Timezone</label> |
167 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
188 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
189 | + print $globalTimezone; |
|
190 | +} |
|
191 | +?>" /> |
|
168 | 192 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
169 | 193 | </p> |
170 | 194 | <p> |
171 | 195 | <label for="language">Language</label> |
172 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
196 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
197 | + print $globalLanguage; |
|
198 | +} |
|
199 | +?>" /> |
|
173 | 200 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
174 | 201 | </p> |
175 | 202 | </fieldset> |
@@ -190,11 +217,17 @@ discard block |
||
190 | 217 | <div id="mapbox_data"> |
191 | 218 | <p> |
192 | 219 | <label for="mapboxid">Mapbox id</label> |
193 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
220 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
221 | + print $globalMapboxId; |
|
222 | +} |
|
223 | +?>" /> |
|
194 | 224 | </p> |
195 | 225 | <p> |
196 | 226 | <label for="mapboxtoken">Mapbox token</label> |
197 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
227 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
228 | + print $globalMapboxToken; |
|
229 | +} |
|
230 | +?>" /> |
|
198 | 231 | </p> |
199 | 232 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
200 | 233 | </div> |
@@ -202,7 +235,10 @@ discard block |
||
202 | 235 | <div id="google_data"> |
203 | 236 | <p> |
204 | 237 | <label for="googlekey">Google API key</label> |
205 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
238 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
239 | + print $globalGoogleAPIKey; |
|
240 | +} |
|
241 | +?>" /> |
|
206 | 242 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
207 | 243 | </p> |
208 | 244 | </div> |
@@ -210,7 +246,10 @@ discard block |
||
210 | 246 | <div id="bing_data"> |
211 | 247 | <p> |
212 | 248 | <label for="bingkey">Bing Map key</label> |
213 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
249 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
250 | + print $globalBingMapKey; |
|
251 | +} |
|
252 | +?>" /> |
|
214 | 253 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
215 | 254 | </p> |
216 | 255 | </div> |
@@ -218,7 +257,10 @@ discard block |
||
218 | 257 | <div id="mapquest_data"> |
219 | 258 | <p> |
220 | 259 | <label for="mapquestkey">MapQuest key</label> |
221 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
260 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
261 | + print $globalMapQuestKey; |
|
262 | +} |
|
263 | +?>" /> |
|
222 | 264 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
223 | 265 | </p> |
224 | 266 | </div> |
@@ -226,11 +268,17 @@ discard block |
||
226 | 268 | <div id="here_data"> |
227 | 269 | <p> |
228 | 270 | <label for="hereappid">Here App_Id</label> |
229 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
271 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
272 | + print $globalHereappId; |
|
273 | +} |
|
274 | +?>" /> |
|
230 | 275 | </p> |
231 | 276 | <p> |
232 | 277 | <label for="hereappcode">Here App_Code</label> |
233 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
278 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
279 | + print $globalHereappCode; |
|
280 | +} |
|
281 | +?>" /> |
|
234 | 282 | </p> |
235 | 283 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
236 | 284 | </div> |
@@ -238,7 +286,10 @@ discard block |
||
238 | 286 | <div id="openweathermap_data"> |
239 | 287 | <p> |
240 | 288 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
241 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
289 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
290 | + print $globalOpenWeatherMapKey; |
|
291 | +} |
|
292 | +?>" /> |
|
242 | 293 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
243 | 294 | </p> |
244 | 295 | </div> |
@@ -248,42 +299,86 @@ discard block |
||
248 | 299 | <legend>Coverage area</legend> |
249 | 300 | <p> |
250 | 301 | <label for="latitudemax">The maximum latitude (north)</label> |
251 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
302 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
303 | + print $globalLatitudeMax; |
|
304 | +} |
|
305 | +?>" /> |
|
252 | 306 | </p> |
253 | 307 | <p> |
254 | 308 | <label for="latitudemin">The minimum latitude (south)</label> |
255 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
309 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
310 | + print $globalLatitudeMin; |
|
311 | +} |
|
312 | +?>" /> |
|
256 | 313 | </p> |
257 | 314 | <p> |
258 | 315 | <label for="longitudemax">The maximum longitude (west)</label> |
259 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
316 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
317 | + print $globalLongitudeMax; |
|
318 | +} |
|
319 | +?>" /> |
|
260 | 320 | </p> |
261 | 321 | <p> |
262 | 322 | <label for="longitudemin">The minimum longitude (east)</label> |
263 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
323 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
324 | + print $globalLongitudeMin; |
|
325 | +} |
|
326 | +?>" /> |
|
264 | 327 | </p> |
265 | 328 | <p> |
266 | 329 | <label for="latitudecenter">The latitude center</label> |
267 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
330 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
331 | + print $globalCenterLatitude; |
|
332 | +} |
|
333 | +?>" /> |
|
268 | 334 | </p> |
269 | 335 | <p> |
270 | 336 | <label for="longitudecenter">The longitude center</label> |
271 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
337 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
338 | + print $globalCenterLongitude; |
|
339 | +} |
|
340 | +?>" /> |
|
272 | 341 | </p> |
273 | 342 | <p> |
274 | 343 | <label for="livezoom">Default Zoom on live map</label> |
275 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
344 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
345 | + print $globalLiveZoom; |
|
346 | +} else { |
|
347 | + print '9'; |
|
348 | +} |
|
349 | +?>" /> |
|
276 | 350 | </p> |
277 | 351 | <p> |
278 | 352 | <label for="squawk_country">Country for squawk usage</label> |
279 | 353 | <select name="squawk_country" id="squawk_country"> |
280 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
281 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
282 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
283 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
284 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
285 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
286 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
354 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
355 | + print ' selected '; |
|
356 | +} |
|
357 | +?>>UK</option> |
|
358 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
359 | + print ' selected '; |
|
360 | +} |
|
361 | +?>>NZ</option> |
|
362 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
363 | + print ' selected '; |
|
364 | +} |
|
365 | +?>>US</option> |
|
366 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
367 | + print ' selected '; |
|
368 | +} |
|
369 | +?>>AU</option> |
|
370 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
371 | + print ' selected '; |
|
372 | +} |
|
373 | +?>>NL</option> |
|
374 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
375 | + print ' selected '; |
|
376 | +} |
|
377 | +?>>FR</option> |
|
378 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
379 | + print ' selected '; |
|
380 | +} |
|
381 | +?>>TR</option> |
|
287 | 382 | </select> |
288 | 383 | </p> |
289 | 384 | </fieldset> |
@@ -292,15 +387,24 @@ discard block |
||
292 | 387 | <p><i>Only put in DB flights that are inside a circle</i></p> |
293 | 388 | <p> |
294 | 389 | <label for="latitude">Center latitude</label> |
295 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
390 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
391 | + echo $globalDistanceIgnore['latitude']; |
|
392 | +} |
|
393 | +?>" /> |
|
296 | 394 | </p> |
297 | 395 | <p> |
298 | 396 | <label for="longitude">Center longitude</label> |
299 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
397 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
398 | + echo $globalDistanceIgnore['longitude']; |
|
399 | +} |
|
400 | +?>" /> |
|
300 | 401 | </p> |
301 | 402 | <p> |
302 | 403 | <label for="Distance">Distance (in km)</label> |
303 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
404 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
405 | + echo $globalDistanceIgnore['distance']; |
|
406 | +} |
|
407 | +?>" /> |
|
304 | 408 | </p> |
305 | 409 | </fieldset> |
306 | 410 | <fieldset id="sourceloc"> |
@@ -409,11 +513,17 @@ discard block |
||
409 | 513 | <div id="flightaware_data"> |
410 | 514 | <p> |
411 | 515 | <label for="flightawareusername">FlightAware username</label> |
412 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
516 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
517 | + print $globalFlightAwareUsername; |
|
518 | +} |
|
519 | +?>" /> |
|
413 | 520 | </p> |
414 | 521 | <p> |
415 | 522 | <label for="flightawarepassword">FlightAware password/API key</label> |
416 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
523 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
524 | + print $globalFlightAwarePassword; |
|
525 | +} |
|
526 | +?>" /> |
|
417 | 527 | </p> |
418 | 528 | </div> |
419 | 529 | --> |
@@ -455,7 +565,10 @@ discard block |
||
455 | 565 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
456 | 566 | ?> |
457 | 567 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
458 | - <td><input type="number" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
568 | + <td><input type="number" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
569 | + print $source['port']; |
|
570 | +} |
|
571 | +?>" /></td> |
|
459 | 572 | <?php |
460 | 573 | } else { |
461 | 574 | $hostport = explode(':',$source['host']); |
@@ -474,31 +587,94 @@ discard block |
||
474 | 587 | ?> |
475 | 588 | <td> |
476 | 589 | <select name="format[]" id="format"> |
477 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
478 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
479 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
480 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
481 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
482 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
483 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
484 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
485 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
486 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
487 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
488 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
489 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
490 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
491 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
492 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
493 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
494 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
590 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
591 | + print 'selected'; |
|
592 | +} |
|
593 | +?>>Auto</option> |
|
594 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
595 | + print 'selected'; |
|
596 | +} |
|
597 | +?>>SBS</option> |
|
598 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
599 | + print 'selected'; |
|
600 | +} |
|
601 | +?>>TSV</option> |
|
602 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
603 | + print 'selected'; |
|
604 | +} |
|
605 | +?>>Raw</option> |
|
606 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
607 | + print 'selected'; |
|
608 | +} |
|
609 | +?>>APRS</option> |
|
610 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
611 | + print 'selected'; |
|
612 | +} |
|
613 | +?>>Radarcape deltadb.txt</option> |
|
614 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
615 | + print 'selected'; |
|
616 | +} |
|
617 | +?>>Vatsim</option> |
|
618 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
619 | + print 'selected'; |
|
620 | +} |
|
621 | +?>>Virtual Radar Server AircraftList.json</option> |
|
622 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
623 | + print 'selected'; |
|
624 | +} |
|
625 | +?>>Virtual Radar Server TCP</option> |
|
626 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
627 | + print 'selected'; |
|
628 | +} |
|
629 | +?>>phpVMS</option> |
|
630 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
631 | + print 'selected'; |
|
632 | +} |
|
633 | +?>>Virtual Airlines Manager</option> |
|
634 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
635 | + print 'selected'; |
|
636 | +} |
|
637 | +?>>IVAO</option> |
|
638 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
639 | + print 'selected'; |
|
640 | +} |
|
641 | +?>>FlightGear Multiplayer</option> |
|
642 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
643 | + print 'selected'; |
|
644 | +} |
|
645 | +?>>FlightGear Singleplayer</option> |
|
646 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
647 | + print 'selected'; |
|
648 | +} |
|
649 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
650 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
651 | + print 'selected'; |
|
652 | +} |
|
653 | +?>>ACARS SBS-3 over TCP</option> |
|
654 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
655 | + print 'selected'; |
|
656 | +} |
|
657 | +?>>NMEA AIS over TCP</option> |
|
658 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
659 | + print 'selected'; |
|
660 | +} |
|
661 | +?>>AirWhere website</option> |
|
495 | 662 | </select> |
496 | 663 | </td> |
497 | 664 | <td> |
498 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
665 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
666 | + print $source['name']; |
|
667 | +} |
|
668 | +?>" /> |
|
499 | 669 | </td> |
500 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
501 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
670 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
671 | + print 'checked'; |
|
672 | +} |
|
673 | +?> /></td> |
|
674 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
675 | + print 'checked'; |
|
676 | +} |
|
677 | +?> /></td> |
|
502 | 678 | <td> |
503 | 679 | <select name="timezone[]" id="timezone"> |
504 | 680 | <?php |
@@ -508,7 +684,9 @@ discard block |
||
508 | 684 | print '<option selected>'.$timezone.'</option>'; |
509 | 685 | } elseif (!isset($source['timezone']) && $timezone == 'UTC') { |
510 | 686 | print '<option selected>'.$timezone.'</option>'; |
511 | - } else print '<option>'.$timezone.'</option>'; |
|
687 | + } else { |
|
688 | + print '<option>'.$timezone.'</option>'; |
|
689 | + } |
|
512 | 690 | } |
513 | 691 | ?> |
514 | 692 | </select> |
@@ -556,7 +734,9 @@ discard block |
||
556 | 734 | foreach($timezonelist as $timezone){ |
557 | 735 | if ($timezone == 'UTC') { |
558 | 736 | print '<option selected>'.$timezone.'</option>'; |
559 | - } else print '<option>'.$timezone.'</option>'; |
|
737 | + } else { |
|
738 | + print '<option>'.$timezone.'</option>'; |
|
739 | + } |
|
560 | 740 | } |
561 | 741 | ?> |
562 | 742 | </select> |
@@ -577,11 +757,17 @@ discard block |
||
577 | 757 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
578 | 758 | <p> |
579 | 759 | <label for="acarshost">ACARS UDP host</label> |
580 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
760 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
761 | + print $globalACARSHost; |
|
762 | +} |
|
763 | +?>" /> |
|
581 | 764 | </p> |
582 | 765 | <p> |
583 | 766 | <label for="acarsport">ACARS UDP port</label> |
584 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
767 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
768 | + print $globalACARSPort; |
|
769 | +} |
|
770 | +?>" /> |
|
585 | 771 | </p> |
586 | 772 | </fieldset> |
587 | 773 | </div> |
@@ -661,13 +847,19 @@ discard block |
||
661 | 847 | <div id="schedules_options"> |
662 | 848 | <p> |
663 | 849 | <label for="britishairways">British Airways API Key</label> |
664 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
850 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
851 | + print $globalBritishAirwaysKey; |
|
852 | +} |
|
853 | +?>" /> |
|
665 | 854 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
666 | 855 | </p> |
667 | 856 | <!-- |
668 | 857 | <p> |
669 | 858 | <label for="transavia">Transavia Test API Consumer Key</label> |
670 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
859 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
860 | + print $globalTransaviaKey; |
|
861 | +} |
|
862 | +?>" /> |
|
671 | 863 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
672 | 864 | </p> |
673 | 865 | --> |
@@ -676,10 +868,16 @@ discard block |
||
676 | 868 | <b>Lufthansa API Key</b> |
677 | 869 | <p> |
678 | 870 | <label for="lufthansakey">Key</label> |
679 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
871 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
872 | + print $globalLufthansaKey['key']; |
|
873 | +} |
|
874 | +?>" /> |
|
680 | 875 | </p><p> |
681 | 876 | <label for="lufthansasecret">Secret</label> |
682 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
877 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
878 | + print $globalLufthansaKey['secret']; |
|
879 | +} |
|
880 | +?>" /> |
|
683 | 881 | </p> |
684 | 882 | </div> |
685 | 883 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -699,7 +897,10 @@ discard block |
||
699 | 897 | </p> |
700 | 898 | <p> |
701 | 899 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
702 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
900 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
901 | + print $globalNOTAMSource; |
|
902 | +} |
|
903 | +?>" /> |
|
703 | 904 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
704 | 905 | </p> |
705 | 906 | <br /> |
@@ -715,14 +916,20 @@ discard block |
||
715 | 916 | <div id="metarsrc"> |
716 | 917 | <p> |
717 | 918 | <label for="metarsource">URL of your METAR source</label> |
718 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
919 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
920 | + print $globalMETARurl; |
|
921 | +} |
|
922 | +?>" /> |
|
719 | 923 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
720 | 924 | </p> |
721 | 925 | </div> |
722 | 926 | <br /> |
723 | 927 | <p> |
724 | 928 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
725 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
929 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
930 | + print $globalBitlyAccessToken; |
|
931 | +} |
|
932 | +?>" /> |
|
726 | 933 | </p> |
727 | 934 | <br /> |
728 | 935 | <p> |
@@ -738,11 +945,26 @@ discard block |
||
738 | 945 | <p> |
739 | 946 | <label for="geoid_source">Geoid Source</label> |
740 | 947 | <select name="geoid_source" id="geoid_source"> |
741 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
742 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
743 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
744 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
745 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
948 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
949 | + print ' selected="selected"'; |
|
950 | +} |
|
951 | +?>>EGM96 15' (2.1MB)</option> |
|
952 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
953 | + print ' selected="selected"'; |
|
954 | +} |
|
955 | +?>>EGM96 5' (19MB)</option> |
|
956 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
957 | + print ' selected="selected"'; |
|
958 | +} |
|
959 | +?>>EGM2008 5' (19MB)</option> |
|
960 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
961 | + print ' selected="selected"'; |
|
962 | +} |
|
963 | +?>>EGM2008 2.5' (75MB)</option> |
|
964 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
965 | + print ' selected="selected"'; |
|
966 | +} |
|
967 | +?>>EGM2008 1' (470MB)</option> |
|
746 | 968 | </select> |
747 | 969 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
748 | 970 | </p> |
@@ -759,7 +981,12 @@ discard block |
||
759 | 981 | </p> |
760 | 982 | <p> |
761 | 983 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
762 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" /> |
|
984 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
985 | + print $globalArchiveMonths; |
|
986 | +} else { |
|
987 | + echo '0'; |
|
988 | +} |
|
989 | +?>" /> |
|
763 | 990 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
764 | 991 | </p> |
765 | 992 | <p> |
@@ -769,12 +996,22 @@ discard block |
||
769 | 996 | </p> |
770 | 997 | <p> |
771 | 998 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
772 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" /> |
|
999 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
1000 | + print $globalArchiveKeepMonths; |
|
1001 | +} else { |
|
1002 | + echo '0'; |
|
1003 | +} |
|
1004 | +?>" /> |
|
773 | 1005 | <p class="help-block">0 to disable</p> |
774 | 1006 | </p> |
775 | 1007 | <p> |
776 | 1008 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
777 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" /> |
|
1009 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
1010 | + print $globalArchiveKeepTrackMonths; |
|
1011 | +} else { |
|
1012 | + echo '0'; |
|
1013 | +} |
|
1014 | +?>" /> |
|
778 | 1015 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
779 | 1016 | </p> |
780 | 1017 | <br /> |
@@ -784,7 +1021,12 @@ discard block |
||
784 | 1021 | <p class="help-block">Uncheck if the script is running as cron job</p> |
785 | 1022 | <div id="cronends"> |
786 | 1023 | <label for="cronend">Run script for xx seconds</label> |
787 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
1024 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
1025 | + print $globalCronEnd; |
|
1026 | +} else { |
|
1027 | + print '0'; |
|
1028 | +} |
|
1029 | +?>" /> |
|
788 | 1030 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
789 | 1031 | </div> |
790 | 1032 | </p> |
@@ -837,15 +1079,30 @@ discard block |
||
837 | 1079 | <br /> |
838 | 1080 | <p> |
839 | 1081 | <label for="refresh">Show flights detected since xxx seconds</label> |
840 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1082 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1083 | + echo $globalLiveInterval; |
|
1084 | +} else { |
|
1085 | + echo '200'; |
|
1086 | +} |
|
1087 | +?>" /> |
|
841 | 1088 | </p> |
842 | 1089 | <p> |
843 | 1090 | <label for="maprefresh">Live map refresh (in seconds)</label> |
844 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1091 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1092 | + echo $globalMapRefresh; |
|
1093 | +} else { |
|
1094 | + echo '30'; |
|
1095 | +} |
|
1096 | +?>" /> |
|
845 | 1097 | </p> |
846 | 1098 | <p> |
847 | 1099 | <label for="mapidle">Map idle timeout (in minutes)</label> |
848 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1100 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1101 | + echo $globalMapIdleTimeout; |
|
1102 | +} else { |
|
1103 | + echo '30'; |
|
1104 | +} |
|
1105 | +?>" /> |
|
849 | 1106 | <p class="help-block">0 to disable</p> |
850 | 1107 | </p> |
851 | 1108 | <p> |
@@ -860,12 +1117,20 @@ discard block |
||
860 | 1117 | <br /> |
861 | 1118 | <p> |
862 | 1119 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
863 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1120 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1121 | + echo $globalClosestMinDist; |
|
1122 | +} else { |
|
1123 | + echo '50'; |
|
1124 | +} |
|
1125 | +?>" /> |
|
864 | 1126 | </p> |
865 | 1127 | <br /> |
866 | 1128 | <p> |
867 | 1129 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
868 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1130 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1131 | + echo $globalAircraftSize; |
|
1132 | +} |
|
1133 | +?>" /> |
|
869 | 1134 | </p> |
870 | 1135 | <br /> |
871 | 1136 | <p> |
@@ -878,7 +1143,12 @@ discard block |
||
878 | 1143 | if (extension_loaded('gd') && function_exists('gd_info')) { |
879 | 1144 | ?> |
880 | 1145 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
881 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1146 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1147 | + echo $globalAircraftIconColor; |
|
1148 | +} else { |
|
1149 | + echo '1a3151'; |
|
1150 | +} |
|
1151 | +?>" /> |
|
882 | 1152 | <?php |
883 | 1153 | if (!is_writable('../cache')) { |
884 | 1154 | ?> |
@@ -896,14 +1166,27 @@ discard block |
||
896 | 1166 | <p> |
897 | 1167 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
898 | 1168 | <div class="range"> |
899 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
900 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1169 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1170 | + echo $globalAirportZoom; |
|
1171 | +} else { |
|
1172 | + echo '7'; |
|
1173 | +} |
|
1174 | +?>" /> |
|
1175 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1176 | + echo $globalAirportZoom; |
|
1177 | +} else { |
|
1178 | + echo '7'; |
|
1179 | +} |
|
1180 | +?></output> |
|
901 | 1181 | </div> |
902 | 1182 | </p> |
903 | 1183 | <br /> |
904 | 1184 | <p> |
905 | 1185 | <label for="customcss">Custom CSS web path</label> |
906 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1186 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1187 | + echo $globalCustomCSS; |
|
1188 | +} |
|
1189 | +?>" /> |
|
907 | 1190 | </p> |
908 | 1191 | </fieldset> |
909 | 1192 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -930,8 +1213,12 @@ discard block |
||
930 | 1213 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
931 | 1214 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
932 | 1215 | |
933 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
934 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1216 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1217 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1218 | + } |
|
1219 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1220 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1221 | + } |
|
935 | 1222 | |
936 | 1223 | $_SESSION['database_root'] = $dbroot; |
937 | 1224 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -999,15 +1286,23 @@ discard block |
||
999 | 1286 | $source_city = $_POST['source_city']; |
1000 | 1287 | $source_country = $_POST['source_country']; |
1001 | 1288 | $source_ref = $_POST['source_ref']; |
1002 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
1003 | - else $source_id = array(); |
|
1289 | + if (isset($source_id)) { |
|
1290 | + $source_id = $_POST['source_id']; |
|
1291 | + } else { |
|
1292 | + $source_id = array(); |
|
1293 | + } |
|
1004 | 1294 | |
1005 | 1295 | $sources = array(); |
1006 | 1296 | foreach ($source_name as $keys => $name) { |
1007 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1008 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1297 | + if (isset($source_id[$keys])) { |
|
1298 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1299 | + } else { |
|
1300 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1301 | + } |
|
1302 | + } |
|
1303 | + if (count($sources) > 0) { |
|
1304 | + $_SESSION['sources'] = $sources; |
|
1009 | 1305 | } |
1010 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
1011 | 1306 | |
1012 | 1307 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1013 | 1308 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1028,14 +1323,23 @@ discard block |
||
1028 | 1323 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
1029 | 1324 | |
1030 | 1325 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
1031 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1032 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1326 | + if ($globalaircraft == 'aircraft') { |
|
1327 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1328 | + } else { |
|
1329 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1330 | + } |
|
1033 | 1331 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
1034 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1035 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1332 | + if ($globaltracker == 'tracker') { |
|
1333 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1334 | + } else { |
|
1335 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1336 | + } |
|
1036 | 1337 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
1037 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1038 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1338 | + if ($globalmarine == 'marine') { |
|
1339 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1340 | + } else { |
|
1341 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1342 | + } |
|
1039 | 1343 | |
1040 | 1344 | /* |
1041 | 1345 | $globalSBS1Hosts = array(); |
@@ -1057,19 +1361,35 @@ discard block |
||
1057 | 1361 | $name = $_POST['name']; |
1058 | 1362 | $format = $_POST['format']; |
1059 | 1363 | $timezone = $_POST['timezone']; |
1060 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1061 | - else $sourcestats = array(); |
|
1062 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1063 | - else $noarchive = array(); |
|
1364 | + if (isset($_POST['sourcestats'])) { |
|
1365 | + $sourcestats = $_POST['sourcestats']; |
|
1366 | + } else { |
|
1367 | + $sourcestats = array(); |
|
1368 | + } |
|
1369 | + if (isset($_POST['noarchive'])) { |
|
1370 | + $noarchive = $_POST['noarchive']; |
|
1371 | + } else { |
|
1372 | + $noarchive = array(); |
|
1373 | + } |
|
1064 | 1374 | $gSources = array(); |
1065 | 1375 | $forcepilots = false; |
1066 | 1376 | foreach ($host as $key => $h) { |
1067 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1068 | - else $cov = 'FALSE'; |
|
1069 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1070 | - else $arch = 'FALSE'; |
|
1071 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezone[$key]); |
|
1072 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1377 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1378 | + $cov = 'TRUE'; |
|
1379 | + } else { |
|
1380 | + $cov = 'FALSE'; |
|
1381 | + } |
|
1382 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1383 | + $arch = 'TRUE'; |
|
1384 | + } else { |
|
1385 | + $arch = 'FALSE'; |
|
1386 | + } |
|
1387 | + if ($h != '') { |
|
1388 | + $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezone[$key]); |
|
1389 | + } |
|
1390 | + if ($format[$key] == 'airwhere') { |
|
1391 | + $forcepilots = true; |
|
1392 | + } |
|
1073 | 1393 | } |
1074 | 1394 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1075 | 1395 | |
@@ -1097,7 +1417,9 @@ discard block |
||
1097 | 1417 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1098 | 1418 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1099 | 1419 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1100 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1420 | + } else { |
|
1421 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1422 | + } |
|
1101 | 1423 | |
1102 | 1424 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1103 | 1425 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1136,7 +1458,9 @@ discard block |
||
1136 | 1458 | |
1137 | 1459 | // Create in settings.php keys not yet configurable if not already here |
1138 | 1460 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1139 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1461 | + if (!isset($globalDebug)) { |
|
1462 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1463 | + } |
|
1140 | 1464 | |
1141 | 1465 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1142 | 1466 | if ($resetyearstats == 'resetyearstats') { |
@@ -1173,37 +1497,56 @@ discard block |
||
1173 | 1497 | } |
1174 | 1498 | */ |
1175 | 1499 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1176 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1177 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1178 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1179 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1500 | + if ($globalsbs == 'sbs') { |
|
1501 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1502 | + } else { |
|
1503 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1504 | + } |
|
1505 | + if ($globalaprs == 'aprs') { |
|
1506 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1507 | + } else { |
|
1508 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1509 | + } |
|
1180 | 1510 | $va = false; |
1181 | 1511 | if ($globalivao == 'ivao') { |
1182 | 1512 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1183 | 1513 | $va = true; |
1184 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1514 | + } else { |
|
1515 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1516 | + } |
|
1185 | 1517 | if ($globalvatsim == 'vatsim') { |
1186 | 1518 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1187 | 1519 | $va = true; |
1188 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1520 | + } else { |
|
1521 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1522 | + } |
|
1189 | 1523 | if ($globalphpvms == 'phpvms') { |
1190 | 1524 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1191 | 1525 | $va = true; |
1192 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1526 | + } else { |
|
1527 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1528 | + } |
|
1193 | 1529 | if ($globalvam == 'vam') { |
1194 | 1530 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1195 | 1531 | $va = true; |
1196 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1532 | + } else { |
|
1533 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1534 | + } |
|
1197 | 1535 | if ($va) { |
1198 | 1536 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1199 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1537 | + } else { |
|
1538 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1539 | + } |
|
1200 | 1540 | if ($globalva == 'va' || $va) { |
1201 | 1541 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1202 | 1542 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1203 | 1543 | } else { |
1204 | 1544 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1205 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1206 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1545 | + if ($forcepilots) { |
|
1546 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1547 | + } else { |
|
1548 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1549 | + } |
|
1207 | 1550 | } |
1208 | 1551 | |
1209 | 1552 | |
@@ -1379,7 +1722,9 @@ discard block |
||
1379 | 1722 | $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
1380 | 1723 | } |
1381 | 1724 | |
1382 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1725 | + if (!isset($globalTransaction)) { |
|
1726 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1727 | + } |
|
1383 | 1728 | |
1384 | 1729 | // Set some defaults values... |
1385 | 1730 | if (!isset($globalAircraftImageSources)) { |
@@ -1394,15 +1739,23 @@ discard block |
||
1394 | 1739 | |
1395 | 1740 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1396 | 1741 | |
1397 | - if ($error == '') settings::modify_settings($settings); |
|
1398 | - if ($error == '') settings::comment_settings($settings_comment); |
|
1742 | + if ($error == '') { |
|
1743 | + settings::modify_settings($settings); |
|
1744 | + } |
|
1745 | + if ($error == '') { |
|
1746 | + settings::comment_settings($settings_comment); |
|
1747 | + } |
|
1399 | 1748 | if ($error != '') { |
1400 | 1749 | print '<div class="info column">'.$error.'</div>'; |
1401 | 1750 | require('../footer.php'); |
1402 | 1751 | exit; |
1403 | 1752 | } else { |
1404 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1405 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
1753 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
1754 | + $_SESSION['waypoints'] = 1; |
|
1755 | + } |
|
1756 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
1757 | + $_SESSION['owner'] = 1; |
|
1758 | + } |
|
1406 | 1759 | if (isset($_POST['createdb'])) { |
1407 | 1760 | $_SESSION['install'] = 'database_create'; |
1408 | 1761 | } else { |
@@ -1443,10 +1796,18 @@ discard block |
||
1443 | 1796 | $popw = false; |
1444 | 1797 | foreach ($_SESSION['done'] as $done) { |
1445 | 1798 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1446 | - if ($done == 'Create database') $pop = true; |
|
1447 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1448 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1449 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1799 | + if ($done == 'Create database') { |
|
1800 | + $pop = true; |
|
1801 | + } |
|
1802 | + if ($_SESSION['install'] == 'database_create') { |
|
1803 | + $pop = true; |
|
1804 | + } |
|
1805 | + if ($_SESSION['install'] == 'database_import') { |
|
1806 | + $popi = true; |
|
1807 | + } |
|
1808 | + if ($_SESSION['install'] == 'waypoints') { |
|
1809 | + $popw = true; |
|
1810 | + } |
|
1450 | 1811 | } |
1451 | 1812 | if ($pop) { |
1452 | 1813 | sleep(5); |
@@ -1457,7 +1818,9 @@ discard block |
||
1457 | 1818 | } else if ($popw) { |
1458 | 1819 | sleep(5); |
1459 | 1820 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1460 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1821 | + } else { |
|
1822 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1823 | + } |
|
1461 | 1824 | print '</div></ul>'; |
1462 | 1825 | print '<div id="error"></div>'; |
1463 | 1826 | /* foreach ($_SESSION['done'] as $done) { |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | private $openedFiles = []; |
29 | 29 | |
30 | 30 | public function __construct($htgFilesDestination = '', $resolution = 3) { |
31 | - if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
31 | + if ($htgFilesDestination == '') { |
|
32 | + $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
33 | + } |
|
32 | 34 | $this->htgFilesDestination = $htgFilesDestination; |
33 | 35 | $this->resolution = $resolution; |
34 | 36 | switch ($resolution) { |
@@ -171,16 +173,26 @@ discard block |
||
171 | 173 | $fileName = "N{$N}E{$E}.hgt"; |
172 | 174 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
173 | 175 | $Common = new Common(); |
174 | - if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
|
176 | + if ($debug) { |
|
177 | + echo 'Downloading '.$fileName.'.gz ...'; |
|
178 | + } |
|
175 | 179 | $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
176 | 180 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
177 | - if ($debug) echo "File '{$fileName}.gz' not exists."; |
|
181 | + if ($debug) { |
|
182 | + echo "File '{$fileName}.gz' not exists."; |
|
183 | + } |
|
178 | 184 | return false; |
179 | 185 | } |
180 | - if ($debug) echo 'Done'."\n"; |
|
181 | - if ($debug) echo 'Decompress '.$fileName.' ....'; |
|
186 | + if ($debug) { |
|
187 | + echo 'Done'."\n"; |
|
188 | + } |
|
189 | + if ($debug) { |
|
190 | + echo 'Decompress '.$fileName.' ....'; |
|
191 | + } |
|
182 | 192 | $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
183 | - if ($debug) echo 'Done'."\n"; |
|
193 | + if ($debug) { |
|
194 | + echo 'Done'."\n"; |
|
195 | + } |
|
184 | 196 | unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
185 | 197 | } |
186 | 198 | return true; |
@@ -38,8 +38,11 @@ discard block |
||
38 | 38 | global $globalGeoidSource; |
39 | 39 | //if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm'; |
40 | 40 | if ($name == '') { |
41 | - if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
42 | - else $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
41 | + if (isset($globalGeoidSource) && $globalGeoidSource != '') { |
|
42 | + $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
43 | + } else { |
|
44 | + $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
45 | + } |
|
43 | 46 | } |
44 | 47 | |
45 | 48 | $f = @fopen($name,"r"); |
@@ -156,7 +159,9 @@ discard block |
||
156 | 159 | } |
157 | 160 | } |
158 | 161 | $this->t = $t; |
159 | - } else $t = $this->t; |
|
162 | + } else { |
|
163 | + $t = $this->t; |
|
164 | + } |
|
160 | 165 | if (!($cubic)) { |
161 | 166 | $a = (((1 - $fx) * $this->v00) + ($fx * $this->v01)); |
162 | 167 | $b = (((1 - $fx) * $this->v10) + ($fx * $this->v11)); |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | try { |
53 | 53 | $GeoidClass = new GeoidHeight(); |
54 | 54 | } catch(Exception $e) { |
55 | - if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php \n"; |
|
55 | + if ($globalDebug) { |
|
56 | + echo "Can't calculate geoid, check that you downloaded it via update_db.php \n"; |
|
57 | + } |
|
56 | 58 | $GeoidClass = FALSE; |
57 | 59 | } |
58 | 60 | } |
@@ -71,7 +73,9 @@ discard block |
||
71 | 73 | $dbc = $this->db; |
72 | 74 | $this->all_flights[$id]['schedule_check'] = true; |
73 | 75 | if ($globalSchedulesFetch) { |
74 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
76 | + if ($globalDebug) { |
|
77 | + echo 'Getting schedule info...'."\n"; |
|
78 | + } |
|
75 | 79 | $Spotter = new Spotter($dbc); |
76 | 80 | $Schedule = new Schedule($dbc); |
77 | 81 | $Translation = new Translation($dbc); |
@@ -82,7 +86,9 @@ discard block |
||
82 | 86 | if ($Schedule->checkSchedule($operator) == 0) { |
83 | 87 | $schedule = $Schedule->fetchSchedule($operator); |
84 | 88 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
85 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
89 | + if ($globalDebug) { |
|
90 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
91 | + } |
|
86 | 92 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
87 | 93 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
88 | 94 | // Should also check if route schedule = route from DB |
@@ -91,7 +97,9 @@ discard block |
||
91 | 97 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
92 | 98 | if (trim($airport_icao) != '') { |
93 | 99 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
94 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
100 | + if ($globalDebug) { |
|
101 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
102 | + } |
|
95 | 103 | } |
96 | 104 | } |
97 | 105 | } |
@@ -100,17 +108,25 @@ discard block |
||
100 | 108 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
101 | 109 | if (trim($airport_icao) != '') { |
102 | 110 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
103 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
111 | + if ($globalDebug) { |
|
112 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
113 | + } |
|
104 | 114 | } |
105 | 115 | } |
106 | 116 | } |
107 | 117 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
108 | 118 | } |
109 | - } else $scheduleexist = true; |
|
110 | - } else $scheduleexist = true; |
|
119 | + } else { |
|
120 | + $scheduleexist = true; |
|
121 | + } |
|
122 | + } else { |
|
123 | + $scheduleexist = true; |
|
124 | + } |
|
111 | 125 | // close connection, at least one way will work ? |
112 | 126 | if ($scheduleexist) { |
113 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
127 | + if ($globalDebug) { |
|
128 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
129 | + } |
|
114 | 130 | $sch = $Schedule->getSchedule($operator); |
115 | 131 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
116 | 132 | } |
@@ -132,14 +148,18 @@ discard block |
||
132 | 148 | |
133 | 149 | public function checkAll() { |
134 | 150 | global $globalDebug, $globalNoImport; |
135 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
151 | + if ($globalDebug) { |
|
152 | + echo "Update last seen flights data...\n"; |
|
153 | + } |
|
136 | 154 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
137 | 155 | foreach ($this->all_flights as $key => $flight) { |
138 | 156 | if (isset($this->all_flights[$key]['id'])) { |
139 | 157 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
140 | 158 | $Spotter = new Spotter($this->db); |
141 | 159 | $real_arrival = $this->arrival($key); |
142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
160 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) { |
|
161 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
162 | + } |
|
143 | 163 | } |
144 | 164 | } |
145 | 165 | } |
@@ -147,24 +167,32 @@ discard block |
||
147 | 167 | |
148 | 168 | public function arrival($key) { |
149 | 169 | global $globalClosestMinDist, $globalDebug; |
150 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
170 | + if ($globalDebug) { |
|
171 | + echo 'Update arrival...'."\n"; |
|
172 | + } |
|
151 | 173 | $Spotter = new Spotter($this->db); |
152 | 174 | $airport_icao = ''; |
153 | 175 | $airport_time = ''; |
154 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
176 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
177 | + $globalClosestMinDist = 50; |
|
178 | + } |
|
155 | 179 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
156 | 180 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
157 | 181 | if (isset($closestAirports[0])) { |
158 | 182 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
159 | 183 | $airport_icao = $closestAirports[0]['icao']; |
160 | 184 | $airport_time = $this->all_flights[$key]['datetime']; |
161 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
185 | + if ($globalDebug) { |
|
186 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
187 | + } |
|
162 | 188 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
163 | 189 | foreach ($closestAirports as $airport) { |
164 | 190 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
165 | 191 | $airport_icao = $airport['icao']; |
166 | 192 | $airport_time = $this->all_flights[$key]['datetime']; |
167 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
193 | + if ($globalDebug) { |
|
194 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
195 | + } |
|
168 | 196 | break; |
169 | 197 | } |
170 | 198 | } |
@@ -172,14 +200,20 @@ discard block |
||
172 | 200 | $airport_icao = $closestAirports[0]['icao']; |
173 | 201 | $airport_time = $this->all_flights[$key]['datetime']; |
174 | 202 | } else { |
175 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
203 | + if ($globalDebug) { |
|
204 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
205 | + } |
|
176 | 206 | } |
177 | 207 | } else { |
178 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
208 | + if ($globalDebug) { |
|
209 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
210 | + } |
|
179 | 211 | } |
180 | 212 | |
181 | 213 | } else { |
182 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
214 | + if ($globalDebug) { |
|
215 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
216 | + } |
|
183 | 217 | } |
184 | 218 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
185 | 219 | } |
@@ -189,7 +223,9 @@ discard block |
||
189 | 223 | public function del() { |
190 | 224 | global $globalDebug, $globalNoImport, $globalNoDB; |
191 | 225 | // Delete old infos |
192 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
226 | + if ($globalDebug) { |
|
227 | + echo 'Delete old values and update latest data...'."\n"; |
|
228 | + } |
|
193 | 229 | foreach ($this->all_flights as $key => $flight) { |
194 | 230 | if (isset($flight['lastupdate'])) { |
195 | 231 | if ($flight['lastupdate'] < (time()-5900)) { |
@@ -203,13 +239,17 @@ discard block |
||
203 | 239 | global $globalDebug, $globalNoImport, $globalNoDB; |
204 | 240 | // Delete old infos |
205 | 241 | if (isset($this->all_flights[$key]['id'])) { |
206 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
242 | + if ($globalDebug) { |
|
243 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
244 | + } |
|
207 | 245 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
208 | 246 | $real_arrival = $this->arrival($key); |
209 | 247 | $Spotter = new Spotter($this->db); |
210 | 248 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
211 | 249 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
212 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
250 | + if ($globalDebug && $result != 'success') { |
|
251 | + echo '!!! ERROR : '.$result."\n"; |
|
252 | + } |
|
213 | 253 | } |
214 | 254 | } |
215 | 255 | } |
@@ -219,9 +259,13 @@ discard block |
||
219 | 259 | public function add($line) { |
220 | 260 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass; |
221 | 261 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
222 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
223 | - if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000; |
|
224 | -/* |
|
262 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
263 | + $globalCoordMinChange = '0.02'; |
|
264 | + } |
|
265 | + if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') { |
|
266 | + $globalAircraftMaxUpdate = 3000; |
|
267 | + } |
|
268 | + /* |
|
225 | 269 | $Spotter = new Spotter(); |
226 | 270 | $dbc = $Spotter->db; |
227 | 271 | $SpotterLive = new SpotterLive($dbc); |
@@ -243,19 +287,28 @@ discard block |
||
243 | 287 | // SBS format is CSV format |
244 | 288 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
245 | 289 | //print_r($line); |
246 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
290 | + if (isset($line['hex'])) { |
|
291 | + $line['hex'] = strtoupper($line['hex']); |
|
292 | + } |
|
247 | 293 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
248 | 294 | |
249 | 295 | // Increment message number |
250 | 296 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
251 | 297 | $current_date = date('Y-m-d'); |
252 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
253 | - else $source = ''; |
|
254 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
298 | + if (isset($line['source_name'])) { |
|
299 | + $source = $line['source_name']; |
|
300 | + } else { |
|
301 | + $source = ''; |
|
302 | + } |
|
303 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
304 | + $source = $line['format_source']; |
|
305 | + } |
|
255 | 306 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
256 | 307 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
257 | 308 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
258 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
309 | + } else { |
|
310 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
311 | + } |
|
259 | 312 | } |
260 | 313 | |
261 | 314 | /* |
@@ -271,23 +324,38 @@ discard block |
||
271 | 324 | //$this->db = $dbc; |
272 | 325 | |
273 | 326 | //$hex = trim($line['hex']); |
274 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
275 | - else $id = trim($line['id']); |
|
327 | + if (!isset($line['id'])) { |
|
328 | + $id = trim($line['hex']); |
|
329 | + } else { |
|
330 | + $id = trim($line['id']); |
|
331 | + } |
|
276 | 332 | |
277 | 333 | if (!isset($this->all_flights[$id])) { |
278 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
334 | + if ($globalDebug) { |
|
335 | + echo 'New flight...'."\n"; |
|
336 | + } |
|
279 | 337 | $this->all_flights[$id] = array(); |
280 | 338 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
281 | 339 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
340 | + if (isset($globalDaemon) && $globalDaemon === FALSE) { |
|
341 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
342 | + } |
|
283 | 343 | if (!isset($line['id'])) { |
284 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
285 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
344 | + if (!isset($globalDaemon)) { |
|
345 | + $globalDaemon = TRUE; |
|
346 | + } |
|
347 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
286 | 348 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
349 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
350 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
351 | + } |
|
288 | 352 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
290 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
353 | + } else { |
|
354 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
355 | + } |
|
356 | + if ($globalAllFlights !== FALSE) { |
|
357 | + $dataFound = true; |
|
358 | + } |
|
291 | 359 | } |
292 | 360 | if (isset($line['source_type']) && $line['source_type'] != '') { |
293 | 361 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
@@ -309,12 +377,20 @@ discard block |
||
309 | 377 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
310 | 378 | } |
311 | 379 | $Spotter->db = null; |
312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
380 | + if ($globalDebugTimeElapsed) { |
|
381 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
382 | + } |
|
383 | + if ($aircraft_icao != '') { |
|
384 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
385 | + } |
|
314 | 386 | } |
315 | 387 | } |
316 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
317 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
388 | + if ($globalAllFlights !== FALSE) { |
|
389 | + $dataFound = true; |
|
390 | + } |
|
391 | + if ($globalDebug) { |
|
392 | + echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
393 | + } |
|
318 | 394 | } |
319 | 395 | if (isset($line['id']) && !isset($line['hex'])) { |
320 | 396 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
@@ -322,7 +398,9 @@ discard block |
||
322 | 398 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
323 | 399 | $icao = $line['aircraft_icao']; |
324 | 400 | $Spotter = new Spotter($this->db); |
325 | - if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
401 | + if (isset($Spotter->aircraft_correct_icaotype[$icao])) { |
|
402 | + $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
403 | + } |
|
326 | 404 | $Spotter->db = null; |
327 | 405 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
328 | 406 | } |
@@ -332,15 +410,24 @@ discard block |
||
332 | 410 | $Spotter = new Spotter($this->db); |
333 | 411 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
334 | 412 | $Spotter->db = null; |
335 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
413 | + if ($aircraft_icao != '') { |
|
414 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
415 | + } |
|
336 | 416 | } |
337 | 417 | } |
338 | 418 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
339 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
340 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
341 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
342 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
343 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
419 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
420 | + $aircraft_icao = 'GLID'; |
|
421 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
422 | + $aircraft_icao = 'UHEL'; |
|
423 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
424 | + $aircraft_icao = 'TOWPLANE'; |
|
425 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
426 | + $aircraft_icao = 'POWAIRC'; |
|
427 | + } |
|
428 | + if (isset($aircraft_icao)) { |
|
429 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
430 | + } |
|
344 | 431 | } |
345 | 432 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
346 | 433 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
@@ -350,8 +437,11 @@ discard block |
||
350 | 437 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
351 | 438 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
352 | 439 | } else { |
353 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
354 | - elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
440 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
441 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
442 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
443 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
444 | + } |
|
355 | 445 | /* |
356 | 446 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
357 | 447 | print_r($this->all_flights[$id]); |
@@ -360,16 +450,22 @@ discard block |
||
360 | 450 | return ''; |
361 | 451 | } |
362 | 452 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
363 | - if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
|
453 | + if ($globalDebug) { |
|
454 | + echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
|
455 | + } |
|
364 | 456 | return ''; |
365 | 457 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
366 | - if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
|
458 | + if ($globalDebug) { |
|
459 | + echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
|
460 | + } |
|
367 | 461 | return ''; |
368 | 462 | } elseif (!isset($line['datetime'])) { |
369 | 463 | date_default_timezone_set('UTC'); |
370 | 464 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
371 | 465 | } else { |
372 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
466 | + if ($globalDebug) { |
|
467 | + echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
468 | + } |
|
373 | 469 | return ''; |
374 | 470 | } |
375 | 471 | |
@@ -390,30 +486,48 @@ discard block |
||
390 | 486 | |
391 | 487 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
392 | 488 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
393 | - if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
489 | + if ($globalDebug) { |
|
490 | + echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
491 | + } |
|
394 | 492 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
395 | 493 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
396 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
397 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
398 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
494 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
495 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
496 | + } elseif (isset($line['id'])) { |
|
497 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
498 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
500 | + } |
|
399 | 501 | } else { |
400 | 502 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
401 | 503 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
402 | 504 | $timeelapsed = microtime(true); |
403 | 505 | $Spotter = new Spotter($this->db); |
404 | 506 | $fromsource = NULL; |
405 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
406 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
407 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
408 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
409 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
507 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
508 | + $fromsource = $globalAirlinesSource; |
|
509 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
510 | + $fromsource = 'vatsim'; |
|
511 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
512 | + $fromsource = 'ivao'; |
|
513 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
514 | + $fromsource = 'vatsim'; |
|
515 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
516 | + $fromsource = 'ivao'; |
|
517 | + } |
|
410 | 518 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
411 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
519 | + if ($globalDebug && $result != 'success') { |
|
520 | + echo '!!! ERROR : '.$result."\n"; |
|
521 | + } |
|
412 | 522 | $Spotter->db = null; |
413 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
523 | + if ($globalDebugTimeElapsed) { |
|
524 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
525 | + } |
|
414 | 526 | } |
415 | 527 | } |
416 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
528 | + } else { |
|
529 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
530 | + } |
|
417 | 531 | |
418 | 532 | /* |
419 | 533 | if (!isset($line['id'])) { |
@@ -423,7 +537,9 @@ discard block |
||
423 | 537 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
424 | 538 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
425 | 539 | */ |
426 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
540 | + if (!isset($this->all_flights[$id]['id'])) { |
|
541 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
542 | + } |
|
427 | 543 | |
428 | 544 | //$putinarchive = true; |
429 | 545 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -441,7 +557,9 @@ discard block |
||
441 | 557 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
442 | 558 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
443 | 559 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
444 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
560 | + if ($globalDebugTimeElapsed) { |
|
561 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
562 | + } |
|
445 | 563 | } |
446 | 564 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
447 | 565 | $timeelapsed = microtime(true); |
@@ -455,7 +573,9 @@ discard block |
||
455 | 573 | $Translation->db = null; |
456 | 574 | } |
457 | 575 | $Spotter->db = null; |
458 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
576 | + if ($globalDebugTimeElapsed) { |
|
577 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
578 | + } |
|
459 | 579 | } |
460 | 580 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
461 | 581 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -464,9 +584,13 @@ discard block |
||
464 | 584 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
465 | 585 | } |
466 | 586 | } |
467 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
587 | + if (!isset($globalFork)) { |
|
588 | + $globalFork = TRUE; |
|
589 | + } |
|
468 | 590 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
469 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
591 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
592 | + $this->get_Schedule($id,trim($line['ident'])); |
|
593 | + } |
|
470 | 594 | } |
471 | 595 | } |
472 | 596 | } |
@@ -484,9 +608,13 @@ discard block |
||
484 | 608 | $speed = $speed*3.6; |
485 | 609 | if ($speed < 1000) { |
486 | 610 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
487 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
611 | + if ($globalDebug) { |
|
612 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
613 | + } |
|
488 | 614 | } else { |
489 | - if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
615 | + if ($globalDebug) { |
|
616 | + echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
617 | + } |
|
490 | 618 | } |
491 | 619 | } |
492 | 620 | } |
@@ -495,13 +623,21 @@ discard block |
||
495 | 623 | |
496 | 624 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
497 | 625 | if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
498 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
626 | + if ($globalDebug) { |
|
627 | + echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
628 | + } |
|
499 | 629 | return false; |
500 | 630 | } |
501 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
502 | - else unset($timediff); |
|
503 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
504 | - else unset($timediff_archive); |
|
631 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
632 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
633 | + } else { |
|
634 | + unset($timediff); |
|
635 | + } |
|
636 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) { |
|
637 | + $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
638 | + } else { |
|
639 | + unset($timediff_archive); |
|
640 | + } |
|
505 | 641 | if ($this->tmd > 5 |
506 | 642 | || (isset($line['format_source']) |
507 | 643 | && $line['format_source'] == 'airwhere' |
@@ -537,16 +673,25 @@ discard block |
||
537 | 673 | $this->all_flights[$id]['putinarchive'] = true; |
538 | 674 | $this->tmd = 0; |
539 | 675 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
540 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
676 | + if ($globalDebug) { |
|
677 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
678 | + } |
|
541 | 679 | $timeelapsed = microtime(true); |
542 | 680 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
543 | 681 | $Spotter = new Spotter($this->db); |
544 | 682 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
545 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
546 | - else $this->all_flights[$id]['over_country'] = ''; |
|
683 | + if (!empty($all_country)) { |
|
684 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
685 | + } else { |
|
686 | + $this->all_flights[$id]['over_country'] = ''; |
|
687 | + } |
|
547 | 688 | $Spotter->db = null; |
548 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
549 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
689 | + if ($globalDebugTimeElapsed) { |
|
690 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
691 | + } |
|
692 | + if ($globalDebug) { |
|
693 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
694 | + } |
|
550 | 695 | } |
551 | 696 | } |
552 | 697 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
@@ -592,7 +737,9 @@ discard block |
||
592 | 737 | */ |
593 | 738 | } |
594 | 739 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
595 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
740 | + if ($line['longitude'] > 180) { |
|
741 | + $line['longitude'] = $line['longitude'] - 360; |
|
742 | + } |
|
596 | 743 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
597 | 744 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
598 | 745 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -629,7 +776,9 @@ discard block |
||
629 | 776 | } |
630 | 777 | } |
631 | 778 | if (isset($line['last_update']) && $line['last_update'] != '') { |
632 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
779 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
780 | + $dataFound = true; |
|
781 | + } |
|
633 | 782 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
634 | 783 | } |
635 | 784 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -651,35 +800,53 @@ discard block |
||
651 | 800 | // Here we force archive of flight because after ground it's a new one (or should be) |
652 | 801 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
653 | 802 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
654 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
655 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
656 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
803 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
804 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
805 | + } elseif (isset($line['id'])) { |
|
806 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
807 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
808 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
809 | + } |
|
810 | + } |
|
811 | + if ($line['ground'] != 1) { |
|
812 | + $line['ground'] = 0; |
|
657 | 813 | } |
658 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
659 | 814 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
660 | 815 | //$dataFound = true; |
661 | 816 | } |
662 | 817 | if (isset($line['squawk']) && $line['squawk'] != '') { |
663 | 818 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
664 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
819 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) { |
|
820 | + $this->all_flights[$id]['putinarchive'] = true; |
|
821 | + } |
|
665 | 822 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
666 | 823 | $highlight = ''; |
667 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
668 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
669 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
824 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
825 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
826 | + } |
|
827 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
828 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
829 | + } |
|
830 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
831 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
832 | + } |
|
670 | 833 | if ($highlight != '') { |
671 | 834 | $timeelapsed = microtime(true); |
672 | 835 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
673 | 836 | $Spotter = new Spotter($this->db); |
674 | 837 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
675 | 838 | $Spotter->db = null; |
676 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
839 | + if ($globalDebugTimeElapsed) { |
|
840 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
841 | + } |
|
677 | 842 | } |
678 | 843 | //$putinarchive = true; |
679 | 844 | //$highlight = ''; |
680 | 845 | } |
681 | 846 | |
682 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
847 | + } else { |
|
848 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
849 | + } |
|
683 | 850 | //$dataFound = true; |
684 | 851 | } |
685 | 852 | |
@@ -692,19 +859,27 @@ discard block |
||
692 | 859 | } |
693 | 860 | } |
694 | 861 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
695 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
862 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) { |
|
863 | + $this->all_flights[$id]['putinarchive'] = true; |
|
864 | + } |
|
696 | 865 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
697 | 866 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
698 | 867 | //$dataFound = true; |
699 | 868 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
700 | 869 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
701 | 870 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
702 | - if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
|
871 | + if ($globalDebug) { |
|
872 | + echo '--- Reset because of altitude'."\n"; |
|
873 | + } |
|
703 | 874 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
704 | 875 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
705 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
706 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
707 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
876 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
877 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
878 | + } elseif (isset($line['id'])) { |
|
879 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
880 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
881 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
882 | + } |
|
708 | 883 | } |
709 | 884 | } |
710 | 885 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
@@ -715,22 +890,32 @@ discard block |
||
715 | 890 | } |
716 | 891 | |
717 | 892 | if (isset($line['heading']) && $line['heading'] != '') { |
718 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
893 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) { |
|
894 | + $this->all_flights[$id]['putinarchive'] = true; |
|
895 | + } |
|
719 | 896 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
720 | 897 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
721 | 898 | //$dataFound = true; |
722 | 899 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
723 | 900 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
724 | 901 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
725 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
726 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
|
902 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) { |
|
903 | + $this->all_flights[$id]['putinarchive'] = true; |
|
904 | + } |
|
905 | + if ($globalDebug) { |
|
906 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
|
907 | + } |
|
727 | 908 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
728 | 909 | // If not enough messages and ACARS set heading to 0 |
729 | 910 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
730 | 911 | } |
731 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
732 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
733 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
912 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
913 | + $dataFound = false; |
|
914 | + } elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
915 | + $dataFound = false; |
|
916 | + } elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalMinupdate) { |
|
917 | + $dataFound = false; |
|
918 | + } |
|
734 | 919 | |
735 | 920 | // print_r($this->all_flights[$id]); |
736 | 921 | //gets the callsign from the last hour |
@@ -747,23 +932,38 @@ discard block |
||
747 | 932 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
748 | 933 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
749 | 934 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
750 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
935 | + if ($globalDebug) { |
|
936 | + echo "Check if aircraft is already in DB..."; |
|
937 | + } |
|
751 | 938 | $timeelapsed = microtime(true); |
752 | 939 | $SpotterLive = new SpotterLive($this->db); |
753 | 940 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
754 | 941 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
755 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
942 | + if ($globalDebugTimeElapsed) { |
|
943 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
944 | + } |
|
756 | 945 | } elseif (isset($line['id'])) { |
757 | 946 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
947 | + if ($globalDebugTimeElapsed) { |
|
948 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
949 | + } |
|
759 | 950 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
760 | 951 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
762 | - } else $recent_ident = ''; |
|
952 | + if ($globalDebugTimeElapsed) { |
|
953 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
954 | + } |
|
955 | + } else { |
|
956 | + $recent_ident = ''; |
|
957 | + } |
|
763 | 958 | $SpotterLive->db=null; |
764 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
765 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
766 | - } else $recent_ident = ''; |
|
959 | + if ($globalDebug && $recent_ident == '') { |
|
960 | + echo " Not in DB.\n"; |
|
961 | + } elseif ($globalDebug && $recent_ident != '') { |
|
962 | + echo " Already in DB.\n"; |
|
963 | + } |
|
964 | + } else { |
|
965 | + $recent_ident = ''; |
|
966 | + } |
|
767 | 967 | } else { |
768 | 968 | $recent_ident = ''; |
769 | 969 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -771,7 +971,9 @@ discard block |
||
771 | 971 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
772 | 972 | if($recent_ident == "") |
773 | 973 | { |
774 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
974 | + if ($globalDebug) { |
|
975 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
976 | + } |
|
775 | 977 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
776 | 978 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
777 | 979 | //adds the spotter data for the archive |
@@ -815,31 +1017,49 @@ discard block |
||
815 | 1017 | |
816 | 1018 | if (!$ignoreImport) { |
817 | 1019 | $highlight = ''; |
818 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
819 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
820 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
821 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1020 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
1021 | + $highlight = 'Squawk 7500 : Hijack'; |
|
1022 | + } |
|
1023 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
1024 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
1025 | + } |
|
1026 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
1027 | + $highlight = 'Squawk 7700 : Emergency'; |
|
1028 | + } |
|
1029 | + if (!isset($this->all_flights[$id]['id'])) { |
|
1030 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1031 | + } |
|
822 | 1032 | $timeelapsed = microtime(true); |
823 | 1033 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
824 | 1034 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
825 | 1035 | $Spotter = new Spotter($this->db); |
826 | 1036 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
827 | 1037 | $Spotter->db = null; |
828 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
1038 | + if ($globalDebug && isset($result)) { |
|
1039 | + echo $result."\n"; |
|
1040 | + } |
|
829 | 1041 | } |
830 | 1042 | } |
831 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1043 | + if ($globalDebugTimeElapsed) { |
|
1044 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1045 | + } |
|
832 | 1046 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
833 | 1047 | |
834 | 1048 | // Add source stat in DB |
835 | 1049 | $Stats = new Stats($this->db); |
836 | 1050 | if (!empty($this->stats)) { |
837 | - if ($globalDebug) echo 'Add source stats : '; |
|
1051 | + if ($globalDebug) { |
|
1052 | + echo 'Add source stats : '; |
|
1053 | + } |
|
838 | 1054 | foreach($this->stats as $date => $data) { |
839 | 1055 | foreach($data as $source => $sourced) { |
840 | 1056 | //print_r($sourced); |
841 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
842 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
1057 | + if (isset($sourced['polar'])) { |
|
1058 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
1059 | + } |
|
1060 | + if (isset($sourced['hist'])) { |
|
1061 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
1062 | + } |
|
843 | 1063 | if (isset($sourced['msg'])) { |
844 | 1064 | if (time() - $sourced['msg']['date'] > 10) { |
845 | 1065 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -852,13 +1072,17 @@ discard block |
||
852 | 1072 | unset($this->stats[$date]); |
853 | 1073 | } |
854 | 1074 | } |
855 | - if ($globalDebug) echo 'Done'."\n"; |
|
1075 | + if ($globalDebug) { |
|
1076 | + echo 'Done'."\n"; |
|
1077 | + } |
|
856 | 1078 | |
857 | 1079 | } |
858 | 1080 | $Stats->db = null; |
859 | 1081 | } |
860 | 1082 | $this->del(); |
861 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
1083 | + } elseif ($globalDebug) { |
|
1084 | + echo 'Ignore data'."\n"; |
|
1085 | + } |
|
862 | 1086 | //$ignoreImport = false; |
863 | 1087 | $this->all_flights[$id]['addedSpotter'] = 1; |
864 | 1088 | //print_r($this->all_flights[$id]); |
@@ -875,7 +1099,9 @@ discard block |
||
875 | 1099 | */ |
876 | 1100 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
877 | 1101 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
878 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
1102 | + if ($globalDebug) { |
|
1103 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
1104 | + } |
|
879 | 1105 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
880 | 1106 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
881 | 1107 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -884,7 +1110,9 @@ discard block |
||
884 | 1110 | $SpotterLive->db=null; |
885 | 1111 | } |
886 | 1112 | } |
887 | - if ($globalDebug) echo " Done\n"; |
|
1113 | + if ($globalDebug) { |
|
1114 | + echo " Done\n"; |
|
1115 | + } |
|
888 | 1116 | $this->last_delete = time(); |
889 | 1117 | } |
890 | 1118 | } else { |
@@ -911,11 +1139,17 @@ discard block |
||
911 | 1139 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
912 | 1140 | if ($globalDebug) { |
913 | 1141 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
914 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
915 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
1142 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
1143 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
1144 | + } else { |
|
1145 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
1146 | + } |
|
916 | 1147 | } else { |
917 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
918 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
1148 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
1149 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
1150 | + } else { |
|
1151 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
1152 | + } |
|
919 | 1153 | } |
920 | 1154 | } |
921 | 1155 | $ignoreImport = false; |
@@ -961,22 +1195,30 @@ discard block |
||
961 | 1195 | |
962 | 1196 | if (!$ignoreImport) { |
963 | 1197 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
964 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1198 | + if (!isset($this->all_flights[$id]['id'])) { |
|
1199 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1200 | + } |
|
965 | 1201 | $timeelapsed = microtime(true); |
966 | 1202 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
967 | 1203 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
968 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
1204 | + if ($globalDebug) { |
|
1205 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
1206 | + } |
|
969 | 1207 | $SpotterLive = new SpotterLive($this->db); |
970 | 1208 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
971 | 1209 | $SpotterLive->db = null; |
972 | - if ($globalDebug) echo $result."\n"; |
|
1210 | + if ($globalDebug) { |
|
1211 | + echo $result."\n"; |
|
1212 | + } |
|
973 | 1213 | } |
974 | 1214 | } |
975 | 1215 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
976 | 1216 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
977 | 1217 | } |
978 | 1218 | $this->all_flights[$id]['putinarchive'] = false; |
979 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1219 | + if ($globalDebugTimeElapsed) { |
|
1220 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1221 | + } |
|
980 | 1222 | |
981 | 1223 | // Put statistics in $this->stats variable |
982 | 1224 | //if ($line['format_source'] != 'aprs') { |
@@ -984,7 +1226,9 @@ discard block |
||
984 | 1226 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
985 | 1227 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
986 | 1228 | $source = $this->all_flights[$id]['source_name']; |
987 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
1229 | + if ($source == '') { |
|
1230 | + $source = $this->all_flights[$id]['format_source']; |
|
1231 | + } |
|
988 | 1232 | if (!isset($this->source_location[$source])) { |
989 | 1233 | $Location = new Source(); |
990 | 1234 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -1005,7 +1249,9 @@ discard block |
||
1005 | 1249 | $stats_heading = round($stats_heading/22.5); |
1006 | 1250 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
1007 | 1251 | $current_date = date('Y-m-d'); |
1008 | - if ($stats_heading == 16) $stats_heading = 0; |
|
1252 | + if ($stats_heading == 16) { |
|
1253 | + $stats_heading = 0; |
|
1254 | + } |
|
1009 | 1255 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1010 | 1256 | for ($i=0;$i<=15;$i++) { |
1011 | 1257 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -1023,7 +1269,9 @@ discard block |
||
1023 | 1269 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1024 | 1270 | end($this->stats[$current_date][$source]['hist']); |
1025 | 1271 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
1026 | - } else $mini = 0; |
|
1272 | + } else { |
|
1273 | + $mini = 0; |
|
1274 | + } |
|
1027 | 1275 | for ($i=$mini;$i<=$distance;$i+=10) { |
1028 | 1276 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1029 | 1277 | } |
@@ -1035,19 +1283,27 @@ discard block |
||
1035 | 1283 | } |
1036 | 1284 | |
1037 | 1285 | $this->all_flights[$id]['lastupdate'] = time(); |
1038 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
1286 | + if ($this->all_flights[$id]['putinarchive']) { |
|
1287 | + $send = true; |
|
1288 | + } |
|
1039 | 1289 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1040 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1290 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
1291 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1292 | + } |
|
1041 | 1293 | //$this->del(); |
1042 | 1294 | |
1043 | 1295 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
1044 | 1296 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
1045 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
1297 | + if ($globalDebug) { |
|
1298 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
1299 | + } |
|
1046 | 1300 | $SpotterLive = new SpotterLive($this->db); |
1047 | 1301 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
1048 | 1302 | $SpotterLive->db = null; |
1049 | 1303 | //SpotterLive->deleteLiveSpotterData(); |
1050 | - if ($globalDebug) echo " Done\n"; |
|
1304 | + if ($globalDebug) { |
|
1305 | + echo " Done\n"; |
|
1306 | + } |
|
1051 | 1307 | $this->last_delete_hourly = time(); |
1052 | 1308 | } else { |
1053 | 1309 | $this->del(); |
@@ -1059,7 +1315,9 @@ discard block |
||
1059 | 1315 | //$ignoreImport = false; |
1060 | 1316 | } |
1061 | 1317 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
1062 | - if ($send) return $this->all_flights[$id]; |
|
1318 | + if ($send) { |
|
1319 | + return $this->all_flights[$id]; |
|
1320 | + } |
|
1063 | 1321 | } |
1064 | 1322 | } |
1065 | 1323 | } |