@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * Gets the images based on the aircraft registration |
|
27 | - * |
|
28 | - * @return Array the images list |
|
29 | - * |
|
30 | - */ |
|
26 | + * Gets the images based on the aircraft registration |
|
27 | + * |
|
28 | + * @return Array the images list |
|
29 | + * |
|
30 | + */ |
|
31 | 31 | public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
32 | 32 | { |
33 | 33 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * Gets the images based on the ship name |
|
52 | - * |
|
53 | - * @return Array the images list |
|
54 | - * |
|
55 | - */ |
|
51 | + * Gets the images based on the ship name |
|
52 | + * |
|
53 | + * @return Array the images list |
|
54 | + * |
|
55 | + */ |
|
56 | 56 | public function getMarineImage($mmsi,$imo = '',$name = '',$type_name = '') |
57 | 57 | { |
58 | 58 | global $globalMarineImagePics; |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * Gets the image copyright based on the Exif data |
|
94 | - * |
|
95 | - * @return String image copyright |
|
96 | - * |
|
97 | - */ |
|
93 | + * Gets the image copyright based on the Exif data |
|
94 | + * |
|
95 | + * @return String image copyright |
|
96 | + * |
|
97 | + */ |
|
98 | 98 | public function getExifCopyright($url) { |
99 | 99 | $exif = exif_read_data($url); |
100 | 100 | $copyright = ''; |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * Adds the images based on the aircraft registration |
|
113 | - * |
|
114 | - * @return String either success or error |
|
115 | - * |
|
116 | - */ |
|
112 | + * Adds the images based on the aircraft registration |
|
113 | + * |
|
114 | + * @return String either success or error |
|
115 | + * |
|
116 | + */ |
|
117 | 117 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
118 | 118 | { |
119 | 119 | global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * Adds the images based on the marine name |
|
145 | - * |
|
146 | - * @return String either success or error |
|
147 | - * |
|
148 | - */ |
|
144 | + * Adds the images based on the marine name |
|
145 | + * |
|
146 | + * @return String either success or error |
|
147 | + * |
|
148 | + */ |
|
149 | 149 | public function addMarineImage($mmsi,$imo = '',$name = '') |
150 | 150 | { |
151 | 151 | global $globalDebug,$globalMarineImageFetch, $globalOffline; |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * Gets the aircraft image |
|
186 | - * |
|
187 | - * @param String $aircraft_registration the registration of the aircraft |
|
188 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
189 | - * |
|
190 | - */ |
|
185 | + * Gets the aircraft image |
|
186 | + * |
|
187 | + * @param String $aircraft_registration the registration of the aircraft |
|
188 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
189 | + * |
|
190 | + */ |
|
191 | 191 | public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '') |
192 | 192 | { |
193 | 193 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
234 | - * Gets the vessel image |
|
235 | - * |
|
236 | - * @param String $mmsi the vessel mmsi |
|
237 | - * @param String $imo the vessel imo |
|
238 | - * @param String $name the vessel name |
|
239 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
240 | - * |
|
241 | - */ |
|
234 | + * Gets the vessel image |
|
235 | + * |
|
236 | + * @param String $mmsi the vessel mmsi |
|
237 | + * @param String $imo the vessel imo |
|
238 | + * @param String $name the vessel name |
|
239 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
240 | + * |
|
241 | + */ |
|
242 | 242 | public function findMarineImage($mmsi,$imo = '',$name = '') |
243 | 243 | { |
244 | 244 | global $globalMarineImageSources; |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
275 | - * Gets the aircraft image from Planespotters |
|
276 | - * |
|
277 | - * @param String $aircraft_registration the registration of the aircraft |
|
278 | - * @param String $aircraft_name type of the aircraft |
|
279 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
280 | - * |
|
281 | - */ |
|
275 | + * Gets the aircraft image from Planespotters |
|
276 | + * |
|
277 | + * @param String $aircraft_registration the registration of the aircraft |
|
278 | + * @param String $aircraft_name type of the aircraft |
|
279 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
280 | + * |
|
281 | + */ |
|
282 | 282 | public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
283 | 283 | $Common = new Common(); |
284 | 284 | // If aircraft registration is only number, also check with aircraft model |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * Gets the aircraft image from Deviantart |
|
310 | - * |
|
311 | - * @param String $registration the registration of the aircraft |
|
312 | - * @param String $name type of the aircraft |
|
313 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
314 | - * |
|
315 | - */ |
|
309 | + * Gets the aircraft image from Deviantart |
|
310 | + * |
|
311 | + * @param String $registration the registration of the aircraft |
|
312 | + * @param String $name type of the aircraft |
|
313 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
314 | + * |
|
315 | + */ |
|
316 | 316 | public function fromDeviantart($type,$registration, $name='') { |
317 | 317 | $Common = new Common(); |
318 | 318 | if ($type == 'aircraft') { |
@@ -346,13 +346,13 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | - * Gets the aircraft image from JetPhotos |
|
350 | - * |
|
351 | - * @param String $aircraft_registration the registration of the aircraft |
|
352 | - * @param String $aircraft_name type of the aircraft |
|
353 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
354 | - * |
|
355 | - */ |
|
349 | + * Gets the aircraft image from JetPhotos |
|
350 | + * |
|
351 | + * @param String $aircraft_registration the registration of the aircraft |
|
352 | + * @param String $aircraft_name type of the aircraft |
|
353 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
354 | + * |
|
355 | + */ |
|
356 | 356 | public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
357 | 357 | $Common = new Common(); |
358 | 358 | $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
391 | - * Gets the aircraft image from PlanePictures |
|
392 | - * |
|
393 | - * @param String $aircraft_registration the registration of the aircraft |
|
394 | - * @param String $aircraft_name type of the aircraft |
|
395 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
396 | - * |
|
397 | - */ |
|
391 | + * Gets the aircraft image from PlanePictures |
|
392 | + * |
|
393 | + * @param String $aircraft_registration the registration of the aircraft |
|
394 | + * @param String $aircraft_name type of the aircraft |
|
395 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
396 | + * |
|
397 | + */ |
|
398 | 398 | public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
399 | 399 | $Common = new Common(); |
400 | 400 | $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
425 | - * Gets the aircraft image from Flickr |
|
426 | - * |
|
427 | - * @param String $registration the registration of the aircraft |
|
428 | - * @param String $name type of the aircraft |
|
429 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
430 | - * |
|
431 | - */ |
|
425 | + * Gets the aircraft image from Flickr |
|
426 | + * |
|
427 | + * @param String $registration the registration of the aircraft |
|
428 | + * @param String $name type of the aircraft |
|
429 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
430 | + * |
|
431 | + */ |
|
432 | 432 | public function fromFlickr($type,$registration,$name='') { |
433 | 433 | $Common = new Common(); |
434 | 434 | if ($type == 'aircraft') { |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
475 | - * Gets the aircraft image from Bing |
|
476 | - * |
|
477 | - * @param String $aircraft_registration the registration of the aircraft |
|
478 | - * @param String $aircraft_name type of the aircraft |
|
479 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
480 | - * |
|
481 | - */ |
|
475 | + * Gets the aircraft image from Bing |
|
476 | + * |
|
477 | + * @param String $aircraft_registration the registration of the aircraft |
|
478 | + * @param String $aircraft_name type of the aircraft |
|
479 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
480 | + * |
|
481 | + */ |
|
482 | 482 | public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
483 | 483 | global $globalImageBingKey; |
484 | 484 | $Common = new Common(); |
@@ -509,13 +509,13 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | /** |
512 | - * Gets the aircraft image from airport-data |
|
513 | - * |
|
514 | - * @param String $aircraft_registration the registration of the aircraft |
|
515 | - * @param String $aircraft_name type of the aircraft |
|
516 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
517 | - * |
|
518 | - */ |
|
512 | + * Gets the aircraft image from airport-data |
|
513 | + * |
|
514 | + * @param String $aircraft_registration the registration of the aircraft |
|
515 | + * @param String $aircraft_name type of the aircraft |
|
516 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
517 | + * |
|
518 | + */ |
|
519 | 519 | public function fromAirportData($type,$aircraft_registration,$aircraft_name='') { |
520 | 520 | $Common = new Common(); |
521 | 521 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
@@ -534,13 +534,13 @@ discard block |
||
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
537 | - * Gets image from WikiMedia |
|
538 | - * |
|
539 | - * @param String $registration the registration of the aircraft/mmsi |
|
540 | - * @param String $name name |
|
541 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
542 | - * |
|
543 | - */ |
|
537 | + * Gets image from WikiMedia |
|
538 | + * |
|
539 | + * @param String $registration the registration of the aircraft/mmsi |
|
540 | + * @param String $name name |
|
541 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
542 | + * |
|
543 | + */ |
|
544 | 544 | public function fromWikimedia($type,$registration,$name='') { |
545 | 545 | $Common = new Common(); |
546 | 546 | if ($type == 'aircraft') { |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |
598 | - * Gets the aircraft image from custom url |
|
599 | - * |
|
600 | - * @param String $registration the registration of the aircraft |
|
601 | - * @param String $name type of the aircraft |
|
602 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
603 | - * |
|
604 | - */ |
|
598 | + * Gets the aircraft image from custom url |
|
599 | + * |
|
600 | + * @param String $registration the registration of the aircraft |
|
601 | + * @param String $name type of the aircraft |
|
602 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
603 | + * |
|
604 | + */ |
|
605 | 605 | public function fromCustomSource($type,$registration,$name='') { |
606 | 606 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
607 | 607 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
@@ -28,22 +28,22 @@ discard block |
||
28 | 28 | * @return Array the images list |
29 | 29 | * |
30 | 30 | */ |
31 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
31 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
32 | 32 | { |
33 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
34 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
35 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
33 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
34 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
35 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
36 | 36 | $reg = $registration; |
37 | 37 | if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
38 | 38 | $reg = trim($reg); |
39 | - $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
39 | + $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
40 | 40 | FROM spotter_image |
41 | 41 | WHERE spotter_image.registration = :registration LIMIT 1"; |
42 | 42 | $sth = $this->db->prepare($query); |
43 | 43 | $sth->execute(array(':registration' => $reg)); |
44 | 44 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
45 | 45 | if (!empty($result)) return $result; |
46 | - elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
46 | + elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
47 | 47 | else return array(); |
48 | 48 | } |
49 | 49 | |
@@ -53,34 +53,34 @@ discard block |
||
53 | 53 | * @return Array the images list |
54 | 54 | * |
55 | 55 | */ |
56 | - public function getMarineImage($mmsi,$imo = '',$name = '',$type_name = '') |
|
56 | + public function getMarineImage($mmsi, $imo = '', $name = '', $type_name = '') |
|
57 | 57 | { |
58 | 58 | global $globalMarineImagePics; |
59 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
60 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
61 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
62 | - $type_name = str_replace(''',"'",filter_var($type_name,FILTER_SANITIZE_STRING)); |
|
59 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
60 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
61 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
62 | + $type_name = str_replace(''', "'", filter_var($type_name, FILTER_SANITIZE_STRING)); |
|
63 | 63 | if (isset($globalMarineImagePics) && !empty($globalMarineImagePics)) { |
64 | 64 | if ($type_name != '' && isset($globalMarineImagePics['type'][$type_name])) { |
65 | 65 | if (!isset($globalMarineImagePics['type'][$type_name]['image_thumbnail'])) { |
66 | 66 | $globalMarineImagePics['type'][$type_name]['image_thumbnail'] = $globalMarineImagePics['type'][$type_name]['image']; |
67 | 67 | } |
68 | - return array($globalMarineImagePics['type'][$type_name]+array('image_thumbnail' => '','image' => '', 'image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
68 | + return array($globalMarineImagePics['type'][$type_name] + array('image_thumbnail' => '', 'image' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | $name = trim($name); |
72 | 72 | if ($mmsi == '' && $imo == '' && $name == '') return array(); |
73 | - $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
73 | + $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
74 | 74 | FROM marine_image |
75 | 75 | WHERE marine_image.mmsi = :mmsi"; |
76 | 76 | $query_data = array(':mmsi' => $mmsi); |
77 | 77 | if ($imo != '') { |
78 | 78 | $query .= " AND marine_image.imo = :imo"; |
79 | - $query_data = array_merge($query_data,array(':imo' => $imo)); |
|
79 | + $query_data = array_merge($query_data, array(':imo' => $imo)); |
|
80 | 80 | } |
81 | 81 | if ($name != '') { |
82 | 82 | $query .= " AND marine_image.name = :name"; |
83 | - $query_data = array_merge($query_data,array(':name' => $name)); |
|
83 | + $query_data = array_merge($query_data, array(':name' => $name)); |
|
84 | 84 | } |
85 | 85 | $query .= " LIMIT 1"; |
86 | 86 | $sth = $this->db->prepare($query); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
102 | 102 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
103 | 103 | if ($copyright != '') { |
104 | - $copyright = str_replace('Copyright ','',$copyright); |
|
105 | - $copyright = str_replace('© ','',$copyright); |
|
106 | - $copyright = str_replace('(c) ','',$copyright); |
|
104 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
105 | + $copyright = str_replace('© ', '', $copyright); |
|
106 | + $copyright = str_replace('(c) ', '', $copyright); |
|
107 | 107 | } |
108 | 108 | return $copyright; |
109 | 109 | } |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | * @return String either success or error |
115 | 115 | * |
116 | 116 | */ |
117 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
117 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
118 | 118 | { |
119 | - global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
|
119 | + global $globalDebug, $globalAircraftImageFetch, $globalOffline; |
|
120 | 120 | if ((isset($globalAircraftImageFetch) && $globalAircraftImageFetch === FALSE) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
121 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
121 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
122 | 122 | $registration = trim($registration); |
123 | 123 | //getting the aircraft image |
124 | 124 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
125 | 125 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
126 | 126 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
127 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
127 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
128 | 128 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
129 | 129 | if ($image_url['original'] != '') { |
130 | 130 | if ($globalDebug) echo 'Found !'."\n"; |
131 | - $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
131 | + $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
132 | 132 | try { |
133 | 133 | $sth = $this->db->prepare($query); |
134 | - $sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
135 | - } catch(PDOException $e) { |
|
134 | + $sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
135 | + } catch (PDOException $e) { |
|
136 | 136 | echo $e->getMessage()."\n"; |
137 | 137 | return "error"; |
138 | 138 | } |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | * @return String either success or error |
147 | 147 | * |
148 | 148 | */ |
149 | - public function addMarineImage($mmsi,$imo = '',$name = '') |
|
149 | + public function addMarineImage($mmsi, $imo = '', $name = '') |
|
150 | 150 | { |
151 | - global $globalDebug,$globalMarineImageFetch, $globalOffline; |
|
151 | + global $globalDebug, $globalMarineImageFetch, $globalOffline; |
|
152 | 152 | if ((isset($globalMarineImageFetch) && !$globalMarineImageFetch) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
153 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
154 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
155 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
153 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
154 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
155 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
156 | 156 | $name = trim($name); |
157 | 157 | $Marine = new Marine($this->db); |
158 | 158 | if ($imo == '' || $name == '') { |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | |
167 | 167 | //getting the aircraft image |
168 | 168 | if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
169 | - $image_url = $this->findMarineImage($mmsi,$imo,$name); |
|
169 | + $image_url = $this->findMarineImage($mmsi, $imo, $name); |
|
170 | 170 | if ($image_url['original'] != '') { |
171 | 171 | if ($globalDebug) echo 'Found !'."\n"; |
172 | - $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
172 | + $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
173 | 173 | try { |
174 | 174 | $sth = $this->db->prepare($query); |
175 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':name' => $name,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
176 | - } catch(PDOException $e) { |
|
175 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':name' => $name, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
176 | + } catch (PDOException $e) { |
|
177 | 177 | echo $e->getMessage()."\n"; |
178 | 178 | return "error"; |
179 | 179 | } |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
194 | 194 | $Spotter = new Spotter($this->db); |
195 | 195 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
196 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
196 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
197 | 197 | if ($aircraft_registration != '' && $aircraft_registration != 'NA' && (!isset($globalVA) || $globalVA !== TRUE)) { |
198 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
198 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
199 | 199 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
200 | 200 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
201 | 201 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -209,25 +209,25 @@ discard block |
||
209 | 209 | if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
210 | 210 | else $aircraft_name = ''; |
211 | 211 | $aircraft_registration = $aircraft_icao; |
212 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
212 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
213 | 213 | unset($Spotter); |
214 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
214 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
215 | 215 | foreach ($globalAircraftImageSources as $source) { |
216 | 216 | $source = strtolower($source); |
217 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
218 | - if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
219 | - if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
220 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
221 | - if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
222 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
223 | - if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
224 | - if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
225 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
226 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
217 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft', $aircraft_icao, $airline_icao); |
|
218 | + if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft', $aircraft_registration, $aircraft_name); |
|
219 | + if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft', $aircraft_registration, $aircraft_name); |
|
220 | + if ($source == 'bing') $images_array = $this->fromBing('aircraft', $aircraft_registration, $aircraft_name); |
|
221 | + if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft', $aircraft_registration, $aircraft_name); |
|
222 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft', $aircraft_registration, $aircraft_name); |
|
223 | + if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft', $aircraft_registration, $aircraft_name); |
|
224 | + if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft', $aircraft_registration, $aircraft_name); |
|
225 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft', $aircraft_registration, $aircraft_name); |
|
226 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft', $aircraft_registration, $aircraft_name); |
|
227 | 227 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
228 | 228 | } |
229 | 229 | if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
230 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
230 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -239,14 +239,14 @@ discard block |
||
239 | 239 | * @return Array the aircraft thumbnail, orignal url and copyright |
240 | 240 | * |
241 | 241 | */ |
242 | - public function findMarineImage($mmsi,$imo = '',$name = '') |
|
242 | + public function findMarineImage($mmsi, $imo = '', $name = '') |
|
243 | 243 | { |
244 | 244 | global $globalMarineImageSources; |
245 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
245 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
246 | 246 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
247 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
247 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
248 | 248 | $name = trim($name); |
249 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
249 | + if (strlen($name) < 4) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
250 | 250 | /* |
251 | 251 | $Marine = new Marine($this->db); |
252 | 252 | if ($imo == '' || $name == '') { |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | } |
259 | 259 | unset($Marine); |
260 | 260 | */ |
261 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
261 | + if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia', 'deviantart', 'flickr', 'bing'); |
|
262 | 262 | foreach ($globalMarineImageSources as $source) { |
263 | 263 | $source = strtolower($source); |
264 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
265 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
266 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
267 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
268 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
264 | + if ($source == 'flickr') $images_array = $this->fromFlickr('marine', $mmsi, $name); |
|
265 | + if ($source == 'bing') $images_array = $this->fromBing('marine', $mmsi, $name); |
|
266 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine', $mmsi, $name); |
|
267 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine', $mmsi, $name); |
|
268 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('marine', $mmsi, $name); |
|
269 | 269 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
270 | 270 | } |
271 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
271 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -279,25 +279,25 @@ discard block |
||
279 | 279 | * @return Array the aircraft thumbnail, orignal url and copyright |
280 | 280 | * |
281 | 281 | */ |
282 | - public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
|
282 | + public function fromPlanespotters($type, $aircraft_registration, $aircraft_name = '') { |
|
283 | 283 | $Common = new Common(); |
284 | 284 | // If aircraft registration is only number, also check with aircraft model |
285 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
286 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
285 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
286 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
287 | 287 | } else { |
288 | 288 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
289 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
289 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
290 | 290 | } |
291 | 291 | $data = $Common->getData($url); |
292 | 292 | if (substr($data, 0, 5) != "<?xml") return false; |
293 | 293 | if ($xml = simplexml_load_string($data)) { |
294 | 294 | if (isset($xml->channel->item)) { |
295 | 295 | $image_url = array(); |
296 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
296 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
297 | 297 | $image_url['thumbnail'] = $thumbnail_url; |
298 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
299 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
300 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
298 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
299 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
300 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
301 | 301 | $image_url['source'] = 'planespotters'; |
302 | 302 | return $image_url; |
303 | 303 | } |
@@ -313,31 +313,31 @@ discard block |
||
313 | 313 | * @return Array the aircraft thumbnail, orignal url and copyright |
314 | 314 | * |
315 | 315 | */ |
316 | - public function fromDeviantart($type,$registration, $name='') { |
|
316 | + public function fromDeviantart($type, $registration, $name = '') { |
|
317 | 317 | $Common = new Common(); |
318 | 318 | if ($type == 'aircraft') { |
319 | 319 | // If aircraft registration is only number, also check with aircraft model |
320 | - if (preg_match('/^[[:digit]]+$/',$registration) && $name != '') { |
|
321 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
320 | + if (preg_match('/^[[:digit]]+$/', $registration) && $name != '') { |
|
321 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
322 | 322 | } else { |
323 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
323 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
324 | 324 | } |
325 | 325 | } elseif ($type == 'marine') { |
326 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
326 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
327 | 327 | } else { |
328 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
328 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
329 | 329 | } |
330 | 330 | $data = $Common->getData($url); |
331 | 331 | if (substr($data, 0, 5) != "<?xml") return false; |
332 | 332 | if ($xml = simplexml_load_string($data)) { |
333 | 333 | if (isset($xml->channel->item->link)) { |
334 | 334 | $image_url = array(); |
335 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
335 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
336 | 336 | $image_url['thumbnail'] = $thumbnail_url; |
337 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
337 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
338 | 338 | $image_url['original'] = $original_url; |
339 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
340 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
339 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
340 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
341 | 341 | $image_url['source'] = 'deviantart'; |
342 | 342 | return $image_url; |
343 | 343 | } |
@@ -353,32 +353,32 @@ discard block |
||
353 | 353 | * @return Array the aircraft thumbnail, orignal url and copyright |
354 | 354 | * |
355 | 355 | */ |
356 | - public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
|
356 | + public function fromJetPhotos($type, $aircraft_registration, $aircraft_name = '') { |
|
357 | 357 | $Common = new Common(); |
358 | - $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
358 | + $url = 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
359 | 359 | $data = $Common->getData($url); |
360 | 360 | $dom = new DOMDocument(); |
361 | 361 | @$dom->loadHTML($data); |
362 | 362 | $all_pics = array(); |
363 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
363 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
364 | 364 | if ($image->getAttribute('itemprop') == "http://schema.org/image") { |
365 | 365 | $all_pics[] = $image->getAttribute('src'); |
366 | 366 | } |
367 | 367 | } |
368 | 368 | $all_authors = array(); |
369 | - foreach($dom->getElementsByTagName('meta') as $author) { |
|
369 | + foreach ($dom->getElementsByTagName('meta') as $author) { |
|
370 | 370 | if ($author->getAttribute('itemprop') == "http://schema.org/author") { |
371 | 371 | $all_authors[] = $author->getAttribute('content'); |
372 | 372 | } |
373 | 373 | } |
374 | 374 | $all_ref = array(); |
375 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
375 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
376 | 376 | $all_ref[] = $link->getAttribute('href'); |
377 | 377 | } |
378 | 378 | if (isset($all_pics[0])) { |
379 | 379 | $image_url = array(); |
380 | 380 | $image_url['thumbnail'] = $all_pics[0]; |
381 | - $image_url['original'] = str_replace('_tb','',$all_pics[0]); |
|
381 | + $image_url['original'] = str_replace('_tb', '', $all_pics[0]); |
|
382 | 382 | $image_url['copyright'] = $all_authors[0]; |
383 | 383 | $image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8]; |
384 | 384 | $image_url['source'] = 'JetPhotos'; |
@@ -395,24 +395,24 @@ discard block |
||
395 | 395 | * @return Array the aircraft thumbnail, orignal url and copyright |
396 | 396 | * |
397 | 397 | */ |
398 | - public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
|
398 | + public function fromPlanePictures($type, $aircraft_registration, $aircraft_name = '') { |
|
399 | 399 | $Common = new Common(); |
400 | - $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
400 | + $url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
401 | 401 | $data = $Common->getData($url); |
402 | 402 | $dom = new DOMDocument(); |
403 | 403 | @$dom->loadHTML($data); |
404 | 404 | $all_pics = array(); |
405 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
405 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
406 | 406 | $all_pics[] = $image->getAttribute('src'); |
407 | 407 | } |
408 | 408 | $all_links = array(); |
409 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
410 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
409 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
410 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
411 | 411 | } |
412 | - if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1]) && !preg_match('/flagge/',$all_pics[1])) { |
|
412 | + if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1]) && !preg_match('/flagge/', $all_pics[1])) { |
|
413 | 413 | $image_url = array(); |
414 | 414 | $image_url['thumbnail'] = 'http://www.planepictures.net/'.$all_pics[1]; |
415 | - $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN','',$all_pics[1]); |
|
415 | + $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN', '', $all_pics[1]); |
|
416 | 416 | $image_url['copyright'] = $all_links[6]['text']; |
417 | 417 | $image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href']; |
418 | 418 | $image_url['source'] = 'PlanePictures'; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return Array the aircraft thumbnail, orignal url and copyright |
430 | 430 | * |
431 | 431 | */ |
432 | - public function fromFlickr($type,$registration,$name='') { |
|
432 | + public function fromFlickr($type, $registration, $name = '') { |
|
433 | 433 | $Common = new Common(); |
434 | 434 | if ($type == 'aircraft') { |
435 | 435 | if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | if (substr($data, 0, 5) != "<?xml") return false; |
443 | 443 | if ($xml = simplexml_load_string($data)) { |
444 | 444 | if (isset($xml->channel->item)) { |
445 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
445 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
446 | 446 | $image_url = array(); |
447 | 447 | $image_url['thumbnail'] = $original_url; |
448 | 448 | $image_url['original'] = $original_url; |
449 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
450 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
449 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
450 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
451 | 451 | $image_url['source'] = 'flickr'; |
452 | 452 | return $image_url; |
453 | 453 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | return false; |
456 | 456 | } |
457 | 457 | |
458 | - public function fromIvaoMtl($type,$aircraft_icao,$airline_icao) { |
|
458 | + public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) { |
|
459 | 459 | $Common = new Common(); |
460 | 460 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
461 | 461 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return Array the aircraft thumbnail, orignal url and copyright |
480 | 480 | * |
481 | 481 | */ |
482 | - public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
|
482 | + public function fromBing($type, $aircraft_registration, $aircraft_name = '') { |
|
483 | 483 | global $globalImageBingKey; |
484 | 484 | $Common = new Common(); |
485 | 485 | if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
491 | 491 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
492 | 492 | } |
493 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
494 | - $data = $Common->getData($url,'get','',$headers); |
|
493 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
494 | + $data = $Common->getData($url, 'get', '', $headers); |
|
495 | 495 | $result = json_decode($data); |
496 | 496 | if (isset($result->d->results[0]->MediaUrl)) { |
497 | 497 | $image_url = array(); |
@@ -516,14 +516,14 @@ discard block |
||
516 | 516 | * @return Array the aircraft thumbnail, orignal url and copyright |
517 | 517 | * |
518 | 518 | */ |
519 | - public function fromAirportData($type,$aircraft_registration,$aircraft_name='') { |
|
519 | + public function fromAirportData($type, $aircraft_registration, $aircraft_name = '') { |
|
520 | 520 | $Common = new Common(); |
521 | 521 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
522 | 522 | $data = $Common->getData($url); |
523 | 523 | $result = json_decode($data); |
524 | 524 | if (isset($result->count) && $result->count > 0) { |
525 | 525 | $image_url = array(); |
526 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
526 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
527 | 527 | $image_url['source_website'] = $result->data[0]->link; |
528 | 528 | $image_url['thumbnail'] = $result->data[0]->image; |
529 | 529 | $image_url['copyright'] = $result->data[0]->photographer; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @return Array the aircraft thumbnail, orignal url and copyright |
542 | 542 | * |
543 | 543 | */ |
544 | - public function fromWikimedia($type,$registration,$name='') { |
|
544 | + public function fromWikimedia($type, $registration, $name = '') { |
|
545 | 545 | $Common = new Common(); |
546 | 546 | if ($type == 'aircraft') { |
547 | 547 | if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $result = json_decode($data); |
555 | 555 | if (isset($result->query->search[0]->title)) { |
556 | 556 | $fileo = $result->query->search[0]->title; |
557 | - if (substr($fileo,-3) == 'pdf') return false; |
|
557 | + if (substr($fileo, -3) == 'pdf') return false; |
|
558 | 558 | $file = urlencode($fileo); |
559 | 559 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
560 | 560 | $data2 = $Common->getData($url2); |
@@ -579,11 +579,11 @@ discard block |
||
579 | 579 | if (isset($result2->query->pages)) { |
580 | 580 | foreach ($result2->query->pages as $page) { |
581 | 581 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
582 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
582 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
583 | 583 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
584 | 584 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
585 | 585 | } |
586 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
586 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
587 | 587 | return $image_url; |
588 | 588 | } |
589 | 589 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * @return Array the aircraft thumbnail, orignal url and copyright |
603 | 603 | * |
604 | 604 | */ |
605 | - public function fromCustomSource($type,$registration,$name='') { |
|
605 | + public function fromCustomSource($type, $registration, $name = '') { |
|
606 | 606 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
607 | 607 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
608 | 608 | if (!empty($globalAircraftImageCustomSources) && $type == 'aircraft') { |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | print_r($source); |
620 | 620 | print_r($customsources); |
621 | 621 | } |
622 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
623 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
622 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
623 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
624 | 624 | if ($Common->urlexist($url)) { |
625 | 625 | $image_url = array(); |
626 | 626 | $image_url['thumbnail'] = $url_thumbnail; |
627 | 627 | $image_url['original'] = $url; |
628 | 628 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
629 | 629 | else $exifCopyright = ''; |
630 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
630 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
631 | 631 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
632 | 632 | else $image_url['copyright'] = $source['source_website']; |
633 | 633 | $image_url['source_website'] = $source['source_website']; |
@@ -651,19 +651,19 @@ discard block |
||
651 | 651 | print_r($source); |
652 | 652 | print_r($customsources); |
653 | 653 | } |
654 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
655 | - $url = str_replace('{mmsi}',$registration,$url); |
|
656 | - $url = str_replace('{name}',$name,$url); |
|
657 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
658 | - $url_thumbnail = str_replace('{mmsi}',$registration,$url_thumbnail); |
|
659 | - $url_thumbnail = str_replace('{name}',$name,$url_thumbnail); |
|
654 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
655 | + $url = str_replace('{mmsi}', $registration, $url); |
|
656 | + $url = str_replace('{name}', $name, $url); |
|
657 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
658 | + $url_thumbnail = str_replace('{mmsi}', $registration, $url_thumbnail); |
|
659 | + $url_thumbnail = str_replace('{name}', $name, $url_thumbnail); |
|
660 | 660 | if ($Common->urlexist($url)) { |
661 | 661 | $image_url = array(); |
662 | 662 | $image_url['thumbnail'] = $url_thumbnail; |
663 | 663 | $image_url['original'] = $url; |
664 | 664 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
665 | 665 | else $exifCopyright = ''; |
666 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
666 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
667 | 667 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
668 | 668 | else $image_url['copyright'] = $source['source_website']; |
669 | 669 | $image_url['source_website'] = $source['source_website']; |
@@ -19,7 +19,9 @@ discard block |
||
19 | 19 | public function __construct($dbc = null) { |
20 | 20 | $Connection = new Connection($dbc); |
21 | 21 | $this->db = $Connection->db(); |
22 | - if ($this->db === null) die('Error: No DB connection. (Image)'); |
|
22 | + if ($this->db === null) { |
|
23 | + die('Error: No DB connection. (Image)'); |
|
24 | + } |
|
23 | 25 | } |
24 | 26 | |
25 | 27 | /** |
@@ -34,7 +36,9 @@ discard block |
||
34 | 36 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
35 | 37 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
36 | 38 | $reg = $registration; |
37 | - if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
|
39 | + if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') { |
|
40 | + $reg = $aircraft_icao.$airline_icao; |
|
41 | + } |
|
38 | 42 | $reg = trim($reg); |
39 | 43 | $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
40 | 44 | FROM spotter_image |
@@ -42,9 +46,13 @@ discard block |
||
42 | 46 | $sth = $this->db->prepare($query); |
43 | 47 | $sth->execute(array(':registration' => $reg)); |
44 | 48 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
45 | - if (!empty($result)) return $result; |
|
46 | - elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
47 | - else return array(); |
|
49 | + if (!empty($result)) { |
|
50 | + return $result; |
|
51 | + } elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) { |
|
52 | + return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
53 | + } else { |
|
54 | + return array(); |
|
55 | + } |
|
48 | 56 | } |
49 | 57 | |
50 | 58 | /** |
@@ -69,7 +77,9 @@ discard block |
||
69 | 77 | } |
70 | 78 | } |
71 | 79 | $name = trim($name); |
72 | - if ($mmsi == '' && $imo == '' && $name == '') return array(); |
|
80 | + if ($mmsi == '' && $imo == '' && $name == '') { |
|
81 | + return array(); |
|
82 | + } |
|
73 | 83 | $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
74 | 84 | FROM marine_image |
75 | 85 | WHERE marine_image.mmsi = :mmsi"; |
@@ -98,8 +108,11 @@ discard block |
||
98 | 108 | public function getExifCopyright($url) { |
99 | 109 | $exif = exif_read_data($url); |
100 | 110 | $copyright = ''; |
101 | - if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
|
102 | - elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
|
111 | + if (isset($exif['COMPUTED']['copyright'])) { |
|
112 | + $copyright = $exif['COMPUTED']['copyright']; |
|
113 | + } elseif (isset($exif['copyright'])) { |
|
114 | + $copyright = $exif['copyright']; |
|
115 | + } |
|
103 | 116 | if ($copyright != '') { |
104 | 117 | $copyright = str_replace('Copyright ','',$copyright); |
105 | 118 | $copyright = str_replace('© ','',$copyright); |
@@ -117,17 +130,27 @@ discard block |
||
117 | 130 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
118 | 131 | { |
119 | 132 | global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
120 | - if ((isset($globalAircraftImageFetch) && $globalAircraftImageFetch === FALSE) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
|
133 | + if ((isset($globalAircraftImageFetch) && $globalAircraftImageFetch === FALSE) || (isset($globalOffline) && $globalOffline === TRUE)) { |
|
134 | + return ''; |
|
135 | + } |
|
121 | 136 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
122 | 137 | $registration = trim($registration); |
123 | 138 | //getting the aircraft image |
124 | - if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
|
125 | - elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
126 | - elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
139 | + if ($globalDebug && $registration != '') { |
|
140 | + echo 'Try to find an aircraft image for '.$registration.'...'; |
|
141 | + } elseif ($globalDebug && $aircraft_icao != '') { |
|
142 | + echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
143 | + } elseif ($globalDebug && $airline_icao != '') { |
|
144 | + echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
145 | + } |
|
127 | 146 | $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
128 | - if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
|
147 | + if ($registration == '' && $aircraft_icao != '') { |
|
148 | + $registration = $aircraft_icao.$airline_icao; |
|
149 | + } |
|
129 | 150 | if ($image_url['original'] != '') { |
130 | - if ($globalDebug) echo 'Found !'."\n"; |
|
151 | + if ($globalDebug) { |
|
152 | + echo 'Found !'."\n"; |
|
153 | + } |
|
131 | 154 | $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
132 | 155 | try { |
133 | 156 | $sth = $this->db->prepare($query); |
@@ -136,7 +159,9 @@ discard block |
||
136 | 159 | echo $e->getMessage()."\n"; |
137 | 160 | return "error"; |
138 | 161 | } |
139 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
162 | + } elseif ($globalDebug) { |
|
163 | + echo "Not found :'(\n"; |
|
164 | + } |
|
140 | 165 | return "success"; |
141 | 166 | } |
142 | 167 | |
@@ -149,7 +174,9 @@ discard block |
||
149 | 174 | public function addMarineImage($mmsi,$imo = '',$name = '') |
150 | 175 | { |
151 | 176 | global $globalDebug,$globalMarineImageFetch, $globalOffline; |
152 | - if ((isset($globalMarineImageFetch) && !$globalMarineImageFetch) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
|
177 | + if ((isset($globalMarineImageFetch) && !$globalMarineImageFetch) || (isset($globalOffline) && $globalOffline === TRUE)) { |
|
178 | + return ''; |
|
179 | + } |
|
153 | 180 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
154 | 181 | $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
155 | 182 | $name = filter_var($name,FILTER_SANITIZE_STRING); |
@@ -159,16 +186,22 @@ discard block |
||
159 | 186 | $identity = $Marine->getIdentity($mmsi); |
160 | 187 | if (isset($identity[0]['mmsi'])) { |
161 | 188 | $imo = $identity[0]['imo']; |
162 | - if ($identity[0]['ship_name'] != '') $name = $identity[0]['ship_name']; |
|
189 | + if ($identity[0]['ship_name'] != '') { |
|
190 | + $name = $identity[0]['ship_name']; |
|
191 | + } |
|
163 | 192 | } |
164 | 193 | } |
165 | 194 | unset($Marine); |
166 | 195 | |
167 | 196 | //getting the aircraft image |
168 | - if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
|
197 | + if ($globalDebug && $name != '') { |
|
198 | + echo 'Try to find an vessel image for '.$name.'...'; |
|
199 | + } |
|
169 | 200 | $image_url = $this->findMarineImage($mmsi,$imo,$name); |
170 | 201 | if ($image_url['original'] != '') { |
171 | - if ($globalDebug) echo 'Found !'."\n"; |
|
202 | + if ($globalDebug) { |
|
203 | + echo 'Found !'."\n"; |
|
204 | + } |
|
172 | 205 | $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
173 | 206 | try { |
174 | 207 | $sth = $this->db->prepare($query); |
@@ -177,7 +210,9 @@ discard block |
||
177 | 210 | echo $e->getMessage()."\n"; |
178 | 211 | return "error"; |
179 | 212 | } |
180 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
213 | + } elseif ($globalDebug) { |
|
214 | + echo "Not found :'(\n"; |
|
215 | + } |
|
181 | 216 | return "success"; |
182 | 217 | } |
183 | 218 | |
@@ -192,41 +227,85 @@ discard block |
||
192 | 227 | { |
193 | 228 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
194 | 229 | $Spotter = new Spotter($this->db); |
195 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
230 | + if (!isset($globalIVAO)) { |
|
231 | + $globalIVAO = FALSE; |
|
232 | + } |
|
196 | 233 | $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
197 | 234 | if ($aircraft_registration != '' && $aircraft_registration != 'NA' && (!isset($globalVA) || $globalVA !== TRUE)) { |
198 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
235 | + if (strpos($aircraft_registration,'/') !== false) { |
|
236 | + return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
237 | + } |
|
199 | 238 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
200 | 239 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
201 | - if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
202 | - else $aircraft_name = ''; |
|
203 | - if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
204 | - else $aircraft_icao = ''; |
|
205 | - if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao']; |
|
206 | - else $airline_icao = ''; |
|
240 | + if (isset($aircraft_info[0]['aircraft_name'])) { |
|
241 | + $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
242 | + } else { |
|
243 | + $aircraft_name = ''; |
|
244 | + } |
|
245 | + if (isset($aircraft_info[0]['aircraft_icao'])) { |
|
246 | + $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
247 | + } else { |
|
248 | + $aircraft_icao = ''; |
|
249 | + } |
|
250 | + if (isset($aircraft_info[0]['airline_icao'])) { |
|
251 | + $airline_icao = $aircraft_info[0]['airline_icao']; |
|
252 | + } else { |
|
253 | + $airline_icao = ''; |
|
254 | + } |
|
207 | 255 | } elseif ($aircraft_icao != '') { |
208 | 256 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
209 | - if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
|
210 | - else $aircraft_name = ''; |
|
257 | + if (isset($aircraft_info[0]['type'])) { |
|
258 | + $aircraft_name = $aircraft_info[0]['type']; |
|
259 | + } else { |
|
260 | + $aircraft_name = ''; |
|
261 | + } |
|
211 | 262 | $aircraft_registration = $aircraft_icao; |
212 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
263 | + } else { |
|
264 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
265 | + } |
|
213 | 266 | unset($Spotter); |
214 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
267 | + if (!isset($globalAircraftImageSources)) { |
|
268 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
269 | + } |
|
215 | 270 | foreach ($globalAircraftImageSources as $source) { |
216 | 271 | $source = strtolower($source); |
217 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
218 | - if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
219 | - if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
220 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
221 | - if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
222 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
223 | - if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
224 | - if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
225 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
226 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
227 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
228 | - } |
|
229 | - if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
|
272 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') { |
|
273 | + $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
274 | + } |
|
275 | + if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) { |
|
276 | + $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
277 | + } |
|
278 | + if ($source == 'flickr' && extension_loaded('simplexml')) { |
|
279 | + $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
280 | + } |
|
281 | + if ($source == 'bing') { |
|
282 | + $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
283 | + } |
|
284 | + if ($source == 'deviantart' && extension_loaded('simplexml')) { |
|
285 | + $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
286 | + } |
|
287 | + if ($source == 'wikimedia') { |
|
288 | + $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
289 | + } |
|
290 | + if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) { |
|
291 | + $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
292 | + } |
|
293 | + if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) { |
|
294 | + $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
295 | + } |
|
296 | + if ($source == 'airportdata' && !$globalIVAO) { |
|
297 | + $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
298 | + } |
|
299 | + if ($source == 'customsources') { |
|
300 | + $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
301 | + } |
|
302 | + if (isset($images_array) && $images_array['original'] != '') { |
|
303 | + return $images_array; |
|
304 | + } |
|
305 | + } |
|
306 | + if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) { |
|
307 | + return $this->findAircraftImage($aircraft_icao); |
|
308 | + } |
|
230 | 309 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
231 | 310 | } |
232 | 311 | |
@@ -246,7 +325,9 @@ discard block |
||
246 | 325 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
247 | 326 | $name = filter_var($name,FILTER_SANITIZE_STRING); |
248 | 327 | $name = trim($name); |
249 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
328 | + if (strlen($name) < 4) { |
|
329 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
330 | + } |
|
250 | 331 | /* |
251 | 332 | $Marine = new Marine($this->db); |
252 | 333 | if ($imo == '' || $name == '') { |
@@ -258,15 +339,29 @@ discard block |
||
258 | 339 | } |
259 | 340 | unset($Marine); |
260 | 341 | */ |
261 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
342 | + if (!isset($globalMarineImageSources)) { |
|
343 | + $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
344 | + } |
|
262 | 345 | foreach ($globalMarineImageSources as $source) { |
263 | 346 | $source = strtolower($source); |
264 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
265 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
266 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
267 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
268 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
269 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
347 | + if ($source == 'flickr') { |
|
348 | + $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
349 | + } |
|
350 | + if ($source == 'bing') { |
|
351 | + $images_array = $this->fromBing('marine',$mmsi,$name); |
|
352 | + } |
|
353 | + if ($source == 'deviantart') { |
|
354 | + $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
355 | + } |
|
356 | + if ($source == 'wikimedia') { |
|
357 | + $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
358 | + } |
|
359 | + if ($source == 'customsources') { |
|
360 | + $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
361 | + } |
|
362 | + if (isset($images_array) && $images_array['original'] != '') { |
|
363 | + return $images_array; |
|
364 | + } |
|
270 | 365 | } |
271 | 366 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
272 | 367 | } |
@@ -289,7 +384,9 @@ discard block |
||
289 | 384 | $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
290 | 385 | } |
291 | 386 | $data = $Common->getData($url); |
292 | - if (substr($data, 0, 5) != "<?xml") return false; |
|
387 | + if (substr($data, 0, 5) != "<?xml") { |
|
388 | + return false; |
|
389 | + } |
|
293 | 390 | if ($xml = simplexml_load_string($data)) { |
294 | 391 | if (isset($xml->channel->item)) { |
295 | 392 | $image_url = array(); |
@@ -328,7 +425,9 @@ discard block |
||
328 | 425 | $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
329 | 426 | } |
330 | 427 | $data = $Common->getData($url); |
331 | - if (substr($data, 0, 5) != "<?xml") return false; |
|
428 | + if (substr($data, 0, 5) != "<?xml") { |
|
429 | + return false; |
|
430 | + } |
|
332 | 431 | if ($xml = simplexml_load_string($data)) { |
333 | 432 | if (isset($xml->channel->item->link)) { |
334 | 433 | $image_url = array(); |
@@ -432,14 +531,22 @@ discard block |
||
432 | 531 | public function fromFlickr($type,$registration,$name='') { |
433 | 532 | $Common = new Common(); |
434 | 533 | if ($type == 'aircraft') { |
435 | - if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
|
436 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft'; |
|
534 | + if ($name != '') { |
|
535 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
|
536 | + } else { |
|
537 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft'; |
|
538 | + } |
|
437 | 539 | } elseif ($type == 'marine') { |
438 | - if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name); |
|
439 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
|
540 | + if ($name != '') { |
|
541 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name); |
|
542 | + } else { |
|
543 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
|
544 | + } |
|
440 | 545 | } |
441 | 546 | $data = $Common->getData($url); |
442 | - if (substr($data, 0, 5) != "<?xml") return false; |
|
547 | + if (substr($data, 0, 5) != "<?xml") { |
|
548 | + return false; |
|
549 | + } |
|
443 | 550 | if ($xml = simplexml_load_string($data)) { |
444 | 551 | if (isset($xml->channel->item)) { |
445 | 552 | $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
@@ -482,13 +589,21 @@ discard block |
||
482 | 589 | public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
483 | 590 | global $globalImageBingKey; |
484 | 591 | $Common = new Common(); |
485 | - if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
|
592 | + if (!isset($globalImageBingKey) || $globalImageBingKey == '') { |
|
593 | + return false; |
|
594 | + } |
|
486 | 595 | if ($type == 'aircraft') { |
487 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
488 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
596 | + if ($aircraft_name != '') { |
|
597 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
598 | + } else { |
|
599 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
600 | + } |
|
489 | 601 | } elseif ($type == 'marine') { |
490 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
|
491 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
|
602 | + if ($aircraft_name != '') { |
|
603 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
|
604 | + } else { |
|
605 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
|
606 | + } |
|
492 | 607 | } |
493 | 608 | $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
494 | 609 | $data = $Common->getData($url,'get','',$headers); |
@@ -544,17 +659,25 @@ discard block |
||
544 | 659 | public function fromWikimedia($type,$registration,$name='') { |
545 | 660 | $Common = new Common(); |
546 | 661 | if ($type == 'aircraft') { |
547 | - if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
|
548 | - else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
|
662 | + if ($name != '') { |
|
663 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
|
664 | + } else { |
|
665 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
|
666 | + } |
|
549 | 667 | } elseif ($type == 'marine') { |
550 | - if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
|
551 | - else return false; |
|
668 | + if ($name != '') { |
|
669 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
|
670 | + } else { |
|
671 | + return false; |
|
672 | + } |
|
552 | 673 | } |
553 | 674 | $data = $Common->getData($url); |
554 | 675 | $result = json_decode($data); |
555 | 676 | if (isset($result->query->search[0]->title)) { |
556 | 677 | $fileo = $result->query->search[0]->title; |
557 | - if (substr($fileo,-3) == 'pdf') return false; |
|
678 | + if (substr($fileo,-3) == 'pdf') { |
|
679 | + return false; |
|
680 | + } |
|
558 | 681 | $file = urlencode($fileo); |
559 | 682 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
560 | 683 | $data2 = $Common->getData($url2); |
@@ -625,18 +748,27 @@ discard block |
||
625 | 748 | $image_url = array(); |
626 | 749 | $image_url['thumbnail'] = $url_thumbnail; |
627 | 750 | $image_url['original'] = $url; |
628 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
629 | - else $exifCopyright = ''; |
|
630 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
631 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
632 | - else $image_url['copyright'] = $source['source_website']; |
|
751 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
752 | + $exifCopyright = $this->getExifCopyright($url); |
|
753 | + } else { |
|
754 | + $exifCopyright = ''; |
|
755 | + } |
|
756 | + if ($exifCopyright != '') { |
|
757 | + $image_url['copyright'] = $exifCopyright; |
|
758 | + } elseif (isset($source['copyright'])) { |
|
759 | + $image_url['copyright'] = $source['copyright']; |
|
760 | + } else { |
|
761 | + $image_url['copyright'] = $source['source_website']; |
|
762 | + } |
|
633 | 763 | $image_url['source_website'] = $source['source_website']; |
634 | 764 | $image_url['source'] = $source['source']; |
635 | 765 | return $image_url; |
636 | 766 | } |
637 | 767 | } |
638 | 768 | return false; |
639 | - } else return false; |
|
769 | + } else { |
|
770 | + return false; |
|
771 | + } |
|
640 | 772 | if (!empty($globalMarineImageCustomSources) && $type == 'marine') { |
641 | 773 | $customsources = array(); |
642 | 774 | if (!isset($globalMarineImageCustomSources[0])) { |
@@ -661,18 +793,27 @@ discard block |
||
661 | 793 | $image_url = array(); |
662 | 794 | $image_url['thumbnail'] = $url_thumbnail; |
663 | 795 | $image_url['original'] = $url; |
664 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
665 | - else $exifCopyright = ''; |
|
666 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
667 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
668 | - else $image_url['copyright'] = $source['source_website']; |
|
796 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
797 | + $exifCopyright = $this->getExifCopyright($url); |
|
798 | + } else { |
|
799 | + $exifCopyright = ''; |
|
800 | + } |
|
801 | + if ($exifCopyright != '') { |
|
802 | + $image_url['copyright'] = $exifCopyright; |
|
803 | + } elseif (isset($source['copyright'])) { |
|
804 | + $image_url['copyright'] = $source['copyright']; |
|
805 | + } else { |
|
806 | + $image_url['copyright'] = $source['source_website']; |
|
807 | + } |
|
669 | 808 | $image_url['source_website'] = $source['source_website']; |
670 | 809 | $image_url['source'] = $source['source']; |
671 | 810 | return $image_url; |
672 | 811 | } |
673 | 812 | } |
674 | 813 | return false; |
675 | - } else return false; |
|
814 | + } else { |
|
815 | + return false; |
|
816 | + } |
|
676 | 817 | } |
677 | 818 | } |
678 | 819 |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * Executes the SQL statements to get the spotter information |
|
92 | - * |
|
93 | - * @param String $query the SQL query |
|
94 | - * @param Array $params parameter of the query |
|
95 | - * @param String $limitQuery the limit query |
|
96 | - * @return Array the spotter information |
|
97 | - * |
|
98 | - */ |
|
91 | + * Executes the SQL statements to get the spotter information |
|
92 | + * |
|
93 | + * @param String $query the SQL query |
|
94 | + * @param Array $params parameter of the query |
|
95 | + * @param String $limitQuery the limit query |
|
96 | + * @return Array the spotter information |
|
97 | + * |
|
98 | + */ |
|
99 | 99 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
100 | 100 | { |
101 | 101 | global $globalVM; |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | |
247 | 247 | |
248 | 248 | /** |
249 | - * Gets all the spotter information based on the latest data entry |
|
250 | - * |
|
251 | - * @return Array the spotter information |
|
252 | - * |
|
253 | - */ |
|
249 | + * Gets all the spotter information based on the latest data entry |
|
250 | + * |
|
251 | + * @return Array the spotter information |
|
252 | + * |
|
253 | + */ |
|
254 | 254 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
255 | 255 | { |
256 | 256 | global $global_marine_query; |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
302 | - * Gets all the spotter information based on the callsign |
|
303 | - * |
|
304 | - * @return Array the spotter information |
|
305 | - * |
|
306 | - */ |
|
302 | + * Gets all the spotter information based on the callsign |
|
303 | + * |
|
304 | + * @return Array the spotter information |
|
305 | + * |
|
306 | + */ |
|
307 | 307 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
308 | 308 | { |
309 | 309 | global $global_marine_query; |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
358 | - * Gets all the marine information based on the type |
|
359 | - * |
|
360 | - * @return Array the marine information |
|
361 | - * |
|
362 | - */ |
|
358 | + * Gets all the marine information based on the type |
|
359 | + * |
|
360 | + * @return Array the marine information |
|
361 | + * |
|
362 | + */ |
|
363 | 363 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
364 | 364 | { |
365 | 365 | global $global_marine_query; |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
468 | - * Gets all the marine information based on the captain |
|
469 | - * |
|
470 | - * @return Array the marine information |
|
471 | - * |
|
472 | - */ |
|
468 | + * Gets all the marine information based on the captain |
|
469 | + * |
|
470 | + * @return Array the marine information |
|
471 | + * |
|
472 | + */ |
|
473 | 473 | public function getMarineDataByCaptain($captain = '', $limit = '', $sort = '', $filter = array()) |
474 | 474 | { |
475 | 475 | global $global_marine_query; |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
511 | - * Gets all the marine information based on the race |
|
512 | - * |
|
513 | - * @return Array the marine information |
|
514 | - * |
|
515 | - */ |
|
511 | + * Gets all the marine information based on the race |
|
512 | + * |
|
513 | + * @return Array the marine information |
|
514 | + * |
|
515 | + */ |
|
516 | 516 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
517 | 517 | { |
518 | 518 | global $global_marine_query,$globalDBdriver; |
@@ -555,11 +555,11 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
558 | - * Count races by captain |
|
559 | - * |
|
560 | - * @return String Duration of all races |
|
561 | - * |
|
562 | - */ |
|
558 | + * Count races by captain |
|
559 | + * |
|
560 | + * @return String Duration of all races |
|
561 | + * |
|
562 | + */ |
|
563 | 563 | public function countRacesByCaptain($captain,$filters = array()) |
564 | 564 | { |
565 | 565 | $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
578 | - * Count captains by race |
|
579 | - * |
|
580 | - * @return String Duration of all races |
|
581 | - * |
|
582 | - */ |
|
578 | + * Count captains by race |
|
579 | + * |
|
580 | + * @return String Duration of all races |
|
581 | + * |
|
582 | + */ |
|
583 | 583 | public function countCaptainsByRace($race,$filters = array()) |
584 | 584 | { |
585 | 585 | $race = filter_var($race,FILTER_SANITIZE_STRING); |
@@ -595,11 +595,11 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |
598 | - * Gets all boat types that have been used by a captain |
|
599 | - * |
|
600 | - * @return Array the boat list |
|
601 | - * |
|
602 | - */ |
|
598 | + * Gets all boat types that have been used by a captain |
|
599 | + * |
|
600 | + * @return Array the boat list |
|
601 | + * |
|
602 | + */ |
|
603 | 603 | public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
604 | 604 | { |
605 | 605 | global $globalDBdriver; |
@@ -644,11 +644,11 @@ discard block |
||
644 | 644 | } |
645 | 645 | |
646 | 646 | /** |
647 | - * Gets all boat types that have been used on a race |
|
648 | - * |
|
649 | - * @return Array the boat list |
|
650 | - * |
|
651 | - */ |
|
647 | + * Gets all boat types that have been used on a race |
|
648 | + * |
|
649 | + * @return Array the boat list |
|
650 | + * |
|
651 | + */ |
|
652 | 652 | public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
653 | 653 | { |
654 | 654 | global $globalDBdriver; |
@@ -693,11 +693,11 @@ discard block |
||
693 | 693 | } |
694 | 694 | |
695 | 695 | /** |
696 | - * Gets race duration by captain |
|
697 | - * |
|
698 | - * @return String Duration of all race |
|
699 | - * |
|
700 | - */ |
|
696 | + * Gets race duration by captain |
|
697 | + * |
|
698 | + * @return String Duration of all race |
|
699 | + * |
|
700 | + */ |
|
701 | 701 | public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
702 | 702 | { |
703 | 703 | global $globalDBdriver; |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | } |
744 | 744 | |
745 | 745 | /** |
746 | - * Gets a list of all captain names and captain ids |
|
747 | - * |
|
748 | - * @return Array list of captain names and captain ids |
|
749 | - * |
|
750 | - */ |
|
746 | + * Gets a list of all captain names and captain ids |
|
747 | + * |
|
748 | + * @return Array list of captain names and captain ids |
|
749 | + * |
|
750 | + */ |
|
751 | 751 | public function getAllCaptainNames($filters = array()) |
752 | 752 | { |
753 | 753 | $filter_query = $this->getFilter($filters,true,true); |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
764 | - * Gets a list of all race names and race ids |
|
765 | - * |
|
766 | - * @return Array list of race names and race ids |
|
767 | - * |
|
768 | - */ |
|
764 | + * Gets a list of all race names and race ids |
|
765 | + * |
|
766 | + * @return Array list of race names and race ids |
|
767 | + * |
|
768 | + */ |
|
769 | 769 | public function getAllRaceNames($filters = array()) |
770 | 770 | { |
771 | 771 | $filter_query = $this->getFilter($filters,true,true); |
@@ -779,12 +779,12 @@ discard block |
||
779 | 779 | } |
780 | 780 | |
781 | 781 | /** |
782 | - * Gets all source name |
|
783 | - * |
|
784 | - * @param String type format of source |
|
785 | - * @return Array list of source name |
|
786 | - * |
|
787 | - */ |
|
782 | + * Gets all source name |
|
783 | + * |
|
784 | + * @param String type format of source |
|
785 | + * @return Array list of source name |
|
786 | + * |
|
787 | + */ |
|
788 | 788 | public function getAllSourceName($type = '',$filters = array()) |
789 | 789 | { |
790 | 790 | $filter_query = $this->getFilter($filters,true,true); |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | |
815 | 815 | |
816 | 816 | /** |
817 | - * Gets a list of all idents/callsigns |
|
818 | - * |
|
819 | - * @return Array list of ident/callsign names |
|
820 | - * |
|
821 | - */ |
|
817 | + * Gets a list of all idents/callsigns |
|
818 | + * |
|
819 | + * @return Array list of ident/callsign names |
|
820 | + * |
|
821 | + */ |
|
822 | 822 | public function getAllIdents($filters = array()) |
823 | 823 | { |
824 | 824 | $filter_query = $this->getFilter($filters,true,true); |
@@ -842,11 +842,11 @@ discard block |
||
842 | 842 | } |
843 | 843 | |
844 | 844 | /** |
845 | - * Gets all info from a mmsi |
|
846 | - * |
|
847 | - * @return Array ident |
|
848 | - * |
|
849 | - */ |
|
845 | + * Gets all info from a mmsi |
|
846 | + * |
|
847 | + * @return Array ident |
|
848 | + * |
|
849 | + */ |
|
850 | 850 | public function getIdentity($mmsi) |
851 | 851 | { |
852 | 852 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | } |
860 | 860 | |
861 | 861 | /** |
862 | - * Add identity |
|
863 | - * |
|
864 | - */ |
|
862 | + * Add identity |
|
863 | + * |
|
864 | + */ |
|
865 | 865 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
866 | 866 | { |
867 | 867 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -927,13 +927,13 @@ discard block |
||
927 | 927 | } |
928 | 928 | |
929 | 929 | /** |
930 | - * Update ident tracker data |
|
931 | - * |
|
932 | - * @param String $fammarine_id the ID |
|
933 | - * @param String $ident the marine ident |
|
934 | - * @return String success or false |
|
935 | - * |
|
936 | - */ |
|
930 | + * Update ident tracker data |
|
931 | + * |
|
932 | + * @param String $fammarine_id the ID |
|
933 | + * @param String $ident the marine ident |
|
934 | + * @return String success or false |
|
935 | + * |
|
936 | + */ |
|
937 | 937 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
938 | 938 | { |
939 | 939 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -948,13 +948,13 @@ discard block |
||
948 | 948 | } |
949 | 949 | |
950 | 950 | /** |
951 | - * Update arrival marine data |
|
952 | - * |
|
953 | - * @param String $fammarine_id the ID |
|
954 | - * @param String $arrival_code the marine ident |
|
955 | - * @return String success or false |
|
956 | - * |
|
957 | - */ |
|
951 | + * Update arrival marine data |
|
952 | + * |
|
953 | + * @param String $fammarine_id the ID |
|
954 | + * @param String $arrival_code the marine ident |
|
955 | + * @return String success or false |
|
956 | + * |
|
957 | + */ |
|
958 | 958 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
959 | 959 | { |
960 | 960 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -969,19 +969,19 @@ discard block |
||
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
972 | - * Update Status data |
|
973 | - * |
|
974 | - * @param String $fammarine_id the ID |
|
975 | - * @param String $status_id the marine status id |
|
976 | - * @param String $status the marine status |
|
977 | - * @return String success or false |
|
978 | - * |
|
979 | - */ |
|
972 | + * Update Status data |
|
973 | + * |
|
974 | + * @param String $fammarine_id the ID |
|
975 | + * @param String $status_id the marine status id |
|
976 | + * @param String $status the marine status |
|
977 | + * @return String success or false |
|
978 | + * |
|
979 | + */ |
|
980 | 980 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
981 | 981 | { |
982 | 982 | |
983 | 983 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
984 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
984 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
985 | 985 | |
986 | 986 | try { |
987 | 987 | $sth = $this->db->prepare($query); |
@@ -994,13 +994,13 @@ discard block |
||
994 | 994 | |
995 | 995 | } |
996 | 996 | /** |
997 | - * Update latest marine data |
|
998 | - * |
|
999 | - * @param String $fammarine_id the ID |
|
1000 | - * @param String $ident the marine ident |
|
1001 | - * @return String success or false |
|
1002 | - * |
|
1003 | - */ |
|
997 | + * Update latest marine data |
|
998 | + * |
|
999 | + * @param String $fammarine_id the ID |
|
1000 | + * @param String $ident the marine ident |
|
1001 | + * @return String success or false |
|
1002 | + * |
|
1003 | + */ |
|
1004 | 1004 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
1005 | 1005 | { |
1006 | 1006 | if ($latitude == '') $latitude = NULL; |
@@ -1026,30 +1026,30 @@ discard block |
||
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | /** |
1029 | - * Adds a new marine data |
|
1030 | - * |
|
1031 | - * @param String $fammarine_id the ID |
|
1032 | - * @param String $ident the marine ident |
|
1033 | - * @param String $departure_airport_icao the departure airport |
|
1034 | - * @param String $arrival_airport_icao the arrival airport |
|
1035 | - * @param String $latitude latitude of flight |
|
1036 | - * @param String $longitude latitude of flight |
|
1037 | - * @param String $waypoints waypoints of flight |
|
1038 | - * @param String $heading heading of flight |
|
1039 | - * @param String $groundspeed speed of flight |
|
1040 | - * @param String $date date of flight |
|
1041 | - * @param String $departure_airport_time departure time of flight |
|
1042 | - * @param String $arrival_airport_time arrival time of flight |
|
1043 | - * @param String $squawk squawk code of flight |
|
1044 | - * @param String $route_stop route stop of flight |
|
1045 | - * @param String $highlight highlight or not |
|
1046 | - * @param String $ModeS ModesS code of flight |
|
1047 | - * @param String $registration registration code of flight |
|
1048 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
1049 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
1050 | - * @param String $verticalrate vertival rate of flight |
|
1051 | - * @return String success or false |
|
1052 | - */ |
|
1029 | + * Adds a new marine data |
|
1030 | + * |
|
1031 | + * @param String $fammarine_id the ID |
|
1032 | + * @param String $ident the marine ident |
|
1033 | + * @param String $departure_airport_icao the departure airport |
|
1034 | + * @param String $arrival_airport_icao the arrival airport |
|
1035 | + * @param String $latitude latitude of flight |
|
1036 | + * @param String $longitude latitude of flight |
|
1037 | + * @param String $waypoints waypoints of flight |
|
1038 | + * @param String $heading heading of flight |
|
1039 | + * @param String $groundspeed speed of flight |
|
1040 | + * @param String $date date of flight |
|
1041 | + * @param String $departure_airport_time departure time of flight |
|
1042 | + * @param String $arrival_airport_time arrival time of flight |
|
1043 | + * @param String $squawk squawk code of flight |
|
1044 | + * @param String $route_stop route stop of flight |
|
1045 | + * @param String $highlight highlight or not |
|
1046 | + * @param String $ModeS ModesS code of flight |
|
1047 | + * @param String $registration registration code of flight |
|
1048 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
1049 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
1050 | + * @param String $verticalrate vertival rate of flight |
|
1051 | + * @return String success or false |
|
1052 | + */ |
|
1053 | 1053 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
1054 | 1054 | { |
1055 | 1055 | global $globalURL, $globalMarineImageFetch; |
@@ -1183,11 +1183,11 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | |
1185 | 1185 | /** |
1186 | - * Gets the aircraft ident within the last hour |
|
1187 | - * |
|
1188 | - * @return String the ident |
|
1189 | - * |
|
1190 | - */ |
|
1186 | + * Gets the aircraft ident within the last hour |
|
1187 | + * |
|
1188 | + * @return String the ident |
|
1189 | + * |
|
1190 | + */ |
|
1191 | 1191 | public function getIdentFromLastHour($ident) |
1192 | 1192 | { |
1193 | 1193 | global $globalDBdriver, $globalTimezone; |
@@ -1203,11 +1203,11 @@ discard block |
||
1203 | 1203 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
1204 | 1204 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
1205 | 1205 | $query_data = array(':ident' => $ident); |
1206 | - } |
|
1206 | + } |
|
1207 | 1207 | |
1208 | 1208 | $sth = $this->db->prepare($query); |
1209 | 1209 | $sth->execute($query_data); |
1210 | - $ident_result=''; |
|
1210 | + $ident_result=''; |
|
1211 | 1211 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1212 | 1212 | { |
1213 | 1213 | $ident_result = $row['ident']; |
@@ -1218,11 +1218,11 @@ discard block |
||
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | /** |
1221 | - * Gets the aircraft data from the last 20 seconds |
|
1222 | - * |
|
1223 | - * @return Array the marine data |
|
1224 | - * |
|
1225 | - */ |
|
1221 | + * Gets the aircraft data from the last 20 seconds |
|
1222 | + * |
|
1223 | + * @return Array the marine data |
|
1224 | + * |
|
1225 | + */ |
|
1226 | 1226 | public function getRealTimeData($q = '') |
1227 | 1227 | { |
1228 | 1228 | global $globalDBdriver; |
@@ -1260,11 +1260,11 @@ discard block |
||
1260 | 1260 | |
1261 | 1261 | |
1262 | 1262 | /** |
1263 | - * Gets all number of flight over countries |
|
1264 | - * |
|
1265 | - * @return Array the airline country list |
|
1266 | - * |
|
1267 | - */ |
|
1263 | + * Gets all number of flight over countries |
|
1264 | + * |
|
1265 | + * @return Array the airline country list |
|
1266 | + * |
|
1267 | + */ |
|
1268 | 1268 | |
1269 | 1269 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
1270 | 1270 | { |
@@ -1337,11 +1337,11 @@ discard block |
||
1337 | 1337 | |
1338 | 1338 | |
1339 | 1339 | /** |
1340 | - * Gets all callsigns that have flown over |
|
1341 | - * |
|
1342 | - * @return Array the callsign list |
|
1343 | - * |
|
1344 | - */ |
|
1340 | + * Gets all callsigns that have flown over |
|
1341 | + * |
|
1342 | + * @return Array the callsign list |
|
1343 | + * |
|
1344 | + */ |
|
1345 | 1345 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
1346 | 1346 | { |
1347 | 1347 | global $globalDBdriver; |
@@ -1408,11 +1408,11 @@ discard block |
||
1408 | 1408 | |
1409 | 1409 | |
1410 | 1410 | /** |
1411 | - * Counts all dates |
|
1412 | - * |
|
1413 | - * @return Array the date list |
|
1414 | - * |
|
1415 | - */ |
|
1411 | + * Counts all dates |
|
1412 | + * |
|
1413 | + * @return Array the date list |
|
1414 | + * |
|
1415 | + */ |
|
1416 | 1416 | public function countAllDates($filters = array()) |
1417 | 1417 | { |
1418 | 1418 | global $globalTimezone, $globalDBdriver; |
@@ -1458,11 +1458,11 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | |
1460 | 1460 | /** |
1461 | - * Counts all dates during the last 7 days |
|
1462 | - * |
|
1463 | - * @return Array the date list |
|
1464 | - * |
|
1465 | - */ |
|
1461 | + * Counts all dates during the last 7 days |
|
1462 | + * |
|
1463 | + * @return Array the date list |
|
1464 | + * |
|
1465 | + */ |
|
1466 | 1466 | public function countAllDatesLast7Days($filters = array()) |
1467 | 1467 | { |
1468 | 1468 | global $globalTimezone, $globalDBdriver; |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | $query .= " GROUP BY date_name |
1485 | 1485 | ORDER BY date_name ASC"; |
1486 | 1486 | $query_data = array(':offset' => $offset); |
1487 | - } |
|
1487 | + } |
|
1488 | 1488 | |
1489 | 1489 | $sth = $this->db->prepare($query); |
1490 | 1490 | $sth->execute($query_data); |
@@ -1504,11 +1504,11 @@ discard block |
||
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | /** |
1507 | - * Counts all dates during the last month |
|
1508 | - * |
|
1509 | - * @return Array the date list |
|
1510 | - * |
|
1511 | - */ |
|
1507 | + * Counts all dates during the last month |
|
1508 | + * |
|
1509 | + * @return Array the date list |
|
1510 | + * |
|
1511 | + */ |
|
1512 | 1512 | public function countAllDatesLastMonth($filters = array()) |
1513 | 1513 | { |
1514 | 1514 | global $globalTimezone, $globalDBdriver; |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | $query .= " GROUP BY date_name |
1531 | 1531 | ORDER BY date_name ASC"; |
1532 | 1532 | $query_data = array(':offset' => $offset); |
1533 | - } |
|
1533 | + } |
|
1534 | 1534 | |
1535 | 1535 | $sth = $this->db->prepare($query); |
1536 | 1536 | $sth->execute($query_data); |
@@ -1552,11 +1552,11 @@ discard block |
||
1552 | 1552 | |
1553 | 1553 | |
1554 | 1554 | /** |
1555 | - * Counts all month |
|
1556 | - * |
|
1557 | - * @return Array the month list |
|
1558 | - * |
|
1559 | - */ |
|
1555 | + * Counts all month |
|
1556 | + * |
|
1557 | + * @return Array the month list |
|
1558 | + * |
|
1559 | + */ |
|
1560 | 1560 | public function countAllMonths($filters = array()) |
1561 | 1561 | { |
1562 | 1562 | global $globalTimezone, $globalDBdriver; |
@@ -1601,11 +1601,11 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | |
1603 | 1603 | /** |
1604 | - * Counts all dates during the last year |
|
1605 | - * |
|
1606 | - * @return Array the date list |
|
1607 | - * |
|
1608 | - */ |
|
1604 | + * Counts all dates during the last year |
|
1605 | + * |
|
1606 | + * @return Array the date list |
|
1607 | + * |
|
1608 | + */ |
|
1609 | 1609 | public function countAllMonthsLastYear($filters) |
1610 | 1610 | { |
1611 | 1611 | global $globalTimezone, $globalDBdriver; |
@@ -1627,7 +1627,7 @@ discard block |
||
1627 | 1627 | $query .= " GROUP BY year_name, month_name |
1628 | 1628 | ORDER BY year_name, month_name ASC"; |
1629 | 1629 | $query_data = array(':offset' => $offset); |
1630 | - } |
|
1630 | + } |
|
1631 | 1631 | |
1632 | 1632 | $sth = $this->db->prepare($query); |
1633 | 1633 | $sth->execute($query_data); |
@@ -1650,11 +1650,11 @@ discard block |
||
1650 | 1650 | |
1651 | 1651 | |
1652 | 1652 | /** |
1653 | - * Counts all hours |
|
1654 | - * |
|
1655 | - * @return Array the hour list |
|
1656 | - * |
|
1657 | - */ |
|
1653 | + * Counts all hours |
|
1654 | + * |
|
1655 | + * @return Array the hour list |
|
1656 | + * |
|
1657 | + */ |
|
1658 | 1658 | public function countAllHours($orderby,$filters = array()) |
1659 | 1659 | { |
1660 | 1660 | global $globalTimezone, $globalDBdriver; |
@@ -1717,11 +1717,11 @@ discard block |
||
1717 | 1717 | |
1718 | 1718 | |
1719 | 1719 | /** |
1720 | - * Counts all hours by date |
|
1721 | - * |
|
1722 | - * @return Array the hour list |
|
1723 | - * |
|
1724 | - */ |
|
1720 | + * Counts all hours by date |
|
1721 | + * |
|
1722 | + * @return Array the hour list |
|
1723 | + * |
|
1724 | + */ |
|
1725 | 1725 | public function countAllHoursByDate($date, $filters = array()) |
1726 | 1726 | { |
1727 | 1727 | global $globalTimezone, $globalDBdriver; |
@@ -1765,11 +1765,11 @@ discard block |
||
1765 | 1765 | |
1766 | 1766 | |
1767 | 1767 | /** |
1768 | - * Counts all hours by a ident/callsign |
|
1769 | - * |
|
1770 | - * @return Array the hour list |
|
1771 | - * |
|
1772 | - */ |
|
1768 | + * Counts all hours by a ident/callsign |
|
1769 | + * |
|
1770 | + * @return Array the hour list |
|
1771 | + * |
|
1772 | + */ |
|
1773 | 1773 | public function countAllHoursByIdent($ident, $filters = array()) |
1774 | 1774 | { |
1775 | 1775 | global $globalTimezone, $globalDBdriver; |
@@ -1814,11 +1814,11 @@ discard block |
||
1814 | 1814 | |
1815 | 1815 | |
1816 | 1816 | /** |
1817 | - * Counts all vessels |
|
1818 | - * |
|
1819 | - * @return Integer the number of vessels |
|
1820 | - * |
|
1821 | - */ |
|
1817 | + * Counts all vessels |
|
1818 | + * |
|
1819 | + * @return Integer the number of vessels |
|
1820 | + * |
|
1821 | + */ |
|
1822 | 1822 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1823 | 1823 | { |
1824 | 1824 | global $globalDBdriver; |
@@ -1853,11 +1853,11 @@ discard block |
||
1853 | 1853 | } |
1854 | 1854 | |
1855 | 1855 | /** |
1856 | - * Counts all vessel type |
|
1857 | - * |
|
1858 | - * @return Integer the number of vessels |
|
1859 | - * |
|
1860 | - */ |
|
1856 | + * Counts all vessel type |
|
1857 | + * |
|
1858 | + * @return Integer the number of vessels |
|
1859 | + * |
|
1860 | + */ |
|
1861 | 1861 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
1862 | 1862 | { |
1863 | 1863 | global $globalDBdriver; |
@@ -1892,11 +1892,11 @@ discard block |
||
1892 | 1892 | |
1893 | 1893 | |
1894 | 1894 | /** |
1895 | - * Counts all hours of today |
|
1896 | - * |
|
1897 | - * @return Array the hour list |
|
1898 | - * |
|
1899 | - */ |
|
1895 | + * Counts all hours of today |
|
1896 | + * |
|
1897 | + * @return Array the hour list |
|
1898 | + * |
|
1899 | + */ |
|
1900 | 1900 | public function countAllHoursFromToday($filters = array()) |
1901 | 1901 | { |
1902 | 1902 | global $globalTimezone, $globalDBdriver; |
@@ -1936,12 +1936,12 @@ discard block |
||
1936 | 1936 | } |
1937 | 1937 | |
1938 | 1938 | |
1939 | - /** |
|
1940 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1941 | - * |
|
1942 | - * @return Integer the Barrie Spotter ID |
|
1939 | + /** |
|
1940 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1941 | + * |
|
1942 | + * @return Integer the Barrie Spotter ID |
|
1943 | 1943 | q * |
1944 | - */ |
|
1944 | + */ |
|
1945 | 1945 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1946 | 1946 | { |
1947 | 1947 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1962,13 +1962,13 @@ discard block |
||
1962 | 1962 | |
1963 | 1963 | |
1964 | 1964 | /** |
1965 | - * Parses a date string |
|
1966 | - * |
|
1967 | - * @param String $dateString the date string |
|
1968 | - * @param String $timezone the timezone of a user |
|
1969 | - * @return Array the time information |
|
1970 | - * |
|
1971 | - */ |
|
1965 | + * Parses a date string |
|
1966 | + * |
|
1967 | + * @param String $dateString the date string |
|
1968 | + * @param String $timezone the timezone of a user |
|
1969 | + * @return Array the time information |
|
1970 | + * |
|
1971 | + */ |
|
1972 | 1972 | public function parseDateString($dateString, $timezone = '') |
1973 | 1973 | { |
1974 | 1974 | $time_array = array(); |
@@ -2001,12 +2001,12 @@ discard block |
||
2001 | 2001 | } |
2002 | 2002 | |
2003 | 2003 | /** |
2004 | - * Parses the direction degrees to working |
|
2005 | - * |
|
2006 | - * @param Float $direction the direction in degrees |
|
2007 | - * @return Array the direction information |
|
2008 | - * |
|
2009 | - */ |
|
2004 | + * Parses the direction degrees to working |
|
2005 | + * |
|
2006 | + * @param Float $direction the direction in degrees |
|
2007 | + * @return Array the direction information |
|
2008 | + * |
|
2009 | + */ |
|
2010 | 2010 | public function parseDirection($direction = 0) |
2011 | 2011 | { |
2012 | 2012 | if ($direction == '') $direction = 0; |
@@ -2085,12 +2085,12 @@ discard block |
||
2085 | 2085 | |
2086 | 2086 | |
2087 | 2087 | /** |
2088 | - * Gets Country from latitude/longitude |
|
2089 | - * |
|
2090 | - * @param Float $latitude latitute of the flight |
|
2091 | - * @param Float $longitude longitute of the flight |
|
2092 | - * @return String the countrie |
|
2093 | - */ |
|
2088 | + * Gets Country from latitude/longitude |
|
2089 | + * |
|
2090 | + * @param Float $latitude latitute of the flight |
|
2091 | + * @param Float $longitude longitute of the flight |
|
2092 | + * @return String the countrie |
|
2093 | + */ |
|
2094 | 2094 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
2095 | 2095 | { |
2096 | 2096 | global $globalDBdriver, $globalDebug; |
@@ -2127,11 +2127,11 @@ discard block |
||
2127 | 2127 | } |
2128 | 2128 | |
2129 | 2129 | /** |
2130 | - * Gets Country from iso2 |
|
2131 | - * |
|
2132 | - * @param String $iso2 ISO2 country code |
|
2133 | - * @return String the countrie |
|
2134 | - */ |
|
2130 | + * Gets Country from iso2 |
|
2131 | + * |
|
2132 | + * @param String $iso2 ISO2 country code |
|
2133 | + * @return String the countrie |
|
2134 | + */ |
|
2135 | 2135 | public function getCountryFromISO2($iso2) |
2136 | 2136 | { |
2137 | 2137 | global $globalDBdriver, $globalDebug; |
@@ -2160,12 +2160,12 @@ discard block |
||
2160 | 2160 | |
2161 | 2161 | |
2162 | 2162 | /** |
2163 | - * Gets the short url from bit.ly |
|
2164 | - * |
|
2165 | - * @param String $url the full url |
|
2166 | - * @return String the bit.ly url |
|
2167 | - * |
|
2168 | - */ |
|
2163 | + * Gets the short url from bit.ly |
|
2164 | + * |
|
2165 | + * @param String $url the full url |
|
2166 | + * @return String the bit.ly url |
|
2167 | + * |
|
2168 | + */ |
|
2169 | 2169 | public function getBitlyURL($url) |
2170 | 2170 | { |
2171 | 2171 | global $globalBitlyAccessToken; |
@@ -2192,11 +2192,11 @@ discard block |
||
2192 | 2192 | |
2193 | 2193 | |
2194 | 2194 | /** |
2195 | - * Gets all vessels types that have flown over |
|
2196 | - * |
|
2197 | - * @return Array the vessel type list |
|
2198 | - * |
|
2199 | - */ |
|
2195 | + * Gets all vessels types that have flown over |
|
2196 | + * |
|
2197 | + * @return Array the vessel type list |
|
2198 | + * |
|
2199 | + */ |
|
2200 | 2200 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
2201 | 2201 | { |
2202 | 2202 | global $globalDBdriver; |
@@ -2262,11 +2262,11 @@ discard block |
||
2262 | 2262 | } |
2263 | 2263 | |
2264 | 2264 | /** |
2265 | - * Gets all the tracker information |
|
2266 | - * |
|
2267 | - * @return Array the tracker information |
|
2268 | - * |
|
2269 | - */ |
|
2265 | + * Gets all the tracker information |
|
2266 | + * |
|
2267 | + * @return Array the tracker information |
|
2268 | + * |
|
2269 | + */ |
|
2270 | 2270 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
2271 | 2271 | { |
2272 | 2272 | global $globalTimezone, $globalDBdriver; |
@@ -2395,11 +2395,11 @@ discard block |
||
2395 | 2395 | } |
2396 | 2396 | |
2397 | 2397 | /** |
2398 | - * Check marine by id |
|
2399 | - * |
|
2400 | - * @return String the ident |
|
2401 | - * |
|
2402 | - */ |
|
2398 | + * Check marine by id |
|
2399 | + * |
|
2400 | + * @return String the ident |
|
2401 | + * |
|
2402 | + */ |
|
2403 | 2403 | public function checkId($id) |
2404 | 2404 | { |
2405 | 2405 | global $globalDBdriver, $globalTimezone; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
3 | 3 | $global_marine_query = "SELECT marine_output.* FROM marine_output"; |
4 | 4 | |
5 | -class Marine{ |
|
5 | +class Marine { |
|
6 | 6 | public $db; |
7 | 7 | |
8 | 8 | public function __construct($dbc = null) { |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | 19 | |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
82 | 82 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
83 | 83 | if ($filter_query_where != '') { |
84 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
84 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
85 | 85 | } |
86 | 86 | $filter_query = $filter_query_join.$filter_query_where; |
87 | 87 | return $filter_query; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return Array the spotter information |
97 | 97 | * |
98 | 98 | */ |
99 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
99 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
100 | 100 | { |
101 | 101 | global $globalVM; |
102 | 102 | date_default_timezone_set('UTC'); |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | $sth = $this->db->prepare($query.$limitQuery); |
118 | 118 | $sth->execute($params); |
119 | 119 | } catch (PDOException $e) { |
120 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
120 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
121 | 121 | exit(); |
122 | 122 | } |
123 | 123 | |
124 | 124 | $num_rows = 0; |
125 | 125 | $spotter_array = array(); |
126 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
126 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
127 | 127 | { |
128 | 128 | $num_rows++; |
129 | 129 | $temp_array = array(); |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | } |
166 | 166 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
167 | 167 | |
168 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
168 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
169 | 169 | { |
170 | 170 | $Image = new Image($this->db); |
171 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
171 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
172 | 172 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
173 | 173 | unset($Image); |
174 | 174 | if (count($image_array) > 0) { |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | $temp_array['image_source_website'] = $image_array[0]['image_source_website']; |
179 | 179 | $temp_array['image_copyright'] = $image_array[0]['image_copyright']; |
180 | 180 | } |
181 | - } elseif(isset($temp_array['type']) && $temp_array['type'] != "") |
|
181 | + } elseif (isset($temp_array['type']) && $temp_array['type'] != "") |
|
182 | 182 | { |
183 | 183 | $Image = new Image($this->db); |
184 | - $image_array = $Image->getMarineImage('','','',$temp_array['type']); |
|
184 | + $image_array = $Image->getMarineImage('', '', '', $temp_array['type']); |
|
185 | 185 | unset($Image); |
186 | 186 | if (count($image_array) > 0) { |
187 | 187 | $temp_array['image'] = $image_array[0]['image']; |
@@ -216,17 +216,17 @@ discard block |
||
216 | 216 | { |
217 | 217 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
218 | 218 | } else { |
219 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
219 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
220 | 220 | } |
221 | 221 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
222 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
223 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
222 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
223 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
224 | 224 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
225 | 225 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
226 | 226 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
227 | 227 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
228 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
229 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
228 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
229 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
230 | 230 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
231 | 231 | } |
232 | 232 | } |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | if ($limit != "") |
260 | 260 | { |
261 | 261 | $limit_array = explode(",", $limit); |
262 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
263 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
262 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
263 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
264 | 264 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
265 | 265 | { |
266 | 266 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | } else { |
275 | 275 | $orderby_query = " ORDER BY marine_output.date DESC"; |
276 | 276 | } |
277 | - $query = $global_marine_query.$filter_query." ".$orderby_query; |
|
278 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
277 | + $query = $global_marine_query.$filter_query." ".$orderby_query; |
|
278 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
279 | 279 | return $spotter_array; |
280 | 280 | } |
281 | 281 | |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | if ($id == '') return array(); |
294 | 294 | $additional_query = "marine_output.fammarine_id = :id"; |
295 | 295 | $query_values = array(':id' => $id); |
296 | - $query = $global_marine_query." WHERE ".$additional_query." "; |
|
297 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
296 | + $query = $global_marine_query." WHERE ".$additional_query." "; |
|
297 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
298 | 298 | return $spotter_array; |
299 | 299 | } |
300 | 300 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $query_values = array(); |
314 | 314 | $limit_query = ''; |
315 | 315 | $additional_query = ''; |
316 | - $filter_query = $this->getFilter($filter,true,true); |
|
316 | + $filter_query = $this->getFilter($filter, true, true); |
|
317 | 317 | if ($ident != "") |
318 | 318 | { |
319 | 319 | if (!is_string($ident)) |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | { |
330 | 330 | $limit_array = explode(",", $limit); |
331 | 331 | |
332 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
333 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
332 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
333 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
334 | 334 | |
335 | 335 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
336 | 336 | { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $query_values = array(); |
370 | 370 | $limit_query = ''; |
371 | 371 | $additional_query = ''; |
372 | - $filter_query = $this->getFilter($filter,true,true); |
|
372 | + $filter_query = $this->getFilter($filter, true, true); |
|
373 | 373 | if (!is_string($type)) |
374 | 374 | { |
375 | 375 | return false; |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | { |
383 | 383 | $limit_array = explode(",", $limit); |
384 | 384 | |
385 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
386 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
385 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
386 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
387 | 387 | |
388 | 388 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
389 | 389 | { |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | return $spotter_array; |
408 | 408 | } |
409 | 409 | |
410 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
410 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
411 | 411 | { |
412 | 412 | global $global_marine_query, $globalTimezone, $globalDBdriver; |
413 | 413 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $limit_query = ''; |
416 | 416 | $additional_query = ''; |
417 | 417 | |
418 | - $filter_query = $this->getFilter($filter,true,true); |
|
418 | + $filter_query = $this->getFilter($filter, true, true); |
|
419 | 419 | |
420 | 420 | if ($date != "") |
421 | 421 | { |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | { |
442 | 442 | $limit_array = explode(",", $limit); |
443 | 443 | |
444 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
445 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
444 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
445 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
446 | 446 | |
447 | 447 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
448 | 448 | { |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | $query_values = array(); |
478 | 478 | $limit_query = ''; |
479 | 479 | $additional_query = ''; |
480 | - $filter_query = $this->getFilter($filter,true,true); |
|
481 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
480 | + $filter_query = $this->getFilter($filter, true, true); |
|
481 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
482 | 482 | if ($captain != "") |
483 | 483 | { |
484 | 484 | $additional_query = " AND (marine_output.captain_name = :captain OR marine_output.captain_id = :captain)"; |
@@ -487,8 +487,8 @@ discard block |
||
487 | 487 | if ($limit != "") |
488 | 488 | { |
489 | 489 | $limit_array = explode(",", $limit); |
490 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
491 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
490 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
491 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
492 | 492 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
493 | 493 | { |
494 | 494 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | */ |
516 | 516 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
517 | 517 | { |
518 | - global $global_marine_query,$globalDBdriver; |
|
518 | + global $global_marine_query, $globalDBdriver; |
|
519 | 519 | date_default_timezone_set('UTC'); |
520 | 520 | $query_values = array(); |
521 | 521 | $limit_query = ''; |
522 | 522 | $additional_query = ''; |
523 | - $filter_query = $this->getFilter($filter,true,true); |
|
524 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
523 | + $filter_query = $this->getFilter($filter, true, true); |
|
524 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
525 | 525 | if ($race != "") |
526 | 526 | { |
527 | 527 | $additional_query = " AND (marine_output.race_name = :race OR marine_output.race_id = :race)"; |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | if ($limit != "") |
531 | 531 | { |
532 | 532 | $limit_array = explode(",", $limit); |
533 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
534 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
533 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
534 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
535 | 535 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
536 | 536 | { |
537 | 537 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -560,14 +560,14 @@ discard block |
||
560 | 560 | * @return String Duration of all races |
561 | 561 | * |
562 | 562 | */ |
563 | - public function countRacesByCaptain($captain,$filters = array()) |
|
563 | + public function countRacesByCaptain($captain, $filters = array()) |
|
564 | 564 | { |
565 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
566 | - $filter_query = $this->getFilter($filters,true,true); |
|
567 | - $query = "SELECT COUNT(*) AS nb |
|
565 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
566 | + $filter_query = $this->getFilter($filters, true, true); |
|
567 | + $query = "SELECT COUNT(*) AS nb |
|
568 | 568 | FROM marine_output".$filter_query." (marine_output.captain_name = :captain OR marine_output.captain_id = :captain)"; |
569 | 569 | $query_values = array(); |
570 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
570 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
571 | 571 | $sth = $this->db->prepare($query); |
572 | 572 | $sth->execute($query_values); |
573 | 573 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -580,14 +580,14 @@ discard block |
||
580 | 580 | * @return String Duration of all races |
581 | 581 | * |
582 | 582 | */ |
583 | - public function countCaptainsByRace($race,$filters = array()) |
|
583 | + public function countCaptainsByRace($race, $filters = array()) |
|
584 | 584 | { |
585 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
586 | - $filter_query = $this->getFilter($filters,true,true); |
|
587 | - $query = "SELECT COUNT(*) AS nb |
|
585 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
586 | + $filter_query = $this->getFilter($filters, true, true); |
|
587 | + $query = "SELECT COUNT(*) AS nb |
|
588 | 588 | FROM marine_output".$filter_query." (marine_output.race_name = :race OR marine_output.race_id = :race)"; |
589 | 589 | $query_values = array(); |
590 | - $query_values = array_merge($query_values,array(':race' => $race)); |
|
590 | + $query_values = array_merge($query_values, array(':race' => $race)); |
|
591 | 591 | $sth = $this->db->prepare($query); |
592 | 592 | $sth->execute($query_values); |
593 | 593 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -600,44 +600,44 @@ discard block |
||
600 | 600 | * @return Array the boat list |
601 | 601 | * |
602 | 602 | */ |
603 | - public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
|
603 | + public function countAllBoatTypesByCaptain($captain, $filters = array(), $year = '', $month = '', $day = '') |
|
604 | 604 | { |
605 | 605 | global $globalDBdriver; |
606 | - $filter_query = $this->getFilter($filters,true,true); |
|
607 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
608 | - $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
606 | + $filter_query = $this->getFilter($filters, true, true); |
|
607 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
608 | + $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
609 | 609 | FROM marine_output".$filter_query." (marine_output.captain_id = :captain OR marine_output.captain_name = :captain)"; |
610 | 610 | $query_values = array(); |
611 | 611 | if ($year != '') { |
612 | 612 | if ($globalDBdriver == 'mysql') { |
613 | 613 | $query .= " AND YEAR(marine_output.date) = :year"; |
614 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
614 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
615 | 615 | } else { |
616 | 616 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
617 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
617 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 | if ($month != '') { |
621 | 621 | if ($globalDBdriver == 'mysql') { |
622 | 622 | $query .= " AND MONTH(marine_output.date) = :month"; |
623 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
623 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
624 | 624 | } else { |
625 | 625 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
626 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
626 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 | if ($day != '') { |
630 | 630 | if ($globalDBdriver == 'mysql') { |
631 | 631 | $query .= " AND DAY(marine_output.date) = :day"; |
632 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
632 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
633 | 633 | } else { |
634 | 634 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
635 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
635 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | $query .= " GROUP BY marine_output.type |
639 | 639 | ORDER BY type_count DESC"; |
640 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
640 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
641 | 641 | $sth = $this->db->prepare($query); |
642 | 642 | $sth->execute($query_values); |
643 | 643 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -649,44 +649,44 @@ discard block |
||
649 | 649 | * @return Array the boat list |
650 | 650 | * |
651 | 651 | */ |
652 | - public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
|
652 | + public function countAllBoatTypesByRace($race, $filters = array(), $year = '', $month = '', $day = '') |
|
653 | 653 | { |
654 | 654 | global $globalDBdriver; |
655 | - $filter_query = $this->getFilter($filters,true,true); |
|
656 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
657 | - $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
655 | + $filter_query = $this->getFilter($filters, true, true); |
|
656 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
657 | + $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
658 | 658 | FROM marine_output".$filter_query." (marine_output.race_id = :race OR marine_output.race_name = :race)"; |
659 | 659 | $query_values = array(); |
660 | 660 | if ($year != '') { |
661 | 661 | if ($globalDBdriver == 'mysql') { |
662 | 662 | $query .= " AND YEAR(marine_output.date) = :year"; |
663 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
663 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
664 | 664 | } else { |
665 | 665 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
666 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
666 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | if ($month != '') { |
670 | 670 | if ($globalDBdriver == 'mysql') { |
671 | 671 | $query .= " AND MONTH(marine_output.date) = :month"; |
672 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
672 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
673 | 673 | } else { |
674 | 674 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
675 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
675 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 | if ($day != '') { |
679 | 679 | if ($globalDBdriver == 'mysql') { |
680 | 680 | $query .= " AND DAY(marine_output.date) = :day"; |
681 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
681 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
682 | 682 | } else { |
683 | 683 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
684 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
684 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
685 | 685 | } |
686 | 686 | } |
687 | 687 | $query .= " GROUP BY marine_output.type |
688 | 688 | ORDER BY type_count DESC"; |
689 | - $query_values = array_merge($query_values,array(':race' => $race)); |
|
689 | + $query_values = array_merge($query_values, array(':race' => $race)); |
|
690 | 690 | $sth = $this->db->prepare($query); |
691 | 691 | $sth->execute($query_values); |
692 | 692 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -698,47 +698,47 @@ discard block |
||
698 | 698 | * @return String Duration of all race |
699 | 699 | * |
700 | 700 | */ |
701 | - public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
|
701 | + public function getRaceDurationByCaptain($captain, $filters = array(), $year = '', $month = '', $day = '') |
|
702 | 702 | { |
703 | 703 | global $globalDBdriver; |
704 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
705 | - $filter_query = $this->getFilter($filters,true,true); |
|
706 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
704 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
705 | + $filter_query = $this->getFilter($filters, true, true); |
|
706 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
707 | 707 | FROM marine_output".$filter_query." (marine_output.captain_name = :captain OR marine_output.captain_id = :captain) |
708 | 708 | AND last_seen > date"; |
709 | 709 | $query_values = array(); |
710 | 710 | if ($year != '') { |
711 | 711 | if ($globalDBdriver == 'mysql') { |
712 | 712 | $query .= " AND YEAR(marine_output.date) = :year"; |
713 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
713 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
714 | 714 | } else { |
715 | 715 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
716 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
716 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | if ($month != '') { |
720 | 720 | if ($globalDBdriver == 'mysql') { |
721 | 721 | $query .= " AND MONTH(marine_output.date) = :month"; |
722 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
722 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
723 | 723 | } else { |
724 | 724 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
725 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
725 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
726 | 726 | } |
727 | 727 | } |
728 | 728 | if ($day != '') { |
729 | 729 | if ($globalDBdriver == 'mysql') { |
730 | 730 | $query .= " AND DAY(marine_output.date) = :day"; |
731 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
731 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
732 | 732 | } else { |
733 | 733 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
734 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
734 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
735 | 735 | } |
736 | 736 | } |
737 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
737 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
738 | 738 | $sth = $this->db->prepare($query); |
739 | 739 | $sth->execute($query_values); |
740 | 740 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
741 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
741 | + if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
742 | 742 | else return $result[0]['duration']; |
743 | 743 | } |
744 | 744 | |
@@ -750,8 +750,8 @@ discard block |
||
750 | 750 | */ |
751 | 751 | public function getAllCaptainNames($filters = array()) |
752 | 752 | { |
753 | - $filter_query = $this->getFilter($filters,true,true); |
|
754 | - $query = "SELECT DISTINCT marine_output.captain_name, marine_output.captain_id |
|
753 | + $filter_query = $this->getFilter($filters, true, true); |
|
754 | + $query = "SELECT DISTINCT marine_output.captain_name, marine_output.captain_id |
|
755 | 755 | FROM marine_output".$filter_query." marine_output.captain_name <> '' |
756 | 756 | ORDER BY marine_output.captain_name ASC"; |
757 | 757 | |
@@ -768,8 +768,8 @@ discard block |
||
768 | 768 | */ |
769 | 769 | public function getAllRaceNames($filters = array()) |
770 | 770 | { |
771 | - $filter_query = $this->getFilter($filters,true,true); |
|
772 | - $query = "SELECT DISTINCT marine_output.race_name, marine_output.race_id |
|
771 | + $filter_query = $this->getFilter($filters, true, true); |
|
772 | + $query = "SELECT DISTINCT marine_output.race_name, marine_output.race_id |
|
773 | 773 | FROM marine_output".$filter_query." marine_output.race_name <> '' |
774 | 774 | ORDER BY marine_output.race_name ASC"; |
775 | 775 | |
@@ -785,11 +785,11 @@ discard block |
||
785 | 785 | * @return Array list of source name |
786 | 786 | * |
787 | 787 | */ |
788 | - public function getAllSourceName($type = '',$filters = array()) |
|
788 | + public function getAllSourceName($type = '', $filters = array()) |
|
789 | 789 | { |
790 | - $filter_query = $this->getFilter($filters,true,true); |
|
790 | + $filter_query = $this->getFilter($filters, true, true); |
|
791 | 791 | $query_values = array(); |
792 | - $query = "SELECT DISTINCT marine_output.source_name |
|
792 | + $query = "SELECT DISTINCT marine_output.source_name |
|
793 | 793 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
794 | 794 | if ($type != '') { |
795 | 795 | $query_values = array(':type' => $type); |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | $source_array = array(); |
805 | 805 | $temp_array = array(); |
806 | 806 | |
807 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
807 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
808 | 808 | { |
809 | 809 | $temp_array['source_name'] = $row['source_name']; |
810 | 810 | $source_array[] = $temp_array; |
@@ -821,8 +821,8 @@ discard block |
||
821 | 821 | */ |
822 | 822 | public function getAllIdents($filters = array()) |
823 | 823 | { |
824 | - $filter_query = $this->getFilter($filters,true,true); |
|
825 | - $query = "SELECT DISTINCT marine_output.ident |
|
824 | + $filter_query = $this->getFilter($filters, true, true); |
|
825 | + $query = "SELECT DISTINCT marine_output.ident |
|
826 | 826 | FROM marine_output".$filter_query." marine_output.ident <> '' |
827 | 827 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
828 | 828 | |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $ident_array = array(); |
833 | 833 | $temp_array = array(); |
834 | 834 | |
835 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
835 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
836 | 836 | { |
837 | 837 | $temp_array['ident'] = $row['ident']; |
838 | 838 | $ident_array[] = $temp_array; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | */ |
850 | 850 | public function getIdentity($mmsi) |
851 | 851 | { |
852 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
852 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
853 | 853 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
854 | 854 | $sth = $this->db->prepare($query); |
855 | 855 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -862,23 +862,23 @@ discard block |
||
862 | 862 | * Add identity |
863 | 863 | * |
864 | 864 | */ |
865 | - public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
|
865 | + public function addIdentity($mmsi, $imo, $ident, $callsign, $type) |
|
866 | 866 | { |
867 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
867 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
868 | 868 | if ($mmsi != '') { |
869 | - $imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT); |
|
870 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
871 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
872 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
869 | + $imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT); |
|
870 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
871 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
872 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
873 | 873 | $identinfo = $this->getIdentity($mmsi); |
874 | 874 | if (empty($identinfo)) { |
875 | - $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
875 | + $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
876 | 876 | $sth = $this->db->prepare($query); |
877 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type)); |
|
877 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type)); |
|
878 | 878 | } elseif ($ident != '' && $identinfo['ship_name'] != $ident) { |
879 | - $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
879 | + $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
880 | 880 | $sth = $this->db->prepare($query); |
881 | - $sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type)); |
|
881 | + $sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type)); |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | } |
@@ -899,12 +899,12 @@ discard block |
||
899 | 899 | } else $offset = '+00:00'; |
900 | 900 | |
901 | 901 | if ($globalDBdriver == 'mysql') { |
902 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
902 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
903 | 903 | FROM marine_output |
904 | 904 | WHERE marine_output.date <> '' |
905 | 905 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
906 | 906 | } else { |
907 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
907 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
908 | 908 | FROM marine_output |
909 | 909 | WHERE marine_output.date <> '' |
910 | 910 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | $date_array = array(); |
917 | 917 | $temp_array = array(); |
918 | 918 | |
919 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
919 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
920 | 920 | { |
921 | 921 | $temp_array['date'] = $row['date']; |
922 | 922 | |
@@ -934,10 +934,10 @@ discard block |
||
934 | 934 | * @return String success or false |
935 | 935 | * |
936 | 936 | */ |
937 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
937 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
938 | 938 | { |
939 | 939 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
940 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
940 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
941 | 941 | try { |
942 | 942 | $sth = $this->db->prepare($query); |
943 | 943 | $sth->execute($query_values); |
@@ -955,10 +955,10 @@ discard block |
||
955 | 955 | * @return String success or false |
956 | 956 | * |
957 | 957 | */ |
958 | - public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
|
958 | + public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL) |
|
959 | 959 | { |
960 | 960 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
961 | - $query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code); |
|
961 | + $query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code); |
|
962 | 962 | try { |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute($query_values); |
@@ -977,11 +977,11 @@ discard block |
||
977 | 977 | * @return String success or false |
978 | 978 | * |
979 | 979 | */ |
980 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
980 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
981 | 981 | { |
982 | 982 | |
983 | 983 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
984 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
984 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
985 | 985 | |
986 | 986 | try { |
987 | 987 | $sth = $this->db->prepare($query); |
@@ -1001,17 +1001,17 @@ discard block |
||
1001 | 1001 | * @return String success or false |
1002 | 1002 | * |
1003 | 1003 | */ |
1004 | - public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
|
1004 | + public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '', $distance = NULL, $race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
|
1005 | 1005 | { |
1006 | 1006 | if ($latitude == '') $latitude = NULL; |
1007 | 1007 | if ($longitude == '') $longitude = NULL; |
1008 | 1008 | $groundspeed = round($groundspeed); |
1009 | 1009 | if ($race_begin != '') { |
1010 | 1010 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status, date = :race_begin WHERE fammarine_id = :fammarine_id'; |
1011 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time,':status' => $status,':race_begin' => $race_begin); |
|
1011 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time, ':status' => $status, ':race_begin' => $race_begin); |
|
1012 | 1012 | } else { |
1013 | 1013 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status WHERE fammarine_id = :fammarine_id'; |
1014 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time,':status' => $status); |
|
1014 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time, ':status' => $status); |
|
1015 | 1015 | } |
1016 | 1016 | try { |
1017 | 1017 | $sth = $this->db->prepare($query); |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | * @param String $verticalrate vertival rate of flight |
1051 | 1051 | * @return String success or false |
1052 | 1052 | */ |
1053 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
|
1053 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
1054 | 1054 | { |
1055 | 1055 | global $globalURL, $globalMarineImageFetch; |
1056 | 1056 | |
@@ -1122,34 +1122,34 @@ discard block |
||
1122 | 1122 | $date = date("Y-m-d H:i:s", time()); |
1123 | 1123 | } |
1124 | 1124 | |
1125 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1126 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1127 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1128 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1129 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1130 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1131 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1132 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
1133 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
1134 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
1135 | - $type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
1136 | - $status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
1137 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1138 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1139 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
1140 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
1141 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
1142 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
1143 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
1144 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
1145 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
1146 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1147 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1125 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1126 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1127 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1128 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1129 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1130 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1131 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1132 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
1133 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
1134 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
1135 | + $type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
1136 | + $status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
1137 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1138 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1139 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
1140 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
1141 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
1142 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
1143 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
1144 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
1145 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
1146 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1147 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1148 | 1148 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
1149 | 1149 | $Image = new Image($this->db); |
1150 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
1150 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
1151 | 1151 | if (!isset($image_array[0]['mmsi'])) { |
1152 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
1152 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
1153 | 1153 | } |
1154 | 1154 | unset($Image); |
1155 | 1155 | } |
@@ -1165,10 +1165,10 @@ discard block |
||
1165 | 1165 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
1166 | 1166 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
1167 | 1167 | if ($arrival_date == '') $arrival_date = NULL; |
1168 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
|
1168 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
|
1169 | 1169 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name, :distance, :race_rank,:race_time)"; |
1170 | 1170 | |
1171 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time); |
|
1171 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time); |
|
1172 | 1172 | try { |
1173 | 1173 | $sth = $this->db->prepare($query); |
1174 | 1174 | $sth->execute($query_values); |
@@ -1192,13 +1192,13 @@ discard block |
||
1192 | 1192 | { |
1193 | 1193 | global $globalDBdriver, $globalTimezone; |
1194 | 1194 | if ($globalDBdriver == 'mysql') { |
1195 | - $query = "SELECT marine_output.ident FROM marine_output |
|
1195 | + $query = "SELECT marine_output.ident FROM marine_output |
|
1196 | 1196 | WHERE marine_output.ident = :ident |
1197 | 1197 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
1198 | 1198 | AND marine_output.date < UTC_TIMESTAMP()"; |
1199 | 1199 | $query_data = array(':ident' => $ident); |
1200 | 1200 | } else { |
1201 | - $query = "SELECT marine_output.ident FROM marine_output |
|
1201 | + $query = "SELECT marine_output.ident FROM marine_output |
|
1202 | 1202 | WHERE marine_output.ident = :ident |
1203 | 1203 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
1204 | 1204 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -1207,8 +1207,8 @@ discard block |
||
1207 | 1207 | |
1208 | 1208 | $sth = $this->db->prepare($query); |
1209 | 1209 | $sth->execute($query_data); |
1210 | - $ident_result=''; |
|
1211 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1210 | + $ident_result = ''; |
|
1211 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1212 | 1212 | { |
1213 | 1213 | $ident_result = $row['ident']; |
1214 | 1214 | } |
@@ -1234,8 +1234,8 @@ discard block |
||
1234 | 1234 | return false; |
1235 | 1235 | } else { |
1236 | 1236 | $q_array = explode(" ", $q); |
1237 | - foreach ($q_array as $q_item){ |
|
1238 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1237 | + foreach ($q_array as $q_item) { |
|
1238 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1239 | 1239 | $additional_query .= " AND ("; |
1240 | 1240 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
1241 | 1241 | $additional_query .= ")"; |
@@ -1243,11 +1243,11 @@ discard block |
||
1243 | 1243 | } |
1244 | 1244 | } |
1245 | 1245 | if ($globalDBdriver == 'mysql') { |
1246 | - $query = "SELECT marine_output.* FROM marine_output |
|
1246 | + $query = "SELECT marine_output.* FROM marine_output |
|
1247 | 1247 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
1248 | 1248 | AND marine_output.date < UTC_TIMESTAMP()"; |
1249 | 1249 | } else { |
1250 | - $query = "SELECT marine_output.* FROM marine_output |
|
1250 | + $query = "SELECT marine_output.* FROM marine_output |
|
1251 | 1251 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
1252 | 1252 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
1253 | 1253 | } |
@@ -1266,16 +1266,16 @@ discard block |
||
1266 | 1266 | * |
1267 | 1267 | */ |
1268 | 1268 | |
1269 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
1269 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
1270 | 1270 | { |
1271 | 1271 | global $globalDBdriver, $globalArchive; |
1272 | 1272 | //$filter_query = $this->getFilter($filters,true,true); |
1273 | - $Connection= new Connection($this->db); |
|
1273 | + $Connection = new Connection($this->db); |
|
1274 | 1274 | if (!$Connection->tableExists('countries')) return array(); |
1275 | 1275 | require_once('class.SpotterLive.php'); |
1276 | 1276 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
1277 | 1277 | $MarineLive = new MarineLive($this->db); |
1278 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
1278 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
1279 | 1279 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
1280 | 1280 | if ($olderthanmonths > 0) { |
1281 | 1281 | if ($globalDBdriver == 'mysql') { |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | } else { |
1296 | 1296 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
1297 | 1297 | $MarineArchive = new MarineArchive($this->db); |
1298 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
1298 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
1299 | 1299 | $filter_query .= " over_country <> ''"; |
1300 | 1300 | if ($olderthanmonths > 0) { |
1301 | 1301 | if ($globalDBdriver == 'mysql') { |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | $flight_array = array(); |
1324 | 1324 | $temp_array = array(); |
1325 | 1325 | |
1326 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1326 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1327 | 1327 | { |
1328 | 1328 | $temp_array['marine_count'] = $row['nb']; |
1329 | 1329 | $temp_array['marine_country'] = $row['name']; |
@@ -1342,11 +1342,11 @@ discard block |
||
1342 | 1342 | * @return Array the callsign list |
1343 | 1343 | * |
1344 | 1344 | */ |
1345 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
1345 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1346 | 1346 | { |
1347 | 1347 | global $globalDBdriver; |
1348 | - $filter_query = $this->getFilter($filters,true,true); |
|
1349 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
1348 | + $filter_query = $this->getFilter($filters, true, true); |
|
1349 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
1350 | 1350 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
1351 | 1351 | if ($olderthanmonths > 0) { |
1352 | 1352 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -1360,28 +1360,28 @@ discard block |
||
1360 | 1360 | if ($year != '') { |
1361 | 1361 | if ($globalDBdriver == 'mysql') { |
1362 | 1362 | $query .= " AND YEAR(marine_output.date) = :year"; |
1363 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1363 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1364 | 1364 | } else { |
1365 | 1365 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1366 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1366 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1367 | 1367 | } |
1368 | 1368 | } |
1369 | 1369 | if ($month != '') { |
1370 | 1370 | if ($globalDBdriver == 'mysql') { |
1371 | 1371 | $query .= " AND MONTH(marine_output.date) = :month"; |
1372 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1372 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1373 | 1373 | } else { |
1374 | 1374 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1375 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1375 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1376 | 1376 | } |
1377 | 1377 | } |
1378 | 1378 | if ($day != '') { |
1379 | 1379 | if ($globalDBdriver == 'mysql') { |
1380 | 1380 | $query .= " AND DAY(marine_output.date) = :day"; |
1381 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1381 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1382 | 1382 | } else { |
1383 | 1383 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1384 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1384 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1385 | 1385 | } |
1386 | 1386 | } |
1387 | 1387 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | $callsign_array = array(); |
1394 | 1394 | $temp_array = array(); |
1395 | 1395 | |
1396 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1396 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1397 | 1397 | { |
1398 | 1398 | $temp_array['callsign_icao'] = $row['ident']; |
1399 | 1399 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | $date_array = array(); |
1446 | 1446 | $temp_array = array(); |
1447 | 1447 | |
1448 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1448 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1449 | 1449 | { |
1450 | 1450 | $temp_array['date_name'] = $row['date_name']; |
1451 | 1451 | $temp_array['date_count'] = $row['date_count']; |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | $datetime = new DateTime(); |
1472 | 1472 | $offset = $datetime->format('P'); |
1473 | 1473 | } else $offset = '+00:00'; |
1474 | - $filter_query = $this->getFilter($filters,true,true); |
|
1474 | + $filter_query = $this->getFilter($filters, true, true); |
|
1475 | 1475 | if ($globalDBdriver == 'mysql') { |
1476 | 1476 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1477 | 1477 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | $date_array = array(); |
1493 | 1493 | $temp_array = array(); |
1494 | 1494 | |
1495 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1495 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1496 | 1496 | { |
1497 | 1497 | $temp_array['date_name'] = $row['date_name']; |
1498 | 1498 | $temp_array['date_count'] = $row['date_count']; |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | $datetime = new DateTime(); |
1518 | 1518 | $offset = $datetime->format('P'); |
1519 | 1519 | } else $offset = '+00:00'; |
1520 | - $filter_query = $this->getFilter($filters,true,true); |
|
1520 | + $filter_query = $this->getFilter($filters, true, true); |
|
1521 | 1521 | if ($globalDBdriver == 'mysql') { |
1522 | 1522 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1523 | 1523 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | $date_array = array(); |
1539 | 1539 | $temp_array = array(); |
1540 | 1540 | |
1541 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1541 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1542 | 1542 | { |
1543 | 1543 | $temp_array['date_name'] = $row['date_name']; |
1544 | 1544 | $temp_array['date_count'] = $row['date_count']; |
@@ -1585,7 +1585,7 @@ discard block |
||
1585 | 1585 | $date_array = array(); |
1586 | 1586 | $temp_array = array(); |
1587 | 1587 | |
1588 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1588 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1589 | 1589 | { |
1590 | 1590 | $temp_array['month_name'] = $row['month_name']; |
1591 | 1591 | $temp_array['year_name'] = $row['year_name']; |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | $datetime = new DateTime(); |
1615 | 1615 | $offset = $datetime->format('P'); |
1616 | 1616 | } else $offset = '+00:00'; |
1617 | - $filter_query = $this->getFilter($filters,true,true); |
|
1617 | + $filter_query = $this->getFilter($filters, true, true); |
|
1618 | 1618 | if ($globalDBdriver == 'mysql') { |
1619 | 1619 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1620 | 1620 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | $date_array = array(); |
1636 | 1636 | $temp_array = array(); |
1637 | 1637 | |
1638 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1638 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1639 | 1639 | { |
1640 | 1640 | $temp_array['year_name'] = $row['year_name']; |
1641 | 1641 | $temp_array['month_name'] = $row['month_name']; |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | * @return Array the hour list |
1656 | 1656 | * |
1657 | 1657 | */ |
1658 | - public function countAllHours($orderby,$filters = array()) |
|
1658 | + public function countAllHours($orderby, $filters = array()) |
|
1659 | 1659 | { |
1660 | 1660 | global $globalTimezone, $globalDBdriver; |
1661 | 1661 | if ($globalTimezone != '') { |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | $hour_array = array(); |
1704 | 1704 | $temp_array = array(); |
1705 | 1705 | |
1706 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1706 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1707 | 1707 | { |
1708 | 1708 | $temp_array['hour_name'] = $row['hour_name']; |
1709 | 1709 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1725,8 +1725,8 @@ discard block |
||
1725 | 1725 | public function countAllHoursByDate($date, $filters = array()) |
1726 | 1726 | { |
1727 | 1727 | global $globalTimezone, $globalDBdriver; |
1728 | - $filter_query = $this->getFilter($filters,true,true); |
|
1729 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1728 | + $filter_query = $this->getFilter($filters, true, true); |
|
1729 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1730 | 1730 | if ($globalTimezone != '') { |
1731 | 1731 | date_default_timezone_set($globalTimezone); |
1732 | 1732 | $datetime = new DateTime($date); |
@@ -1734,12 +1734,12 @@ discard block |
||
1734 | 1734 | } else $offset = '+00:00'; |
1735 | 1735 | |
1736 | 1736 | if ($globalDBdriver == 'mysql') { |
1737 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1737 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1738 | 1738 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1739 | 1739 | GROUP BY hour_name |
1740 | 1740 | ORDER BY hour_name ASC"; |
1741 | 1741 | } else { |
1742 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1742 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1743 | 1743 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1744 | 1744 | GROUP BY hour_name |
1745 | 1745 | ORDER BY hour_name ASC"; |
@@ -1751,7 +1751,7 @@ discard block |
||
1751 | 1751 | $hour_array = array(); |
1752 | 1752 | $temp_array = array(); |
1753 | 1753 | |
1754 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1754 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1755 | 1755 | { |
1756 | 1756 | $temp_array['hour_name'] = $row['hour_name']; |
1757 | 1757 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1773,8 +1773,8 @@ discard block |
||
1773 | 1773 | public function countAllHoursByIdent($ident, $filters = array()) |
1774 | 1774 | { |
1775 | 1775 | global $globalTimezone, $globalDBdriver; |
1776 | - $filter_query = $this->getFilter($filters,true,true); |
|
1777 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1776 | + $filter_query = $this->getFilter($filters, true, true); |
|
1777 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1778 | 1778 | if ($globalTimezone != '') { |
1779 | 1779 | date_default_timezone_set($globalTimezone); |
1780 | 1780 | $datetime = new DateTime(); |
@@ -1782,12 +1782,12 @@ discard block |
||
1782 | 1782 | } else $offset = '+00:00'; |
1783 | 1783 | |
1784 | 1784 | if ($globalDBdriver == 'mysql') { |
1785 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1785 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1786 | 1786 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1787 | 1787 | GROUP BY hour_name |
1788 | 1788 | ORDER BY hour_name ASC"; |
1789 | 1789 | } else { |
1790 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1790 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1791 | 1791 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1792 | 1792 | GROUP BY hour_name |
1793 | 1793 | ORDER BY hour_name ASC"; |
@@ -1795,12 +1795,12 @@ discard block |
||
1795 | 1795 | |
1796 | 1796 | |
1797 | 1797 | $sth = $this->db->prepare($query); |
1798 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1798 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1799 | 1799 | |
1800 | 1800 | $hour_array = array(); |
1801 | 1801 | $temp_array = array(); |
1802 | 1802 | |
1803 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1803 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1804 | 1804 | { |
1805 | 1805 | $temp_array['hour_name'] = $row['hour_name']; |
1806 | 1806 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1819,33 +1819,33 @@ discard block |
||
1819 | 1819 | * @return Integer the number of vessels |
1820 | 1820 | * |
1821 | 1821 | */ |
1822 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1822 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1823 | 1823 | { |
1824 | 1824 | global $globalDBdriver; |
1825 | 1825 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
1826 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1826 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1827 | 1827 | $query_values = array(); |
1828 | 1828 | $query = ''; |
1829 | 1829 | if ($year != '') { |
1830 | 1830 | if ($globalDBdriver == 'mysql') { |
1831 | 1831 | $query .= " AND YEAR(marine_output.date) = :year"; |
1832 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1832 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1833 | 1833 | } else { |
1834 | 1834 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1835 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1835 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1836 | 1836 | } |
1837 | 1837 | } |
1838 | 1838 | if ($month != '') { |
1839 | 1839 | if ($globalDBdriver == 'mysql') { |
1840 | 1840 | $query .= " AND MONTH(marine_output.date) = :month"; |
1841 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1841 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1842 | 1842 | } else { |
1843 | 1843 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1844 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1844 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1845 | 1845 | } |
1846 | 1846 | } |
1847 | 1847 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1848 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1848 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1849 | 1849 | |
1850 | 1850 | $sth = $this->db->prepare($queryi); |
1851 | 1851 | $sth->execute($query_values); |
@@ -1858,32 +1858,32 @@ discard block |
||
1858 | 1858 | * @return Integer the number of vessels |
1859 | 1859 | * |
1860 | 1860 | */ |
1861 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
1861 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
1862 | 1862 | { |
1863 | 1863 | global $globalDBdriver; |
1864 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1864 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1865 | 1865 | $query_values = array(); |
1866 | 1866 | $query = ''; |
1867 | 1867 | if ($year != '') { |
1868 | 1868 | if ($globalDBdriver == 'mysql') { |
1869 | 1869 | $query .= " AND YEAR(marine_output.date) = :year"; |
1870 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1870 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1871 | 1871 | } else { |
1872 | 1872 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1873 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1873 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1874 | 1874 | } |
1875 | 1875 | } |
1876 | 1876 | if ($month != '') { |
1877 | 1877 | if ($globalDBdriver == 'mysql') { |
1878 | 1878 | $query .= " AND MONTH(marine_output.date) = :month"; |
1879 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1879 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1880 | 1880 | } else { |
1881 | 1881 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1882 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1882 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1883 | 1883 | } |
1884 | 1884 | } |
1885 | 1885 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1886 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1886 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1887 | 1887 | |
1888 | 1888 | $sth = $this->db->prepare($queryi); |
1889 | 1889 | $sth->execute($query_values); |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | public function countAllHoursFromToday($filters = array()) |
1901 | 1901 | { |
1902 | 1902 | global $globalTimezone, $globalDBdriver; |
1903 | - $filter_query = $this->getFilter($filters,true,true); |
|
1903 | + $filter_query = $this->getFilter($filters, true, true); |
|
1904 | 1904 | if ($globalTimezone != '') { |
1905 | 1905 | date_default_timezone_set($globalTimezone); |
1906 | 1906 | $datetime = new DateTime(); |
@@ -1908,12 +1908,12 @@ discard block |
||
1908 | 1908 | } else $offset = '+00:00'; |
1909 | 1909 | |
1910 | 1910 | if ($globalDBdriver == 'mysql') { |
1911 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1911 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1912 | 1912 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
1913 | 1913 | GROUP BY hour_name |
1914 | 1914 | ORDER BY hour_name ASC"; |
1915 | 1915 | } else { |
1916 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1916 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1917 | 1917 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1918 | 1918 | GROUP BY hour_name |
1919 | 1919 | ORDER BY hour_name ASC"; |
@@ -1925,7 +1925,7 @@ discard block |
||
1925 | 1925 | $hour_array = array(); |
1926 | 1926 | $temp_array = array(); |
1927 | 1927 | |
1928 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1928 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1929 | 1929 | { |
1930 | 1930 | $temp_array['hour_name'] = $row['hour_name']; |
1931 | 1931 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1944,9 +1944,9 @@ discard block |
||
1944 | 1944 | */ |
1945 | 1945 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1946 | 1946 | { |
1947 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1947 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1948 | 1948 | |
1949 | - $query = "SELECT marine_output.marine_id |
|
1949 | + $query = "SELECT marine_output.marine_id |
|
1950 | 1950 | FROM marine_output |
1951 | 1951 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
1952 | 1952 | |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | $sth = $this->db->prepare($query); |
1955 | 1955 | $sth->execute(); |
1956 | 1956 | |
1957 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1957 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1958 | 1958 | { |
1959 | 1959 | return $row['marine_id']; |
1960 | 1960 | } |
@@ -1979,23 +1979,23 @@ discard block |
||
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | $current_date = date("Y-m-d H:i:s"); |
1982 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1982 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1983 | 1983 | |
1984 | 1984 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1985 | 1985 | |
1986 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1986 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1987 | 1987 | $years = $time_array['years']; |
1988 | 1988 | |
1989 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1989 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1990 | 1990 | $months = $time_array['months']; |
1991 | 1991 | |
1992 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1992 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1993 | 1993 | $days = $time_array['days']; |
1994 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1994 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1995 | 1995 | $hours = $time_array['hours']; |
1996 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1996 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1997 | 1997 | $minutes = $time_array['minutes']; |
1998 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1998 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1999 | 1999 | |
2000 | 2000 | return $time_array; |
2001 | 2001 | } |
@@ -2018,63 +2018,63 @@ discard block |
||
2018 | 2018 | $temp_array['direction_degree'] = $direction; |
2019 | 2019 | $temp_array['direction_shortname'] = "N"; |
2020 | 2020 | $temp_array['direction_fullname'] = "North"; |
2021 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
2021 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
2022 | 2022 | $temp_array['direction_degree'] = $direction; |
2023 | 2023 | $temp_array['direction_shortname'] = "NNE"; |
2024 | 2024 | $temp_array['direction_fullname'] = "North-Northeast"; |
2025 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
2025 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
2026 | 2026 | $temp_array['direction_degree'] = $direction; |
2027 | 2027 | $temp_array['direction_shortname'] = "NE"; |
2028 | 2028 | $temp_array['direction_fullname'] = "Northeast"; |
2029 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
2029 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
2030 | 2030 | $temp_array['direction_degree'] = $direction; |
2031 | 2031 | $temp_array['direction_shortname'] = "ENE"; |
2032 | 2032 | $temp_array['direction_fullname'] = "East-Northeast"; |
2033 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
2033 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
2034 | 2034 | $temp_array['direction_degree'] = $direction; |
2035 | 2035 | $temp_array['direction_shortname'] = "E"; |
2036 | 2036 | $temp_array['direction_fullname'] = "East"; |
2037 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
2037 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
2038 | 2038 | $temp_array['direction_degree'] = $direction; |
2039 | 2039 | $temp_array['direction_shortname'] = "ESE"; |
2040 | 2040 | $temp_array['direction_fullname'] = "East-Southeast"; |
2041 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
2041 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
2042 | 2042 | $temp_array['direction_degree'] = $direction; |
2043 | 2043 | $temp_array['direction_shortname'] = "SE"; |
2044 | 2044 | $temp_array['direction_fullname'] = "Southeast"; |
2045 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
2045 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
2046 | 2046 | $temp_array['direction_degree'] = $direction; |
2047 | 2047 | $temp_array['direction_shortname'] = "SSE"; |
2048 | 2048 | $temp_array['direction_fullname'] = "South-Southeast"; |
2049 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
2049 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
2050 | 2050 | $temp_array['direction_degree'] = $direction; |
2051 | 2051 | $temp_array['direction_shortname'] = "S"; |
2052 | 2052 | $temp_array['direction_fullname'] = "South"; |
2053 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
2053 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
2054 | 2054 | $temp_array['direction_degree'] = $direction; |
2055 | 2055 | $temp_array['direction_shortname'] = "SSW"; |
2056 | 2056 | $temp_array['direction_fullname'] = "South-Southwest"; |
2057 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
2057 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
2058 | 2058 | $temp_array['direction_degree'] = $direction; |
2059 | 2059 | $temp_array['direction_shortname'] = "SW"; |
2060 | 2060 | $temp_array['direction_fullname'] = "Southwest"; |
2061 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
2061 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
2062 | 2062 | $temp_array['direction_degree'] = $direction; |
2063 | 2063 | $temp_array['direction_shortname'] = "WSW"; |
2064 | 2064 | $temp_array['direction_fullname'] = "West-Southwest"; |
2065 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
2065 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
2066 | 2066 | $temp_array['direction_degree'] = $direction; |
2067 | 2067 | $temp_array['direction_shortname'] = "W"; |
2068 | 2068 | $temp_array['direction_fullname'] = "West"; |
2069 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
2069 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
2070 | 2070 | $temp_array['direction_degree'] = $direction; |
2071 | 2071 | $temp_array['direction_shortname'] = "WNW"; |
2072 | 2072 | $temp_array['direction_fullname'] = "West-Northwest"; |
2073 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
2073 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
2074 | 2074 | $temp_array['direction_degree'] = $direction; |
2075 | 2075 | $temp_array['direction_shortname'] = "NW"; |
2076 | 2076 | $temp_array['direction_fullname'] = "Northwest"; |
2077 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
2077 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
2078 | 2078 | $temp_array['direction_degree'] = $direction; |
2079 | 2079 | $temp_array['direction_shortname'] = "NNW"; |
2080 | 2080 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -2091,11 +2091,11 @@ discard block |
||
2091 | 2091 | * @param Float $longitude longitute of the flight |
2092 | 2092 | * @return String the countrie |
2093 | 2093 | */ |
2094 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
2094 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
2095 | 2095 | { |
2096 | 2096 | global $globalDBdriver, $globalDebug; |
2097 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2098 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2097 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2098 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2099 | 2099 | |
2100 | 2100 | $Connection = new Connection($this->db); |
2101 | 2101 | if (!$Connection->tableExists('countries')) return ''; |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | public function getCountryFromISO2($iso2) |
2136 | 2136 | { |
2137 | 2137 | global $globalDBdriver, $globalDebug; |
2138 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
2138 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
2139 | 2139 | |
2140 | 2140 | $Connection = new Connection($this->db); |
2141 | 2141 | if (!$Connection->tableExists('countries')) return ''; |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | |
2184 | 2184 | $bitly_data = json_decode($bitly_data); |
2185 | 2185 | $bitly_url = ''; |
2186 | - if ($bitly_data->status_txt = "OK"){ |
|
2186 | + if ($bitly_data->status_txt = "OK") { |
|
2187 | 2187 | $bitly_url = $bitly_data->data->url; |
2188 | 2188 | } |
2189 | 2189 | |
@@ -2197,11 +2197,11 @@ discard block |
||
2197 | 2197 | * @return Array the vessel type list |
2198 | 2198 | * |
2199 | 2199 | */ |
2200 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
2200 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
2201 | 2201 | { |
2202 | 2202 | global $globalDBdriver; |
2203 | - $filter_query = $this->getFilter($filters,true,true); |
|
2204 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
2203 | + $filter_query = $this->getFilter($filters, true, true); |
|
2204 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
2205 | 2205 | FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL"; |
2206 | 2206 | if ($olderthanmonths > 0) { |
2207 | 2207 | if ($globalDBdriver == 'mysql') { |
@@ -2221,28 +2221,28 @@ discard block |
||
2221 | 2221 | if ($year != '') { |
2222 | 2222 | if ($globalDBdriver == 'mysql') { |
2223 | 2223 | $query .= " AND YEAR(marine_output.date) = :year"; |
2224 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2224 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2225 | 2225 | } else { |
2226 | 2226 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
2227 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2227 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2228 | 2228 | } |
2229 | 2229 | } |
2230 | 2230 | if ($month != '') { |
2231 | 2231 | if ($globalDBdriver == 'mysql') { |
2232 | 2232 | $query .= " AND MONTH(marine_output.date) = :month"; |
2233 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2233 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2234 | 2234 | } else { |
2235 | 2235 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
2236 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2236 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2237 | 2237 | } |
2238 | 2238 | } |
2239 | 2239 | if ($day != '') { |
2240 | 2240 | if ($globalDBdriver == 'mysql') { |
2241 | 2241 | $query .= " AND DAY(marine_output.date) = :day"; |
2242 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
2242 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
2243 | 2243 | } else { |
2244 | 2244 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
2245 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
2245 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
2246 | 2246 | } |
2247 | 2247 | } |
2248 | 2248 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
@@ -2251,7 +2251,7 @@ discard block |
||
2251 | 2251 | $sth->execute($query_values); |
2252 | 2252 | $marine_array = array(); |
2253 | 2253 | $temp_array = array(); |
2254 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2254 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2255 | 2255 | { |
2256 | 2256 | $temp_array['marine_type'] = $row['marine_type']; |
2257 | 2257 | $temp_array['marine_type_id'] = $row['marine_type_id']; |
@@ -2267,13 +2267,13 @@ discard block |
||
2267 | 2267 | * @return Array the tracker information |
2268 | 2268 | * |
2269 | 2269 | */ |
2270 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
2270 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
2271 | 2271 | { |
2272 | 2272 | global $globalTimezone, $globalDBdriver; |
2273 | 2273 | date_default_timezone_set('UTC'); |
2274 | 2274 | $query_values = array(); |
2275 | 2275 | $additional_query = ''; |
2276 | - $filter_query = $this->getFilter($filters,true,true); |
|
2276 | + $filter_query = $this->getFilter($filters, true, true); |
|
2277 | 2277 | if ($q != "") |
2278 | 2278 | { |
2279 | 2279 | if (!is_string($q)) |
@@ -2281,8 +2281,8 @@ discard block |
||
2281 | 2281 | return false; |
2282 | 2282 | } else { |
2283 | 2283 | $q_array = explode(" ", $q); |
2284 | - foreach ($q_array as $q_item){ |
|
2285 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
2284 | + foreach ($q_array as $q_item) { |
|
2285 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
2286 | 2286 | $additional_query .= " AND ("; |
2287 | 2287 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
2288 | 2288 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -2294,42 +2294,42 @@ discard block |
||
2294 | 2294 | } |
2295 | 2295 | if ($callsign != "") |
2296 | 2296 | { |
2297 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
2297 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
2298 | 2298 | if (!is_string($callsign)) |
2299 | 2299 | { |
2300 | 2300 | return false; |
2301 | 2301 | } else { |
2302 | 2302 | $additional_query .= " AND marine_output.ident = :callsign"; |
2303 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
2303 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
2304 | 2304 | } |
2305 | 2305 | } |
2306 | 2306 | if ($mmsi != "") |
2307 | 2307 | { |
2308 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
2308 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
2309 | 2309 | if (!is_numeric($mmsi)) |
2310 | 2310 | { |
2311 | 2311 | return false; |
2312 | 2312 | } else { |
2313 | 2313 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
2314 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
2314 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
2315 | 2315 | } |
2316 | 2316 | } |
2317 | 2317 | if ($imo != "") |
2318 | 2318 | { |
2319 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
2319 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
2320 | 2320 | if (!is_numeric($imo)) |
2321 | 2321 | { |
2322 | 2322 | return false; |
2323 | 2323 | } else { |
2324 | 2324 | $additional_query .= " AND marine_output.imo = :imo"; |
2325 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
2325 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
2326 | 2326 | } |
2327 | 2327 | } |
2328 | 2328 | if ($date_posted != "") |
2329 | 2329 | { |
2330 | 2330 | $date_array = explode(",", $date_posted); |
2331 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
2332 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
2331 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
2332 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
2333 | 2333 | if ($globalTimezone != '') { |
2334 | 2334 | date_default_timezone_set($globalTimezone); |
2335 | 2335 | $datetime = new DateTime(); |
@@ -2356,8 +2356,8 @@ discard block |
||
2356 | 2356 | if ($limit != "") |
2357 | 2357 | { |
2358 | 2358 | $limit_array = explode(",", $limit); |
2359 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
2360 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
2359 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
2360 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
2361 | 2361 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2362 | 2362 | { |
2363 | 2363 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -2375,22 +2375,22 @@ discard block |
||
2375 | 2375 | } |
2376 | 2376 | } |
2377 | 2377 | if ($origLat != "" && $origLon != "" && $dist != "") { |
2378 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
2378 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
2379 | 2379 | if ($globalDBdriver == 'mysql') { |
2380 | - $query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
2380 | + $query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
2381 | 2381 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
2382 | 2382 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
2383 | 2383 | } else { |
2384 | - $query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
2384 | + $query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
2385 | 2385 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
2386 | 2386 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
2387 | 2387 | } |
2388 | 2388 | } else { |
2389 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2389 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2390 | 2390 | ".$additional_query." |
2391 | 2391 | ".$orderby_query; |
2392 | 2392 | } |
2393 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
2393 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
2394 | 2394 | return $marine_array; |
2395 | 2395 | } |
2396 | 2396 | |
@@ -2403,12 +2403,12 @@ discard block |
||
2403 | 2403 | public function checkId($id) |
2404 | 2404 | { |
2405 | 2405 | global $globalDBdriver, $globalTimezone; |
2406 | - $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
|
2406 | + $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
|
2407 | 2407 | $query_data = array(':id' => $id); |
2408 | 2408 | $sth = $this->db->prepare($query); |
2409 | 2409 | $sth->execute($query_data); |
2410 | - $ident_result=''; |
|
2411 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2410 | + $ident_result = ''; |
|
2411 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2412 | 2412 | { |
2413 | 2413 | $ident_result = $row['fammarine_id']; |
2414 | 2414 | } |
@@ -2417,7 +2417,7 @@ discard block |
||
2417 | 2417 | |
2418 | 2418 | public function getOrderBy() |
2419 | 2419 | { |
2420 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure port - ASC", "sql" => "ORDER BY marine_output.departure_port_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
2420 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure port - ASC", "sql" => "ORDER BY marine_output.departure_port_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
2421 | 2421 | |
2422 | 2422 | return $orderby; |
2423 | 2423 |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | $min = true; |
65 | 65 | $allhistory = false; |
66 | 66 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
69 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
72 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
78 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
79 | 79 | |
80 | 80 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
81 | 81 | $min = true; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $spotter_array = array(); |
85 | 85 | |
86 | 86 | if (isset($_GET['ident'])) { |
87 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
87 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
88 | 88 | if ($tracker) { |
89 | 89 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
90 | 90 | } elseif ($marine) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | $allhistory = true; |
100 | 100 | } elseif (isset($_GET['flightaware_id'])) { |
101 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
101 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
102 | 102 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
103 | 103 | if (empty($spotter_array)) { |
104 | 104 | $from_archive = true; |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | } |
107 | 107 | $allhistory = true; |
108 | 108 | } elseif (isset($_GET['famtrack_id'])) { |
109 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
109 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
110 | 110 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
111 | 111 | $allhistory = true; |
112 | 112 | } elseif (isset($_GET['fammarine_id'])) { |
113 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
113 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
114 | 114 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
115 | 115 | $allhistory = true; |
116 | 116 | /* |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | */ |
131 | 131 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) { |
132 | 132 | $usecoord = true; |
133 | - $coord = explode(',',$_GET['coord']); |
|
134 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
133 | + $coord = explode(',', $_GET['coord']); |
|
134 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
135 | 135 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
136 | 136 | if ($tracker) { |
137 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
137 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
138 | 138 | } elseif ($marine) { |
139 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
139 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
140 | 140 | } else { |
141 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
141 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
142 | 142 | } |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | $from_archive = true; |
154 | 154 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
155 | 155 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
156 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
157 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
158 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
159 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
160 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
161 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
156 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
157 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
158 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
159 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
160 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
161 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
162 | 162 | } elseif ($min) { |
163 | 163 | if ($tracker) { |
164 | 164 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | # $min = true; |
171 | 171 | } else { |
172 | 172 | if ($tracker) { |
173 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
173 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
174 | 174 | } elseif ($marine) { |
175 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
175 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
176 | 176 | } else { |
177 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
177 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | 181 | if ($usecoord) { |
182 | 182 | if (isset($_GET['archive'])) { |
183 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
183 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
184 | 184 | } else { |
185 | 185 | if ($tracker) { |
186 | 186 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | if ($flightcnt == '') $flightcnt = 0; |
194 | 194 | } else $flightcnt = 0; |
195 | 195 | |
196 | -$sqltime = round(microtime(true)-$begintime,2); |
|
196 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
197 | 197 | |
198 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
198 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
199 | 199 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
200 | 200 | |
201 | 201 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | if (!empty($spotter_array) && is_array($spotter_array)) |
215 | 215 | { |
216 | 216 | $output .= '"features": ['; |
217 | - foreach($spotter_array as $spotter_item) |
|
217 | + foreach ($spotter_array as $spotter_item) |
|
218 | 218 | { |
219 | 219 | $j++; |
220 | 220 | unset($idistance); |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | */ |
272 | 272 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
273 | 273 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
274 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
275 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
274 | + if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
275 | + else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
276 | 276 | //' |
277 | 277 | } else { |
278 | 278 | if ($compress) $output .= '"c": "NA",'; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
286 | 286 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
287 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
287 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
288 | 288 | } elseif (isset($spotter_item['aircraft_type'])) { |
289 | 289 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
290 | 290 | } elseif (!$min) { |
@@ -431,15 +431,15 @@ discard block |
||
431 | 431 | if (isset($archivespeed) || $usenextlatlon) { |
432 | 432 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
433 | 433 | if (isset($spotter_item['arrival_airport_latitude'])) { |
434 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
435 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
434 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
435 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
436 | 436 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
437 | 437 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
438 | 438 | } else { |
439 | 439 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
440 | 440 | if (isset($aairport[0]['latitude'])) { |
441 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
442 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
441 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
442 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
443 | 443 | $farr_lat = $aairport[0]['latitude']; |
444 | 444 | $farr_lon = $aairport[0]['longitude']; |
445 | 445 | } |
@@ -452,59 +452,59 @@ discard block |
||
452 | 452 | if ($currenttime != '') { |
453 | 453 | if (strtotime($spotter_item['date']) < $currenttime) { |
454 | 454 | if (isset($archivespeed)) { |
455 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
456 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
455 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
456 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
457 | 457 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
458 | 458 | else { |
459 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
460 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
459 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
460 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
461 | 461 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
462 | 462 | else { |
463 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
463 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
464 | 464 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
465 | 465 | } |
466 | 466 | } |
467 | 467 | } elseif ($usenextlatlon) { |
468 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
469 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
468 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
469 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
470 | 470 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
471 | 471 | else { |
472 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
473 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
472 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
473 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
474 | 474 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
475 | 475 | else { |
476 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
476 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
477 | 477 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
478 | 478 | } |
479 | 479 | } |
480 | 480 | } |
481 | 481 | } else { |
482 | 482 | if (isset($archivespeed)) { |
483 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
483 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
484 | 484 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
485 | 485 | } elseif ($usenextlatlon) { |
486 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
486 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
487 | 487 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
488 | 488 | } |
489 | 489 | } |
490 | 490 | } else { |
491 | 491 | if (isset($archivespeed)) { |
492 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
493 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
492 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
493 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
494 | 494 | if (!isset($idistance) || $fdistance < $idistance) { |
495 | 495 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
496 | 496 | } else { |
497 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
497 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
498 | 498 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
499 | 499 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
500 | 500 | } |
501 | 501 | } elseif ($usenextlatlon) { |
502 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
503 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
502 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
503 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
504 | 504 | if (!isset($idistance) || $fdistance < $idistance) { |
505 | 505 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
506 | 506 | } else { |
507 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
507 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
508 | 508 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
509 | 509 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
510 | 510 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | |
514 | 514 | if (!$min) $output .= '"image": "'.$image.'",'; |
515 | 515 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
516 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
516 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
517 | 517 | } |
518 | 518 | if (isset($spotter_item['image_source_website'])) { |
519 | 519 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
539 | 539 | } |
540 | 540 | if (isset($spotter_item['acars'])) { |
541 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
541 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
542 | 542 | } |
543 | 543 | // type when not aircraft ? |
544 | 544 | if (isset($spotter_item['type'])) { |
@@ -558,12 +558,12 @@ discard block |
||
558 | 558 | if ($currenttime != '') { |
559 | 559 | if (strtotime($spotter_item['date']) < $currenttime) { |
560 | 560 | if (!isset($archivespeed)) $archivespeed = 1; |
561 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
562 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
561 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
562 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
563 | 563 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
564 | 564 | else { |
565 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
566 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
565 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
566 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
567 | 567 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
568 | 568 | else { |
569 | 569 | $output .= $spotter_item['longitude'].', '; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | } |
644 | 644 | */ |
645 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
645 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
646 | 646 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
647 | 647 | |
648 | 648 | if ( |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
651 | 651 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
652 | 652 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
653 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
653 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
654 | 654 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
655 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
655 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
656 | 656 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
657 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
657 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
658 | 658 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
659 | 659 | ) { |
660 | 660 | if ($tracker) { |
@@ -683,9 +683,9 @@ discard block |
||
683 | 683 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
684 | 684 | $MapMatching = new MapMatching(); |
685 | 685 | if (isset($spotter_item['date_iso_8601'])) { |
686 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
686 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
687 | 687 | } else { |
688 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
688 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
689 | 689 | } |
690 | 690 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
691 | 691 | } |
@@ -717,9 +717,9 @@ discard block |
||
717 | 717 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
718 | 718 | } |
719 | 719 | $output_history .= '['; |
720 | - $output_history .= $spotter_history['longitude'].', '; |
|
721 | - $output_history .= $spotter_history['latitude'].', '; |
|
722 | - $output_history .= $spotter_history['altitude']*30.48; |
|
720 | + $output_history .= $spotter_history['longitude'].', '; |
|
721 | + $output_history .= $spotter_history['latitude'].', '; |
|
722 | + $output_history .= $spotter_history['altitude']*30.48; |
|
723 | 723 | $output_history .= '],'; |
724 | 724 | /* |
725 | 725 | if ($from_archive === false) { |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | $d = true; |
743 | 743 | } |
744 | 744 | $output_history .= '['; |
745 | - $output_history .= $spotter_history['longitude'].', '; |
|
746 | - $output_history .= $spotter_history['latitude']; |
|
745 | + $output_history .= $spotter_history['longitude'].', '; |
|
746 | + $output_history .= $spotter_history['latitude']; |
|
747 | 747 | $output_history .= '],'; |
748 | 748 | /* |
749 | 749 | if ($from_archive === false) { |
@@ -759,9 +759,9 @@ discard block |
||
759 | 759 | //echo $output_history; |
760 | 760 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
761 | 761 | $output_historyd = '['; |
762 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
763 | - $output_historyd .= $spotter_item['latitude']; |
|
764 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
762 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
763 | + $output_historyd .= $spotter_item['latitude']; |
|
764 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
765 | 765 | $output_historyd .= '],'; |
766 | 766 | //$output_history = $output_historyd.$output_history; |
767 | 767 | $output_history = $output_history.$output_historyd; |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | $last = array_pop($spotter_history_array); |
770 | 770 | $latitude = $last['latitude']; |
771 | 771 | $longitude = $last['longitude']; |
772 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
772 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | $output_history = substr($output_history, 0, -1); |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | } |
781 | 781 | } |
782 | 782 | |
783 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
783 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
784 | 784 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
785 | 785 | && (isset($spotter_item['departure_airport']) |
786 | 786 | && $spotter_item['departure_airport'] != 'NA' |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
816 | 816 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
817 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
817 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
818 | 818 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
819 | 819 | && (isset($spotter_item['arrival_airport']) |
820 | 820 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -841,11 +841,11 @@ discard block |
||
841 | 841 | } |
842 | 842 | } |
843 | 843 | if ($havedata) { |
844 | - $line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon); |
|
844 | + $line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon); |
|
845 | 845 | foreach ($line[0] as $coord) { |
846 | 846 | $output_dest .= '['.$coord[0].','.$coord[1].'],'; |
847 | 847 | } |
848 | - $output_dest = substr($output_dest, 0, -1); |
|
848 | + $output_dest = substr($output_dest, 0, -1); |
|
849 | 849 | } |
850 | 850 | $output_dest .= ']}},'; |
851 | 851 | if ($havedata) $output .= $output_dest; |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $output = substr($output, 0, -1); |
856 | 856 | $output .= ']'; |
857 | 857 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
858 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
858 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
859 | 859 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
860 | 860 | $output .= '"fc": "'.$j.'"'; |
861 | 861 | } else { |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $tracker = false; |
13 | 13 | $marine = false; |
14 | 14 | $usecoord = false; |
15 | -if (isset($_GET['test'])) exit(); |
|
15 | +if (isset($_GET['test'])) { |
|
16 | + exit(); |
|
17 | +} |
|
16 | 18 | if (isset($_GET['tracker'])) { |
17 | 19 | $tracker = true; |
18 | 20 | } |
@@ -57,29 +59,58 @@ discard block |
||
57 | 59 | } |
58 | 60 | header('Content-Type: text/javascript'); |
59 | 61 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
62 | +if (!isset($globalJsonCompress)) { |
|
63 | + $compress = true; |
|
64 | +} else { |
|
65 | + $compress = $globalJsonCompress; |
|
66 | +} |
|
62 | 67 | |
63 | 68 | $from_archive = false; |
64 | 69 | $min = true; |
65 | 70 | $allhistory = false; |
66 | 71 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
73 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
74 | +} |
|
75 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
76 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
77 | +} |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
79 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
80 | +} |
|
81 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
82 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
83 | +} |
|
84 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
85 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
86 | +} |
|
87 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
88 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
89 | +} |
|
90 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
91 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
92 | +} |
|
93 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
94 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | +} |
|
96 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
97 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
98 | +} |
|
99 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
100 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
101 | +} |
|
102 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
103 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
104 | +} |
|
105 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') { |
|
106 | + $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
107 | +} |
|
79 | 108 | |
80 | 109 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
81 | 110 | $min = true; |
82 | -} else $min = false; |
|
111 | +} else { |
|
112 | + $min = false; |
|
113 | +} |
|
83 | 114 | |
84 | 115 | $spotter_array = array(); |
85 | 116 | |
@@ -190,24 +221,38 @@ discard block |
||
190 | 221 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
191 | 222 | } |
192 | 223 | } |
193 | - if ($flightcnt == '') $flightcnt = 0; |
|
194 | -} else $flightcnt = 0; |
|
224 | + if ($flightcnt == '') { |
|
225 | + $flightcnt = 0; |
|
226 | + } |
|
227 | + } else { |
|
228 | + $flightcnt = 0; |
|
229 | +} |
|
195 | 230 | |
196 | 231 | $sqltime = round(microtime(true)-$begintime,2); |
197 | 232 | |
198 | 233 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
199 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
234 | +if ($currenttime != '') { |
|
235 | + $currenttime = round($currenttime/1000); |
|
236 | +} |
|
200 | 237 | |
201 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
202 | -else $usenextlatlon = true; |
|
203 | -if ($usenextlatlon === false) $currenttime = ''; |
|
238 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
239 | + $usenextlatlon = false; |
|
240 | +} else { |
|
241 | + $usenextlatlon = true; |
|
242 | +} |
|
243 | +if ($usenextlatlon === false) { |
|
244 | + $currenttime = ''; |
|
245 | +} |
|
204 | 246 | $j = 0; |
205 | 247 | $prev_flightaware_id = ''; |
206 | 248 | $aircrafts_shadow = array(); |
207 | 249 | $output = '{'; |
208 | 250 | $output .= '"type": "FeatureCollection",'; |
209 | - if ($min) $output .= '"minimal": "true",'; |
|
210 | - else $output .= '"minimal": "false",'; |
|
251 | + if ($min) { |
|
252 | + $output .= '"minimal": "true",'; |
|
253 | + } else { |
|
254 | + $output .= '"minimal": "false",'; |
|
255 | + } |
|
211 | 256 | //$output .= '"fc": "'.$flightcnt.'",'; |
212 | 257 | $output .= '"sqt": "'.$sqltime.'",'; |
213 | 258 | |
@@ -252,18 +297,29 @@ discard block |
||
252 | 297 | } |
253 | 298 | $output .= '"properties": {'; |
254 | 299 | if (isset($spotter_item['flightaware_id'])) { |
255 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
256 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
300 | + if ($compress) { |
|
301 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
302 | + } else { |
|
303 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
304 | + } |
|
257 | 305 | } elseif (isset($spotter_item['famtrackid'])) { |
258 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
259 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
306 | + if ($compress) { |
|
307 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
308 | + } else { |
|
309 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
310 | + } |
|
260 | 311 | } elseif (isset($spotter_item['fammarine_id'])) { |
261 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
262 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
312 | + if ($compress) { |
|
313 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
314 | + } else { |
|
315 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
316 | + } |
|
263 | 317 | } |
264 | 318 | $output .= '"fc": "'.$flightcnt.'",'; |
265 | 319 | $output .= '"sqt": "'.$sqltime.'",'; |
266 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
320 | + if (isset($begindate)) { |
|
321 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
322 | + } |
|
267 | 323 | |
268 | 324 | /* |
269 | 325 | if ($min) $output .= '"minimal": "true",'; |
@@ -271,16 +327,25 @@ discard block |
||
271 | 327 | */ |
272 | 328 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
273 | 329 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
274 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
275 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
330 | + if ($compress) { |
|
331 | + $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
332 | + } else { |
|
333 | + $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
334 | + } |
|
276 | 335 | //' |
277 | 336 | } else { |
278 | - if ($compress) $output .= '"c": "NA",'; |
|
279 | - else $output .= '"callsign": "NA",'; |
|
337 | + if ($compress) { |
|
338 | + $output .= '"c": "NA",'; |
|
339 | + } else { |
|
340 | + $output .= '"callsign": "NA",'; |
|
341 | + } |
|
280 | 342 | } |
281 | 343 | if (isset($spotter_item['registration'])) { |
282 | - if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
283 | - else $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
344 | + if ($compress) { |
|
345 | + $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
346 | + } else { |
|
347 | + $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
348 | + } |
|
284 | 349 | } |
285 | 350 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
286 | 351 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
@@ -291,20 +356,30 @@ discard block |
||
291 | 356 | $output .= '"aircraft_name": "NA",'; |
292 | 357 | } |
293 | 358 | if (isset($spotter_item['aircraft_icao'])) { |
294 | - if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
295 | - else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
359 | + if ($compress) { |
|
360 | + $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
361 | + } else { |
|
362 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
363 | + } |
|
296 | 364 | } |
297 | 365 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
298 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
299 | - else { |
|
366 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
367 | + $spotter_item['aircraft_shadow'] = ''; |
|
368 | + } else { |
|
300 | 369 | $aircraft_icao = $spotter_item['aircraft_icao']; |
301 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
302 | - else { |
|
370 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
371 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
372 | + } else { |
|
303 | 373 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
304 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
305 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
306 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
307 | - else $spotter_item['aircraft_shadow'] = ''; |
|
374 | + if (count($aircraft_info) > 0) { |
|
375 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
376 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
377 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
378 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
379 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
380 | + } else { |
|
381 | + $spotter_item['aircraft_shadow'] = ''; |
|
382 | + } |
|
308 | 383 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
309 | 384 | } |
310 | 385 | } |
@@ -312,73 +387,139 @@ discard block |
||
312 | 387 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
313 | 388 | if ($tracker) { |
314 | 389 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
315 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
390 | + if ($compress) { |
|
391 | + $output .= '"as": "ambulance.png",'; |
|
392 | + } else { |
|
393 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
394 | + } |
|
317 | 395 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
318 | - if ($compress) $output .= '"as": "police.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
396 | + if ($compress) { |
|
397 | + $output .= '"as": "police.png",'; |
|
398 | + } else { |
|
399 | + $output .= '"aircraft_shadow": "police.png",'; |
|
400 | + } |
|
320 | 401 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
321 | - if ($compress) $output .= '"as": "ship.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
402 | + if ($compress) { |
|
403 | + $output .= '"as": "ship.png",'; |
|
404 | + } else { |
|
405 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
406 | + } |
|
323 | 407 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
324 | - if ($compress) $output .= '"as": "ship.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
408 | + if ($compress) { |
|
409 | + $output .= '"as": "ship.png",'; |
|
410 | + } else { |
|
411 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
412 | + } |
|
326 | 413 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
327 | - if ($compress) $output .= '"as": "ship.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
414 | + if ($compress) { |
|
415 | + $output .= '"as": "ship.png",'; |
|
416 | + } else { |
|
417 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
418 | + } |
|
329 | 419 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
330 | - if ($compress) $output .= '"as": "truck.png",'; |
|
331 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
420 | + if ($compress) { |
|
421 | + $output .= '"as": "truck.png",'; |
|
422 | + } else { |
|
423 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
424 | + } |
|
332 | 425 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
333 | - if ($compress) $output .= '"as": "truck.png",'; |
|
334 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
426 | + if ($compress) { |
|
427 | + $output .= '"as": "truck.png",'; |
|
428 | + } else { |
|
429 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
430 | + } |
|
335 | 431 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
336 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
337 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
432 | + if ($compress) { |
|
433 | + $output .= '"as": "aircraft.png",'; |
|
434 | + } else { |
|
435 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
436 | + } |
|
338 | 437 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
339 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
340 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
438 | + if ($compress) { |
|
439 | + $output .= '"as": "aircraft.png",'; |
|
440 | + } else { |
|
441 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
442 | + } |
|
341 | 443 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
342 | - if ($compress) $output .= '"as": "helico.png",'; |
|
343 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
444 | + if ($compress) { |
|
445 | + $output .= '"as": "helico.png",'; |
|
446 | + } else { |
|
447 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
448 | + } |
|
344 | 449 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
345 | - if ($compress) $output .= '"as": "rail.png",'; |
|
346 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
450 | + if ($compress) { |
|
451 | + $output .= '"as": "rail.png",'; |
|
452 | + } else { |
|
453 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
454 | + } |
|
347 | 455 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
348 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
349 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
456 | + if ($compress) { |
|
457 | + $output .= '"as": "firetruck.png",'; |
|
458 | + } else { |
|
459 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
460 | + } |
|
350 | 461 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
351 | - if ($compress) $output .= '"as": "bus.png",'; |
|
352 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
462 | + if ($compress) { |
|
463 | + $output .= '"as": "bus.png",'; |
|
464 | + } else { |
|
465 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
466 | + } |
|
353 | 467 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
354 | - if ($compress) $output .= '"as": "phone.png",'; |
|
355 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
468 | + if ($compress) { |
|
469 | + $output .= '"as": "phone.png",'; |
|
470 | + } else { |
|
471 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
472 | + } |
|
356 | 473 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
357 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
358 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
474 | + if ($compress) { |
|
475 | + $output .= '"as": "jogger.png",'; |
|
476 | + } else { |
|
477 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
478 | + } |
|
359 | 479 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
360 | - if ($compress) $output .= '"as": "bike.png",'; |
|
361 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
480 | + if ($compress) { |
|
481 | + $output .= '"as": "bike.png",'; |
|
482 | + } else { |
|
483 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
484 | + } |
|
362 | 485 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
363 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
364 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
486 | + if ($compress) { |
|
487 | + $output .= '"as": "motorcycle.png",'; |
|
488 | + } else { |
|
489 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
490 | + } |
|
365 | 491 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
366 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
367 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
492 | + if ($compress) { |
|
493 | + $output .= '"as": "balloon.png",'; |
|
494 | + } else { |
|
495 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
496 | + } |
|
368 | 497 | } else { |
369 | - if ($compress) $output .= '"as": "car.png",'; |
|
370 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
498 | + if ($compress) { |
|
499 | + $output .= '"as": "car.png",'; |
|
500 | + } else { |
|
501 | + $output .= '"aircraft_shadow": "car.png",'; |
|
502 | + } |
|
371 | 503 | } |
372 | 504 | } elseif ($marine) { |
373 | - if ($compress) $output .= '"as": "ship.png",'; |
|
374 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
505 | + if ($compress) { |
|
506 | + $output .= '"as": "ship.png",'; |
|
507 | + } else { |
|
508 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
509 | + } |
|
375 | 510 | } else { |
376 | - if ($compress) $output .= '"as": "default.png",'; |
|
377 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
511 | + if ($compress) { |
|
512 | + $output .= '"as": "default.png",'; |
|
513 | + } else { |
|
514 | + $output .= '"aircraft_shadow": "default.png",'; |
|
515 | + } |
|
378 | 516 | } |
379 | 517 | } else { |
380 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
381 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
518 | + if ($compress) { |
|
519 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
520 | + } else { |
|
521 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
522 | + } |
|
382 | 523 | } |
383 | 524 | if (isset($spotter_item['airline_name'])) { |
384 | 525 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -386,8 +527,11 @@ discard block |
||
386 | 527 | $output .= '"airline_name": "NA",'; |
387 | 528 | } |
388 | 529 | if (isset($spotter_item['departure_airport'])) { |
389 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
390 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
530 | + if ($compress) { |
|
531 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
532 | + } else { |
|
533 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
534 | + } |
|
391 | 535 | } |
392 | 536 | if (isset($spotter_item['departure_airport_city'])) { |
393 | 537 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -399,8 +543,11 @@ discard block |
||
399 | 543 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
400 | 544 | } |
401 | 545 | if (isset($spotter_item['arrival_airport'])) { |
402 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
403 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
546 | + if ($compress) { |
|
547 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
548 | + } else { |
|
549 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
550 | + } |
|
404 | 551 | } |
405 | 552 | if (isset($spotter_item['arrival_airport_city'])) { |
406 | 553 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -419,11 +566,17 @@ discard block |
||
419 | 566 | } |
420 | 567 | |
421 | 568 | if (isset($spotter_item['real_altitude'])) { |
422 | - if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
423 | - else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
569 | + if ($compress) { |
|
570 | + $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
571 | + } else { |
|
572 | + $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
573 | + } |
|
424 | 574 | } elseif (isset($spotter_item['altitude'])) { |
425 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
426 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
575 | + if ($compress) { |
|
576 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
577 | + } else { |
|
578 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
579 | + } |
|
427 | 580 | } |
428 | 581 | |
429 | 582 | $heading = $spotter_item['heading']; |
@@ -447,19 +600,24 @@ discard block |
||
447 | 600 | } |
448 | 601 | } |
449 | 602 | |
450 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
451 | - else $output .= '"heading": "'.$heading.'",'; |
|
603 | + if ($compress) { |
|
604 | + $output .= '"h": "'.$heading.'",'; |
|
605 | + } else { |
|
606 | + $output .= '"heading": "'.$heading.'",'; |
|
607 | + } |
|
452 | 608 | if ($currenttime != '') { |
453 | 609 | if (strtotime($spotter_item['date']) < $currenttime) { |
454 | 610 | if (isset($archivespeed)) { |
455 | 611 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
456 | 612 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
457 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
458 | - else { |
|
613 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
614 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
615 | + } else { |
|
459 | 616 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
460 | 617 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
461 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
462 | - else { |
|
618 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
619 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
620 | + } else { |
|
463 | 621 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
464 | 622 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
465 | 623 | } |
@@ -467,12 +625,14 @@ discard block |
||
467 | 625 | } elseif ($usenextlatlon) { |
468 | 626 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
469 | 627 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
470 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
471 | - else { |
|
628 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
629 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
630 | + } else { |
|
472 | 631 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
473 | 632 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
474 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
475 | - else { |
|
633 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
634 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
635 | + } else { |
|
476 | 636 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
477 | 637 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
478 | 638 | } |
@@ -511,7 +671,9 @@ discard block |
||
511 | 671 | } |
512 | 672 | } |
513 | 673 | |
514 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
674 | + if (!$min) { |
|
675 | + $output .= '"image": "'.$image.'",'; |
|
676 | + } |
|
515 | 677 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
516 | 678 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
517 | 679 | } |
@@ -519,8 +681,11 @@ discard block |
||
519 | 681 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
520 | 682 | } |
521 | 683 | if (isset($spotter_item['squawk'])) { |
522 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
523 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
684 | + if ($compress) { |
|
685 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
686 | + } else { |
|
687 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
688 | + } |
|
524 | 689 | } |
525 | 690 | if (isset($spotter_item['squawk_usage'])) { |
526 | 691 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -542,14 +707,23 @@ discard block |
||
542 | 707 | } |
543 | 708 | // type when not aircraft ? |
544 | 709 | if (isset($spotter_item['type'])) { |
545 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
546 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
710 | + if ($compress) { |
|
711 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
712 | + } else { |
|
713 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
714 | + } |
|
547 | 715 | } elseif ($marine) { |
548 | - if ($compress) $output .= '"t": "ship"'; |
|
549 | - else $output .= '"type": "ship"'; |
|
716 | + if ($compress) { |
|
717 | + $output .= '"t": "ship"'; |
|
718 | + } else { |
|
719 | + $output .= '"type": "ship"'; |
|
720 | + } |
|
550 | 721 | } else { |
551 | - if ($compress) $output .= '"t": "aircraft"'; |
|
552 | - else $output .= '"type": "aircraft"'; |
|
722 | + if ($compress) { |
|
723 | + $output .= '"t": "aircraft"'; |
|
724 | + } else { |
|
725 | + $output .= '"type": "aircraft"'; |
|
726 | + } |
|
553 | 727 | } |
554 | 728 | $output .= '},'; |
555 | 729 | $output .= '"geometry": {'; |
@@ -557,15 +731,19 @@ discard block |
||
557 | 731 | $output .= '"coordinates": ['; |
558 | 732 | if ($currenttime != '') { |
559 | 733 | if (strtotime($spotter_item['date']) < $currenttime) { |
560 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
734 | + if (!isset($archivespeed)) { |
|
735 | + $archivespeed = 1; |
|
736 | + } |
|
561 | 737 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
562 | 738 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
563 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
564 | - else { |
|
739 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
740 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
741 | + } else { |
|
565 | 742 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
566 | 743 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
567 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
568 | - else { |
|
744 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
745 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
746 | + } else { |
|
569 | 747 | $output .= $spotter_item['longitude'].', '; |
570 | 748 | $output .= $spotter_item['latitude']; |
571 | 749 | } |
@@ -643,7 +821,9 @@ discard block |
||
643 | 821 | } |
644 | 822 | */ |
645 | 823 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
646 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
824 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
825 | + $history = $_COOKIE['history']; |
|
826 | + } |
|
647 | 827 | |
648 | 828 | if ( |
649 | 829 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -713,8 +893,11 @@ discard block |
||
713 | 893 | $output_history .= ']}},'; |
714 | 894 | $output .= $output_history; |
715 | 895 | } |
716 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
717 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
896 | + if ($compress) { |
|
897 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
898 | + } else { |
|
899 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
900 | + } |
|
718 | 901 | } |
719 | 902 | $output_history .= '['; |
720 | 903 | $output_history .= $spotter_history['longitude'].', '; |
@@ -735,10 +918,15 @@ discard block |
||
735 | 918 | if ($d == false) { |
736 | 919 | if ($compress) { |
737 | 920 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
738 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
739 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
921 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
922 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
923 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
924 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
925 | + } |
|
740 | 926 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
741 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
927 | + } else { |
|
928 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
929 | + } |
|
742 | 930 | $d = true; |
743 | 931 | } |
744 | 932 | $output_history .= '['; |
@@ -761,7 +949,9 @@ discard block |
||
761 | 949 | $output_historyd = '['; |
762 | 950 | $output_historyd .= $spotter_item['longitude'].', '; |
763 | 951 | $output_historyd .= $spotter_item['latitude']; |
764 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
952 | + if (isset($spotter_history['altitude'])) { |
|
953 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
954 | + } |
|
765 | 955 | $output_historyd .= '],'; |
766 | 956 | //$output_history = $output_historyd.$output_history; |
767 | 957 | $output_history = $output_history.$output_historyd; |
@@ -788,8 +978,11 @@ discard block |
||
788 | 978 | && $spotter_item['arrival_airport'] != 'NA' |
789 | 979 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
790 | 980 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
791 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
792 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
981 | + if ($compress) { |
|
982 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
983 | + } else { |
|
984 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
985 | + } |
|
793 | 986 | if (isset($spotter_item['departure_airport_latitude'])) { |
794 | 987 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
795 | 988 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -822,8 +1015,11 @@ discard block |
||
822 | 1015 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
823 | 1016 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
824 | 1017 | $havedata = false; |
825 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
826 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1018 | + if ($compress) { |
|
1019 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1020 | + } else { |
|
1021 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1022 | + } |
|
827 | 1023 | |
828 | 1024 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
829 | 1025 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -848,7 +1044,9 @@ discard block |
||
848 | 1044 | $output_dest = substr($output_dest, 0, -1); |
849 | 1045 | } |
850 | 1046 | $output_dest .= ']}},'; |
851 | - if ($havedata) $output .= $output_dest; |
|
1047 | + if ($havedata) { |
|
1048 | + $output .= $output_dest; |
|
1049 | + } |
|
852 | 1050 | unset($output_dest); |
853 | 1051 | } |
854 | 1052 | } |
@@ -856,7 +1054,9 @@ discard block |
||
856 | 1054 | $output .= ']'; |
857 | 1055 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
858 | 1056 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
859 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
1057 | + if (isset($begindate)) { |
|
1058 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
1059 | + } |
|
860 | 1060 | $output .= '"fc": "'.$j.'"'; |
861 | 1061 | } else { |
862 | 1062 | $output .= '"features": '; |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $s3 = sin($bank/2); |
60 | 60 | $c1c2 = $c1*$c2; |
61 | 61 | $s1s2 = $s1*$s2; |
62 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
63 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
64 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
62 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
63 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
64 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
67 | 67 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
68 | 68 | |
69 | 69 | } |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | $min = false; |
85 | 85 | $allhistory = false; |
86 | 86 | $filter['source'] = array(); |
87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
98 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
87 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
88 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
90 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
91 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
92 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
93 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
94 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
95 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
96 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
97 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
98 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
99 | 99 | /* |
100 | 100 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
101 | 101 | $min = true; |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | $from_archive = true; |
143 | 143 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
144 | 144 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
145 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
146 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
147 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
149 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
145 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
146 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
149 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
150 | 150 | if ($tracker) { |
151 | - $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
|
151 | + $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter); |
|
152 | 152 | } elseif ($marine) { |
153 | - $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
|
153 | + $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter); |
|
154 | 154 | } else { |
155 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
155 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
156 | 156 | } |
157 | 157 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
158 | 158 | $from_archive = true; |
@@ -169,36 +169,36 @@ discard block |
||
169 | 169 | } |
170 | 170 | $enddate = $_COOKIE['archive_end']; |
171 | 171 | $enddateinitial = $_COOKIE['archive_end']; |
172 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
173 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
174 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
172 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
173 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
174 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
175 | 175 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
176 | 176 | if ($tracker) { |
177 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
177 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
178 | 178 | } elseif ($marine) { |
179 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
179 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
180 | 180 | } else { |
181 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
181 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
182 | 182 | } |
183 | 183 | } elseif ($tracker) { |
184 | 184 | $coord = array(); |
185 | 185 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
186 | - $coord = explode(',',$_GET['coord']); |
|
187 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
186 | + $coord = explode(',', $_GET['coord']); |
|
187 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
188 | 188 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
189 | 189 | $coord = array(); |
190 | 190 | } |
191 | 191 | } |
192 | 192 | $previous_filter = $filter; |
193 | 193 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
194 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
|
195 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
194 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker'])); |
|
195 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
196 | 196 | /* |
197 | 197 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
198 | 198 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
199 | 199 | */ |
200 | 200 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
201 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
201 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
202 | 202 | } else { |
203 | 203 | $spotter_array = array(); |
204 | 204 | } |
@@ -207,20 +207,20 @@ discard block |
||
207 | 207 | $coord = array(); |
208 | 208 | //if (isset($_GET['coord']) && $_GET['coord'] != '') { |
209 | 209 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
210 | - $coord = explode(',',$_GET['coord']); |
|
211 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
210 | + $coord = explode(',', $_GET['coord']); |
|
211 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
212 | 212 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
213 | 213 | $coord = array(); |
214 | 214 | } |
215 | 215 | } |
216 | 216 | $previous_filter = $filter; |
217 | 217 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
218 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
|
219 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
218 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine'])); |
|
219 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
220 | 220 | } elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) { |
221 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
221 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
222 | 222 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
223 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
223 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
224 | 224 | } else { |
225 | 225 | $spotter_array = array(); |
226 | 226 | } |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | } else { |
229 | 229 | $coord = array(); |
230 | 230 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
231 | - $coord = explode(',',$_GET['coord']); |
|
232 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
231 | + $coord = explode(',', $_GET['coord']); |
|
232 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
233 | 233 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
234 | 234 | $coord = array(); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | $previous_filter = $filter; |
238 | 238 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
239 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
|
240 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
|
239 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrack'])); |
|
240 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false); |
|
241 | 241 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
242 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
242 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
243 | 243 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
244 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
|
244 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false); |
|
245 | 245 | } else { |
246 | 246 | $spotter_array = array(); |
247 | 247 | } |
@@ -251,19 +251,19 @@ discard block |
||
251 | 251 | if (!empty($spotter_array) && isset($coord)) { |
252 | 252 | if ($tracker) { |
253 | 253 | if (isset($_GET['archive'])) { |
254 | - $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
254 | + $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
255 | 255 | } else { |
256 | 256 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
257 | 257 | } |
258 | 258 | } elseif ($marine) { |
259 | 259 | if (isset($_GET['archive'])) { |
260 | - $flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter); |
|
260 | + $flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter); |
|
261 | 261 | } else { |
262 | 262 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
263 | 263 | } |
264 | 264 | } else { |
265 | 265 | if (isset($_GET['archive'])) { |
266 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
266 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
267 | 267 | } else { |
268 | 268 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
269 | 269 | } |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | if ($flightcnt == '') $flightcnt = 0; |
272 | 272 | } else $flightcnt = 0; |
273 | 273 | |
274 | -$sqltime = round(microtime(true)-$begintime,2); |
|
274 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
275 | 275 | $minitime = time(); |
276 | 276 | $minitracktime_begin = time(); |
277 | 277 | $minitracktime = $minitracktime_begin; |
278 | 278 | $maxitime = 0; |
279 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
279 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
280 | 280 | $modelsdb = array(); |
281 | 281 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
282 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
283 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
284 | - if (isset($row[1]) ){ |
|
282 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
283 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
284 | + if (isset($row[1])) { |
|
285 | 285 | $model = $row[0]; |
286 | 286 | $modelsdb[$model] = $row[1]; |
287 | 287 | } |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | } |
292 | 292 | $modelsdb2 = array(); |
293 | 293 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
294 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
295 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
296 | - if (isset($row[1]) ){ |
|
294 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
295 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
296 | + if (isset($row[1])) { |
|
297 | 297 | $model = $row[0]; |
298 | 298 | $glb = $row[1]; |
299 | 299 | if (isset($row[2])) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | if (!empty($spotter_array) && is_array($spotter_array)) |
340 | 340 | { |
341 | 341 | $nblatlong = 0; |
342 | - foreach($spotter_array as $spotter_item) |
|
342 | + foreach ($spotter_array as $spotter_item) |
|
343 | 343 | { |
344 | 344 | $j++; |
345 | 345 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | } |
394 | 394 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
395 | 395 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
396 | - if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
396 | + if (isset($spotter_item['ident'])) $output .= '"ident": "'.$spotter_item['ident'].'",'; |
|
397 | 397 | if ($tracker) { |
398 | 398 | if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
399 | - $output.= '"type": "tracker"'; |
|
399 | + $output .= '"type": "tracker"'; |
|
400 | 400 | } elseif ($marine) { |
401 | 401 | if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
402 | - $output.= '"type": "marine"'; |
|
402 | + $output .= '"type": "marine"'; |
|
403 | 403 | } else { |
404 | 404 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
405 | 405 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -413,14 +413,14 @@ discard block |
||
413 | 413 | if (isset($airline_icao)) { |
414 | 414 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
415 | 415 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
416 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
416 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | } |
420 | 420 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
421 | 421 | } |
422 | - $output.= '"gltf2": %gltf2%,'; |
|
423 | - $output.= '"type": "flight"'; |
|
422 | + $output .= '"gltf2": %gltf2%,'; |
|
423 | + $output .= '"type": "flight"'; |
|
424 | 424 | } |
425 | 425 | $output .= '},'; |
426 | 426 | |
@@ -795,8 +795,8 @@ discard block |
||
795 | 795 | $output .= '},'; |
796 | 796 | } |
797 | 797 | } |
798 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
799 | - else $output = str_replace('%onground%','false',$output); |
|
798 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
799 | + else $output = str_replace('%onground%', 'false', $output); |
|
800 | 800 | |
801 | 801 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
802 | 802 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
813 | 813 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
814 | 814 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
815 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
815 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
816 | 816 | $output .= $spotter_item['longitude'].', '; |
817 | 817 | $output .= $spotter_item['latitude']; |
818 | 818 | $prevlong = $spotter_item['longitude']; |
@@ -840,8 +840,8 @@ discard block |
||
840 | 840 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
841 | 841 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
842 | 842 | } else { |
843 | - $nblatlong = $nblatlong+1; |
|
844 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
843 | + $nblatlong = $nblatlong + 1; |
|
844 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
845 | 845 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
846 | 846 | if ($spotter_item['ground_speed'] == 0) { |
847 | 847 | $output .= $prevlong.', '; |
@@ -882,26 +882,26 @@ discard block |
||
882 | 882 | $output .= ']'; |
883 | 883 | if (isset($globalArchive) && $globalArchive === TRUE) { |
884 | 884 | if (isset($begindateinitial)) { |
885 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
886 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
887 | - if (time()-$globalLiveInterval > $maxitime) { |
|
888 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
885 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
886 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
887 | + if (time() - $globalLiveInterval > $maxitime) { |
|
888 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
889 | 889 | } else { |
890 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
890 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
891 | 891 | } |
892 | 892 | } |
893 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
893 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
894 | 894 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
895 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
895 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
896 | 896 | } else { |
897 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
897 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
898 | 898 | } |
899 | 899 | if (isset($enddateinitial)) { |
900 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
900 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
901 | 901 | } else { |
902 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
902 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
903 | 903 | } |
904 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
905 | -else $output = str_replace('%gltf2%','false',$output); |
|
904 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
905 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
906 | 906 | print $output; |
907 | 907 | ?> |
@@ -19,8 +19,12 @@ discard block |
||
19 | 19 | } |
20 | 20 | $tracker = false; |
21 | 21 | $marine = false; |
22 | -if (isset($_GET['tracker'])) $tracker = true; |
|
23 | -if (isset($_GET['marine'])) $marine = true; |
|
22 | +if (isset($_GET['tracker'])) { |
|
23 | + $tracker = true; |
|
24 | +} |
|
25 | +if (isset($_GET['marine'])) { |
|
26 | + $marine = true; |
|
27 | +} |
|
24 | 28 | if ($tracker) { |
25 | 29 | require_once('require/class.Tracker.php'); |
26 | 30 | require_once('require/class.TrackerLive.php'); |
@@ -77,25 +81,52 @@ discard block |
||
77 | 81 | } |
78 | 82 | header('Content-Type: text/javascript'); |
79 | 83 | |
80 | -if (!isset($globalJsonCompress)) $compress = true; |
|
81 | -else $compress = $globalJsonCompress; |
|
84 | +if (!isset($globalJsonCompress)) { |
|
85 | + $compress = true; |
|
86 | +} else { |
|
87 | + $compress = $globalJsonCompress; |
|
88 | +} |
|
82 | 89 | |
83 | 90 | $from_archive = false; |
84 | 91 | $min = false; |
85 | 92 | $allhistory = false; |
86 | 93 | $filter['source'] = array(); |
87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
98 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
94 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
95 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
96 | +} |
|
97 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
98 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
99 | +} |
|
100 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
101 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
102 | +} |
|
103 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
104 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
105 | +} |
|
106 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
107 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
108 | +} |
|
109 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
110 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
111 | +} |
|
112 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
113 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
114 | +} |
|
115 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
116 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
117 | +} |
|
118 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
119 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
120 | +} |
|
121 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
122 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
123 | +} |
|
124 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
125 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
126 | +} |
|
127 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') { |
|
128 | + $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
129 | +} |
|
99 | 130 | /* |
100 | 131 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
101 | 132 | $min = true; |
@@ -268,8 +299,12 @@ discard block |
||
268 | 299 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
269 | 300 | } |
270 | 301 | } |
271 | - if ($flightcnt == '') $flightcnt = 0; |
|
272 | -} else $flightcnt = 0; |
|
302 | + if ($flightcnt == '') { |
|
303 | + $flightcnt = 0; |
|
304 | + } |
|
305 | + } else { |
|
306 | + $flightcnt = 0; |
|
307 | +} |
|
273 | 308 | |
274 | 309 | $sqltime = round(microtime(true)-$begintime,2); |
275 | 310 | $minitime = time(); |
@@ -315,7 +350,9 @@ discard block |
||
315 | 350 | $gltf2 = false; |
316 | 351 | $scale = 1.0; |
317 | 352 | $minimumpixelsize = 20; |
318 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
353 | +if (isset($archivespeed)) { |
|
354 | + $speed = $archivespeed; |
|
355 | +} |
|
319 | 356 | $output = '['; |
320 | 357 | if ($tracker) { |
321 | 358 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -351,9 +388,13 @@ discard block |
||
351 | 388 | $image = "images/placeholder_thumb.png"; |
352 | 389 | } |
353 | 390 | |
354 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
355 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
356 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
391 | + if (isset($spotter_item['flightaware_id'])) { |
|
392 | + $id = $spotter_item['flightaware_id']; |
|
393 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
394 | + $id = $spotter_item['famtrackid']; |
|
395 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
396 | + $id = $spotter_item['fammarine_id']; |
|
397 | + } |
|
357 | 398 | if ($prev_flightaware_id != $id) { |
358 | 399 | if ($prev_flightaware_id != '') { |
359 | 400 | /* |
@@ -391,14 +432,24 @@ discard block |
||
391 | 432 | if (isset($spotter_item['squawk'])) { |
392 | 433 | $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
393 | 434 | } |
394 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
395 | - if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
396 | - if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
435 | + if (isset($spotter_item['registration'])) { |
|
436 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
437 | + } |
|
438 | + if (isset($spotter_item['format_source'])) { |
|
439 | + $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
440 | + } |
|
441 | + if (isset($spotter_item['ident'])) { |
|
442 | + $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
443 | + } |
|
397 | 444 | if ($tracker) { |
398 | - if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
|
445 | + if (isset($spotter_item['type'])) { |
|
446 | + $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
|
447 | + } |
|
399 | 448 | $output.= '"type": "tracker"'; |
400 | 449 | } elseif ($marine) { |
401 | - if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
|
450 | + if (isset($spotter_item['type'])) { |
|
451 | + $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
|
452 | + } |
|
402 | 453 | $output.= '"type": "marine"'; |
403 | 454 | } else { |
404 | 455 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
@@ -449,7 +500,9 @@ discard block |
||
449 | 500 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
450 | 501 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
451 | 502 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
452 | - } else $aircraft_shadow = ''; |
|
503 | + } else { |
|
504 | + $aircraft_shadow = ''; |
|
505 | + } |
|
453 | 506 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
454 | 507 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
455 | 508 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -457,7 +510,9 @@ discard block |
||
457 | 510 | } |
458 | 511 | $output .= '},'; |
459 | 512 | } |
460 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
513 | + } else { |
|
514 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
515 | + } |
|
461 | 516 | } elseif ($one3dmodel) { |
462 | 517 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
463 | 518 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
@@ -497,7 +552,9 @@ discard block |
||
497 | 552 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
498 | 553 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
499 | 554 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
500 | - } else $aircraft_shadow = ''; |
|
555 | + } else { |
|
556 | + $aircraft_shadow = ''; |
|
557 | + } |
|
501 | 558 | if ($aircraft_shadow != '') { |
502 | 559 | if (isset($modelsdb2[$aircraft_shadow])) { |
503 | 560 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size']; |
@@ -652,7 +709,9 @@ discard block |
||
652 | 709 | } |
653 | 710 | $output .= '},'; |
654 | 711 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
655 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
712 | + if ($spotter_item['aircraft_icao'] != '') { |
|
713 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
714 | + } |
|
656 | 715 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
657 | 716 | } |
658 | 717 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -674,7 +733,9 @@ discard block |
||
674 | 733 | } |
675 | 734 | $output .= '},'; |
676 | 735 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
677 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
736 | + if ($spotter_item['aircraft_icao'] != '') { |
|
737 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
738 | + } |
|
678 | 739 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
679 | 740 | } |
680 | 741 | } else { |
@@ -687,7 +748,9 @@ discard block |
||
687 | 748 | } |
688 | 749 | $output .= '},'; |
689 | 750 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
690 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
751 | + if ($spotter_item['aircraft_icao'] != '') { |
|
752 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
753 | + } |
|
691 | 754 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
692 | 755 | } |
693 | 756 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -795,8 +858,11 @@ discard block |
||
795 | 858 | $output .= '},'; |
796 | 859 | } |
797 | 860 | } |
798 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
799 | - else $output = str_replace('%onground%','false',$output); |
|
861 | + if (isset($onground) && $onground) { |
|
862 | + $output = str_replace('%onground%','true',$output); |
|
863 | + } else { |
|
864 | + $output = str_replace('%onground%','false',$output); |
|
865 | + } |
|
800 | 866 | |
801 | 867 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
802 | 868 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -809,9 +875,15 @@ discard block |
||
809 | 875 | // $output .= '"interpolationDegree" : 5,'; |
810 | 876 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
811 | 877 | $output .= '"cartographicDegrees": ['; |
812 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
813 | - if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
|
814 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
878 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
879 | + $minitime = strtotime($spotter_item['date']); |
|
880 | + } |
|
881 | + if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) { |
|
882 | + $minitracktime = strtotime($spotter_item['date']); |
|
883 | + } |
|
884 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
885 | + $maxitime = strtotime($spotter_item['date']); |
|
886 | + } |
|
815 | 887 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
816 | 888 | $output .= $spotter_item['longitude'].', '; |
817 | 889 | $output .= $spotter_item['latitude']; |
@@ -834,7 +906,9 @@ discard block |
||
834 | 906 | $output .= ', '.round($spotter_item['altitude']*30.48); |
835 | 907 | $prevalt = round($spotter_item['altitude']*30.48); |
836 | 908 | } |
837 | - } else $output .= ', 0'; |
|
909 | + } else { |
|
910 | + $output .= ', 0'; |
|
911 | + } |
|
838 | 912 | //$orientation = '"orientation" : { '; |
839 | 913 | //$orientation .= '"unitQuaternion": ['; |
840 | 914 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
@@ -842,13 +916,18 @@ discard block |
||
842 | 916 | } else { |
843 | 917 | $nblatlong = $nblatlong+1; |
844 | 918 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
845 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
919 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
920 | + $maxitime = strtotime($spotter_item['date']); |
|
921 | + } |
|
846 | 922 | if ($spotter_item['ground_speed'] == 0) { |
847 | 923 | $output .= $prevlong.', '; |
848 | 924 | $output .= $prevlat; |
849 | 925 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; |
850 | - if (!$marine) $output .= ', '.$prevalt; |
|
851 | - else $output .= ', 0'; |
|
926 | + if (!$marine) { |
|
927 | + $output .= ', '.$prevalt; |
|
928 | + } else { |
|
929 | + $output .= ', 0'; |
|
930 | + } |
|
852 | 931 | } else { |
853 | 932 | $output .= $spotter_item['longitude'].', '; |
854 | 933 | $output .= $spotter_item['latitude']; |
@@ -861,14 +940,17 @@ discard block |
||
861 | 940 | $output .= ', 0'; |
862 | 941 | } |
863 | 942 | } else { |
864 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
865 | - elseif ($tracker) { |
|
943 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
944 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
945 | + } elseif ($tracker) { |
|
866 | 946 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
867 | 947 | } else { |
868 | 948 | $output .= ', '.round($spotter_item['altitude']*30.48); |
869 | 949 | } |
870 | 950 | } |
871 | - } else $output .= ', 0'; |
|
951 | + } else { |
|
952 | + $output .= ', 0'; |
|
953 | + } |
|
872 | 954 | } |
873 | 955 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
874 | 956 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -889,9 +971,10 @@ discard block |
||
889 | 971 | } else { |
890 | 972 | $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
891 | 973 | } |
974 | + } else { |
|
975 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
892 | 976 | } |
893 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
894 | -} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
977 | + } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
895 | 978 | $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
896 | 979 | } else { |
897 | 980 | $output = str_replace('%minitime%',date("c",$minitime),$output); |
@@ -901,7 +984,10 @@ discard block |
||
901 | 984 | } else { |
902 | 985 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
903 | 986 | } |
904 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
905 | -else $output = str_replace('%gltf2%','false',$output); |
|
987 | +if ($gltf2) { |
|
988 | + $output = str_replace('%gltf2%','true',$output); |
|
989 | +} else { |
|
990 | + $output = str_replace('%gltf2%','false',$output); |
|
991 | +} |
|
906 | 992 | print $output; |
907 | 993 | ?> |
@@ -4,15 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
6 | 6 | $Common = new Common(); |
7 | -$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
|
7 | +$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop'); |
|
8 | 8 | if (isset($globalVM) && $globalVM) { |
9 | - $showDuration = $Common->multiKeyExists($spotter_array,'race_time'); |
|
10 | - if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
9 | + $showDuration = $Common->multiKeyExists($spotter_array, 'race_time'); |
|
10 | + if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
11 | 11 | } else { |
12 | - $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
12 | + $showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
13 | 13 | } |
14 | 14 | if (isset($globalVM) && $globalVM) { |
15 | - $showDistance = $Common->multiKeyExists($spotter_array,'distance'); |
|
15 | + $showDistance = $Common->multiKeyExists($spotter_array, 'distance'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | print '<th class="more"></th>'; |
176 | 176 | print '</thead>'; |
177 | -} else if (strtolower($current_page) == "upcoming"){ |
|
177 | +} else if (strtolower($current_page) == "upcoming") { |
|
178 | 178 | print '<thead>'; |
179 | 179 | if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
180 | 180 | if ($_GET['sort'] == "airline_name_asc") |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | */ |
230 | 230 | print '</thead>'; |
231 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
231 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
232 | 232 | print '<thead>'; |
233 | 233 | print '<th class="aircraft_thumbnail"></th>'; |
234 | 234 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | print '</thead>'; |
266 | 266 | } else { |
267 | 267 | |
268 | - if ($hide_th_links === true){ |
|
268 | + if ($hide_th_links === true) { |
|
269 | 269 | print '<thead>'; |
270 | 270 | if ($type == 'marine' && isset($globalVM) && $globalVM) { |
271 | 271 | print '<th class="rank">'._("Rank").'</th>'; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | } |
585 | 585 | |
586 | 586 | print '<tbody>'."\n"; |
587 | -foreach($spotter_array as $spotter_item) |
|
587 | +foreach ($spotter_array as $spotter_item) |
|
588 | 588 | { |
589 | 589 | if (isset($globalTimezone)) |
590 | 590 | { |
@@ -619,13 +619,13 @@ discard block |
||
619 | 619 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
620 | 620 | } |
621 | 621 | if (isset($spotter_item['airline_name'])) { |
622 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
622 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
623 | 623 | } else { |
624 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
624 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
625 | 625 | } |
626 | 626 | } else { |
627 | 627 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
628 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
628 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
629 | 629 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
630 | 630 | if (isset($spotter_item['airline_name'])) { |
631 | 631 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | { |
652 | 652 | print '<td class="aircraft_thumbnail">'."\n"; |
653 | 653 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
654 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
654 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
655 | 655 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
656 | 656 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
657 | 657 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | { |
674 | 674 | print '<td class="aircraft_thumbnail">'."\n"; |
675 | 675 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
676 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
676 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
677 | 677 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
678 | 678 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
679 | 679 | print '</td>'."\n"; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | print '</td>'."\n"; |
718 | 718 | } |
719 | 719 | } |
720 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
720 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
721 | 721 | if ($type == 'aircraft') { |
722 | 722 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
723 | 723 | $spotter_item['squawk'] = '-'; |
@@ -734,17 +734,17 @@ discard block |
||
734 | 734 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
735 | 735 | } |
736 | 736 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
737 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
737 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
738 | 738 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
739 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
739 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
740 | 740 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
741 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
741 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
742 | 742 | } else { |
743 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
743 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
744 | 744 | } |
745 | 745 | } else { |
746 | 746 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
747 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
747 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
748 | 748 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
749 | 749 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
750 | 750 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | { |
785 | 785 | print '<td class="aircraft_thumbnail">'."\n"; |
786 | 786 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
787 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
787 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
788 | 788 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
789 | 789 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
790 | 790 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n"; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | { |
809 | 809 | print '<td class="aircraft_thumbnail">'."\n"; |
810 | 810 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
811 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
811 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
812 | 812 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
813 | 813 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
814 | 814 | print '</td>'."\n"; |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | print '</td>'."\n"; |
918 | 918 | } |
919 | 919 | // Aircraft type |
920 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
920 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
921 | 921 | print '<td class="type">'."\n"; |
922 | 922 | if ($type == 'aircraft') { |
923 | 923 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | //print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'._("Not available").'</a></span>'."\n"; |
927 | 927 | print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
928 | 928 | } else { |
929 | - $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
|
929 | + $aircraft_names = explode('/', $spotter_item['aircraft_name']); |
|
930 | 930 | if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
931 | 931 | else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
932 | 932 | } |
@@ -970,22 +970,22 @@ discard block |
||
970 | 970 | } |
971 | 971 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
972 | 972 | if ($spotter_item['departure_airport_time'] > 2460) { |
973 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
974 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
973 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
974 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
975 | 975 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
976 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
976 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
977 | 977 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
978 | 978 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
979 | 979 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
980 | 980 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
981 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
981 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
982 | 982 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
983 | 983 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
984 | 984 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
985 | 985 | if ($spotter_item['departure_airport_time'] > 2460) { |
986 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
986 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
987 | 987 | } else { |
988 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
988 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
989 | 989 | } |
990 | 990 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
991 | 991 | } |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | $latitude = $spotter_item['latitude']; |
1001 | 1001 | $longitude = $spotter_item['longitude']; |
1002 | 1002 | } |
1003 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
1003 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
1004 | 1004 | } else $distance = ''; |
1005 | 1005 | if ($distance != '') { |
1006 | 1006 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -1043,20 +1043,20 @@ discard block |
||
1043 | 1043 | } |
1044 | 1044 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
1045 | 1045 | if ($spotter_item['arrival_airport_time'] > 2460) { |
1046 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
1046 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
1047 | 1047 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
1048 | 1048 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
1049 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
1049 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
1050 | 1050 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
1051 | 1051 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
1052 | 1052 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
1053 | 1053 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
1054 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
1054 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
1055 | 1055 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
1056 | 1056 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
1057 | 1057 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
1058 | 1058 | if ($spotter_item['arrival_airport_time'] > 2460) { |
1059 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
1059 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
1060 | 1060 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
1061 | 1061 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
1062 | 1062 | } |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | $latitude = $spotter_item['latitude']; |
1070 | 1070 | $longitude = $spotter_item['longitude']; |
1071 | 1071 | } |
1072 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
1072 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
1073 | 1073 | } else $distance = ''; |
1074 | 1074 | if ($distance != '') { |
1075 | 1075 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -1131,19 +1131,19 @@ discard block |
||
1131 | 1131 | print '<span class="mobile">-</span>'."\n"; |
1132 | 1132 | } else { |
1133 | 1133 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
1134 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
1135 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
1134 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
1135 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
1136 | 1136 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
1137 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
1138 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
1137 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
1138 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
1139 | 1139 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1140 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
1141 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
1140 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
1141 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | print '</td>'."\n"; |
1145 | 1145 | } |
1146 | - if(strtolower($current_page) != "upcoming"){ |
|
1146 | + if (strtolower($current_page) != "upcoming") { |
|
1147 | 1147 | if ($type == 'aircraft') { |
1148 | 1148 | //if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
1149 | 1149 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
@@ -1188,14 +1188,14 @@ discard block |
||
1188 | 1188 | if (isset($spotter_item['distance'])) { |
1189 | 1189 | print '<td class="distance">'; |
1190 | 1190 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
1191 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
1192 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
1191 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
1192 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
1193 | 1193 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
1194 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
1195 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
1194 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
1195 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
1196 | 1196 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1197 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
1198 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
1197 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
1198 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
1199 | 1199 | } |
1200 | 1200 | print '</td>'."\n"; |
1201 | 1201 | } else { |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | |
1227 | 1227 | if ($showRouteStop) { |
1228 | 1228 | // Route stop |
1229 | - if(strtolower($current_page) != "upcoming"){ |
|
1229 | + if (strtolower($current_page) != "upcoming") { |
|
1230 | 1230 | print '<td class="route_stop">'."\n"; |
1231 | 1231 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
1232 | 1232 | print '<span class="nomobile">-</span>'."\n"; |
@@ -1249,19 +1249,19 @@ discard block |
||
1249 | 1249 | print '<td class="duration">'."\n"; |
1250 | 1250 | if (isset($spotter_item['race_time'])) { |
1251 | 1251 | if ($spotter_item['race_time'] > 86400) { |
1252 | - print '<span class="nomobile">'.gmdate("z\d. H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
1253 | - print '<span class="mobile">'.gmdate("z\d. H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
1252 | + print '<span class="nomobile">'.gmdate("z\d. H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
1253 | + print '<span class="mobile">'.gmdate("z\d. H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
1254 | 1254 | } else { |
1255 | - print '<span class="nomobile">'.gmdate("H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
1256 | - print '<span class="mobile">'.gmdate("H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
1255 | + print '<span class="nomobile">'.gmdate("H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
1256 | + print '<span class="mobile">'.gmdate("H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
1257 | 1257 | } |
1258 | 1258 | } elseif (isset($spotter_item['duration'])) { |
1259 | 1259 | if ($spotter_item['duration'] > 86400) { |
1260 | - print '<span class="nomobile">'.gmdate('z\d. H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
1261 | - print '<span class="mobile">'.gmdate('z\d. H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
1260 | + print '<span class="nomobile">'.gmdate('z\d. H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
1261 | + print '<span class="mobile">'.gmdate('z\d. H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
1262 | 1262 | } else { |
1263 | - print '<span class="nomobile">'.gmdate('H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
1264 | - print '<span class="mobile">'.gmdate('H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
1263 | + print '<span class="nomobile">'.gmdate('H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
1264 | + print '<span class="mobile">'.gmdate('H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
1265 | 1265 | } |
1266 | 1266 | } else { |
1267 | 1267 | print '<span class="nomobile">-</span>'."\n"; |
@@ -1269,11 +1269,11 @@ discard block |
||
1269 | 1269 | } |
1270 | 1270 | print '</td>'."\n"; |
1271 | 1271 | } else { |
1272 | - if(strtolower($current_page) != "upcoming"){ |
|
1272 | + if (strtolower($current_page) != "upcoming") { |
|
1273 | 1273 | print '<td class="duration">'."\n"; |
1274 | 1274 | if (isset($spotter_item['duration'])) { |
1275 | - print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
1276 | - print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
1275 | + print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
1276 | + print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
1277 | 1277 | } else { |
1278 | 1278 | print '<span class="nomobile">-</span>'."\n"; |
1279 | 1279 | print '<span class="mobile">-</span>'."\n"; |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
1288 | 1288 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
1289 | 1289 | print '<td class="message"><p>'."\n"; |
1290 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1290 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1291 | 1291 | print '</p><p class="decode">'; |
1292 | 1292 | $decode_array = json_decode($spotter_item['decode']); |
1293 | 1293 | foreach ($decode_array as $key => $value) { |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | print '</td>'."\n"; |
1298 | 1298 | } else { |
1299 | 1299 | print '<td class="message">'."\n"; |
1300 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1300 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1301 | 1301 | print '</td>'."\n"; |
1302 | 1302 | } |
1303 | 1303 | } |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | } |
1323 | 1323 | print '</td>'."\n"; |
1324 | 1324 | print '<td class="message">'."\n"; |
1325 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1325 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1326 | 1326 | print '</td>'."\n"; |
1327 | 1327 | } |
1328 | 1328 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | print '</td>'."\n"; |
1349 | 1349 | */ |
1350 | 1350 | print '<td class="message">'."\n"; |
1351 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1351 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1352 | 1352 | print '</td>'."\n"; |
1353 | 1353 | } |
1354 | 1354 |
@@ -7,8 +7,10 @@ discard block |
||
7 | 7 | $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
8 | 8 | if (isset($globalVM) && $globalVM) { |
9 | 9 | $showDuration = $Common->multiKeyExists($spotter_array,'race_time'); |
10 | - if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
11 | -} else { |
|
10 | + if ($showDuration === false) { |
|
11 | + $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
12 | + } |
|
13 | + } else { |
|
12 | 14 | $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
13 | 15 | } |
14 | 16 | if (isset($globalVM) && $globalVM) { |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | } |
17 | 19 | |
18 | 20 | |
19 | -if (!isset($type)) $type = 'aircraft'; |
|
21 | +if (!isset($type)) { |
|
22 | + $type = 'aircraft'; |
|
23 | +} |
|
20 | 24 | |
21 | 25 | if (!isset($_GET['sort'])) |
22 | 26 | { |
@@ -589,7 +593,9 @@ discard block |
||
589 | 593 | if (isset($globalTimezone)) |
590 | 594 | { |
591 | 595 | date_default_timezone_set($globalTimezone); |
592 | - } else date_default_timezone_set('UTC'); |
|
596 | + } else { |
|
597 | + date_default_timezone_set('UTC'); |
|
598 | + } |
|
593 | 599 | if ($showSpecial === true) |
594 | 600 | { |
595 | 601 | print '<tr class="special">'."\n"; |
@@ -604,7 +610,9 @@ discard block |
||
604 | 610 | print '<tr class="active">'; |
605 | 611 | } elseif (isset($spotter_item['spotted_registration'])) { |
606 | 612 | print '<tr class="info">'; |
607 | - } else print '<tr>'; |
|
613 | + } else { |
|
614 | + print '<tr>'; |
|
615 | + } |
|
608 | 616 | } |
609 | 617 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") { |
610 | 618 | if ($type == 'aircraft') { |
@@ -612,8 +620,9 @@ discard block |
||
612 | 620 | { |
613 | 621 | print '<td class="aircraft_thumbnail">'."\n"; |
614 | 622 | if ($spotter_item['image_source'] == 'planespotters') { |
615 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
616 | - else { |
|
623 | + if ($spotter_item['image_source_website'] != '') { |
|
624 | + $image_src = $spotter_item['image_source_website']; |
|
625 | + } else { |
|
617 | 626 | $planespotter_url_array = explode("_", $spotter_item['image']); |
618 | 627 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
619 | 628 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -626,7 +635,9 @@ discard block |
||
626 | 635 | } else { |
627 | 636 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
628 | 637 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
629 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
638 | + } else { |
|
639 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
640 | + } |
|
630 | 641 | if (isset($spotter_item['airline_name'])) { |
631 | 642 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
632 | 643 | } else { |
@@ -652,7 +663,9 @@ discard block |
||
652 | 663 | print '<td class="aircraft_thumbnail">'."\n"; |
653 | 664 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
654 | 665 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
655 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
666 | + } else { |
|
667 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
668 | + } |
|
656 | 669 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
657 | 670 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
658 | 671 | } else { |
@@ -674,7 +687,9 @@ discard block |
||
674 | 687 | print '<td class="aircraft_thumbnail">'."\n"; |
675 | 688 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
676 | 689 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
677 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
690 | + } else { |
|
691 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
692 | + } |
|
678 | 693 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
679 | 694 | print '</td>'."\n"; |
680 | 695 | } else { |
@@ -727,8 +742,9 @@ discard block |
||
727 | 742 | print '<td class="aircraft_thumbnail">'."\n"; |
728 | 743 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
729 | 744 | if ($spotter_item['image_source'] == 'planespotters') { |
730 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
731 | - else { |
|
745 | + if ($spotter_item['image_source_website'] != '') { |
|
746 | + $image_src = $spotter_item['image_source_website']; |
|
747 | + } else { |
|
732 | 748 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
733 | 749 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
734 | 750 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -745,7 +761,9 @@ discard block |
||
745 | 761 | } else { |
746 | 762 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
747 | 763 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
748 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
764 | + } else { |
|
765 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
766 | + } |
|
749 | 767 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
750 | 768 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
751 | 769 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -785,13 +803,19 @@ discard block |
||
785 | 803 | print '<td class="aircraft_thumbnail">'."\n"; |
786 | 804 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
787 | 805 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
788 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
806 | + } else { |
|
807 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
808 | + } |
|
789 | 809 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
790 | 810 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n"; |
791 | - if ($spotter_item['image_copyright'] != '') print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
811 | + if ($spotter_item['image_copyright'] != '') { |
|
812 | + print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
813 | + } |
|
792 | 814 | } else { |
793 | 815 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['ident'].'" data-content="'._("Ident:").' '.$spotter_item['ident'].'" data-html="true" width="100px" />'."\n"; |
794 | - if ($spotter_item['image_copyright'] != '') print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
816 | + if ($spotter_item['image_copyright'] != '') { |
|
817 | + print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
818 | + } |
|
795 | 819 | } |
796 | 820 | print '</td>'."\n"; |
797 | 821 | } else { |
@@ -809,7 +833,9 @@ discard block |
||
809 | 833 | print '<td class="aircraft_thumbnail">'."\n"; |
810 | 834 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
811 | 835 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
812 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
836 | + } else { |
|
837 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
838 | + } |
|
813 | 839 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
814 | 840 | print '</td>'."\n"; |
815 | 841 | } else { |
@@ -927,8 +953,11 @@ discard block |
||
927 | 953 | print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
928 | 954 | } else { |
929 | 955 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
930 | - if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
|
931 | - else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
|
956 | + if (count($aircraft_names) == 1) { |
|
957 | + print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
|
958 | + } else { |
|
959 | + print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
|
960 | + } |
|
932 | 961 | } |
933 | 962 | print '<span class="mobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
934 | 963 | } elseif ($type == 'marine') { |
@@ -971,15 +1000,21 @@ discard block |
||
971 | 1000 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
972 | 1001 | if ($spotter_item['departure_airport_time'] > 2460) { |
973 | 1002 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
974 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
1003 | + } else { |
|
1004 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
1005 | + } |
|
975 | 1006 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
976 | 1007 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
977 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
1008 | + } else { |
|
1009 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
1010 | + } |
|
978 | 1011 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
979 | 1012 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
980 | 1013 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
981 | 1014 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
982 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
1015 | + } else { |
|
1016 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
1017 | + } |
|
983 | 1018 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
984 | 1019 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
985 | 1020 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -1001,7 +1036,9 @@ discard block |
||
1001 | 1036 | $longitude = $spotter_item['longitude']; |
1002 | 1037 | } |
1003 | 1038 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
1004 | - } else $distance = ''; |
|
1039 | + } else { |
|
1040 | + $distance = ''; |
|
1041 | + } |
|
1005 | 1042 | if ($distance != '') { |
1006 | 1043 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1007 | 1044 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -1028,7 +1065,9 @@ discard block |
||
1028 | 1065 | } else { |
1029 | 1066 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
1030 | 1067 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
1031 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
1068 | + if (!isset($Spotter)) { |
|
1069 | + $Spotter = new Spotter(); |
|
1070 | + } |
|
1032 | 1071 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
1033 | 1072 | print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
1034 | 1073 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
@@ -1044,20 +1083,28 @@ discard block |
||
1044 | 1083 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
1045 | 1084 | if ($spotter_item['arrival_airport_time'] > 2460) { |
1046 | 1085 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
1047 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
1086 | + } else { |
|
1087 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
1088 | + } |
|
1048 | 1089 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
1049 | 1090 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
1050 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
1091 | + } else { |
|
1092 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
1093 | + } |
|
1051 | 1094 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
1052 | 1095 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
1053 | 1096 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
1054 | 1097 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
1055 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
1098 | + } else { |
|
1099 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
1100 | + } |
|
1056 | 1101 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
1057 | 1102 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
1058 | 1103 | if ($spotter_item['arrival_airport_time'] > 2460) { |
1059 | 1104 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
1060 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
1105 | + } else { |
|
1106 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
1107 | + } |
|
1061 | 1108 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
1062 | 1109 | } |
1063 | 1110 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -1070,7 +1117,9 @@ discard block |
||
1070 | 1117 | $longitude = $spotter_item['longitude']; |
1071 | 1118 | } |
1072 | 1119 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
1073 | - } else $distance = ''; |
|
1120 | + } else { |
|
1121 | + $distance = ''; |
|
1122 | + } |
|
1074 | 1123 | if ($distance != '') { |
1075 | 1124 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1076 | 1125 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | /* |
20 | 20 | } else { |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | } |
25 | 25 | |
26 | -$raceid = filter_input(INPUT_GET,'raceid',FILTER_SANITIZE_NUMBER_INT); |
|
26 | +$raceid = filter_input(INPUT_GET, 'raceid', FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | if ($raceid != '') { |
28 | - setcookie('filter_race',$raceid); |
|
28 | + setcookie('filter_race', $raceid); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $title = _("Home"); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | <div class="form-group"> |
249 | 249 | <label><?php echo _("From:"); ?></label> |
250 | 250 | <div class='input-group date' id='datetimepicker1'> |
251 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
251 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
252 | 252 | <span class="input-group-addon"> |
253 | 253 | <span class="glyphicon glyphicon-calendar"></span> |
254 | 254 | </span> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | <div class="form-group"> |
258 | 258 | <label><?php echo _("To:"); ?></label> |
259 | 259 | <div class='input-group date' id='datetimepicker2'> |
260 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
260 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" /> |
|
261 | 261 | <span class="input-group-addon"> |
262 | 262 | <span class="glyphicon glyphicon-calendar"></span> |
263 | 263 | </span> |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | <li><?php echo _("Type of Terrain:"); ?> |
427 | 427 | <select class="selectpicker" onchange="terrainType(this);"> |
428 | 428 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
429 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
430 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
431 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
429 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
430 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
431 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
432 | 432 | </select> |
433 | 433 | </li> |
434 | 434 | <?php |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
494 | 494 | <?php |
495 | 495 | } |
496 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
496 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
497 | 497 | ?> |
498 | 498 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
499 | 499 | <?php |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | $Spotter = new Spotter(); |
675 | 675 | $allairlinenames = $Spotter->getAllAirlineNames(); |
676 | 676 | } |
677 | - foreach($allairlinenames as $airline) { |
|
677 | + foreach ($allairlinenames as $airline) { |
|
678 | 678 | $airline_name = $airline['airline_name']; |
679 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
680 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
679 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
680 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
681 | 681 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
682 | 682 | } else { |
683 | 683 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
697 | 697 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
698 | 698 | <?php |
699 | - foreach($allalliancenames as $alliance) { |
|
699 | + foreach ($allalliancenames as $alliance) { |
|
700 | 700 | $alliance_name = $alliance['alliance']; |
701 | 701 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
702 | 702 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -732,8 +732,8 @@ discard block |
||
732 | 732 | */ |
733 | 733 | $Source = new Source(); |
734 | 734 | $datasource = $Source->getLocationInfoByType('gs'); |
735 | - foreach($datasource as $src) { |
|
736 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
735 | + foreach ($datasource as $src) { |
|
736 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
737 | 737 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
738 | 738 | } else { |
739 | 739 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
842 | 842 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
843 | 843 | |
844 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
844 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
845 | 845 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
846 | 846 | } else { |
847 | 847 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |