@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$spotter_array = $Spotter->getSpotterDataByDate($_GET['date'],"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$spotter_array = $Spotter->getSpotterDataByDate($_GET['date'], "0,1", $sort); |
|
8 | 8 | |
9 | 9 | if (!empty($spotter_array)) |
10 | 10 | { |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | print '</div>'; |
21 | 21 | |
22 | 22 | print '<div class="info column">'; |
23 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
23 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | 24 | print '</div>'; |
25 | 25 | |
26 | 26 | include('date-sub-menu.php'); |
27 | 27 | print '<div class="column">'; |
28 | 28 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
29 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
29 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | 30 | |
31 | 31 | $aircraft_array = $Spotter->countAllAircraftRegistrationByDate($_GET['date']); |
32 | 32 | if (!empty($aircraft_array)) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | print '</thead>'; |
44 | 44 | print '<tbody>'; |
45 | 45 | $i = 1; |
46 | - foreach($aircraft_array as $aircraft_item) |
|
46 | + foreach ($aircraft_array as $aircraft_item) |
|
47 | 47 | { |
48 | 48 | print '<tr>'; |
49 | 49 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (isset($aircraft_item['aircraft_type'])) { |
54 | 54 | print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
55 | 55 | } else { |
56 | - print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
|
56 | + print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
|
57 | 57 | } |
58 | 58 | print '</td>'; |
59 | 59 | } else { |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | * @return Array the images list |
18 | 18 | * |
19 | 19 | */ |
20 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
20 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
21 | 21 | { |
22 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
23 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
24 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
22 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
23 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
24 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
25 | 25 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
26 | 26 | $registration = trim($registration); |
27 | - $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 |
|
27 | + $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 |
|
28 | 28 | FROM spotter_image |
29 | 29 | WHERE spotter_image.registration = :registration"; |
30 | 30 | $sth = $this->db->prepare($query); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
64 | 64 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
65 | 65 | if ($copyright != '') { |
66 | - $copyright = str_replace('Copyright ','',$copyright); |
|
67 | - $copyright = str_replace('© ','',$copyright); |
|
68 | - $copyright = str_replace('(c) ','',$copyright); |
|
66 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
67 | + $copyright = str_replace('© ', '', $copyright); |
|
68 | + $copyright = str_replace('(c) ', '', $copyright); |
|
69 | 69 | } |
70 | 70 | return $copyright; |
71 | 71 | } |
@@ -76,26 +76,26 @@ discard block |
||
76 | 76 | * @return String either success or error |
77 | 77 | * |
78 | 78 | */ |
79 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
79 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
80 | 80 | { |
81 | - global $globalDebug,$globalAircraftImageFetch; |
|
81 | + global $globalDebug, $globalAircraftImageFetch; |
|
82 | 82 | if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
83 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
83 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
84 | 84 | $registration = trim($registration); |
85 | 85 | //getting the aircraft image |
86 | 86 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
87 | 87 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
88 | 88 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
89 | 89 | else return "success"; |
90 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
90 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
91 | 91 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
92 | 92 | if ($image_url['original'] != '') { |
93 | 93 | if ($globalDebug) echo 'Found !'."\n"; |
94 | - $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)"; |
|
94 | + $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)"; |
|
95 | 95 | try { |
96 | 96 | $sth = $this->db->prepare($query); |
97 | - $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'])); |
|
98 | - } catch(PDOException $e) { |
|
97 | + $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'])); |
|
98 | + } catch (PDOException $e) { |
|
99 | 99 | echo $e->getMessage()."\n"; |
100 | 100 | return "error"; |
101 | 101 | } |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | global $globalAircraftImageSources, $globalIVAO; |
116 | 116 | $Spotter = new Spotter($this->db); |
117 | 117 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
118 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
118 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
119 | 119 | if ($aircraft_registration != '') { |
120 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
120 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
121 | 121 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
122 | 122 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
123 | 123 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -129,23 +129,23 @@ discard block |
||
129 | 129 | } elseif ($aircraft_icao != '') { |
130 | 130 | $aircraft_registration = $aircraft_icao; |
131 | 131 | $aircraft_name = ''; |
132 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
133 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
132 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
133 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
134 | 134 | foreach ($globalAircraftImageSources as $source) { |
135 | 135 | $source = strtolower($source); |
136 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao); |
|
137 | - if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name); |
|
138 | - if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name); |
|
139 | - if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration,$aircraft_name); |
|
140 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name); |
|
141 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name); |
|
142 | - if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name); |
|
143 | - if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name); |
|
144 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name); |
|
145 | - if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name); |
|
136 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao, $airline_icao); |
|
137 | + if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration, $aircraft_name); |
|
138 | + if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration, $aircraft_name); |
|
139 | + if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration, $aircraft_name); |
|
140 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration, $aircraft_name); |
|
141 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration, $aircraft_name); |
|
142 | + if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration, $aircraft_name); |
|
143 | + if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration, $aircraft_name); |
|
144 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration, $aircraft_name); |
|
145 | + if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration, $aircraft_name); |
|
146 | 146 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
147 | 147 | } |
148 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
148 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -156,24 +156,24 @@ discard block |
||
156 | 156 | * @return Array the aircraft thumbnail, orignal url and copyright |
157 | 157 | * |
158 | 158 | */ |
159 | - public function fromPlanespotters($aircraft_registration, $aircraft_name='') { |
|
159 | + public function fromPlanespotters($aircraft_registration, $aircraft_name = '') { |
|
160 | 160 | $Common = new Common(); |
161 | 161 | // If aircraft registration is only number, also check with aircraft model |
162 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
163 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
162 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
163 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
164 | 164 | } else { |
165 | 165 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
166 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
166 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
167 | 167 | } |
168 | 168 | $data = $Common->getData($url); |
169 | 169 | if ($xml = simplexml_load_string($data)) { |
170 | 170 | if (isset($xml->channel->item)) { |
171 | 171 | $image_url = array(); |
172 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
172 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
173 | 173 | $image_url['thumbnail'] = $thumbnail_url; |
174 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
175 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
176 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
174 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
175 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
176 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
177 | 177 | $image_url['source'] = 'planespotters'; |
178 | 178 | return $image_url; |
179 | 179 | } |
@@ -189,25 +189,25 @@ discard block |
||
189 | 189 | * @return Array the aircraft thumbnail, orignal url and copyright |
190 | 190 | * |
191 | 191 | */ |
192 | - public function fromDeviantart($aircraft_registration, $aircraft_name='') { |
|
192 | + public function fromDeviantart($aircraft_registration, $aircraft_name = '') { |
|
193 | 193 | $Common = new Common(); |
194 | 194 | // If aircraft registration is only number, also check with aircraft model |
195 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
196 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name); |
|
195 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
196 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name); |
|
197 | 197 | } else { |
198 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration; |
|
198 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $data = $Common->getData($url); |
202 | 202 | if ($xml = simplexml_load_string($data)) { |
203 | 203 | if (isset($xml->channel->item->link)) { |
204 | 204 | $image_url = array(); |
205 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
205 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
206 | 206 | $image_url['thumbnail'] = $thumbnail_url; |
207 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
207 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
208 | 208 | $image_url['original'] = $original_url; |
209 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
210 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
209 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
210 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
211 | 211 | $image_url['source'] = 'deviantart'; |
212 | 212 | return $image_url; |
213 | 213 | } |
@@ -223,32 +223,32 @@ discard block |
||
223 | 223 | * @return Array the aircraft thumbnail, orignal url and copyright |
224 | 224 | * |
225 | 225 | */ |
226 | - public function fromJetPhotos($aircraft_registration, $aircraft_name='') { |
|
226 | + public function fromJetPhotos($aircraft_registration, $aircraft_name = '') { |
|
227 | 227 | $Common = new Common(); |
228 | - $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
228 | + $url = 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
229 | 229 | $data = $Common->getData($url); |
230 | 230 | $dom = new DOMDocument(); |
231 | 231 | @$dom->loadHTML($data); |
232 | 232 | $all_pics = array(); |
233 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
233 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
234 | 234 | if ($image->getAttribute('itemprop') == "http://schema.org/image") { |
235 | 235 | $all_pics[] = $image->getAttribute('src'); |
236 | 236 | } |
237 | 237 | } |
238 | 238 | $all_authors = array(); |
239 | - foreach($dom->getElementsByTagName('meta') as $author) { |
|
239 | + foreach ($dom->getElementsByTagName('meta') as $author) { |
|
240 | 240 | if ($author->getAttribute('itemprop') == "http://schema.org/author") { |
241 | 241 | $all_authors[] = $author->getAttribute('content'); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | $all_ref = array(); |
245 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
245 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
246 | 246 | $all_ref[] = $link->getAttribute('href'); |
247 | 247 | } |
248 | 248 | if (isset($all_pics[0])) { |
249 | 249 | $image_url = array(); |
250 | 250 | $image_url['thumbnail'] = $all_pics[0]; |
251 | - $image_url['original'] = str_replace('_tb','',$all_pics[0]); |
|
251 | + $image_url['original'] = str_replace('_tb', '', $all_pics[0]); |
|
252 | 252 | $image_url['copyright'] = $all_authors[0]; |
253 | 253 | $image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8]; |
254 | 254 | $image_url['source'] = 'JetPhotos'; |
@@ -265,24 +265,24 @@ discard block |
||
265 | 265 | * @return Array the aircraft thumbnail, orignal url and copyright |
266 | 266 | * |
267 | 267 | */ |
268 | - public function fromPlanePictures($aircraft_registration, $aircraft_name='') { |
|
268 | + public function fromPlanePictures($aircraft_registration, $aircraft_name = '') { |
|
269 | 269 | $Common = new Common(); |
270 | - $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
270 | + $url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
271 | 271 | $data = $Common->getData($url); |
272 | 272 | $dom = new DOMDocument(); |
273 | 273 | @$dom->loadHTML($data); |
274 | 274 | $all_pics = array(); |
275 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
275 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
276 | 276 | $all_pics[] = $image->getAttribute('src'); |
277 | 277 | } |
278 | 278 | $all_links = array(); |
279 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
280 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
279 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
280 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
281 | 281 | } |
282 | - if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1])) { |
|
282 | + if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1])) { |
|
283 | 283 | $image_url = array(); |
284 | 284 | $image_url['thumbnail'] = 'http://www.planepictures.net'.$all_pics[1]; |
285 | - $image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN','',$all_pics[1]); |
|
285 | + $image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN', '', $all_pics[1]); |
|
286 | 286 | $image_url['copyright'] = $all_links[6]['text']; |
287 | 287 | $image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href']; |
288 | 288 | $image_url['source'] = 'PlanePictures'; |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | * @return Array the aircraft thumbnail, orignal url and copyright |
300 | 300 | * |
301 | 301 | */ |
302 | - public function fromFlickr($aircraft_registration,$aircraft_name='') { |
|
302 | + public function fromFlickr($aircraft_registration, $aircraft_name = '') { |
|
303 | 303 | $Common = new Common(); |
304 | 304 | if ($aircraft_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='.$aircraft_registration.','.urlencode($aircraft_name); |
305 | 305 | 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='.$aircraft_registration.',aircraft'; |
306 | 306 | $data = $Common->getData($url); |
307 | 307 | if ($xml = simplexml_load_string($data)) { |
308 | 308 | if (isset($xml->channel->item)) { |
309 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
309 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
310 | 310 | $image_url = array(); |
311 | 311 | $image_url['thumbnail'] = $original_url; |
312 | 312 | $image_url['original'] = $original_url; |
313 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
314 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
313 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
314 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
315 | 315 | $image_url['source'] = 'flickr'; |
316 | 316 | return $image_url; |
317 | 317 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | return false; |
320 | 320 | } |
321 | 321 | |
322 | - public function fromIvaoMtl($aircraft_icao,$airline_icao) { |
|
322 | + public function fromIvaoMtl($aircraft_icao, $airline_icao) { |
|
323 | 323 | $Common = new Common(); |
324 | 324 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
325 | 325 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | * @return Array the aircraft thumbnail, orignal url and copyright |
344 | 344 | * |
345 | 345 | */ |
346 | - public function fromBing($aircraft_registration,$aircraft_name='') { |
|
346 | + public function fromBing($aircraft_registration, $aircraft_name = '') { |
|
347 | 347 | global $globalImageBingKey; |
348 | 348 | $Common = new Common(); |
349 | 349 | if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
350 | 350 | 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'; |
351 | 351 | 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'; |
352 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
353 | - $data = $Common->getData($url,'get','',$headers); |
|
352 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
353 | + $data = $Common->getData($url, 'get', '', $headers); |
|
354 | 354 | $result = json_decode($data); |
355 | 355 | if (isset($result->d->results[0]->MediaUrl)) { |
356 | 356 | $image_url = array(); |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | * @return Array the aircraft thumbnail, orignal url and copyright |
376 | 376 | * |
377 | 377 | */ |
378 | - public function fromAirportData($aircraft_registration,$aircraft_name='') { |
|
378 | + public function fromAirportData($aircraft_registration, $aircraft_name = '') { |
|
379 | 379 | $Common = new Common(); |
380 | 380 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
381 | 381 | $data = $Common->getData($url); |
382 | 382 | $result = json_decode($data); |
383 | 383 | if (isset($result->count) && $result->count > 0) { |
384 | 384 | $image_url = array(); |
385 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
385 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
386 | 386 | $image_url['source_website'] = $result->data[0]->link; |
387 | 387 | $image_url['thumbnail'] = $result->data[0]->image; |
388 | 388 | $image_url['copyright'] = $result->data[0]->photographer; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @return Array the aircraft thumbnail, orignal url and copyright |
401 | 401 | * |
402 | 402 | */ |
403 | - public function fromWikimedia($aircraft_registration,$aircraft_name='') { |
|
403 | + public function fromWikimedia($aircraft_registration, $aircraft_name = '') { |
|
404 | 404 | $Common = new Common(); |
405 | 405 | if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name); |
406 | 406 | else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $result = json_decode($data); |
409 | 409 | if (isset($result->query->search[0]->title)) { |
410 | 410 | $fileo = $result->query->search[0]->title; |
411 | - if (substr($fileo,-3) == 'pdf') return false; |
|
411 | + if (substr($fileo, -3) == 'pdf') return false; |
|
412 | 412 | $file = urlencode($fileo); |
413 | 413 | $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; |
414 | 414 | $data2 = $Common->getData($url2); |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | if (isset($result2->query->pages)) { |
434 | 434 | foreach ($result2->query->pages as $page) { |
435 | 435 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
436 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
436 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
437 | 437 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
438 | 438 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
439 | 439 | } |
440 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
440 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
441 | 441 | return $image_url; |
442 | 442 | } |
443 | 443 | } |
@@ -456,22 +456,22 @@ discard block |
||
456 | 456 | * @return Array the aircraft thumbnail, orignal url and copyright |
457 | 457 | * |
458 | 458 | */ |
459 | - public function fromCustomSource($aircraft_registration,$aircraft_name='') { |
|
459 | + public function fromCustomSource($aircraft_registration, $aircraft_name = '') { |
|
460 | 460 | global $globalAircraftImageCustomSources; |
461 | 461 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
462 | 462 | if (!empty($globalAircraftImageCustomSources)) { |
463 | 463 | if (!isset($globalAircraftImageCustomSources[0])) $globalAircraftImageCustomSources[] = $globalAircraftImageCustomSources; |
464 | 464 | foreach ($globalAircraftImageCustomSources as $source) { |
465 | 465 | $Common = new Common(); |
466 | - $url = str_replace('{registration}',$aircraft_registration,$source['original']); |
|
467 | - $url_thumbnail = str_replace('{registration}',$aircraft_registration,$source['original']); |
|
466 | + $url = str_replace('{registration}', $aircraft_registration, $source['original']); |
|
467 | + $url_thumbnail = str_replace('{registration}', $aircraft_registration, $source['original']); |
|
468 | 468 | if ($Common->urlexist($url)) { |
469 | 469 | $image_url = array(); |
470 | 470 | $image_url['thumbnail'] = $url_thumbnail; |
471 | 471 | $image_url['original'] = $url; |
472 | 472 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
473 | 473 | else $exifCopyright = ''; |
474 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
474 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
475 | 475 | else $image_url['copyright'] = $source['copyright']; |
476 | 476 | $image_url['source_website'] = $source['source_website']; |
477 | 477 | $image_url['source'] = $source['source']; |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | |
4 | -class Connection{ |
|
4 | +class Connection { |
|
5 | 5 | public $db = null; |
6 | 6 | public $dbs = array(); |
7 | 7 | public $latest_schema = 26; |
8 | 8 | |
9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
10 | 10 | global $globalDBdriver; |
11 | 11 | if ($dbc === null) { |
12 | 12 | if ($this->db === null && $dbname === null) { |
13 | 13 | if ($user === null && $pass === null) { |
14 | 14 | $this->createDBConnection(); |
15 | 15 | } else { |
16 | - $this->createDBConnection(null,$user,$pass); |
|
16 | + $this->createDBConnection(null, $user, $pass); |
|
17 | 17 | } |
18 | 18 | } else { |
19 | 19 | $this->createDBConnection($dbname); |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | while (true) { |
92 | 92 | try { |
93 | 93 | if ($globalDBSdriver == 'mysql') { |
94 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
94 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
95 | 95 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
96 | 96 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
97 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
97 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
98 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
99 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
100 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
101 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
102 | 102 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
103 | 103 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
104 | 104 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
109 | 109 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
110 | 110 | } else { |
111 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
111 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
112 | 112 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
113 | 113 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
114 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
114 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
115 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
116 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
117 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
118 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
119 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
120 | 120 | } |
121 | 121 | break; |
122 | - } catch(PDOException $e) { |
|
122 | + } catch (PDOException $e) { |
|
123 | 123 | $i++; |
124 | 124 | if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n"; |
125 | 125 | //exit; |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | try { |
144 | 144 | //$Connection = new Connection(); |
145 | 145 | $results = $this->db->query($query); |
146 | - } catch(PDOException $e) { |
|
146 | + } catch (PDOException $e) { |
|
147 | 147 | return false; |
148 | 148 | } |
149 | - if($results->rowCount()>0) { |
|
149 | + if ($results->rowCount() > 0) { |
|
150 | 150 | return true; |
151 | 151 | } |
152 | 152 | else return false; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
170 | - } catch(PDOException $e) { |
|
171 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
170 | + } catch (PDOException $e) { |
|
171 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
172 | 172 | throw $e; |
173 | 173 | } |
174 | 174 | //echo 'error ! '.$e->getMessage(); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | /* |
181 | 181 | * Check if index exist |
182 | 182 | */ |
183 | - public function indexExists($table,$index) |
|
183 | + public function indexExists($table, $index) |
|
184 | 184 | { |
185 | 185 | global $globalDBdriver, $globalDBname; |
186 | 186 | if ($globalDBdriver == 'mysql') { |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | try { |
192 | 192 | //$Connection = new Connection(); |
193 | 193 | $results = $this->db->query($query); |
194 | - } catch(PDOException $e) { |
|
194 | + } catch (PDOException $e) { |
|
195 | 195 | return false; |
196 | 196 | } |
197 | 197 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
198 | - if($nb[0]['nb'] > 0) { |
|
198 | + if ($nb[0]['nb'] > 0) { |
|
199 | 199 | return true; |
200 | 200 | } |
201 | 201 | else return false; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
211 | 211 | try { |
212 | 212 | $results = $this->db->query($query); |
213 | - } catch(PDOException $e) { |
|
213 | + } catch (PDOException $e) { |
|
214 | 214 | return "error : ".$e->getMessage()."\n"; |
215 | 215 | } |
216 | 216 | $columns = array(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * Check if a column name exist in a table |
227 | 227 | * @return Boolean column exist or not |
228 | 228 | */ |
229 | - public function checkColumnName($table,$name) |
|
229 | + public function checkColumnName($table, $name) |
|
230 | 230 | { |
231 | 231 | global $globalDBdriver, $globalDBname; |
232 | 232 | if ($globalDBdriver == 'mysql') { |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | } |
237 | 237 | try { |
238 | 238 | $sth = $this->db()->prepare($query); |
239 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
240 | - } catch(PDOException $e) { |
|
239 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
240 | + } catch (PDOException $e) { |
|
241 | 241 | echo "error : ".$e->getMessage()."\n"; |
242 | 242 | } |
243 | 243 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | try { |
277 | 277 | $sth = $this->db->prepare($query); |
278 | 278 | $sth->execute(); |
279 | - } catch(PDOException $e) { |
|
279 | + } catch (PDOException $e) { |
|
280 | 280 | return "error : ".$e->getMessage()."\n"; |
281 | 281 | } |
282 | 282 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | $currentdate = date('Y-m-d'); |
30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
31 | 31 | if (!empty($sourcestat)) { |
32 | - foreach($sourcestat as $srcst) { |
|
32 | + foreach ($sourcestat as $srcst) { |
|
33 | 33 | $type = $srcst['stats_type']; |
34 | 34 | if ($type == 'polar' || $type == 'hist') { |
35 | 35 | $source = $srcst['source_name']; |
36 | 36 | $data = $srcst['source_data']; |
37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
37 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | - public function get_Schedule($id,$ident) { |
|
43 | + public function get_Schedule($id, $ident) { |
|
44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
45 | 45 | // Get schedule here, so it's done only one time |
46 | 46 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $schedule = $Schedule->fetchSchedule($operator); |
65 | 65 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
66 | 66 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
67 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
67 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
69 | 69 | // Should also check if route schedule = route from DB |
70 | 70 | if ($schedule['DepartureAirportIATA'] != '') { |
71 | 71 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
88 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
88 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
116 | 116 | $Spotter = new Spotter($this->db); |
117 | 117 | $real_arrival = $this->arrival($key); |
118 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
118 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $airport_time = ''; |
129 | 129 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
130 | 130 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
131 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
131 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
132 | 132 | if (isset($closestAirports[0])) { |
133 | 133 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
134 | 134 | $airport_icao = $closestAirports[0]['icao']; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | break; |
144 | 144 | } |
145 | 145 | } |
146 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
146 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
147 | 147 | $airport_icao = $closestAirports[0]['icao']; |
148 | 148 | $airport_time = $this->all_flights[$key]['datetime']; |
149 | 149 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } else { |
157 | 157 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
158 | 158 | } |
159 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
159 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
168 | 168 | foreach ($this->all_flights as $key => $flight) { |
169 | 169 | if (isset($flight['lastupdate'])) { |
170 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
170 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
171 | 171 | if (isset($this->all_flights[$key]['id'])) { |
172 | 172 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
173 | 173 | /* |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $real_arrival = $this->arrival($key); |
179 | 179 | $Spotter = new Spotter($this->db); |
180 | 180 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
181 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
181 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
182 | 182 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
183 | 183 | } |
184 | 184 | // Put in archive |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $send = false; |
215 | 215 | |
216 | 216 | // SBS format is CSV format |
217 | - if(is_array($line) && isset($line['hex'])) { |
|
217 | + if (is_array($line) && isset($line['hex'])) { |
|
218 | 218 | //print_r($line); |
219 | 219 | if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
220 | 220 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | //print_r($this->all_flights); |
249 | 249 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
250 | 250 | $this->all_flights[$id] = array('hex' => $hex); |
251 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
251 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
252 | 252 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
253 | 253 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
254 | 254 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $Spotter = new Spotter($this->db); |
259 | 259 | $aircraft_icao = $Spotter->getAllAircraftType($hex); |
260 | 260 | $Spotter->db = null; |
261 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
261 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
262 | 262 | |
263 | 263 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
264 | 264 | if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
@@ -266,32 +266,32 @@ discard block |
||
266 | 266 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
267 | 267 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
268 | 268 | } |
269 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
269 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
270 | 270 | } else if (isset($line['aircraft_name'])) { |
271 | 271 | // Get aircraft ICAO from aircraft name |
272 | 272 | $Spotter = new Spotter($this->db); |
273 | 273 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
274 | 274 | $Spotter->db = null; |
275 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
276 | - else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
277 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
278 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
279 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
275 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
276 | + else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
277 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $line['aircraft_icao'])); |
|
278 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true)); |
|
279 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
280 | 280 | if (!isset($line['id'])) { |
281 | 281 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
282 | 282 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
283 | 283 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
284 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
284 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
285 | 285 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
286 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
286 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
287 | 287 | |
288 | 288 | if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
289 | 289 | if ($globalAllFlights !== FALSE) $dataFound = true; |
290 | 290 | } |
291 | 291 | |
292 | - if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
292 | + if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/', $line['datetime'])) { |
|
293 | 293 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
294 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
294 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
295 | 295 | } else { |
296 | 296 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
297 | 297 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -302,23 +302,23 @@ discard block |
||
302 | 302 | */ |
303 | 303 | return ''; |
304 | 304 | } |
305 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
305 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
306 | 306 | |
307 | 307 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
308 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
308 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
309 | 309 | } |
310 | 310 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
312 | 312 | } |
313 | 313 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
314 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id'])); |
|
315 | 315 | } |
316 | 316 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name'])); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
322 | 322 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
323 | 323 | $timeelapsed = microtime(true); |
324 | 324 | $Spotter = new Spotter($this->db); |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
329 | 329 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
330 | 330 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
331 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
331 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
332 | 332 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
333 | 333 | $Spotter->db = null; |
334 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
334 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /* |
@@ -342,24 +342,24 @@ discard block |
||
342 | 342 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
343 | 343 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
344 | 344 | */ |
345 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
345 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
346 | 346 | |
347 | 347 | //$putinarchive = true; |
348 | 348 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
349 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
349 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
350 | 350 | } |
351 | 351 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
352 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
352 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
353 | 353 | } |
354 | 354 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
355 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
355 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
356 | 356 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
357 | 357 | $timeelapsed = microtime(true); |
358 | 358 | $Spotter = new Spotter($this->db); |
359 | 359 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
360 | 360 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
361 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
362 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
361 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
362 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
363 | 363 | |
364 | 364 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
365 | 365 | $timeelapsed = microtime(true); |
@@ -372,34 +372,34 @@ discard block |
||
372 | 372 | $Translation->db = null; |
373 | 373 | } |
374 | 374 | $Spotter->db = null; |
375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
375 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
376 | 376 | |
377 | 377 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
378 | 378 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
379 | 379 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
380 | 380 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | if (!isset($globalFork)) $globalFork = TRUE; |
385 | 385 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
386 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
386 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($line['speed']) && $line['speed'] != '') { |
392 | 392 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
393 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
393 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
395 | 395 | //$dataFound = true; |
396 | 396 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
397 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
397 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
398 | 398 | if ($distance > 1000 && $distance < 10000) { |
399 | 399 | // use datetime |
400 | 400 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
401 | 401 | $speed = $speed*3.6; |
402 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
402 | + if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
403 | 403 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
404 | 404 | } |
405 | 405 | } |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | |
408 | 408 | |
409 | 409 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
410 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
410 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
411 | 411 | else unset($timediff); |
412 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
412 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) { |
|
413 | 413 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
414 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
414 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
415 | 415 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
416 | 416 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
417 | 417 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | if ($globalDebug) echo "\n".' ------- Check Country.... '; |
420 | 420 | $timeelapsed = microtime(true); |
421 | 421 | $Spotter = new Spotter($this->db); |
422 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
422 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
423 | 423 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
424 | 424 | $Spotter->db = null; |
425 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
425 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
426 | 426 | $this->tmd = 0; |
427 | 427 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
428 | 428 | } |
@@ -431,13 +431,13 @@ discard block |
||
431 | 431 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
432 | 432 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
433 | 433 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
434 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
434 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
435 | 435 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
436 | 436 | $dataFound = true; |
437 | 437 | $this->all_flights[$id]['time_last_coord'] = time(); |
438 | 438 | } |
439 | 439 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
440 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
440 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
441 | 441 | /* |
442 | 442 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
443 | 443 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -455,13 +455,13 @@ discard block |
||
455 | 455 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
456 | 456 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
457 | 457 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
458 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
458 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
459 | 459 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
460 | 460 | $dataFound = true; |
461 | 461 | $this->all_flights[$id]['time_last_coord'] = time(); |
462 | 462 | } |
463 | 463 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
464 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
464 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
465 | 465 | /* |
466 | 466 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
467 | 467 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -479,45 +479,45 @@ discard block |
||
479 | 479 | } else if ($globalDebug && $timediff > 20) { |
480 | 480 | $this->tmd = $this->tmd + 1; |
481 | 481 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
482 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
483 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
482 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
483 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
484 | 484 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
485 | 485 | } |
486 | 486 | } |
487 | 487 | if (isset($line['last_update']) && $line['last_update'] != '') { |
488 | 488 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
489 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
489 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
490 | 490 | } |
491 | 491 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
492 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
492 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
493 | 493 | //$dataFound = true; |
494 | 494 | } |
495 | 495 | if (isset($line['format_source']) && $line['format_source'] != '') { |
496 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
496 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
497 | 497 | } |
498 | 498 | if (isset($line['source_name']) && $line['source_name'] != '') { |
499 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
500 | 500 | } |
501 | 501 | if (isset($line['emergency']) && $line['emergency'] != '') { |
502 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
503 | 503 | //$dataFound = true; |
504 | 504 | } |
505 | 505 | if (isset($line['ground']) && $line['ground'] != '') { |
506 | 506 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
507 | 507 | // Here we force archive of flight because after ground it's a new one (or should be) |
508 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
509 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
510 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
511 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
512 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
508 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
509 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
510 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
511 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
512 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
513 | 513 | } |
514 | 514 | if ($line['ground'] != 1) $line['ground'] = 0; |
515 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
516 | 516 | //$dataFound = true; |
517 | 517 | } |
518 | 518 | if (isset($line['squawk']) && $line['squawk'] != '') { |
519 | 519 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
520 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
521 | 521 | $highlight = ''; |
522 | 522 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
523 | 523 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -525,48 +525,48 @@ discard block |
||
525 | 525 | if ($highlight != '') { |
526 | 526 | $timeelapsed = microtime(true); |
527 | 527 | $Spotter = new Spotter($this->db); |
528 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
528 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
529 | 529 | $Spotter->db = null; |
530 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
530 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
531 | 531 | |
532 | 532 | $this->all_flights[$id]['putinarchive'] = true; |
533 | 533 | //$putinarchive = true; |
534 | 534 | //$highlight = ''; |
535 | 535 | } |
536 | 536 | |
537 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
537 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
538 | 538 | //$dataFound = true; |
539 | 539 | } |
540 | 540 | |
541 | 541 | if (isset($line['altitude']) && $line['altitude'] != '') { |
542 | 542 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
543 | - if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
544 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
545 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
543 | + if (abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
544 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
545 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
546 | 546 | //$dataFound = true; |
547 | 547 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
548 | 548 | } |
549 | 549 | |
550 | 550 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | if (isset($line['heading']) && $line['heading'] != '') { |
555 | - if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
556 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
557 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
555 | + if (abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
556 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
557 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
558 | 558 | //$dataFound = true; |
559 | 559 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
560 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
562 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
560 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
562 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
563 | 563 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
564 | 564 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
565 | 565 | // If not enough messages and ACARS set heading to 0 |
566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
567 | 567 | } |
568 | - if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
569 | - elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
568 | + if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
569 | + elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
570 | 570 | |
571 | 571 | // print_r($this->all_flights[$id]); |
572 | 572 | //gets the callsign from the last hour |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
577 | 577 | $this->all_flights[$id]['lastupdate'] = time(); |
578 | 578 | if ($this->all_flights[$id]['addedSpotter'] == 0) { |
579 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
579 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
580 | 580 | //print_r($this->all_flights); |
581 | 581 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
582 | 582 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -586,61 +586,61 @@ discard block |
||
586 | 586 | $SpotterLive = new SpotterLive($this->db); |
587 | 587 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
588 | 588 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
589 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
589 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
590 | 590 | } elseif (isset($line['id'])) { |
591 | 591 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
592 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
593 | 593 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
594 | 594 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
595 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
595 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
596 | 596 | } else $recent_ident = ''; |
597 | - $SpotterLive->db=null; |
|
597 | + $SpotterLive->db = null; |
|
598 | 598 | |
599 | 599 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
600 | 600 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
601 | 601 | } else { |
602 | 602 | $recent_ident = ''; |
603 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
603 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
604 | 604 | } |
605 | 605 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
606 | - if($recent_ident == "") |
|
606 | + if ($recent_ident == "") |
|
607 | 607 | { |
608 | 608 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
609 | 609 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
610 | 610 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
611 | 611 | //adds the spotter data for the archive |
612 | 612 | $ignoreImport = false; |
613 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
613 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
614 | 614 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
615 | 615 | $ignoreImport = true; |
616 | 616 | } |
617 | 617 | } |
618 | 618 | if (count($globalAirportAccept) > 0) { |
619 | 619 | $ignoreImport = true; |
620 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
620 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
621 | 621 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
622 | 622 | $ignoreImport = false; |
623 | 623 | } |
624 | 624 | } |
625 | 625 | } |
626 | 626 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
627 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
628 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
627 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
628 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
629 | 629 | $ignoreImport = true; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
633 | 633 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
634 | 634 | $ignoreImport = true; |
635 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
636 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
635 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
636 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
637 | 637 | $ignoreImport = false; |
638 | 638 | } |
639 | 639 | } |
640 | 640 | } |
641 | 641 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
642 | 642 | $ignoreImport = true; |
643 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
643 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
644 | 644 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
645 | 645 | $ignoreImport = false; |
646 | 646 | } |
@@ -652,27 +652,27 @@ discard block |
||
652 | 652 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
653 | 653 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
654 | 654 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
655 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
655 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
656 | 656 | $timeelapsed = microtime(true); |
657 | 657 | $Spotter = new Spotter($this->db); |
658 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
658 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name']); |
|
659 | 659 | $Spotter->db = null; |
660 | 660 | if ($globalDebug && isset($result)) echo $result."\n"; |
661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
661 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
662 | 662 | |
663 | 663 | // Add source stat in DB |
664 | 664 | $Stats = new Stats($this->db); |
665 | 665 | if (!empty($this->stats)) { |
666 | 666 | if ($globalDebug) echo 'Add source stats : '; |
667 | - foreach($this->stats as $date => $data) { |
|
668 | - foreach($data as $source => $sourced) { |
|
667 | + foreach ($this->stats as $date => $data) { |
|
668 | + foreach ($data as $source => $sourced) { |
|
669 | 669 | //print_r($sourced); |
670 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
671 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
670 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
671 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
672 | 672 | if (isset($sourced['msg'])) { |
673 | 673 | if (time() - $sourced['msg']['date'] > 10) { |
674 | 674 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
675 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
675 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
676 | 676 | unset($this->stats[$date][$source]['msg']); |
677 | 677 | } |
678 | 678 | } |
@@ -708,18 +708,18 @@ discard block |
||
708 | 708 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
709 | 709 | $SpotterLive = new SpotterLive($this->db); |
710 | 710 | $SpotterLive->deleteLiveSpotterData(); |
711 | - $SpotterLive->db=null; |
|
711 | + $SpotterLive->db = null; |
|
712 | 712 | if ($globalDebug) echo " Done\n"; |
713 | 713 | $this->last_delete = time(); |
714 | 714 | } |
715 | 715 | } else { |
716 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
716 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
717 | 717 | $this->all_flights[$id]['id'] = $recent_ident; |
718 | 718 | $this->all_flights[$id]['addedSpotter'] = 1; |
719 | 719 | } |
720 | 720 | if (isset($globalDaemon) && !$globalDaemon) { |
721 | 721 | $Spotter = new Spotter($this->db); |
722 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
722 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
723 | 723 | $Spotter->db = null; |
724 | 724 | } |
725 | 725 | |
@@ -743,37 +743,37 @@ discard block |
||
743 | 743 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
744 | 744 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
745 | 745 | |
746 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
746 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
747 | 747 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
748 | 748 | $ignoreImport = true; |
749 | 749 | } |
750 | 750 | } |
751 | 751 | if (count($globalAirportAccept) > 0) { |
752 | 752 | $ignoreImport = true; |
753 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
753 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
754 | 754 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
755 | 755 | $ignoreImport = false; |
756 | 756 | } |
757 | 757 | } |
758 | 758 | } |
759 | 759 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
760 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
761 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
760 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
761 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
762 | 762 | $ignoreImport = true; |
763 | 763 | } |
764 | 764 | } |
765 | 765 | } |
766 | 766 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
767 | 767 | $ignoreImport = true; |
768 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
769 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
768 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
769 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
770 | 770 | $ignoreImport = false; |
771 | 771 | } |
772 | 772 | } |
773 | 773 | } |
774 | 774 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
775 | 775 | $ignoreImport = true; |
776 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
776 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
777 | 777 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
778 | 778 | $ignoreImport = false; |
779 | 779 | } |
@@ -781,13 +781,13 @@ discard block |
||
781 | 781 | } |
782 | 782 | |
783 | 783 | if (!$ignoreImport) { |
784 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
784 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
785 | 785 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
786 | 786 | $timeelapsed = microtime(true); |
787 | 787 | $SpotterLive = new SpotterLive($this->db); |
788 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
788 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
789 | 789 | $SpotterLive->db = null; |
790 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
790 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
791 | 791 | |
792 | 792 | // Put statistics in $this->stats variable |
793 | 793 | //if ($line['format_source'] != 'aprs') { |
@@ -805,19 +805,19 @@ discard block |
||
805 | 805 | $latitude = $globalCenterLatitude; |
806 | 806 | $longitude = $globalCenterLongitude; |
807 | 807 | } |
808 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
808 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
809 | 809 | } else { |
810 | 810 | $latitude = $this->source_location[$source]['latitude']; |
811 | 811 | $longitude = $this->source_location[$source]['longitude']; |
812 | 812 | } |
813 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
813 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
814 | 814 | //$stats_heading = $stats_heading%22.5; |
815 | 815 | $stats_heading = round($stats_heading/22.5); |
816 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
816 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
817 | 817 | $current_date = date('Y-m-d'); |
818 | 818 | if ($stats_heading == 16) $stats_heading = 0; |
819 | 819 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
820 | - for ($i=0;$i<=15;$i++) { |
|
820 | + for ($i = 0; $i <= 15; $i++) { |
|
821 | 821 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
822 | 822 | } |
823 | 823 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -832,9 +832,9 @@ discard block |
||
832 | 832 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
833 | 833 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
834 | 834 | end($this->stats[$current_date][$source]['hist']); |
835 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
835 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
836 | 836 | } else $mini = 0; |
837 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
837 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
838 | 838 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
839 | 839 | } |
840 | 840 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
848 | 848 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
849 | 849 | if ($globalDebug) echo $result."\n"; |
850 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
850 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
851 | 851 | //$this->del(); |
852 | 852 | |
853 | 853 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.create_db.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.settings.php'); |
12 | -$title="Install"; |
|
12 | +$title = "Install"; |
|
13 | 13 | require(dirname(__FILE__).'/../require/settings.php'); |
14 | 14 | require(dirname(__FILE__).'/header.php'); |
15 | 15 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | if (!extension_loaded('curl')) { |
64 | 64 | $error[] = "Curl is not loaded."; |
65 | 65 | } |
66 | -if(function_exists('apache_get_modules') ){ |
|
67 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
66 | +if (function_exists('apache_get_modules')) { |
|
67 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
68 | 68 | $error[] = "mod_rewrite is not available."; |
69 | 69 | } |
70 | 70 | /* |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | } |
80 | 80 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
81 | 81 | if (function_exists('get_headers')) { |
82 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
83 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
82 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
83 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
84 | 84 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
85 | 85 | } |
86 | 86 | } |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | ?> |
421 | 421 | <tr> |
422 | 422 | <?php |
423 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
423 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
424 | 424 | ?> |
425 | 425 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
426 | 426 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
427 | 427 | <?php |
428 | 428 | } else { |
429 | - $hostport = explode(':',$source['host']); |
|
429 | + $hostport = explode(':', $source['host']); |
|
430 | 430 | if (isset($hostport[1])) { |
431 | 431 | $host = $hostport[0]; |
432 | 432 | $port = $hostport[1]; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | <br /> |
750 | 750 | <p> |
751 | 751 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
752 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
752 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
753 | 753 | </p> |
754 | 754 | <br /> |
755 | 755 | <p> |
@@ -795,14 +795,14 @@ discard block |
||
795 | 795 | $error = ''; |
796 | 796 | |
797 | 797 | if (isset($_POST['dbtype'])) { |
798 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
799 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
800 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
801 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
802 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
803 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
804 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
805 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
798 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
799 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
800 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
801 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
802 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
803 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
804 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
805 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
806 | 806 | |
807 | 807 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
808 | 808 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -822,48 +822,48 @@ discard block |
||
822 | 822 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
823 | 823 | */ |
824 | 824 | |
825 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
825 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
826 | 826 | |
827 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
828 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
829 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
830 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
831 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
827 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
828 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
829 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
830 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
831 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
832 | 832 | |
833 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
834 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
835 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
836 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
837 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
838 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
839 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
840 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
841 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey)); |
|
833 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
834 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
835 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
836 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
837 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
838 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
839 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
840 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
841 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey)); |
|
842 | 842 | |
843 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
844 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
845 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
846 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
847 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
848 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
843 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
844 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
845 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
846 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
847 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
848 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
849 | 849 | |
850 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
851 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
850 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
851 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
852 | 852 | |
853 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
854 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
855 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
853 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
854 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
855 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
856 | 856 | |
857 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
857 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
858 | 858 | if ($acars == 'acars') { |
859 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
859 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
860 | 860 | } else { |
861 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
861 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
862 | 862 | } |
863 | 863 | |
864 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
865 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
866 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
864 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
865 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
866 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
867 | 867 | |
868 | 868 | $source_name = $_POST['source_name']; |
869 | 869 | $source_latitude = $_POST['source_latitude']; |
@@ -877,8 +877,8 @@ discard block |
||
877 | 877 | |
878 | 878 | $sources = array(); |
879 | 879 | foreach ($source_name as $keys => $name) { |
880 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
881 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
880 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
881 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
882 | 882 | } |
883 | 883 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
884 | 884 | |
@@ -891,13 +891,13 @@ discard block |
||
891 | 891 | $sbsurl = $_POST['sbsurl']; |
892 | 892 | */ |
893 | 893 | |
894 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
895 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
896 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
897 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
898 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
899 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
900 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
894 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
895 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
896 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
897 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
898 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
899 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
900 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
901 | 901 | |
902 | 902 | /* |
903 | 903 | $globalSBS1Hosts = array(); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | } |
914 | 914 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
915 | 915 | */ |
916 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
916 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
917 | 917 | $host = $_POST['host']; |
918 | 918 | $port = $_POST['port']; |
919 | 919 | $name = $_POST['name']; |
@@ -924,89 +924,89 @@ discard block |
||
924 | 924 | foreach ($host as $key => $h) { |
925 | 925 | if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
926 | 926 | else $cov = 'FALSE'; |
927 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
927 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov); |
|
928 | 928 | } |
929 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
929 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
930 | 930 | |
931 | 931 | /* |
932 | 932 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
933 | 933 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
934 | 934 | */ |
935 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
936 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
937 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
935 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
936 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
937 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
938 | 938 | |
939 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
940 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
939 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
940 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
941 | 941 | |
942 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
943 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
944 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
945 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
942 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
943 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
944 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
945 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
946 | 946 | |
947 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
948 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
949 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
947 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
948 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
949 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
950 | 950 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
951 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
952 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
951 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
952 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
953 | 953 | |
954 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
955 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
956 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
957 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
958 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
959 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
960 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
961 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
954 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
955 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
956 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
957 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
958 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
959 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
960 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
961 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
962 | 962 | |
963 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
964 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
963 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
964 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
965 | 965 | |
966 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
967 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
966 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
967 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
968 | 968 | |
969 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
969 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
970 | 970 | if ($archiveyear == "archiveyear") { |
971 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
971 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
972 | 972 | } else { |
973 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
973 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
974 | 974 | } |
975 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
976 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
977 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
978 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
975 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
976 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
977 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
978 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
979 | 979 | |
980 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
981 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
982 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
983 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
980 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
981 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
982 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
983 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
984 | 984 | |
985 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
986 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
987 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
985 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
986 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
987 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
988 | 988 | |
989 | 989 | // Create in settings.php keys not yet configurable if not already here |
990 | 990 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
991 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
991 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
992 | 992 | |
993 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
993 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
994 | 994 | if ($archive == 'archive') { |
995 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
995 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
996 | 996 | } else { |
997 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
997 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
998 | 998 | } |
999 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
999 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1000 | 1000 | if ($daemon == 'daemon') { |
1001 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1001 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1002 | 1002 | } else { |
1003 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1003 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1004 | 1004 | } |
1005 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1005 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1006 | 1006 | if ($schedules == 'schedules') { |
1007 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1007 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1008 | 1008 | } else { |
1009 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1009 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | /* |
@@ -1017,171 +1017,171 @@ discard block |
||
1017 | 1017 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1018 | 1018 | } |
1019 | 1019 | */ |
1020 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1021 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1022 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1023 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1024 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1020 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1021 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1022 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1023 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1024 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1025 | 1025 | if ($globalivao == 'ivao') { |
1026 | 1026 | //$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE')); |
1027 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1028 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1027 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1028 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1029 | 1029 | if ($globalvatsim == 'vatsim') { |
1030 | 1030 | //$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE')); |
1031 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1032 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1031 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1032 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1033 | 1033 | if ($globalphpvms == 'phpvms') { |
1034 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1035 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1034 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1035 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1036 | 1036 | if ($globalvam == 'vam') { |
1037 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1038 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1037 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1038 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1039 | 1039 | if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') { |
1040 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1041 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1040 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1041 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1042 | 1042 | |
1043 | 1043 | |
1044 | 1044 | |
1045 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1045 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1046 | 1046 | if ($notam == 'notam') { |
1047 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1047 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1048 | 1048 | } else { |
1049 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1049 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1050 | 1050 | } |
1051 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1051 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1052 | 1052 | if ($owner == 'owner') { |
1053 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1053 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1054 | 1054 | } else { |
1055 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1055 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1056 | 1056 | } |
1057 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1057 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1058 | 1058 | if ($map3d == 'map3d') { |
1059 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1059 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1060 | 1060 | } else { |
1061 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1061 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1062 | 1062 | } |
1063 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1063 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1064 | 1064 | if ($mapsatellites == 'mapsatellites') { |
1065 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1065 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1066 | 1066 | } else { |
1067 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1067 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1068 | 1068 | } |
1069 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1069 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1070 | 1070 | if ($map3ddefault == 'map3ddefault') { |
1071 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1071 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1072 | 1072 | } else { |
1073 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1073 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1074 | 1074 | } |
1075 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1075 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1076 | 1076 | if ($translate == 'translate') { |
1077 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1077 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1078 | 1078 | } else { |
1079 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1079 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1080 | 1080 | } |
1081 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1081 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1082 | 1082 | if ($realairlines == 'realairlines') { |
1083 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1083 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1084 | 1084 | } else { |
1085 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1085 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1086 | 1086 | } |
1087 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1087 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1088 | 1088 | if ($estimation == 'estimation') { |
1089 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1089 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1090 | 1090 | } else { |
1091 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1091 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1092 | 1092 | } |
1093 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1093 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1094 | 1094 | if ($metar == 'metar') { |
1095 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1095 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1096 | 1096 | } else { |
1097 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1097 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1098 | 1098 | } |
1099 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1099 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1100 | 1100 | if ($metarcycle == 'metarcycle') { |
1101 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1101 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1102 | 1102 | } else { |
1103 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1103 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1104 | 1104 | } |
1105 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1105 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1106 | 1106 | if ($fork == 'fork') { |
1107 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1107 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1108 | 1108 | } else { |
1109 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1109 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1112 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1113 | 1113 | if ($colormap == 'colormap') { |
1114 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1114 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1115 | 1115 | } else { |
1116 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1116 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | if (isset($_POST['aircrafticoncolor'])) { |
1120 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1121 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1120 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1121 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1125 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1124 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1125 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1126 | 1126 | |
1127 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1128 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1129 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1130 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1131 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1132 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1127 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1128 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1129 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1130 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1131 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1132 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1133 | 1133 | |
1134 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1134 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1135 | 1135 | if ($mappopup == 'mappopup') { |
1136 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1136 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1137 | 1137 | } else { |
1138 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1138 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1139 | 1139 | } |
1140 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1140 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1141 | 1141 | if ($airportpopup == 'airportpopup') { |
1142 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1142 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1143 | 1143 | } else { |
1144 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1144 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1145 | 1145 | } |
1146 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1146 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1147 | 1147 | if ($maphistory == 'maphistory') { |
1148 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1148 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1149 | 1149 | } else { |
1150 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1150 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1151 | 1151 | } |
1152 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1152 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1153 | 1153 | if ($flightroute == 'flightroute') { |
1154 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1154 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1155 | 1155 | } else { |
1156 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1156 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1157 | 1157 | } |
1158 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1158 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1159 | 1159 | if ($allflights == 'allflights') { |
1160 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1160 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1161 | 1161 | } else { |
1162 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1162 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1163 | 1163 | } |
1164 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1164 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1165 | 1165 | if ($waypoints == 'waypoints') { |
1166 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1166 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1167 | 1167 | } else { |
1168 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1168 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1171 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1172 | 1172 | |
1173 | 1173 | // Set some defaults values... |
1174 | 1174 | if (!isset($globalAircraftImageSources)) { |
1175 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1176 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1175 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1176 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | if (!isset($globalSchedulesSources)) { |
1180 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1181 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1180 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1181 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1184 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1185 | 1185 | |
1186 | 1186 | if ($error == '') settings::modify_settings($settings); |
1187 | 1187 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | header('Content-disposition: attachment; filename="atc.geojson"'); |
8 | 8 | } |
9 | 9 | header('Content-Type: text/javascript'); |
10 | -$ATC=new ATC(); |
|
10 | +$ATC = new ATC(); |
|
11 | 11 | if (isset($_GET['coord'])) |
12 | 12 | { |
13 | 13 | //$coords = explode(',',$_GET['coord']); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $output = '{"type": "FeatureCollection","features": ['; |
20 | 20 | if (!empty($spotter_array)) |
21 | 21 | { |
22 | - foreach($spotter_array as $spotter_item) |
|
22 | + foreach ($spotter_array as $spotter_item) |
|
23 | 23 | { |
24 | 24 | date_default_timezone_set('UTC'); |
25 | 25 | //waypoint plotting |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | |
17 | 17 | if (isset($_GET['start_date'])) { |
18 | 18 | //for the date manipulation into the query |
19 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
19 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
20 | 20 | $start_date = $_GET['start_date']." 00:00:00"; |
21 | 21 | $end_date = $_GET['end_date']." 00:00:00"; |
22 | 22 | $sql_date = $start_date.",".$end_date; |
23 | - } else if($_GET['start_date'] != ""){ |
|
23 | + } else if ($_GET['start_date'] != "") { |
|
24 | 24 | $start_date = $_GET['start_date']." 00:00:00"; |
25 | 25 | $sql_date = $start_date; |
26 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
26 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
27 | 27 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
28 | 28 | $sql_date = $end_date; |
29 | 29 | } else $sql_date = ''; |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | |
32 | 32 | if (isset($_GET['highest_altitude'])) { |
33 | 33 | //for altitude manipulation |
34 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
34 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
35 | 35 | $end_altitude = $_GET['highest_altitude']; |
36 | 36 | $start_altitude = $_GET['lowest_altitude']; |
37 | 37 | $sql_altitude = $start_altitude.",".$end_altitude; |
38 | - } else if($_GET['highest_altitude'] != ""){ |
|
38 | + } else if ($_GET['highest_altitude'] != "") { |
|
39 | 39 | $end_altitude = $_GET['highest_altitude']; |
40 | 40 | $sql_altitude = $end_altitude; |
41 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
41 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
42 | 42 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
43 | 43 | $sql_altitude = $start_altitude; |
44 | 44 | } else $sql_altitude = ''; |
45 | 45 | } else $sql_altitude = ''; |
46 | 46 | |
47 | 47 | //calculuation for the pagination |
48 | -if(!isset($_GET['limit'])) |
|
48 | +if (!isset($_GET['limit'])) |
|
49 | 49 | { |
50 | 50 | if (!isset($_GET['number_results'])) |
51 | 51 | { |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | $limit_end = 25; |
54 | 54 | $absolute_difference = 25; |
55 | 55 | } else { |
56 | - if ($_GET['number_results'] > 1000){ |
|
56 | + if ($_GET['number_results'] > 1000) { |
|
57 | 57 | $_GET['number_results'] = 1000; |
58 | 58 | } |
59 | 59 | $limit_start = 0; |
60 | 60 | $limit_end = $_GET['number_results']; |
61 | 61 | $absolute_difference = $_GET['number_results']; |
62 | 62 | } |
63 | -} else { |
|
63 | +} else { |
|
64 | 64 | $limit_explode = explode(",", $_GET['limit']); |
65 | 65 | $limit_start = $limit_explode[0]; |
66 | 66 | $limit_end = $limit_explode[1]; |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | $limit_previous_1 = $limit_start - $absolute_difference; |
71 | 71 | $limit_previous_2 = $limit_end - $absolute_difference; |
72 | 72 | |
73 | -if (!empty($_GET)){ |
|
74 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
75 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
76 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
77 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
78 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
79 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
80 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
81 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
82 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
83 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
84 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
85 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
86 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
87 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
88 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
89 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
90 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
91 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
92 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_STRING); |
|
93 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING); |
|
94 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
73 | +if (!empty($_GET)) { |
|
74 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
75 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
76 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
77 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
78 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
79 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
80 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
81 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
82 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
83 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
84 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
85 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
86 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
87 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
88 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
89 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
90 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
91 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
92 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_STRING); |
|
93 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_STRING); |
|
94 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
95 | 95 | if ($dist != '') { |
96 | 96 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
97 | 97 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | if (!isset($sql_date)) $sql_date = ''; |
100 | 100 | if ($archive == 1) { |
101 | 101 | $SpotterArchive = new SpotterArchive(); |
102 | - $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
102 | + $spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
103 | 103 | } else { |
104 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
104 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | print '<span class="sub-menu-statistic column mobile">'; |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | //remove 3D=true parameter |
135 | 135 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
136 | 136 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
137 | - if (!isset($_GET['3D'])){ |
|
137 | + if (!isset($_GET['3D'])) { |
|
138 | 138 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
139 | 139 | } else { |
140 | 140 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
141 | 141 | } |
142 | - if (isset($_GET['3D'])){ |
|
142 | + if (isset($_GET['3D'])) { |
|
143 | 143 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
144 | 144 | } else { |
145 | 145 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -160,30 +160,30 @@ discard block |
||
160 | 160 | print '<div class="column">'; |
161 | 161 | print '<div class="info">'; |
162 | 162 | print '<h1>'._("Search Results for").' '; |
163 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$_GET['q'].'</span> '; } |
|
164 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$_GET['aircraft'].'</span> '; } |
|
165 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$_GET['manufacturer'].'</span> '; } |
|
166 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$_GET['registration'].'</span> '; } |
|
167 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$_GET['highlights'].'</span> '; } |
|
168 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$_GET['airline'].'</span> '; } |
|
169 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$_GET['airline_country'].'</span> '; } |
|
170 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$_GET['airline_type'].'</span> '; } |
|
171 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$_GET['airport'].'</span> '; } |
|
172 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$_GET['airport_country'].'</span> '; } |
|
173 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$_GET['callsign'].'</span> '; } |
|
174 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$_GET['owner'].'</span> '; } |
|
175 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$_GET['pilot_id'].'</span> '; } |
|
176 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$_GET['pilot_name'].'</span> '; } |
|
177 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$_GET['departure_airport_route'].'</span> '; } |
|
178 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
179 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$_GET['departure_airport_route'].'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
180 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$_GET['start_date'].'</span> '; } |
|
181 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$_GET['end_date'].'</span> '; } |
|
182 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$_GET['start_date'].'</span> and <span>'.$_GET['end_date'].'</span> '; } |
|
183 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '; } |
|
184 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
185 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '._("and").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
186 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$_GET['number_results'].'</span> '; } |
|
163 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$_GET['q'].'</span> '; } |
|
164 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$_GET['aircraft'].'</span> '; } |
|
165 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$_GET['manufacturer'].'</span> '; } |
|
166 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$_GET['registration'].'</span> '; } |
|
167 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$_GET['highlights'].'</span> '; } |
|
168 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$_GET['airline'].'</span> '; } |
|
169 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$_GET['airline_country'].'</span> '; } |
|
170 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$_GET['airline_type'].'</span> '; } |
|
171 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$_GET['airport'].'</span> '; } |
|
172 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$_GET['airport_country'].'</span> '; } |
|
173 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$_GET['callsign'].'</span> '; } |
|
174 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$_GET['owner'].'</span> '; } |
|
175 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$_GET['pilot_id'].'</span> '; } |
|
176 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$_GET['pilot_name'].'</span> '; } |
|
177 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$_GET['departure_airport_route'].'</span> '; } |
|
178 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
179 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$_GET['departure_airport_route'].'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
180 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$_GET['start_date'].'</span> '; } |
|
181 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$_GET['end_date'].'</span> '; } |
|
182 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$_GET['start_date'].'</span> and <span>'.$_GET['end_date'].'</span> '; } |
|
183 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '; } |
|
184 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
185 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '._("and").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
186 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$_GET['number_results'].'</span> '; } |
|
187 | 187 | print '</h1>'; |
188 | 188 | print '</div>'; |
189 | 189 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | </select> |
291 | 291 | </div> |
292 | 292 | </div> |
293 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $_GET['manufacturer']; ?>')</script> |
|
293 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $_GET['manufacturer']; ?>')</script> |
|
294 | 294 | <div class="form-group"> |
295 | 295 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
296 | 296 | <div class="col-sm-10"> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | </select> |
300 | 300 | </div> |
301 | 301 | </div> |
302 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $_GET['aircraft_icao']; ?>');</script> |
|
302 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $_GET['aircraft_icao']; ?>');</script> |
|
303 | 303 | <div class="form-group"> |
304 | 304 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
305 | 305 | <div class="col-sm-10"> |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | </div> |
324 | 324 | <?php |
325 | -}else { |
|
325 | +} else { |
|
326 | 326 | ?> |
327 | 327 | <div class="form-group"> |
328 | 328 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | ?> |
336 | 336 | <div class="form-group"> |
337 | 337 | <div class="col-sm-offset-2 col-sm-10"> |
338 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
339 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
338 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
339 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
340 | 340 | </div> |
341 | 341 | </div> |
342 | 342 | </fieldset> |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | </select> |
351 | 351 | </div> |
352 | 352 | </div> |
353 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $_GET['airline']; ?>');</script> |
|
353 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $_GET['airline']; ?>');</script> |
|
354 | 354 | <div class="form-group"> |
355 | 355 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
356 | 356 | <div class="col-sm-10"> |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | </select> |
360 | 360 | </div> |
361 | 361 | </div> |
362 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $_GET['airline_country']; ?>');</script> |
|
362 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $_GET['airline_country']; ?>');</script> |
|
363 | 363 | <div class="form-group"> |
364 | 364 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
365 | 365 | <div class="col-sm-10"> |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | </div> |
369 | 369 | <div class="form-group"> |
370 | 370 | <div class="col-sm-offset-2 col-sm-10"> |
371 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
372 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
373 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
374 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
371 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
372 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
373 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
374 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
375 | 375 | </div> |
376 | 376 | </div> |
377 | 377 | </fieldset> |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | </select> |
386 | 386 | </div> |
387 | 387 | </div> |
388 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $_GET['airport_icao']; ?>');</script> |
|
388 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $_GET['airport_icao']; ?>');</script> |
|
389 | 389 | <div class="form-group"> |
390 | 390 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
391 | 391 | <div class="col-sm-10"> |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | </select> |
395 | 395 | </div> |
396 | 396 | </div> |
397 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $_GET['airport_country']; ?>');</script> |
|
397 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $_GET['airport_country']; ?>');</script> |
|
398 | 398 | </fieldset> |
399 | 399 | <fieldset> |
400 | 400 | <legend><?php echo _("Route"); ?></legend> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | </select> |
407 | 407 | </div> |
408 | 408 | </div> |
409 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $_GET['departure_airport_route']; ?>');</script> |
|
409 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $_GET['departure_airport_route']; ?>');</script> |
|
410 | 410 | <div class="form-group"> |
411 | 411 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
412 | 412 | <div class="col-sm-10"> |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | </select> |
416 | 416 | </div> |
417 | 417 | </div> |
418 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $_GET['arrival_airport_route']; ?>');</script> |
|
418 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $_GET['arrival_airport_route']; ?>');</script> |
|
419 | 419 | </fieldset> |
420 | 420 | <fieldset> |
421 | 421 | <legend><?php echo _("Date"); ?></legend> |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | <option></option> |
470 | 470 | <?php |
471 | 471 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
472 | -foreach($altitude_array as $altitude) |
|
472 | +foreach ($altitude_array as $altitude) |
|
473 | 473 | { |
474 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
474 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
475 | 475 | { |
476 | 476 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
477 | 477 | } else { |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | <option></option> |
490 | 490 | <?php |
491 | 491 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
492 | -foreach($altitude_array as $altitude) |
|
492 | +foreach ($altitude_array as $altitude) |
|
493 | 493 | { |
494 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
494 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
495 | 495 | { |
496 | 496 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
497 | 497 | } else { |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | <div class="col-sm-10"> |
531 | 531 | <select class="form-control" name="number_results"> |
532 | 532 | <?php |
533 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
534 | -foreach($number_results_array as $number) |
|
533 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
534 | +foreach ($number_results_array as $number) |
|
535 | 535 | { |
536 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
536 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
537 | 537 | { |
538 | 538 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
539 | 539 | } else { |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | <fieldset> |
552 | 552 | <div class="form-group"> |
553 | 553 | <div class="col-sm-offset-2 col-sm-10"> |
554 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
554 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
555 | 555 | </div> |
556 | 556 | </div> |
557 | 557 | </fieldset> |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | die; |
41 | 41 | } |
42 | 42 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
43 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
43 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -$options = getopt('s::',array('source::','server','idsource::')); |
|
47 | +$options = getopt('s::', array('source::', 'server', 'idsource::')); |
|
48 | 48 | //if (isset($options['s'])) $hosts = array($options['s']); |
49 | 49 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
50 | 50 | if (isset($options['s'])) { |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | else $id_source = 1; |
60 | 60 | if (isset($globalServer) && $globalServer) { |
61 | 61 | if ($globalDebug) echo "Using Server Mode\n"; |
62 | - $SI=new SpotterServer(); |
|
63 | -} else $SI=new SpotterImport($Connection->db); |
|
62 | + $SI = new SpotterServer(); |
|
63 | +} else $SI = new SpotterImport($Connection->db); |
|
64 | 64 | //$APRS=new APRS($Connection->db); |
65 | -$SBS=new SBS(); |
|
66 | -$ACARS=new ACARS($Connection->db); |
|
67 | -$Common=new Common(); |
|
65 | +$SBS = new SBS(); |
|
66 | +$ACARS = new ACARS($Connection->db); |
|
67 | +$Common = new Common(); |
|
68 | 68 | date_default_timezone_set('UTC'); |
69 | 69 | //$servertz = system('date +%Z'); |
70 | 70 | // signal handler - playing nice with sockets and dump1090 |
71 | 71 | if (function_exists('pcntl_fork')) { |
72 | - pcntl_signal(SIGINT, function() { |
|
72 | + pcntl_signal(SIGINT, function() { |
|
73 | 73 | global $sockets; |
74 | 74 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
75 | 75 | die("Bye!\n"); |
@@ -112,34 +112,34 @@ discard block |
||
112 | 112 | |
113 | 113 | function connect_all($hosts) { |
114 | 114 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
115 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
115 | + global $sockets, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs; |
|
116 | 116 | if ($globalDebug) echo 'Connect to all...'."\n"; |
117 | 117 | foreach ($hosts as $id => $value) { |
118 | 118 | $host = $value['host']; |
119 | 119 | $globalSources[$id]['last_exec'] = 0; |
120 | 120 | // Here we check type of source(s) |
121 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
122 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
121 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
122 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
123 | 123 | //$formats[$id] = 'deltadbtxt'; |
124 | 124 | $globalSources[$id]['format'] = 'deltadbtxt'; |
125 | 125 | //$last_exec['deltadbtxt'] = 0; |
126 | 126 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
127 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
127 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
128 | 128 | //$formats[$id] = 'vatsimtxt'; |
129 | 129 | $globalSources[$id]['format'] = 'vatsimtxt'; |
130 | 130 | //$last_exec['vatsimtxt'] = 0; |
131 | 131 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
132 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
132 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
133 | 133 | //$formats[$id] = 'aircraftlistjson'; |
134 | 134 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
135 | 135 | //$last_exec['aircraftlistjson'] = 0; |
136 | 136 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
137 | - } else if (preg_match('/opensky/i',$host)) { |
|
137 | + } else if (preg_match('/opensky/i', $host)) { |
|
138 | 138 | //$formats[$id] = 'aircraftlistjson'; |
139 | 139 | $globalSources[$id]['format'] = 'opensky'; |
140 | 140 | //$last_exec['aircraftlistjson'] = 0; |
141 | 141 | if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
142 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
142 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i', $host)) { |
|
143 | 143 | //$formats[$id] = 'radarvirtueljson'; |
144 | 144 | $globalSources[$id]['format'] = 'radarvirtueljson'; |
145 | 145 | //$last_exec['radarvirtueljson'] = 0; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
149 | 149 | exit(0); |
150 | 150 | } |
151 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
151 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
152 | 152 | //$formats[$id] = 'planeupdatefaa'; |
153 | 153 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
154 | 154 | //$last_exec['planeupdatefaa'] = 0; |
@@ -157,26 +157,26 @@ discard block |
||
157 | 157 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
158 | 158 | exit(0); |
159 | 159 | } |
160 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
160 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
161 | 161 | //$formats[$id] = 'phpvmacars'; |
162 | 162 | $globalSources[$id]['format'] = 'phpvmacars'; |
163 | 163 | //$last_exec['phpvmacars'] = 0; |
164 | 164 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
165 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
165 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
166 | 166 | //$formats[$id] = 'phpvmacars'; |
167 | 167 | $globalSources[$id]['format'] = 'vam'; |
168 | 168 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
169 | - } else if (preg_match('/whazzup/i',$host)) { |
|
169 | + } else if (preg_match('/whazzup/i', $host)) { |
|
170 | 170 | //$formats[$id] = 'whazzup'; |
171 | 171 | $globalSources[$id]['format'] = 'whazzup'; |
172 | 172 | //$last_exec['whazzup'] = 0; |
173 | 173 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
174 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
174 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
175 | 175 | //$formats[$id] = 'pirepsjson'; |
176 | 176 | $globalSources[$id]['format'] = 'pirepsjson'; |
177 | 177 | //$last_exec['pirepsjson'] = 0; |
178 | 178 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
179 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
179 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
180 | 180 | //$formats[$id] = 'fr24json'; |
181 | 181 | $globalSources[$id]['format'] = 'fr24json'; |
182 | 182 | //$last_exec['fr24json'] = 0; |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | exit(0); |
187 | 187 | } |
188 | 188 | //} else if (preg_match('/10001/',$host)) { |
189 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
189 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | 190 | //$formats[$id] = 'tsv'; |
191 | 191 | $globalSources[$id]['format'] = 'tsv'; |
192 | 192 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
193 | 193 | } |
194 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
194 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
195 | 195 | if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
196 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
197 | - $hostport = explode(':',$host); |
|
196 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
197 | + $hostport = explode(':', $host); |
|
198 | 198 | if (isset($hostport[1])) { |
199 | 199 | $port = $hostport[1]; |
200 | 200 | $hostn = $hostport[0]; |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | $hostn = $globalSources[$id]['host']; |
204 | 204 | } |
205 | 205 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
206 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
206 | + $s = create_socket($hostn, $port, $errno, $errstr); |
|
207 | 207 | } else { |
208 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
208 | + $s = create_socket_udp($hostn, $port, $errno, $errstr); |
|
209 | 209 | } |
210 | 210 | if ($s) { |
211 | 211 | $sockets[$id] = $s; |
212 | 212 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
213 | - if (preg_match('/aprs/',$hostn)) { |
|
213 | + if (preg_match('/aprs/', $hostn)) { |
|
214 | 214 | //$formats[$id] = 'aprs'; |
215 | 215 | $globalSources[$id]['format'] = 'aprs'; |
216 | 216 | //$aprs_connect = 0; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
252 | 252 | else $timeout = 20; |
253 | 253 | $errno = ''; |
254 | -$errstr=''; |
|
254 | +$errstr = ''; |
|
255 | 255 | |
256 | 256 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
257 | 257 | /* Initiate connections to all the hosts simultaneously */ |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | if ($use_aprs) { |
282 | 282 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
283 | - $APRS=new APRS(); |
|
283 | + $APRS = new APRS(); |
|
284 | 284 | $aprs_connect = 0; |
285 | 285 | $aprs_keep = 120; |
286 | 286 | $aprs_last_tx = time(); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | else $aprs_ssid = 'FAM'; |
292 | 292 | //else $aprs_ssid = 'PerlEx'; |
293 | 293 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
294 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
294 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
295 | 295 | if ($aprs_full) $aprs_filter = ''; |
296 | 296 | if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n"; |
297 | 297 | else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n"; |
@@ -302,12 +302,12 @@ discard block |
||
302 | 302 | sleep(1); |
303 | 303 | if ($globalDebug) echo "SCAN MODE \n\n"; |
304 | 304 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
305 | -$endtime = time()+$globalCronEnd; |
|
305 | +$endtime = time() + $globalCronEnd; |
|
306 | 306 | $i = 1; |
307 | 307 | $tt = array(); |
308 | 308 | // Delete all ATC |
309 | 309 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
310 | - $ATC=new ATC($Connection->db); |
|
310 | + $ATC = new ATC($Connection->db); |
|
311 | 311 | } |
312 | 312 | if (!$globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
313 | 313 | $ATC->deleteAll(); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
317 | 317 | while ($i > 0) { |
318 | - if (!$globalDaemon) $i = $endtime-time(); |
|
318 | + if (!$globalDaemon) $i = $endtime - time(); |
|
319 | 319 | // Delete old ATC |
320 | 320 | if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
321 | 321 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } |
330 | 330 | if ($max != $globalMinFetch) { |
331 | 331 | if ($globalDebug) echo 'Sleeping...'."\n"; |
332 | - sleep($globalMinFetch-$max+2); |
|
332 | + sleep($globalMinFetch - $max + 2); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
341 | 341 | //$buffer = $Common->getData($hosts[$id]); |
342 | 342 | $buffer = $Common->getData($value['host']); |
343 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
344 | - $buffer = explode('\n',$buffer); |
|
343 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
344 | + $buffer = explode('\n', $buffer); |
|
345 | 345 | foreach ($buffer as $line) { |
346 | 346 | if ($line != '' && count($line) > 7) { |
347 | 347 | $line = explode(',', $line); |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $value[' last_exec'] > $globalMinFetch))) { |
371 | 371 | //$buffer = $Common->getData($hosts[$id]); |
372 | 372 | $buffer = $Common->getData($value['host']); |
373 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
374 | - $buffer = explode('\n',$buffer); |
|
373 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
374 | + $buffer = explode('\n', $buffer); |
|
375 | 375 | foreach ($buffer as $line) { |
376 | 376 | if ($line != '') { |
377 | 377 | $line = explode(':', $line); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | $data['id'] = $line[1].'-'.$line[0]; |
381 | 381 | $data['pilot_id'] = $line[1]; |
382 | 382 | $data['pilot_name'] = $line[2]; |
383 | - $data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT); |
|
383 | + $data['hex'] = str_pad(dechex($line[1]), 6, '000000', STR_PAD_LEFT); |
|
384 | 384 | $data['ident'] = $line[0]; // ident |
385 | 385 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
386 | 386 | $data['speed'] = $line[8]; // speed |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
397 | 397 | if (isset($line[37])) $data['last_update'] = $line[37]; |
398 | 398 | $data['departure_airport_icao'] = $line[11]; |
399 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
399 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
400 | 400 | $data['arrival_airport_icao'] = $line[13]; |
401 | 401 | $data['frequency'] = $line[4]; |
402 | 402 | $data['type'] = $line[18]; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $data['id_source'] = $id_source; |
406 | 406 | //$data['arrival_airport_time'] = ; |
407 | 407 | if ($line[9] != '') { |
408 | - $aircraft_data = explode('/',$line[9]); |
|
408 | + $aircraft_data = explode('/', $line[9]); |
|
409 | 409 | if (isset($aircraft_data[1])) { |
410 | 410 | $data['aircraft_icao'] = $aircraft_data[1]; |
411 | 411 | } |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | if ($line[3] == 'PILOT') $SI->add($data); |
420 | 420 | elseif ($line[3] == 'ATC') { |
421 | 421 | //print_r($data); |
422 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
423 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
424 | - $typec = substr($data['ident'],-3); |
|
422 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
423 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
424 | + $typec = substr($data['ident'], -3); |
|
425 | 425 | if ($typec == 'APP') $data['type'] = 'Approach'; |
426 | 426 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
427 | 427 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
433 | 433 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
434 | 434 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
435 | - echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
435 | + echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
436 | 436 | } |
437 | 437 | unset($data); |
438 | 438 | } |
@@ -443,9 +443,9 @@ discard block |
||
443 | 443 | $last_exec[$id]['last'] = time(); |
444 | 444 | //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
445 | 445 | } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
446 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
446 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
447 | 447 | if ($buffer != '') { |
448 | - $all_data = json_decode($buffer,true); |
|
448 | + $all_data = json_decode($buffer, true); |
|
449 | 449 | if (isset($all_data['acList'])) { |
450 | 450 | foreach ($all_data['acList'] as $line) { |
451 | 451 | $data = array(); |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
500 | 500 | } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
501 | 501 | $buffer = $Common->getData($value['host']); |
502 | - $all_data = json_decode($buffer,true); |
|
502 | + $all_data = json_decode($buffer, true); |
|
503 | 503 | if (isset($all_data['planes'])) { |
504 | 504 | foreach ($all_data['planes'] as $key => $line) { |
505 | 505 | $data = array(); |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | $data['emergency'] = ''; // emergency |
516 | 516 | $data['registration'] = $line[2]; |
517 | 517 | $data['aircraft_icao'] = $line[0]; |
518 | - $deparr = explode('-',$line[1]); |
|
518 | + $deparr = explode('-', $line[1]); |
|
519 | 519 | if (count($deparr) == 2) { |
520 | 520 | $data['departure_airport_icao'] = $deparr[0]; |
521 | 521 | $data['arrival_airport_icao'] = $deparr[1]; |
522 | 522 | } |
523 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
523 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
524 | 524 | $data['format_source'] = 'planeupdatefaa'; |
525 | 525 | $data['id_source'] = $id_source; |
526 | 526 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $last_exec[$id]['last'] = time(); |
533 | 533 | } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
534 | 534 | $buffer = $Common->getData($value['host']); |
535 | - $all_data = json_decode($buffer,true); |
|
535 | + $all_data = json_decode($buffer, true); |
|
536 | 536 | if (isset($all_data['states'])) { |
537 | 537 | foreach ($all_data['states'] as $key => $line) { |
538 | 538 | $data = array(); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | //$data['emergency'] = ''; // emergency |
549 | 549 | //$data['registration'] = $line[2]; |
550 | 550 | //$data['aircraft_icao'] = $line[0]; |
551 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
551 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
552 | 552 | $data['format_source'] = 'opensky'; |
553 | 553 | $data['id_source'] = $id_source; |
554 | 554 | $SI->add($data); |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
562 | 562 | //$buffer = $Common->getData($hosts[$id]); |
563 | 563 | $buffer = $Common->getData($value['host']); |
564 | - $all_data = json_decode($buffer,true); |
|
564 | + $all_data = json_decode($buffer, true); |
|
565 | 565 | foreach ($all_data as $key => $line) { |
566 | 566 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
567 | 567 | $data = array(); |
@@ -592,11 +592,11 @@ discard block |
||
592 | 592 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
593 | 593 | } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
594 | 594 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
595 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
595 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
596 | 596 | //echo $buffer; |
597 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
598 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
599 | - $all_data = json_decode($buffer,true); |
|
597 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
598 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
599 | + $all_data = json_decode($buffer, true); |
|
600 | 600 | if (json_last_error() != JSON_ERROR_NONE) { |
601 | 601 | die(json_last_error_msg()); |
602 | 602 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | //$data['departure_airport_iata'] = $line[11]; |
619 | 619 | //$data['arrival_airport_iata'] = $line[12]; |
620 | 620 | //$data['emergency'] = ''; // emergency |
621 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
621 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
622 | 622 | $data['format_source'] = 'radarvirtueljson'; |
623 | 623 | $data['id_source'] = $id_source; |
624 | 624 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
634 | 634 | //$buffer = $Common->getData($hosts[$id]); |
635 | 635 | $buffer = $Common->getData($value['host'].'?'.time()); |
636 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
636 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
637 | 637 | |
638 | 638 | if (isset($all_data['pireps'])) { |
639 | 639 | foreach ($all_data['pireps'] as $line) { |
640 | 640 | $data = array(); |
641 | 641 | $data['id'] = $line['id']; |
642 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
642 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
643 | 643 | $data['ident'] = $line['callsign']; // ident |
644 | 644 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
645 | 645 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -668,9 +668,9 @@ discard block |
||
668 | 668 | $SI->add($data); |
669 | 669 | // print_r($data); |
670 | 670 | } elseif ($line['icon'] == 'ct') { |
671 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
672 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
673 | - $typec = substr($data['ident'],-3); |
|
671 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
672 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
673 | + $typec = substr($data['ident'], -3); |
|
674 | 674 | $data['type'] = ''; |
675 | 675 | if ($typec == 'APP') $data['type'] = 'Approach'; |
676 | 676 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
682 | 682 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
683 | 683 | else $data['type'] = 'Observer'; |
684 | - echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
684 | + echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
685 | 685 | } |
686 | 686 | unset($data); |
687 | 687 | } |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | //$buffer = $Common->getData($hosts[$id]); |
694 | 694 | if ($globalDebug) echo 'Get Data...'."\n"; |
695 | 695 | $buffer = $Common->getData($value['host']); |
696 | - $all_data = json_decode($buffer,true); |
|
696 | + $all_data = json_decode($buffer, true); |
|
697 | 697 | if ($buffer != '' && is_array($all_data)) { |
698 | 698 | foreach ($all_data as $line) { |
699 | 699 | $data = array(); |
700 | 700 | //$data['id'] = $line['id']; // id not usable |
701 | 701 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
702 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
702 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
703 | 703 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
704 | 704 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
705 | 705 | $data['ident'] = $line['flightnum']; // ident |
@@ -722,12 +722,12 @@ discard block |
||
722 | 722 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
723 | 723 | if (isset($line['aircraftname'])) { |
724 | 724 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
725 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
726 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
725 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
726 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
727 | 727 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
728 | 728 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
729 | 729 | else { |
730 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
730 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
731 | 731 | if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
732 | 732 | else $data['aircraft_icao'] = $line['aircraftname']; |
733 | 733 | } |
@@ -749,13 +749,13 @@ discard block |
||
749 | 749 | //$buffer = $Common->getData($hosts[$id]); |
750 | 750 | if ($globalDebug) echo 'Get Data...'."\n"; |
751 | 751 | $buffer = $Common->getData($value['host']); |
752 | - $all_data = json_decode($buffer,true); |
|
752 | + $all_data = json_decode($buffer, true); |
|
753 | 753 | if ($buffer != '' && is_array($all_data)) { |
754 | 754 | foreach ($all_data as $line) { |
755 | 755 | $data = array(); |
756 | 756 | //$data['id'] = $line['id']; // id not usable |
757 | 757 | $data['id'] = trim($line['flight_id']); |
758 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
758 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
759 | 759 | $data['pilot_name'] = $line['pilot_name']; |
760 | 760 | $data['pilot_id'] = $line['pilot_id']; |
761 | 761 | $data['ident'] = trim($line['callsign']); // ident |
@@ -805,9 +805,9 @@ discard block |
||
805 | 805 | //$value = $formats[$nb]; |
806 | 806 | $format = $globalSources[$nb]['format']; |
807 | 807 | if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
808 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
808 | + $buffer = socket_read($r, 6000, PHP_NORMAL_READ); |
|
809 | 809 | } else { |
810 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
810 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
811 | 811 | } |
812 | 812 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
813 | 813 | //echo $buffer."\n"; |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
816 | 816 | $error = false; |
817 | 817 | //$SI::del(); |
818 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
818 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
819 | 819 | // SBS format is CSV format |
820 | 820 | if ($buffer != '') { |
821 | 821 | $tt[$format] = 0; |
@@ -836,10 +836,10 @@ discard block |
||
836 | 836 | } elseif ($format == 'flightgearsp') { |
837 | 837 | //echo $buffer."\n"; |
838 | 838 | if (strlen($buffer) > 5) { |
839 | - $line = explode(',',$buffer); |
|
839 | + $line = explode(',', $buffer); |
|
840 | 840 | $data = array(); |
841 | 841 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
842 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
842 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
843 | 843 | $data['ident'] = $line[6]; |
844 | 844 | $data['aircraft_name'] = $line[7]; |
845 | 845 | $data['longitude'] = $line[1]; |
@@ -850,21 +850,21 @@ discard block |
||
850 | 850 | $data['datetime'] = date('Y-m-d H:i:s'); |
851 | 851 | $data['format_source'] = 'flightgearsp'; |
852 | 852 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
853 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
853 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
854 | 854 | } |
855 | 855 | } elseif ($format == 'acars') { |
856 | 856 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
857 | 857 | $ACARS->add(trim($buffer)); |
858 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
858 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
859 | 859 | $ACARS->deleteLiveAcarsData(); |
860 | 860 | } elseif ($format == 'flightgearmp') { |
861 | - if (substr($buffer,0,1) != '#') { |
|
861 | + if (substr($buffer, 0, 1) != '#') { |
|
862 | 862 | $data = array(); |
863 | 863 | //echo $buffer."\n"; |
864 | - $line = explode(' ',$buffer); |
|
864 | + $line = explode(' ', $buffer); |
|
865 | 865 | if (count($line) == 11) { |
866 | - $userserver = explode('@',$line[0]); |
|
867 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
866 | + $userserver = explode('@', $line[0]); |
|
867 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
868 | 868 | $data['ident'] = $userserver[0]; |
869 | 869 | $data['registration'] = $userserver[0]; |
870 | 870 | $data['latitude'] = $line[4]; |
@@ -872,24 +872,24 @@ discard block |
||
872 | 872 | $data['altitude'] = $line[6]; |
873 | 873 | $data['datetime'] = date('Y-m-d H:i:s'); |
874 | 874 | $aircraft_type = $line[10]; |
875 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
876 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
875 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
876 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
877 | 877 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
878 | 878 | } |
879 | 879 | } |
880 | 880 | } elseif ($format == 'beast') { |
881 | 881 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
882 | 882 | die; |
883 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
883 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
884 | 884 | $line = explode("\t", $buffer); |
885 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
885 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
886 | 886 | $key = $line[$k]; |
887 | - $lined[$key] = $line[$k+1]; |
|
887 | + $lined[$key] = $line[$k + 1]; |
|
888 | 888 | } |
889 | 889 | if (count($lined) > 3) { |
890 | 890 | $data['hex'] = $lined['hexid']; |
891 | 891 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
892 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
892 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
893 | 893 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
894 | 894 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
895 | 895 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -907,24 +907,24 @@ discard block |
||
907 | 907 | } else $error = true; |
908 | 908 | } elseif ($format == 'aprs' && $use_aprs) { |
909 | 909 | if ($aprs_connect == 0) { |
910 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
910 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
911 | 911 | $aprs_connect = 1; |
912 | 912 | } |
913 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
913 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
914 | 914 | $aprs_last_tx = time(); |
915 | 915 | $data_aprs = "# Keep alive"; |
916 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
916 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
917 | 917 | } |
918 | 918 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
919 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
920 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
921 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
919 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
920 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
921 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
922 | 922 | $line = $APRS->parse($buffer); |
923 | 923 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
924 | 924 | $data = array(); |
925 | 925 | //print_r($line); |
926 | 926 | $data['hex'] = $line['address']; |
927 | - $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
927 | + $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
928 | 928 | //$data['datetime'] = date('Y-m-d H:i:s'); |
929 | 929 | $data['ident'] = $line['ident']; |
930 | 930 | $data['latitude'] = $line['latitude']; |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | $currentdate = date('Y-m-d H:i:s'); |
945 | 945 | $aprsdate = strtotime($data['datetime']); |
946 | 946 | // Accept data if time <= system time + 20s |
947 | - if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
947 | + if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate) + 20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
948 | 948 | else { |
949 | 949 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
950 | 950 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | connect_all($sourceee); |
1030 | 1030 | $sourceee = array(); |
1031 | 1031 | //connect_all($globalSources); |
1032 | - $tt[$format]=0; |
|
1032 | + $tt[$format] = 0; |
|
1033 | 1033 | break; |
1034 | 1034 | } |
1035 | 1035 | } |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | } else { |
1039 | 1039 | $error = socket_strerror(socket_last_error()); |
1040 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1040 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1041 | 1041 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
1042 | 1042 | if (isset($globalDebug)) echo "Restarting...\n"; |
1043 | 1043 | // Restart the script if possible |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | if ($globalDebug) echo "Shutdown all sockets..."; |
1046 | 1046 | |
1047 | 1047 | foreach ($sockets as $sock) { |
1048 | - @socket_shutdown($sock,2); |
|
1048 | + @socket_shutdown($sock, 2); |
|
1049 | 1049 | @socket_close($sock); |
1050 | 1050 | } |
1051 | 1051 |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -if (!isset($_GET['departure_airport']) || !isset($_GET['arrival_airport'])){ |
|
6 | +if (!isset($_GET['departure_airport']) || !isset($_GET['arrival_airport'])) { |
|
7 | 7 | header('Location: '.$globalURL.''); |
8 | 8 | } else { |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | $limit_previous_1 = $limit_start - $absolute_difference; |
28 | 28 | $limit_previous_2 = $limit_end - $absolute_difference; |
29 | 29 | |
30 | - $departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
31 | - $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
30 | + $departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
31 | + $arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/route/'.$departure_airport.'/'.$arrival_airport; |
33 | 33 | if (isset($_GET['sort'])) { |
34 | 34 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, $limit_start.",".$absolute_difference, $_GET['sort']); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | if (!empty($spotter_array)) |
40 | 40 | { |
41 | - $title = sprintf(_("Detailed View for flights between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
41 | + $title = sprintf(_("Detailed View for flights between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
42 | 42 | require_once('header.php'); |
43 | 43 | print '<div class="info column">'; |
44 | 44 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | include('route-sub-menu.php'); |
50 | 50 | print '<div class="table column">'; |
51 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights that used the route <strong>%s - %s</strong>."),$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['arrival_airport_icao']).'</p>'; |
|
51 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights that used the route <strong>%s - %s</strong>."), $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['arrival_airport_icao']).'</p>'; |
|
52 | 52 | |
53 | 53 | include('table-output.php'); |
54 | 54 | print '<div class="pagination">'; |