@@ -18,22 +18,22 @@ discard block |
||
18 | 18 | * @return Array the images list |
19 | 19 | * |
20 | 20 | */ |
21 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
21 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
22 | 22 | { |
23 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
24 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
25 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
23 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
24 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
25 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
26 | 26 | $reg = $registration; |
27 | 27 | if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
28 | 28 | $reg = trim($reg); |
29 | - $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 |
|
29 | + $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
30 | 30 | FROM spotter_image |
31 | 31 | WHERE spotter_image.registration = :registration LIMIT 1"; |
32 | 32 | $sth = $this->db->prepare($query); |
33 | 33 | $sth->execute(array(':registration' => $reg)); |
34 | 34 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
35 | 35 | if (!empty($result)) return $result; |
36 | - elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
36 | + elseif ($registration != '') return $this->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
37 | 37 | else return array(); |
38 | 38 | } |
39 | 39 | |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | * @return Array the images list |
44 | 44 | * |
45 | 45 | */ |
46 | - public function getMarineImage($mmsi,$imo = '',$name = '') |
|
46 | + public function getMarineImage($mmsi, $imo = '', $name = '') |
|
47 | 47 | { |
48 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
49 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
50 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
48 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
49 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
50 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
51 | 51 | $name = trim($name); |
52 | - $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
52 | + $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
53 | 53 | FROM marine_image |
54 | 54 | WHERE marine_image.mmsi = :mmsi"; |
55 | 55 | $query_data = array(':mmsi' => $mmsi); |
56 | 56 | if ($imo != '') { |
57 | 57 | $query .= " AND marine_image.imo = :imo"; |
58 | - $query_data = array_merge($query_data,array(':imo' => $imo)); |
|
58 | + $query_data = array_merge($query_data, array(':imo' => $imo)); |
|
59 | 59 | } |
60 | 60 | if ($name != '') { |
61 | 61 | $query .= " AND marine_image.name = :name"; |
62 | - $query_data = array_merge($query_data,array(':name' => $name)); |
|
62 | + $query_data = array_merge($query_data, array(':name' => $name)); |
|
63 | 63 | } |
64 | 64 | $query .= " LIMIT 1"; |
65 | 65 | $sth = $this->db->prepare($query); |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
81 | 81 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
82 | 82 | if ($copyright != '') { |
83 | - $copyright = str_replace('Copyright ','',$copyright); |
|
84 | - $copyright = str_replace('© ','',$copyright); |
|
85 | - $copyright = str_replace('(c) ','',$copyright); |
|
83 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
84 | + $copyright = str_replace('© ', '', $copyright); |
|
85 | + $copyright = str_replace('(c) ', '', $copyright); |
|
86 | 86 | } |
87 | 87 | return $copyright; |
88 | 88 | } |
@@ -93,25 +93,25 @@ discard block |
||
93 | 93 | * @return String either success or error |
94 | 94 | * |
95 | 95 | */ |
96 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
96 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
97 | 97 | { |
98 | - global $globalDebug,$globalAircraftImageFetch; |
|
98 | + global $globalDebug, $globalAircraftImageFetch; |
|
99 | 99 | if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
100 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
100 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
101 | 101 | $registration = trim($registration); |
102 | 102 | //getting the aircraft image |
103 | 103 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
104 | 104 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
105 | 105 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
106 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
106 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
107 | 107 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
108 | 108 | if ($image_url['original'] != '') { |
109 | 109 | if ($globalDebug) echo 'Found !'."\n"; |
110 | - $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)"; |
|
110 | + $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
111 | 111 | try { |
112 | 112 | $sth = $this->db->prepare($query); |
113 | - $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'])); |
|
114 | - } catch(PDOException $e) { |
|
113 | + $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'])); |
|
114 | + } catch (PDOException $e) { |
|
115 | 115 | echo $e->getMessage()."\n"; |
116 | 116 | return "error"; |
117 | 117 | } |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | * @return String either success or error |
126 | 126 | * |
127 | 127 | */ |
128 | - public function addMarineImage($mmsi,$imo = '',$name = '') |
|
128 | + public function addMarineImage($mmsi, $imo = '', $name = '') |
|
129 | 129 | { |
130 | - global $globalDebug,$globalMarineImageFetch; |
|
130 | + global $globalDebug, $globalMarineImageFetch; |
|
131 | 131 | if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) return ''; |
132 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
133 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
134 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
132 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
133 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
134 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
135 | 135 | $name = trim($name); |
136 | 136 | $Marine = new Marine($this->db); |
137 | 137 | if ($imo == '' || $name == '') { |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | |
146 | 146 | //getting the aircraft image |
147 | 147 | if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
148 | - $image_url = $this->findMarineImage($mmsi,$imo,$name); |
|
148 | + $image_url = $this->findMarineImage($mmsi, $imo, $name); |
|
149 | 149 | if ($image_url['original'] != '') { |
150 | 150 | if ($globalDebug) echo 'Found !'."\n"; |
151 | - $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
151 | + $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
152 | 152 | try { |
153 | 153 | $sth = $this->db->prepare($query); |
154 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':name' => $name,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
155 | - } catch(PDOException $e) { |
|
154 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':name' => $name, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
155 | + } catch (PDOException $e) { |
|
156 | 156 | echo $e->getMessage()."\n"; |
157 | 157 | return "error"; |
158 | 158 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
173 | 173 | $Spotter = new Spotter($this->db); |
174 | 174 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
175 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
175 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
176 | 176 | if ($aircraft_registration != '' && $aircraft_registration != 'NA' && (!isset($globalVA) || $globalVA !== TRUE)) { |
177 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
177 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
178 | 178 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
179 | 179 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
180 | 180 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -188,25 +188,25 @@ discard block |
||
188 | 188 | if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
189 | 189 | else $aircraft_name = ''; |
190 | 190 | $aircraft_registration = $aircraft_icao; |
191 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
191 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
192 | 192 | unset($Spotter); |
193 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
193 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
194 | 194 | foreach ($globalAircraftImageSources as $source) { |
195 | 195 | $source = strtolower($source); |
196 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
197 | - if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
198 | - if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
199 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
200 | - if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
201 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
202 | - if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
203 | - if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
204 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
205 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
196 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft', $aircraft_icao, $airline_icao); |
|
197 | + if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft', $aircraft_registration, $aircraft_name); |
|
198 | + if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft', $aircraft_registration, $aircraft_name); |
|
199 | + if ($source == 'bing') $images_array = $this->fromBing('aircraft', $aircraft_registration, $aircraft_name); |
|
200 | + if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft', $aircraft_registration, $aircraft_name); |
|
201 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft', $aircraft_registration, $aircraft_name); |
|
202 | + if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft', $aircraft_registration, $aircraft_name); |
|
203 | + if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft', $aircraft_registration, $aircraft_name); |
|
204 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft', $aircraft_registration, $aircraft_name); |
|
205 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft', $aircraft_registration, $aircraft_name); |
|
206 | 206 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
207 | 207 | } |
208 | 208 | if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
209 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
209 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @return Array the aircraft thumbnail, orignal url and copyright |
219 | 219 | * |
220 | 220 | */ |
221 | - public function findMarineImage($mmsi,$imo = '',$name = '') |
|
221 | + public function findMarineImage($mmsi, $imo = '', $name = '') |
|
222 | 222 | { |
223 | 223 | global $globalMarineImageSources; |
224 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
224 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
225 | 225 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
226 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
226 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
227 | 227 | $name = trim($name); |
228 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
228 | + if (strlen($name) < 4) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
229 | 229 | /* |
230 | 230 | $Marine = new Marine($this->db); |
231 | 231 | if ($imo == '' || $name == '') { |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | } |
238 | 238 | unset($Marine); |
239 | 239 | */ |
240 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
240 | + if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia', 'deviantart', 'flickr', 'bing'); |
|
241 | 241 | foreach ($globalMarineImageSources as $source) { |
242 | 242 | $source = strtolower($source); |
243 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
244 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
245 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
246 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
247 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
243 | + if ($source == 'flickr') $images_array = $this->fromFlickr('marine', $mmsi, $name); |
|
244 | + if ($source == 'bing') $images_array = $this->fromBing('marine', $mmsi, $name); |
|
245 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine', $mmsi, $name); |
|
246 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine', $mmsi, $name); |
|
247 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('marine', $mmsi, $name); |
|
248 | 248 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
249 | 249 | } |
250 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
250 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * @return Array the aircraft thumbnail, orignal url and copyright |
259 | 259 | * |
260 | 260 | */ |
261 | - public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
|
261 | + public function fromPlanespotters($type, $aircraft_registration, $aircraft_name = '') { |
|
262 | 262 | $Common = new Common(); |
263 | 263 | // If aircraft registration is only number, also check with aircraft model |
264 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
265 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
264 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
265 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
266 | 266 | } else { |
267 | 267 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
268 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
268 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
269 | 269 | } |
270 | 270 | $data = $Common->getData($url); |
271 | 271 | if (substr($data, 0, 5) != "<?xml") return false; |
272 | 272 | if ($xml = simplexml_load_string($data)) { |
273 | 273 | if (isset($xml->channel->item)) { |
274 | 274 | $image_url = array(); |
275 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
275 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
276 | 276 | $image_url['thumbnail'] = $thumbnail_url; |
277 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
278 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
279 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
277 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
278 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
279 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
280 | 280 | $image_url['source'] = 'planespotters'; |
281 | 281 | return $image_url; |
282 | 282 | } |
@@ -292,31 +292,31 @@ discard block |
||
292 | 292 | * @return Array the aircraft thumbnail, orignal url and copyright |
293 | 293 | * |
294 | 294 | */ |
295 | - public function fromDeviantart($type,$registration, $name='') { |
|
295 | + public function fromDeviantart($type, $registration, $name = '') { |
|
296 | 296 | $Common = new Common(); |
297 | 297 | if ($type == 'aircraft') { |
298 | 298 | // If aircraft registration is only number, also check with aircraft model |
299 | - if (preg_match('/^[[:digit]]+$/',$registration) && $name != '') { |
|
300 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
299 | + if (preg_match('/^[[:digit]]+$/', $registration) && $name != '') { |
|
300 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
301 | 301 | } else { |
302 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
302 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
303 | 303 | } |
304 | 304 | } elseif ($type == 'marine') { |
305 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
305 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
306 | 306 | } else { |
307 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
307 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
308 | 308 | } |
309 | 309 | $data = $Common->getData($url); |
310 | 310 | if (substr($data, 0, 5) != "<?xml") return false; |
311 | 311 | if ($xml = simplexml_load_string($data)) { |
312 | 312 | if (isset($xml->channel->item->link)) { |
313 | 313 | $image_url = array(); |
314 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
314 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
315 | 315 | $image_url['thumbnail'] = $thumbnail_url; |
316 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
316 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
317 | 317 | $image_url['original'] = $original_url; |
318 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
319 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
318 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
319 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
320 | 320 | $image_url['source'] = 'deviantart'; |
321 | 321 | return $image_url; |
322 | 322 | } |
@@ -332,32 +332,32 @@ discard block |
||
332 | 332 | * @return Array the aircraft thumbnail, orignal url and copyright |
333 | 333 | * |
334 | 334 | */ |
335 | - public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
|
335 | + public function fromJetPhotos($type, $aircraft_registration, $aircraft_name = '') { |
|
336 | 336 | $Common = new Common(); |
337 | - $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
337 | + $url = 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
338 | 338 | $data = $Common->getData($url); |
339 | 339 | $dom = new DOMDocument(); |
340 | 340 | @$dom->loadHTML($data); |
341 | 341 | $all_pics = array(); |
342 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
342 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
343 | 343 | if ($image->getAttribute('itemprop') == "http://schema.org/image") { |
344 | 344 | $all_pics[] = $image->getAttribute('src'); |
345 | 345 | } |
346 | 346 | } |
347 | 347 | $all_authors = array(); |
348 | - foreach($dom->getElementsByTagName('meta') as $author) { |
|
348 | + foreach ($dom->getElementsByTagName('meta') as $author) { |
|
349 | 349 | if ($author->getAttribute('itemprop') == "http://schema.org/author") { |
350 | 350 | $all_authors[] = $author->getAttribute('content'); |
351 | 351 | } |
352 | 352 | } |
353 | 353 | $all_ref = array(); |
354 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
354 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
355 | 355 | $all_ref[] = $link->getAttribute('href'); |
356 | 356 | } |
357 | 357 | if (isset($all_pics[0])) { |
358 | 358 | $image_url = array(); |
359 | 359 | $image_url['thumbnail'] = $all_pics[0]; |
360 | - $image_url['original'] = str_replace('_tb','',$all_pics[0]); |
|
360 | + $image_url['original'] = str_replace('_tb', '', $all_pics[0]); |
|
361 | 361 | $image_url['copyright'] = $all_authors[0]; |
362 | 362 | $image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8]; |
363 | 363 | $image_url['source'] = 'JetPhotos'; |
@@ -374,24 +374,24 @@ discard block |
||
374 | 374 | * @return Array the aircraft thumbnail, orignal url and copyright |
375 | 375 | * |
376 | 376 | */ |
377 | - public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
|
377 | + public function fromPlanePictures($type, $aircraft_registration, $aircraft_name = '') { |
|
378 | 378 | $Common = new Common(); |
379 | - $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
379 | + $url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
380 | 380 | $data = $Common->getData($url); |
381 | 381 | $dom = new DOMDocument(); |
382 | 382 | @$dom->loadHTML($data); |
383 | 383 | $all_pics = array(); |
384 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
384 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
385 | 385 | $all_pics[] = $image->getAttribute('src'); |
386 | 386 | } |
387 | 387 | $all_links = array(); |
388 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
389 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
388 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
389 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
390 | 390 | } |
391 | - if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1]) && !preg_match('/flagge/',$all_pics[1])) { |
|
391 | + if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1]) && !preg_match('/flagge/', $all_pics[1])) { |
|
392 | 392 | $image_url = array(); |
393 | 393 | $image_url['thumbnail'] = 'http://www.planepictures.net/'.$all_pics[1]; |
394 | - $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN','',$all_pics[1]); |
|
394 | + $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN', '', $all_pics[1]); |
|
395 | 395 | $image_url['copyright'] = $all_links[6]['text']; |
396 | 396 | $image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href']; |
397 | 397 | $image_url['source'] = 'PlanePictures'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return Array the aircraft thumbnail, orignal url and copyright |
409 | 409 | * |
410 | 410 | */ |
411 | - public function fromFlickr($type,$registration,$name='') { |
|
411 | + public function fromFlickr($type, $registration, $name = '') { |
|
412 | 412 | $Common = new Common(); |
413 | 413 | if ($type == 'aircraft') { |
414 | 414 | if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
@@ -421,12 +421,12 @@ discard block |
||
421 | 421 | if (substr($data, 0, 5) != "<?xml") return false; |
422 | 422 | if ($xml = simplexml_load_string($data)) { |
423 | 423 | if (isset($xml->channel->item)) { |
424 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
424 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
425 | 425 | $image_url = array(); |
426 | 426 | $image_url['thumbnail'] = $original_url; |
427 | 427 | $image_url['original'] = $original_url; |
428 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
429 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
428 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
429 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
430 | 430 | $image_url['source'] = 'flickr'; |
431 | 431 | return $image_url; |
432 | 432 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | return false; |
435 | 435 | } |
436 | 436 | |
437 | - public function fromIvaoMtl($type,$aircraft_icao,$airline_icao) { |
|
437 | + public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) { |
|
438 | 438 | $Common = new Common(); |
439 | 439 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
440 | 440 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @return Array the aircraft thumbnail, orignal url and copyright |
459 | 459 | * |
460 | 460 | */ |
461 | - public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
|
461 | + public function fromBing($type, $aircraft_registration, $aircraft_name = '') { |
|
462 | 462 | global $globalImageBingKey; |
463 | 463 | $Common = new Common(); |
464 | 464 | if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
470 | 470 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
471 | 471 | } |
472 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
473 | - $data = $Common->getData($url,'get','',$headers); |
|
472 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
473 | + $data = $Common->getData($url, 'get', '', $headers); |
|
474 | 474 | $result = json_decode($data); |
475 | 475 | if (isset($result->d->results[0]->MediaUrl)) { |
476 | 476 | $image_url = array(); |
@@ -495,14 +495,14 @@ discard block |
||
495 | 495 | * @return Array the aircraft thumbnail, orignal url and copyright |
496 | 496 | * |
497 | 497 | */ |
498 | - public function fromAirportData($type,$aircraft_registration,$aircraft_name='') { |
|
498 | + public function fromAirportData($type, $aircraft_registration, $aircraft_name = '') { |
|
499 | 499 | $Common = new Common(); |
500 | 500 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
501 | 501 | $data = $Common->getData($url); |
502 | 502 | $result = json_decode($data); |
503 | 503 | if (isset($result->count) && $result->count > 0) { |
504 | 504 | $image_url = array(); |
505 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
505 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
506 | 506 | $image_url['source_website'] = $result->data[0]->link; |
507 | 507 | $image_url['thumbnail'] = $result->data[0]->image; |
508 | 508 | $image_url['copyright'] = $result->data[0]->photographer; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @return Array the aircraft thumbnail, orignal url and copyright |
521 | 521 | * |
522 | 522 | */ |
523 | - public function fromWikimedia($type,$registration,$name='') { |
|
523 | + public function fromWikimedia($type, $registration, $name = '') { |
|
524 | 524 | $Common = new Common(); |
525 | 525 | if ($type == 'aircraft') { |
526 | 526 | if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $result = json_decode($data); |
534 | 534 | if (isset($result->query->search[0]->title)) { |
535 | 535 | $fileo = $result->query->search[0]->title; |
536 | - if (substr($fileo,-3) == 'pdf') return false; |
|
536 | + if (substr($fileo, -3) == 'pdf') return false; |
|
537 | 537 | $file = urlencode($fileo); |
538 | 538 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
539 | 539 | $data2 = $Common->getData($url2); |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | if (isset($result2->query->pages)) { |
559 | 559 | foreach ($result2->query->pages as $page) { |
560 | 560 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
561 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
561 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
562 | 562 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
563 | 563 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
564 | 564 | } |
565 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
565 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
566 | 566 | return $image_url; |
567 | 567 | } |
568 | 568 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @return Array the aircraft thumbnail, orignal url and copyright |
582 | 582 | * |
583 | 583 | */ |
584 | - public function fromCustomSource($type,$registration,$name='') { |
|
584 | + public function fromCustomSource($type, $registration, $name = '') { |
|
585 | 585 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
586 | 586 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
587 | 587 | if (!empty($globalAircraftImageCustomSources) && $type == 'aircraft') { |
@@ -598,15 +598,15 @@ discard block |
||
598 | 598 | print_r($source); |
599 | 599 | print_r($customsources); |
600 | 600 | } |
601 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
602 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
601 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
602 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
603 | 603 | if ($Common->urlexist($url)) { |
604 | 604 | $image_url = array(); |
605 | 605 | $image_url['thumbnail'] = $url_thumbnail; |
606 | 606 | $image_url['original'] = $url; |
607 | 607 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
608 | 608 | else $exifCopyright = ''; |
609 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
609 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
610 | 610 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
611 | 611 | else $image_url['copyright'] = $source['source_website']; |
612 | 612 | $image_url['source_website'] = $source['source_website']; |
@@ -630,19 +630,19 @@ discard block |
||
630 | 630 | print_r($source); |
631 | 631 | print_r($customsources); |
632 | 632 | } |
633 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
634 | - $url = str_replace('{mmsi}',$registration,$url); |
|
635 | - $url = str_replace('{name}',$name,$url); |
|
636 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
637 | - $url_thumbnail = str_replace('{mmsi}',$registration,$url_thumbnail); |
|
638 | - $url_thumbnail = str_replace('{name}',$name,$url_thumbnail); |
|
633 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
634 | + $url = str_replace('{mmsi}', $registration, $url); |
|
635 | + $url = str_replace('{name}', $name, $url); |
|
636 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
637 | + $url_thumbnail = str_replace('{mmsi}', $registration, $url_thumbnail); |
|
638 | + $url_thumbnail = str_replace('{name}', $name, $url_thumbnail); |
|
639 | 639 | if ($Common->urlexist($url)) { |
640 | 640 | $image_url = array(); |
641 | 641 | $image_url['thumbnail'] = $url_thumbnail; |
642 | 642 | $image_url['original'] = $url; |
643 | 643 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
644 | 644 | else $exifCopyright = ''; |
645 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
645 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
646 | 646 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
647 | 647 | else $image_url['copyright'] = $source['source_website']; |
648 | 648 | $image_url['source_website'] = $source['source_website']; |
@@ -5,8 +5,8 @@ |
||
5 | 5 | |
6 | 6 | if ($_POST['departure_airport'] != "" || $_POST['arrival_airport']) |
7 | 7 | { |
8 | - $departure_airport = filter_input(INPUT_POST,'departure_airport',FILTER_SANITIZE_STRING); |
|
9 | - $arrival_airport = filter_input(INPUT_POST,'arrival_airport',FILTER_SANITIZE_STRING); |
|
8 | + $departure_airport = filter_input(INPUT_POST, 'departure_airport', FILTER_SANITIZE_STRING); |
|
9 | + $arrival_airport = filter_input(INPUT_POST, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
10 | 10 | header('Location: '.$globalURL.'/route/'.$departure_airport.'/'.$arrival_airport); |
11 | 11 | } else { |
12 | 12 | if ($globalURL == '') { |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | if ($_POST['registration'] != "") |
7 | 7 | { |
8 | - $registration = filter_input(INPUT_POST,'registration',FILTER_SANITIZE_STRING); |
|
8 | + $registration = filter_input(INPUT_POST, 'registration', FILTER_SANITIZE_STRING); |
|
9 | 9 | header('Location: '.$globalURL.'/registration/'.$registration); |
10 | 10 | } else { |
11 | 11 | if ($globalURL == '') { |
@@ -5,11 +5,11 @@ |
||
5 | 5 | |
6 | 6 | if ($_POST['aircraft_manufacturer'] != "") |
7 | 7 | { |
8 | - $aircraft_manufacturer = filter_input(INPUT_POST,'aircraft_manufacturer',FILTER_SANITIZE_STRING); |
|
8 | + $aircraft_manufacturer = filter_input(INPUT_POST, 'aircraft_manufacturer', FILTER_SANITIZE_STRING); |
|
9 | 9 | header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer); |
10 | 10 | } elseif ($_GET['aircraft_manufacturer'] != "") |
11 | 11 | { |
12 | - $aircraft_manufacturer = filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING); |
|
12 | + $aircraft_manufacturer = filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING); |
|
13 | 13 | header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer); |
14 | 14 | } else { |
15 | 15 | if ($globalURL == '') { |
@@ -5,7 +5,7 @@ |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if ($_GET['flightaware_id'] != "") |
7 | 7 | { |
8 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
8 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
9 | 9 | $spotter_id = $Spotter->getSpotterIDBasedOnFlightAwareID($flightaware_id); |
10 | 10 | if ($spotter_id != "") |
11 | 11 | { |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | if (isset($_POST['country']) && $_POST['country'] != "") |
6 | 6 | { |
7 | - $country = filter_input(INPUT_POST,'country',FILTER_SANITIZE_STRING); |
|
7 | + $country = filter_input(INPUT_POST, 'country', FILTER_SANITIZE_STRING); |
|
8 | 8 | header('Location: '.$globalURL.'/country/'.$country); |
9 | 9 | } else { |
10 | 10 | if ($globalURL == '') { |
@@ -167,8 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | |
169 | 169 | private function urshift($n, $s) { |
170 | - return ($n >= 0) ? ($n >> $s) : |
|
171 | - (($n & 0x7fffffff) >> $s) | |
|
170 | + return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| |
|
172 | 171 | (0x40000000 >> ($s - 1)); |
173 | 172 | } |
174 | 173 | |
@@ -180,7 +179,7 @@ discard block |
||
180 | 179 | //$split_input = str_split($input); |
181 | 180 | |
182 | 181 | /* Find the end of header checking for NULL bytes while doing it. */ |
183 | - $splitpos = strpos($input,':'); |
|
182 | + $splitpos = strpos($input, ':'); |
|
184 | 183 | |
185 | 184 | /* Check that end was found and body has at least one byte. */ |
186 | 185 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
@@ -190,15 +189,15 @@ discard block |
||
190 | 189 | |
191 | 190 | if ($debug) echo 'input : '.$input."\n"; |
192 | 191 | /* Save header and body. */ |
193 | - $body = substr($input,$splitpos+1,$input_len); |
|
192 | + $body = substr($input, $splitpos + 1, $input_len); |
|
194 | 193 | $body_len = strlen($body); |
195 | - $header = substr($input,0,$splitpos); |
|
194 | + $header = substr($input, 0, $splitpos); |
|
196 | 195 | //$header_len = strlen($header); |
197 | 196 | if ($debug) echo 'header : '.$header."\n"; |
198 | 197 | |
199 | 198 | /* Parse source, target and path. */ |
200 | 199 | //FLRDF0A52>APRS,qAS,LSTB |
201 | - if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
|
200 | + if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) { |
|
202 | 201 | $ident = $matches[1]; |
203 | 202 | $all_elements = $matches[2]; |
204 | 203 | if ($ident == 'AIRCRAFT') { |
@@ -215,14 +214,14 @@ discard block |
||
215 | 214 | if ($debug) 'No ident'."\n"; |
216 | 215 | return false; |
217 | 216 | } |
218 | - $elements = explode(',',$all_elements); |
|
217 | + $elements = explode(',', $all_elements); |
|
219 | 218 | $source = end($elements); |
220 | 219 | $result['source'] = $source; |
221 | 220 | foreach ($elements as $element) { |
222 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
221 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) { |
|
223 | 222 | //echo "ok"; |
224 | 223 | //if ($element == 'TCPIP*') return false; |
225 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
224 | + } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) { |
|
226 | 225 | if ($debug) echo 'element : '.$element."\n"; |
227 | 226 | return false; |
228 | 227 | } |
@@ -235,14 +234,14 @@ discard block |
||
235 | 234 | */ |
236 | 235 | } |
237 | 236 | |
238 | - $type = substr($body,0,1); |
|
237 | + $type = substr($body, 0, 1); |
|
239 | 238 | if ($debug) echo 'type : '.$type."\n"; |
240 | 239 | if ($type == ';') { |
241 | 240 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
242 | - $result['address'] = trim(substr($body,1,9)); |
|
241 | + $result['address'] = trim(substr($body, 1, 9)); |
|
243 | 242 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
244 | - $result['mmsi'] = trim(substr($body,1,9)); |
|
245 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
243 | + $result['mmsi'] = trim(substr($body, 1, 9)); |
|
244 | + } else $result['ident'] = trim(substr($body, 1, 9)); |
|
246 | 245 | } elseif ($type == ',') { |
247 | 246 | // Invalid data or test data |
248 | 247 | return false; |
@@ -250,24 +249,24 @@ discard block |
||
250 | 249 | |
251 | 250 | // Check for Timestamp |
252 | 251 | $find = false; |
253 | - $body_parse = substr($body,1); |
|
252 | + $body_parse = substr($body, 1); |
|
254 | 253 | //echo 'Body : '.$body."\n"; |
255 | - if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
|
256 | - $body_parse = substr($body_parse,10); |
|
254 | + if (preg_match('/^;(.){9}\*/', $body, $matches)) { |
|
255 | + $body_parse = substr($body_parse, 10); |
|
257 | 256 | $find = true; |
258 | 257 | //echo $body_parse."\n"; |
259 | 258 | } |
260 | - if (preg_match('/^`(.*)\//',$body,$matches)) { |
|
261 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
259 | + if (preg_match('/^`(.*)\//', $body, $matches)) { |
|
260 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
262 | 261 | $find = true; |
263 | 262 | //echo $body_parse."\n"; |
264 | 263 | } |
265 | - if (preg_match("/^'(.*)\//",$body,$matches)) { |
|
266 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
264 | + if (preg_match("/^'(.*)\//", $body, $matches)) { |
|
265 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
267 | 266 | $find = true; |
268 | 267 | //echo $body_parse."\n"; |
269 | 268 | } |
270 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
|
269 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) { |
|
271 | 270 | $find = true; |
272 | 271 | //print_r($matches); |
273 | 272 | $timestamp = $matches[0]; |
@@ -282,19 +281,19 @@ discard block |
||
282 | 281 | // This work or not ? |
283 | 282 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
284 | 283 | } |
285 | - $body_parse = substr($body_parse,7); |
|
284 | + $body_parse = substr($body_parse, 7); |
|
286 | 285 | $result['timestamp'] = $timestamp; |
287 | 286 | //echo date('Ymd H:i:s',$timestamp); |
288 | 287 | } |
289 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
|
288 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) { |
|
290 | 289 | $find = true; |
291 | 290 | $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
292 | - $body_parse = substr($body_parse,8); |
|
291 | + $body_parse = substr($body_parse, 8); |
|
293 | 292 | $result['timestamp'] = $timestamp; |
294 | 293 | //echo date('Ymd H:i:s',$timestamp); |
295 | 294 | } |
296 | 295 | //if (strlen($body_parse) > 19) { |
297 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
296 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) { |
|
298 | 297 | $find = true; |
299 | 298 | // 4658.70N/00707.78Ez |
300 | 299 | //print_r(str_split($body_parse)); |
@@ -321,11 +320,11 @@ discard block |
||
321 | 320 | */ |
322 | 321 | $latitude = $lat + floatval($lat_min)/60; |
323 | 322 | $longitude = $lon + floatval($lon_min)/60; |
324 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
325 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
323 | + if ($sind == 'S') $latitude = 0 - $latitude; |
|
324 | + if ($wind == 'W') $longitude = 0 - $longitude; |
|
326 | 325 | $result['latitude'] = $latitude; |
327 | 326 | $result['longitude'] = $longitude; |
328 | - $body_parse = substr($body_parse,18); |
|
327 | + $body_parse = substr($body_parse, 18); |
|
329 | 328 | $body_parse_len = strlen($body_parse); |
330 | 329 | } |
331 | 330 | $body_parse_len = strlen($body_parse); |
@@ -357,7 +356,7 @@ discard block |
||
357 | 356 | //echo $body_parse; |
358 | 357 | //if ($type != ';' && $type != '>') { |
359 | 358 | if ($type != '') { |
360 | - $body_parse = substr($body_parse,1); |
|
359 | + $body_parse = substr($body_parse, 1); |
|
361 | 360 | $body_parse_len = strlen($body_parse); |
362 | 361 | $result['symbol_code'] = $symbol_code; |
363 | 362 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
@@ -368,16 +367,16 @@ discard block |
||
368 | 367 | //$body_parse_len = strlen($body_parse); |
369 | 368 | if ($body_parse_len >= 7) { |
370 | 369 | |
371 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
372 | - $course = substr($body_parse,0,3); |
|
370 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) { |
|
371 | + $course = substr($body_parse, 0, 3); |
|
373 | 372 | $tmp_s = intval($course); |
374 | 373 | if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
375 | - $speed = substr($body_parse,4,3); |
|
374 | + $speed = substr($body_parse, 4, 3); |
|
376 | 375 | if ($speed != '...') { |
377 | 376 | //$result['speed'] = round($speed*1.852); |
378 | 377 | $result['speed'] = intval($speed); |
379 | 378 | } |
380 | - $body_parse = substr($body_parse,7); |
|
379 | + $body_parse = substr($body_parse, 7); |
|
381 | 380 | } |
382 | 381 | // Check PHGR, PHG, RNG |
383 | 382 | } |
@@ -387,12 +386,12 @@ discard block |
||
387 | 386 | } |
388 | 387 | */ |
389 | 388 | if (strlen($body_parse) > 0) { |
390 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
389 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) { |
|
391 | 390 | $altitude = intval($matches[1]); |
392 | 391 | //$result['altitude'] = round($altitude*0.3048); |
393 | 392 | $result['altitude'] = $altitude; |
394 | 393 | //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
395 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
394 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse)); |
|
396 | 395 | } |
397 | 396 | } |
398 | 397 | |
@@ -404,13 +403,13 @@ discard block |
||
404 | 403 | */ |
405 | 404 | // DAO |
406 | 405 | |
407 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
406 | + if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) { |
|
408 | 407 | |
409 | 408 | $dao = $matches[1]; |
410 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
409 | + if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) { |
|
411 | 410 | $dao_split = str_split($dao); |
412 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
413 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
411 | + $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0; |
|
412 | + $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0; |
|
414 | 413 | |
415 | 414 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
416 | 415 | else $result['latitude'] += $lat_off; |
@@ -418,50 +417,50 @@ discard block |
||
418 | 417 | else $result['longitude'] += $lon_off; |
419 | 418 | } |
420 | 419 | |
421 | - $body_parse = substr($body_parse,6); |
|
420 | + $body_parse = substr($body_parse, 6); |
|
422 | 421 | } |
423 | 422 | echo 'bodyparse : '.$body_parse."\n"; |
424 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
425 | - $result['ident'] = str_replace('_',' ',$matches[1]); |
|
423 | + if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
424 | + $result['ident'] = str_replace('_', ' ', $matches[1]); |
|
426 | 425 | } |
427 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
426 | + if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) { |
|
428 | 427 | $result['squawk'] = $matches[1]; |
429 | 428 | } |
430 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
429 | + if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) { |
|
431 | 430 | $result['aircraft_icao'] = $matches[1]; |
432 | 431 | } |
433 | - if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
432 | + if (preg_match('/VR=([0-9]*)/', $body_parse, $matches)) { |
|
434 | 433 | $result['verticalrate'] = $matches[1]; |
435 | 434 | } |
436 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
435 | + if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) { |
|
437 | 436 | $result['typeid'] = $matches[1]; |
438 | 437 | } |
439 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
438 | + if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) { |
|
440 | 439 | $result['statusid'] = $matches[1]; |
441 | 440 | } |
442 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
441 | + if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) { |
|
443 | 442 | $result['imo'] = $matches[1]; |
444 | 443 | } |
445 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
444 | + if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) { |
|
446 | 445 | $result['arrival_date'] = $matches[1]; |
447 | 446 | } |
448 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
449 | - $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
|
447 | + if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
448 | + $result['arrival_code'] = str_replace('_', ' ', $matches[1]); |
|
450 | 449 | } |
451 | 450 | // OGN comment |
452 | 451 | // echo "Before OGN : ".$body_parse."\n"; |
453 | 452 | //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
454 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
453 | + if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) { |
|
455 | 454 | $id = $matches[1]; |
456 | 455 | //$mode = substr($id,0,2); |
457 | - $address = substr($id,2); |
|
456 | + $address = substr($id, 2); |
|
458 | 457 | //print_r($matches); |
459 | - $addressType = (intval(substr($id,0,2),16))&3; |
|
458 | + $addressType = (intval(substr($id, 0, 2), 16))&3; |
|
460 | 459 | if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
461 | 460 | elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
462 | 461 | elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
463 | 462 | elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
464 | - $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
|
463 | + $aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2); |
|
465 | 464 | $result['aircrafttype_code'] = $aircraftType; |
466 | 465 | if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
467 | 466 | elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
@@ -478,7 +477,7 @@ discard block |
||
478 | 477 | elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
479 | 478 | elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
480 | 479 | elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
481 | - $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
|
480 | + $stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0; |
|
482 | 481 | $result['stealth'] = $stealth; |
483 | 482 | $result['address'] = $address; |
484 | 483 | } |
@@ -490,96 +489,96 @@ discard block |
||
490 | 489 | //$body_parse = substr($body_parse,1); |
491 | 490 | //$body_parse_len = strlen($body_parse); |
492 | 491 | //echo 'weather'."\n"; |
493 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
492 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
494 | 493 | $result['wind_dir'] = intval($matches[1]); |
495 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
496 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
497 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
498 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
499 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
494 | + $result['wind_speed'] = round(intval($matches[2])*1.60934, 1); |
|
495 | + $result['wind_gust'] = round(intval($matches[3])*1.60934, 1); |
|
496 | + $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1); |
|
497 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
498 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
500 | 499 | $result['wind_dir'] = intval($matches[1]); |
501 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
502 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
503 | - $result['temp'] = round(5/9*(($matches[4])-32),1); |
|
504 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
505 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
500 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
501 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
502 | + $result['temp'] = round(5/9*(($matches[4]) - 32), 1); |
|
503 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
504 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
506 | 505 | $result['wind_dir'] = intval($matches[1]); |
507 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
508 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
509 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
510 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
506 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
507 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
508 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
509 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) { |
|
511 | 510 | $result['wind_dir'] = intval($matches[1]); |
512 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
513 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
514 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
511 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
512 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
513 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
515 | 514 | } |
516 | 515 | //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
517 | 516 | //g012t088r000p000P000h38b10110 |
518 | 517 | //g011t086r000p000P000h29b10198 |
519 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
518 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
519 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
520 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
521 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
522 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
523 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
525 | 524 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
526 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
527 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
528 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
529 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
530 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
531 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
532 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
533 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
525 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
526 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
527 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
528 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
529 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
530 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
531 | + if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1); |
|
532 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
534 | 533 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
535 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
536 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
537 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
538 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
539 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
540 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
541 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
542 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
534 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
535 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
536 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
537 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
538 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
539 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
540 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
541 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
543 | 542 | if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
544 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
545 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
546 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
547 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
548 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
549 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
550 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
543 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
544 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
545 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
546 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
547 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
548 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
549 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
551 | 550 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
552 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
553 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
554 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
555 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
556 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
557 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
558 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
551 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
552 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
553 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
554 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
555 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
556 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
557 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
559 | 558 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
560 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
561 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
562 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
563 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
564 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
565 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
566 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
559 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
560 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
561 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
562 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
563 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
564 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
565 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
567 | 566 | if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
568 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
569 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
570 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
571 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
572 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
567 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
568 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
569 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
570 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
571 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
573 | 572 | if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
574 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
575 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
576 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
577 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
578 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
579 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
573 | + if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1); |
|
574 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
575 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
576 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
577 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
578 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
580 | 579 | if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
581 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
582 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
580 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
581 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
583 | 582 | } |
584 | 583 | $result['comment'] = trim($body_parse); |
585 | 584 | } |
@@ -587,42 +586,42 @@ discard block |
||
587 | 586 | |
588 | 587 | } |
589 | 588 | //} |
590 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
591 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
589 | + if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4); |
|
590 | + if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4); |
|
592 | 591 | if ($debug) print_r($result); |
593 | 592 | return $result; |
594 | 593 | } |
595 | 594 | |
596 | 595 | public function connect() { |
597 | - global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
596 | + global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
598 | 597 | $aprs_connect = 0; |
599 | 598 | $aprs_keep = 120; |
600 | 599 | $aprs_last_tx = time(); |
601 | 600 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
602 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
601 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
603 | 602 | if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
604 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
603 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
605 | 604 | if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
606 | 605 | else $aprs_pass = '-1'; |
607 | 606 | |
608 | - $aprs_filter = ''; |
|
607 | + $aprs_filter = ''; |
|
609 | 608 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
610 | 609 | $Common = new Common(); |
611 | - $s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr); |
|
610 | + $s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr); |
|
612 | 611 | if ($s !== false) { |
613 | 612 | echo 'Connected to APRS server! '."\n"; |
614 | 613 | $authstart = time(); |
615 | 614 | $this->socket = $s; |
616 | - $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
|
617 | - socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
|
618 | - while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
|
615 | + $send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0); |
|
616 | + socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
|
617 | + while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) { |
|
619 | 618 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
620 | 619 | echo 'APRS user verified !'."\n"; |
621 | 620 | $this->connected = true; |
622 | 621 | return true; |
623 | 622 | break; |
624 | 623 | } |
625 | - if (time()-$authstart > 5) { |
|
624 | + if (time() - $authstart > 5) { |
|
626 | 625 | echo 'APRS timeout'."\n"; |
627 | 626 | break; |
628 | 627 | } |
@@ -637,7 +636,7 @@ discard block |
||
637 | 636 | public function send($data) { |
638 | 637 | global $globalDebug; |
639 | 638 | if ($this->connected === false) $this->connect(); |
640 | - $send = socket_send( $this->socket , $data , strlen($data),0); |
|
639 | + $send = socket_send($this->socket, $data, strlen($data), 0); |
|
641 | 640 | if ($send === FALSE) { |
642 | 641 | if ($globalDebug) echo 'Reconnect...'; |
643 | 642 | socket_close($this->socket); |
@@ -647,17 +646,17 @@ discard block |
||
647 | 646 | } |
648 | 647 | |
649 | 648 | class APRSSpotter extends APRS { |
650 | - public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) { |
|
649 | + public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) { |
|
651 | 650 | $Common = new Common(); |
652 | 651 | date_default_timezone_set('UTC'); |
653 | 652 | if ($latitude != '' && $longitude != '') { |
654 | 653 | $lat = $latitude; |
655 | 654 | $long = $longitude; |
656 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
657 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
658 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
659 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
660 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
655 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
656 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
657 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
658 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
659 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
661 | 660 | $w = $w1.$w2; |
662 | 661 | //$w = '00'; |
663 | 662 | $custom = ''; |
@@ -684,26 +683,26 @@ discard block |
||
684 | 683 | $geoid= round($GeoidClass->get($lat,$long)*3.28084,2); |
685 | 684 | $altitude_real = round($altitude_real + $geoid); |
686 | 685 | */ |
687 | - $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
686 | + $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
688 | 687 | } |
689 | 688 | } |
690 | 689 | } |
691 | 690 | class APRSMarine extends APRS { |
692 | - public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) { |
|
691 | + public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) { |
|
693 | 692 | $Common = new Common(); |
694 | 693 | date_default_timezone_set('UTC'); |
695 | 694 | if ($latitude != '' && $longitude != '') { |
696 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
697 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
698 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
699 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
700 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
695 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
696 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
697 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
698 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
699 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
701 | 700 | $w = $w1.$w2; |
702 | 701 | //$w = '00'; |
703 | 702 | $custom = ''; |
704 | 703 | if ($ident != '') { |
705 | 704 | if ($custom != '') $custom .= '/'; |
706 | - $custom .= 'CS='.str_replace(' ','_',$ident); |
|
705 | + $custom .= 'CS='.str_replace(' ', '_', $ident); |
|
707 | 706 | } |
708 | 707 | if ($typeid != '') { |
709 | 708 | if ($custom != '') $custom .= '/'; |
@@ -723,11 +722,11 @@ discard block |
||
723 | 722 | } |
724 | 723 | if ($arrival_code != '') { |
725 | 724 | if ($custom != '') $custom .= '/'; |
726 | - $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
|
725 | + $custom .= 'AC='.str_replace(' ', '_', $arrival_code); |
|
727 | 726 | } |
728 | 727 | if ($custom != '') $custom = ' '.$custom; |
729 | 728 | $altitude = 0; |
730 | - $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
729 | + $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
731 | 730 | } |
732 | 731 | } |
733 | 732 | } |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | require_once('require/class.Stats.php'); |
6 | 6 | require_once('require/class.METAR.php'); |
7 | 7 | |
8 | -if (!isset($_GET['airport'])){ |
|
8 | +if (!isset($_GET['airport'])) { |
|
9 | 9 | header('Location: '.$globalURL.'/airport'); |
10 | 10 | } else { |
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | //calculation for the pagination |
13 | - if(!isset($_GET['limit'])) |
|
13 | + if (!isset($_GET['limit'])) |
|
14 | 14 | { |
15 | 15 | $limit_start = 0; |
16 | 16 | $limit_end = 25; |
17 | 17 | $absolute_difference = 25; |
18 | - } else { |
|
18 | + } else { |
|
19 | 19 | $limit_explode = explode(",", $_GET['limit']); |
20 | 20 | $limit_start = $limit_explode[0]; |
21 | 21 | $limit_end = $limit_explode[1]; |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | $limit_next = $limit_end + $absolute_difference; |
29 | 29 | $limit_previous_1 = $limit_start - $absolute_difference; |
30 | 30 | $limit_previous_2 = $limit_end - $absolute_difference; |
31 | - $airport_icao = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
31 | + $airport_icao = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
32 | 32 | $airport = $airport_icao; |
33 | 33 | $page_url = $globalURL.'/airport/'.$airport_icao; |
34 | 34 | |
35 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
35 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
36 | 36 | if ($sort != '') { |
37 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, $sort); |
|
37 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, $sort); |
|
38 | 38 | } else { |
39 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, ''); |
|
39 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, ''); |
|
40 | 40 | } |
41 | 41 | $airport_array = $Spotter->getAllAirportInfo($airport_icao); |
42 | 42 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | //print_r($metar_parse); |
52 | 52 | } |
53 | 53 | |
54 | - $title = sprintf(_("Detailed View for %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
54 | + $title = sprintf(_("Detailed View for %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
55 | 55 | |
56 | 56 | require_once('header.php'); |
57 | 57 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | $airport_names = $Stats->getAllAirportNames(); |
64 | 64 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
65 | 65 | ksort($airport_names); |
66 | - foreach($airport_names as $airport_name) |
|
66 | + foreach ($airport_names as $airport_name) |
|
67 | 67 | { |
68 | - if($airport_icao == $airport_name['airport_icao']) |
|
68 | + if ($airport_icao == $airport_name['airport_icao']) |
|
69 | 69 | { |
70 | 70 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
71 | 71 | } else { |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | $date_data = ''; |
112 | 112 | $departure_data = ''; |
113 | 113 | $arrival_data = ''; |
114 | - foreach($all_data as $data) |
|
114 | + foreach ($all_data as $data) |
|
115 | 115 | { |
116 | 116 | $date_data .= '"'.$data['date'].'",'; |
117 | 117 | $departure_data .= $data['departure'].','; |
118 | 118 | $arrival_data .= $data['arrival'].','; |
119 | 119 | } |
120 | - $date_data = "['x',".substr($date_data,0,-1)."]"; |
|
121 | - $departure_data = "['departure',".substr($departure_data,0,-1)."]"; |
|
122 | - $arrival_data = "['arrival',".substr($arrival_data,0,-1)."]"; |
|
120 | + $date_data = "['x',".substr($date_data, 0, -1)."]"; |
|
121 | + $departure_data = "['departure',".substr($departure_data, 0, -1)."]"; |
|
122 | + $arrival_data = "['arrival',".substr($arrival_data, 0, -1)."]"; |
|
123 | 123 | print 'c3.generate({ |
124 | 124 | bindto: "#chart", |
125 | 125 | data: { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | print _("Dew point:").' '.$metar_parse['dew'].' °C'." - "; |
177 | 177 | } |
178 | 178 | if (isset($metar_parse['temperature']) && isset($metar_parse['dew'])) { |
179 | - $humidity = round(100 * pow((112 - (0.1 * $metar_parse['temperature']) + $metar_parse['dew']) / (112 + (0.9 * $metar_parse['temperature'])), 8),1); |
|
179 | + $humidity = round(100*pow((112 - (0.1*$metar_parse['temperature']) + $metar_parse['dew'])/(112 + (0.9*$metar_parse['temperature'])), 8), 1); |
|
180 | 180 | print _("Humidity:").' '.$humidity.'%'." - "; |
181 | 181 | } |
182 | 182 | if (isset($metar_parse['QNH'])) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | print '<div class="table column">'; |
193 | 193 | if ($airport_array[0]['iata'] != "NA") |
194 | 194 | { |
195 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
195 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
196 | 196 | } |
197 | 197 | include('table-output.php'); |
198 | 198 | print '<div class="pagination">'; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | if (!extension_loaded('curl')) { |
93 | 93 | $error[] = "Curl is not loaded."; |
94 | 94 | } |
95 | - if(function_exists('apache_get_modules') ){ |
|
96 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
95 | + if (function_exists('apache_get_modules')) { |
|
96 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
97 | 97 | $error[] = "mod_rewrite is not available."; |
98 | 98 | } |
99 | 99 | /* |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
110 | 110 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
111 | 111 | if (function_exists('get_headers')) { |
112 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
113 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
112 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
113 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
114 | 114 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
115 | 115 | } |
116 | 116 | } |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | ?> |
482 | 482 | <tr> |
483 | 483 | <?php |
484 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
484 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
485 | 485 | ?> |
486 | 486 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
487 | 487 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
488 | 488 | <?php |
489 | 489 | } else { |
490 | - $hostport = explode(':',$source['host']); |
|
490 | + $hostport = explode(':', $source['host']); |
|
491 | 491 | if (isset($hostport[1])) { |
492 | 492 | $host = $hostport[0]; |
493 | 493 | $port = $hostport[1]; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | <select name="timezones[]" id="timezones"> |
535 | 535 | <?php |
536 | 536 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
537 | - foreach($timezonelist as $timezones){ |
|
537 | + foreach ($timezonelist as $timezones) { |
|
538 | 538 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
539 | 539 | print '<option selected>'.$timezones.'</option>'; |
540 | 540 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | <select name="timezones[]" id="timezones"> |
587 | 587 | <?php |
588 | 588 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
589 | - foreach($timezonelist as $timezones){ |
|
589 | + foreach ($timezonelist as $timezones) { |
|
590 | 590 | if ($timezones == 'UTC') { |
591 | 591 | print '<option selected>'.$timezones.'</option>'; |
592 | 592 | } else print '<option>'.$timezones.'</option>'; |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | <br /> |
928 | 928 | <p> |
929 | 929 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
930 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
930 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
931 | 931 | </p> |
932 | 932 | <br /> |
933 | 933 | <p> |
@@ -983,14 +983,14 @@ discard block |
||
983 | 983 | $error = ''; |
984 | 984 | |
985 | 985 | if (isset($_POST['dbtype'])) { |
986 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
987 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
988 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
989 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
990 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
991 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
992 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
993 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
986 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
987 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
988 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
989 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
990 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
991 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
992 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
993 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
994 | 994 | |
995 | 995 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
996 | 996 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1010,49 +1010,49 @@ discard block |
||
1010 | 1010 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1011 | 1011 | */ |
1012 | 1012 | |
1013 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1013 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1014 | 1014 | |
1015 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1016 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1017 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1018 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1019 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1015 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1016 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1017 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1018 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1019 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1020 | 1020 | |
1021 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1022 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1023 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1024 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1025 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1026 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1027 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1028 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1029 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1030 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1021 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1022 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1023 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1024 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1025 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1026 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1027 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1028 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1029 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1030 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1031 | 1031 | |
1032 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1033 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1034 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1035 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1036 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1037 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1032 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1033 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1034 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1035 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1036 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1037 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1038 | 1038 | |
1039 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1040 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1039 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1040 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1041 | 1041 | |
1042 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1043 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1044 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1042 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1043 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1044 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1045 | 1045 | |
1046 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1046 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1047 | 1047 | if ($acars == 'acars') { |
1048 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1048 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1049 | 1049 | } else { |
1050 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1050 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1054 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1055 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1053 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1054 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1055 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1056 | 1056 | |
1057 | 1057 | $source_name = $_POST['source_name']; |
1058 | 1058 | $source_latitude = $_POST['source_latitude']; |
@@ -1066,8 +1066,8 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | $sources = array(); |
1068 | 1068 | foreach ($source_name as $keys => $name) { |
1069 | - 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]); |
|
1070 | - 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]); |
|
1069 | + 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]); |
|
1070 | + 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]); |
|
1071 | 1071 | } |
1072 | 1072 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1073 | 1073 | |
@@ -1080,27 +1080,27 @@ discard block |
||
1080 | 1080 | $sbsurl = $_POST['sbsurl']; |
1081 | 1081 | */ |
1082 | 1082 | |
1083 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1084 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1085 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1086 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1087 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1088 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1089 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1090 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1083 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1084 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1085 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1086 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1087 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1088 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1089 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1090 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1091 | 1091 | |
1092 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1093 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1094 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1095 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1096 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1097 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1098 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1099 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1100 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1101 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1102 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1103 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1092 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1093 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1094 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1095 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1096 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1097 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1098 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1099 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1100 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1101 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1102 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1103 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1104 | 1104 | |
1105 | 1105 | /* |
1106 | 1106 | $globalSBS1Hosts = array(); |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | } |
1117 | 1117 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1118 | 1118 | */ |
1119 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1119 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1120 | 1120 | $host = $_POST['host']; |
1121 | 1121 | $port = $_POST['port']; |
1122 | 1122 | $name = $_POST['name']; |
@@ -1133,113 +1133,113 @@ discard block |
||
1133 | 1133 | else $cov = 'FALSE'; |
1134 | 1134 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1135 | 1135 | else $arch = 'FALSE'; |
1136 | - if (strpos($format[$key],'_callback')) { |
|
1137 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1136 | + if (strpos($format[$key], '_callback')) { |
|
1137 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1138 | 1138 | } elseif ($h != '' || $name[$key] != '') { |
1139 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1139 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1140 | 1140 | } |
1141 | 1141 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1142 | 1142 | } |
1143 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1143 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1144 | 1144 | |
1145 | 1145 | /* |
1146 | 1146 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1147 | 1147 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1148 | 1148 | */ |
1149 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1150 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1151 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1149 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1150 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1151 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1152 | 1152 | |
1153 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1154 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1153 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1154 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1155 | 1155 | |
1156 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1157 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1156 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1157 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1158 | 1158 | |
1159 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1160 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1159 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1160 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1161 | 1161 | |
1162 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1163 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1164 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1165 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1162 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1163 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1164 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1165 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1166 | 1166 | |
1167 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1168 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1169 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1167 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1168 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1169 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1170 | 1170 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1171 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1172 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1171 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1172 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1173 | 1173 | |
1174 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1175 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1176 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1177 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1178 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1179 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1180 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1181 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1174 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1175 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1176 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1177 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1178 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1179 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1180 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1181 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1182 | 1182 | |
1183 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1184 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1183 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1184 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1185 | 1185 | |
1186 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1187 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1186 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1187 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1188 | 1188 | |
1189 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1189 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1190 | 1190 | if ($archiveyear == "archiveyear") { |
1191 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1191 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1192 | 1192 | } else { |
1193 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1193 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1194 | 1194 | } |
1195 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1196 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1197 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1198 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1195 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1196 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1197 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1198 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1199 | 1199 | |
1200 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1201 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1202 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1203 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1200 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1201 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1202 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1203 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1204 | 1204 | |
1205 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1206 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1207 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1205 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1206 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1207 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1208 | 1208 | |
1209 | 1209 | // Create in settings.php keys not yet configurable if not already here |
1210 | 1210 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1211 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1211 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1212 | 1212 | |
1213 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1213 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1214 | 1214 | if ($resetyearstats == 'resetyearstats') { |
1215 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1215 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1216 | 1216 | } else { |
1217 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1217 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1220 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1221 | 1221 | if ($archive == 'archive') { |
1222 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1222 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1223 | 1223 | } else { |
1224 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1224 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1225 | 1225 | } |
1226 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1226 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1227 | 1227 | if ($archiveresults == 'archiveresults') { |
1228 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1228 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1229 | 1229 | } else { |
1230 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1230 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1231 | 1231 | } |
1232 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1232 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1233 | 1233 | if ($daemon == 'daemon') { |
1234 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1234 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1235 | 1235 | } else { |
1236 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1236 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1237 | 1237 | } |
1238 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1238 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1239 | 1239 | if ($schedules == 'schedules') { |
1240 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1240 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1241 | 1241 | } else { |
1242 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1242 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | /* |
@@ -1250,245 +1250,245 @@ discard block |
||
1250 | 1250 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1251 | 1251 | } |
1252 | 1252 | */ |
1253 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1254 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1255 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1256 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1257 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1253 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1254 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1255 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1256 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1257 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1258 | 1258 | $va = false; |
1259 | 1259 | if ($globalivao == 'ivao') { |
1260 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1260 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1261 | 1261 | $va = true; |
1262 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1262 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1263 | 1263 | if ($globalvatsim == 'vatsim') { |
1264 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1264 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1265 | 1265 | $va = true; |
1266 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1266 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1267 | 1267 | if ($globalphpvms == 'phpvms') { |
1268 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1268 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1269 | 1269 | $va = true; |
1270 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1270 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1271 | 1271 | if ($globalvam == 'vam') { |
1272 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1272 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1273 | 1273 | $va = true; |
1274 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1274 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1275 | 1275 | if ($va) { |
1276 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1277 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1276 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1277 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1278 | 1278 | if ($globalva == 'va' || $va) { |
1279 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1280 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1279 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1280 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1281 | 1281 | } else { |
1282 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1283 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1284 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1282 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1283 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1284 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | |
1288 | 1288 | |
1289 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1289 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1290 | 1290 | if ($notam == 'notam') { |
1291 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1291 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1292 | 1292 | } else { |
1293 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1293 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1294 | 1294 | } |
1295 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1295 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1296 | 1296 | if ($owner == 'owner') { |
1297 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1297 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1298 | 1298 | } else { |
1299 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1299 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1300 | 1300 | } |
1301 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1301 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1302 | 1302 | if ($map3d == 'map3d') { |
1303 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1303 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1304 | 1304 | } else { |
1305 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1305 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1306 | 1306 | } |
1307 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1307 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1308 | 1308 | if ($crash == 'crash') { |
1309 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1309 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1310 | 1310 | } else { |
1311 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1311 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1312 | 1312 | } |
1313 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1313 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1314 | 1314 | if ($fires == 'fires') { |
1315 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1315 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1316 | 1316 | } else { |
1317 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1317 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1318 | 1318 | } |
1319 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1319 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1320 | 1320 | if ($firessupport == 'firessupport') { |
1321 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1321 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1322 | 1322 | } else { |
1323 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1323 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1324 | 1324 | } |
1325 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1325 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1326 | 1326 | if ($mapsatellites == 'mapsatellites') { |
1327 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1327 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1328 | 1328 | } else { |
1329 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1329 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1330 | 1330 | } |
1331 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1331 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1332 | 1332 | if ($map3ddefault == 'map3ddefault') { |
1333 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1333 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1334 | 1334 | } else { |
1335 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1335 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1336 | 1336 | } |
1337 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1337 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1338 | 1338 | if ($map3dliveries == 'map3dliveries') { |
1339 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1339 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1340 | 1340 | } else { |
1341 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1341 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1342 | 1342 | } |
1343 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1343 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1344 | 1344 | if ($translate == 'translate') { |
1345 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1345 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1346 | 1346 | } else { |
1347 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1347 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1348 | 1348 | } |
1349 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1349 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1350 | 1350 | if ($realairlines == 'realairlines') { |
1351 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1351 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1352 | 1352 | } else { |
1353 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1353 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1354 | 1354 | } |
1355 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1355 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1356 | 1356 | if ($estimation == 'estimation') { |
1357 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1357 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1358 | 1358 | } else { |
1359 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1359 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1360 | 1360 | } |
1361 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1361 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1362 | 1362 | if ($metar == 'metar') { |
1363 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1363 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1364 | 1364 | } else { |
1365 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1365 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1366 | 1366 | } |
1367 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1367 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1368 | 1368 | if ($metarcycle == 'metarcycle') { |
1369 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1369 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1370 | 1370 | } else { |
1371 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1371 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1372 | 1372 | } |
1373 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1373 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1374 | 1374 | if ($fork == 'fork') { |
1375 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1375 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1376 | 1376 | } else { |
1377 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1377 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1380 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1381 | 1381 | if ($colormap == 'colormap') { |
1382 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1382 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1383 | 1383 | } else { |
1384 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1384 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1385 | 1385 | } |
1386 | 1386 | |
1387 | 1387 | if (isset($_POST['aircrafticoncolor'])) { |
1388 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1389 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1388 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1389 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1393 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1392 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1393 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1394 | 1394 | |
1395 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1396 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1397 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1398 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1399 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1400 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1395 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1396 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1397 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1398 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1399 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1400 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1401 | 1401 | |
1402 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1402 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1403 | 1403 | if ($mappopup == 'mappopup') { |
1404 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1404 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1405 | 1405 | } else { |
1406 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1406 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1407 | 1407 | } |
1408 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1408 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1409 | 1409 | if ($airportpopup == 'airportpopup') { |
1410 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1410 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1411 | 1411 | } else { |
1412 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1412 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1413 | 1413 | } |
1414 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1414 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1415 | 1415 | if ($maphistory == 'maphistory') { |
1416 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1416 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1417 | 1417 | } else { |
1418 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1418 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1419 | 1419 | } |
1420 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1420 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1421 | 1421 | if ($maptooltip == 'maptooltip') { |
1422 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1422 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1423 | 1423 | } else { |
1424 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1424 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1425 | 1425 | } |
1426 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1426 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1427 | 1427 | if ($flightroute == 'flightroute') { |
1428 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1428 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1429 | 1429 | } else { |
1430 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1430 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1431 | 1431 | } |
1432 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1432 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1433 | 1433 | if ($flightremainingroute == 'flightremainingroute') { |
1434 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1434 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1435 | 1435 | } else { |
1436 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1436 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1437 | 1437 | } |
1438 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1438 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1439 | 1439 | if ($allflights == 'allflights') { |
1440 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1440 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1441 | 1441 | } else { |
1442 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1442 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1443 | 1443 | } |
1444 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1444 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1445 | 1445 | if ($bbox == 'bbox') { |
1446 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1446 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1447 | 1447 | } else { |
1448 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1448 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1449 | 1449 | } |
1450 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1450 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1451 | 1451 | if ($groundaltitude == 'groundaltitude') { |
1452 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1452 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1453 | 1453 | } else { |
1454 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1454 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1455 | 1455 | } |
1456 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1456 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1457 | 1457 | if ($waypoints == 'waypoints') { |
1458 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1458 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1459 | 1459 | } else { |
1460 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1460 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1461 | 1461 | } |
1462 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1462 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1463 | 1463 | if ($geoid == 'geoid') { |
1464 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1464 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1465 | 1465 | } else { |
1466 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1466 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1467 | 1467 | } |
1468 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1469 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1468 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1469 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1470 | 1470 | |
1471 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1471 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1472 | 1472 | if ($noairlines == 'noairlines') { |
1473 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1473 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1474 | 1474 | } else { |
1475 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1475 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1478 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1479 | 1479 | |
1480 | 1480 | // Set some defaults values... |
1481 | 1481 | if (!isset($globalAircraftImageSources)) { |
1482 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1483 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1482 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1483 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1484 | 1484 | } |
1485 | 1485 | |
1486 | 1486 | if (!isset($globalSchedulesSources)) { |
1487 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1488 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1487 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1488 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1491 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1492 | 1492 | |
1493 | 1493 | if ($error == '') settings::modify_settings($settings); |
1494 | 1494 | if ($error == '') settings::comment_settings($settings_comment); |