@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | / @param String $source source of data |
25 | 25 | */ |
26 | 26 | |
27 | - public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
|
27 | + public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') { |
|
28 | 28 | date_default_timezone_set('UTC'); |
29 | - $date = date("Y-m-d H:i:s",time()); |
|
29 | + $date = date("Y-m-d H:i:s", time()); |
|
30 | 30 | //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
31 | 31 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
32 | 32 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
@@ -34,69 +34,69 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $sth = $this->db->prepare($query); |
36 | 36 | $sth->execute($query_values); |
37 | - } catch(PDOException $e) { |
|
37 | + } catch (PDOException $e) { |
|
38 | 38 | return "error : ".$e->getMessage(); |
39 | 39 | } |
40 | 40 | if ($sth->fetchColumn() > 0) { |
41 | 41 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
42 | 42 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
43 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
43 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao); |
|
44 | 44 | } elseif ($arrival_airport_time == '') { |
45 | 45 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao"; |
46 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
46 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao); |
|
47 | 47 | } elseif ($departure_airport_time == '') { |
48 | 48 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
49 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
49 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
50 | 50 | } else { |
51 | 51 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time"; |
52 | 52 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
53 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
53 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
54 | 54 | } |
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute($query_values); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | return "error : ".$e->getMessage(); |
60 | 60 | } |
61 | 61 | if ($sth->fetchColumn() == 0) { |
62 | 62 | //$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident'; |
63 | 63 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
64 | 64 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
65 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
65 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
66 | 66 | } elseif ($arrival_airport_time == '') { |
67 | 67 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
68 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
68 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
69 | 69 | } elseif ($departure_airport_time == '') { |
70 | 70 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
71 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
71 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
72 | 72 | } else { |
73 | 73 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
74 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
74 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
75 | 75 | } |
76 | 76 | try { |
77 | 77 | $sth = $this->db->prepare($query); |
78 | 78 | $sth->execute($query_values); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | } else { |
83 | 83 | //$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident'; |
84 | 84 | $query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident'; |
85 | - $query_values = array(':ident' => $ident,':date' => $date); |
|
85 | + $query_values = array(':ident' => $ident, ':date' => $date); |
|
86 | 86 | try { |
87 | 87 | $sth = $this->db->prepare($query); |
88 | 88 | $sth->execute($query_values); |
89 | - } catch(PDOException $e) { |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | return "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | } else { |
94 | 94 | $query = 'INSERT INTO routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source) VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)'; |
95 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
95 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
96 | 96 | try { |
97 | 97 | $sth = $this->db->prepare($query); |
98 | 98 | $sth->execute($query_values); |
99 | - } catch(PDOException $e) { |
|
99 | + } catch (PDOException $e) { |
|
100 | 100 | return "error : ".$e->getMessage(); |
101 | 101 | } |
102 | 102 | } |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | |
106 | 106 | public function getSchedule($ident) { |
107 | 107 | $Translation = new Translation($this->db); |
108 | - $operator = $Translation->checkTranslation($ident,false); |
|
108 | + $operator = $Translation->checkTranslation($ident, false); |
|
109 | 109 | if ($ident != $operator) { |
110 | 110 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1"; |
111 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
111 | + $query_values = array(':ident' => $ident, 'operator' => $operator); |
|
112 | 112 | } else { |
113 | 113 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1"; |
114 | 114 | $query_values = array(':ident' => $ident); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | try { |
117 | 117 | $sth = $this->db->prepare($query); |
118 | 118 | $sth->execute($query_values); |
119 | - } catch(PDOException $e) { |
|
119 | + } catch (PDOException $e) { |
|
120 | 120 | return "error : ".$e->getMessage(); |
121 | 121 | } |
122 | 122 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | try { |
141 | 141 | $sth = $this->db->prepare($query); |
142 | 142 | $sth->execute($query_values); |
143 | - } catch(PDOException $e) { |
|
143 | + } catch (PDOException $e) { |
|
144 | 144 | return "error : ".$e->getMessage(); |
145 | 145 | } |
146 | 146 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | * @param String $carrier IATA code |
156 | 156 | * @return Flight departure and arrival airports and time |
157 | 157 | */ |
158 | - private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
|
158 | + private function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') { |
|
159 | 159 | $Common = new Common(); |
160 | 160 | $check_date = new Datetime($date); |
161 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
162 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
161 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
162 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
163 | 163 | $url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym'); |
164 | 164 | $json = $Common->getData($url); |
165 | 165 | |
166 | 166 | $parsed_json = json_decode($json); |
167 | - if (property_exists($parsed_json,'errors') === false) { |
|
167 | + if (property_exists($parsed_json, 'errors') === false) { |
|
168 | 168 | //$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'}; |
169 | 169 | $originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'}; |
170 | 170 | //$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'}; |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | //$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'}; |
175 | 175 | $arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'}; |
176 | 176 | |
177 | - preg_match('/\((.*?)\)/',$originShort,$originiata); |
|
177 | + preg_match('/\((.*?)\)/', $originShort, $originiata); |
|
178 | 178 | $DepartureAirportIata = $originiata[1]; |
179 | - preg_match('/\((.*?)\)/',$destinationShort,$destinationiata); |
|
179 | + preg_match('/\((.*?)\)/', $destinationShort, $destinationiata); |
|
180 | 180 | $ArrivalAirportIata = $destinationiata[1]; |
181 | 181 | |
182 | 182 | /* |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $arrivalTime = gmdate('H:i',strtotime($arrivalTime)); |
186 | 186 | */ |
187 | 187 | |
188 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
|
188 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance'); |
|
189 | 189 | } else return array(); |
190 | 190 | } |
191 | 191 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | $Common = new Common(); |
201 | 201 | date_default_timezone_set($globalTimezone); |
202 | 202 | $check_date = new Datetime($date); |
203 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
204 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
203 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
204 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
205 | 205 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
206 | 206 | $json = $Common->getData($url); |
207 | 207 | $parsed_json = json_decode($json); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'}; |
214 | 214 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
215 | 215 | |
216 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
|
216 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet'); |
|
217 | 217 | } else return array(); |
218 | 218 | } |
219 | 219 | |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | */ |
225 | 225 | private function getRyanair($callsign) { |
226 | 226 | $Common = new Common(); |
227 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
228 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
227 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
228 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
229 | 229 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
230 | 230 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
231 | - $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
|
232 | - $json = $Common->getData($url,'post',$post,$headers); |
|
231 | + $headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post)); |
|
232 | + $json = $Common->getData($url, 'post', $post, $headers); |
|
233 | 233 | $parsed_json = json_decode($json); |
234 | 234 | if (isset($parsed_json->{'flightInfo'})) { |
235 | 235 | $flights = $parsed_json->{'flightInfo'}; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name |
239 | 239 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
240 | 240 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
241 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
241 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
242 | 242 | } else return array(); |
243 | 243 | } else return array(); |
244 | 244 | } |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | */ |
251 | 251 | private function getSwiss($callsign) { |
252 | 252 | $Common = new Common(); |
253 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
254 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
253 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
254 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
255 | 255 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
256 | 256 | $json = $Common->getData($url); |
257 | 257 | $parsed_json = json_decode($json); |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | if ($flight->{'no'} == "Vol LX ".$numvol) { |
266 | 266 | $DepartureAirportIata = $flight->{'from'}->{'code'}; //city |
267 | 267 | $ArrivalAirportIata = $flight->{'to'}->{'code'}; //city |
268 | - $departureTime = substr($flight->{'from'}->{'hour'},0,5); |
|
269 | - $arrivalTime = substr($flight->{'to'}->{'hour'},0,5); |
|
268 | + $departureTime = substr($flight->{'from'}->{'hour'},0, 5); |
|
269 | + $arrivalTime = substr($flight->{'to'}->{'hour'},0, 5); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
273 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
|
273 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss'); |
|
274 | 274 | } else return array(); |
275 | 275 | } else return array(); |
276 | 276 | } |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | global $globalBritishAirwaysKey; |
286 | 286 | $Common = new Common(); |
287 | 287 | $check_date = new Datetime($date); |
288 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
289 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
288 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
289 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
290 | 290 | if ($globalBritishAirwaysKey == '') return array(); |
291 | 291 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
292 | 292 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
293 | - $json = $Common->getData($url,'get','',$headers); |
|
293 | + $json = $Common->getData($url, 'get', '', $headers); |
|
294 | 294 | if ($json == '') return array(); |
295 | 295 | $parsed_json = json_decode($json); |
296 | 296 | $flights = $parsed_json->{'FlightsResponse'}; |
297 | 297 | if (count($flights) > 0) { |
298 | 298 | $DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'}; |
299 | 299 | $ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'}; |
300 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
301 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
302 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
|
300 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
301 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
302 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways'); |
|
303 | 303 | } else return array(); |
304 | 304 | } |
305 | 305 | |
@@ -313,27 +313,27 @@ discard block |
||
313 | 313 | global $globalLufthansaKey; |
314 | 314 | $Common = new Common(); |
315 | 315 | $check_date = new Datetime($date); |
316 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
317 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
316 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
317 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
318 | 318 | if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
319 | 319 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
320 | - $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
|
321 | - $data = $Common->getData($url,'post',$post); |
|
320 | + $post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials'); |
|
321 | + $data = $Common->getData($url, 'post', $post); |
|
322 | 322 | $parsed_data = json_decode($data); |
323 | 323 | if (!isset($parsed_data->{'access_token'})) return array(); |
324 | 324 | $token = $parsed_data->{'access_token'}; |
325 | 325 | |
326 | 326 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
327 | - $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
|
328 | - $json = $Common->getData($url,'get','',$headers); |
|
327 | + $headers = array('Authorization: Bearer '.$token, 'Accept: application/json'); |
|
328 | + $json = $Common->getData($url, 'get', '', $headers); |
|
329 | 329 | if ($json == '') return array(); |
330 | 330 | $parsed_json = json_decode($json); |
331 | 331 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
332 | 332 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
333 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
333 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
334 | 334 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
335 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
336 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
|
335 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
336 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa'); |
|
337 | 337 | } else return array(); |
338 | 338 | } |
339 | 339 | |
@@ -347,23 +347,23 @@ discard block |
||
347 | 347 | global $globalTransaviaKey; |
348 | 348 | $Common = new Common(); |
349 | 349 | $check_date = new Datetime($date); |
350 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
351 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
350 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
351 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
352 | 352 | if ($globalTransaviaKey == '') return array(); |
353 | 353 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
354 | 354 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
355 | 355 | $headers = array('apikey: '.$globalTransaviaKey); |
356 | - $json = $Common->getData($url,'get','',$headers); |
|
356 | + $json = $Common->getData($url, 'get', '', $headers); |
|
357 | 357 | //echo 'result : '.$json; |
358 | 358 | if ($json == '') return array(); |
359 | 359 | $parsed_json = json_decode($json); |
360 | 360 | |
361 | 361 | if (isset($parsed_json->{'data'}[0])) { |
362 | 362 | $DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'}; |
363 | - $departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
363 | + $departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
364 | 364 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
365 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
366 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
|
365 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
366 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia'); |
|
367 | 367 | } else return array(); |
368 | 368 | } |
369 | 369 | |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function getTunisair($callsign) { |
376 | 376 | $Common = new Common(); |
377 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
378 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
377 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
378 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
379 | 379 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
380 | 380 | $data = $Common->getData($url); |
381 | 381 | $table = $Common->table2array($data); |
382 | 382 | foreach ($table as $flight) { |
383 | - if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) { |
|
384 | - return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair'); |
|
383 | + if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) { |
|
384 | + return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | return array(); |
@@ -392,21 +392,21 @@ discard block |
||
392 | 392 | * @param String $callsign The callsign |
393 | 393 | * @return Flight departure and arrival airports and time |
394 | 394 | */ |
395 | - public function getVueling($callsign,$date = 'NOW') { |
|
395 | + public function getVueling($callsign, $date = 'NOW') { |
|
396 | 396 | $Common = new Common(); |
397 | 397 | $check_date = new Datetime($date); |
398 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
399 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
400 | - $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
|
398 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
399 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
400 | + $final_date = str_replace('/', '%2F', $check_date->format('d/m/Y')); |
|
401 | 401 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
402 | 402 | $data = $Common->getData($url); |
403 | - $data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data)); |
|
403 | + $data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data)); |
|
404 | 404 | if ($data != '') { |
405 | - preg_match('/flightOri=[A-Z]{3}/',$data,$result); |
|
406 | - $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
|
407 | - preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
|
408 | - $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
|
409 | - if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
405 | + preg_match('/flightOri=[A-Z]{3}/', $data, $result); |
|
406 | + $DepartureAirportIata = str_replace('flightOri=', '', $result[0]); |
|
407 | + preg_match('/flightDest=[A-Z]{3}/', $data, $result); |
|
408 | + $ArrivalAirportIata = str_replace('flightDest=', '', $result[0]); |
|
409 | + if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling'); |
|
410 | 410 | else return array(); |
411 | 411 | } |
412 | 412 | return array(); |
@@ -420,27 +420,27 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getIberia($callsign, $date = 'NOW') { |
422 | 422 | $Common = new Common(); |
423 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
423 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
424 | 424 | $check_date = new Datetime($date); |
425 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
425 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
426 | 426 | $url = "https://www.iberia.com/web/flightDetail.do"; |
427 | - $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
|
428 | - $data = $Common->getData($url,'post',$post); |
|
427 | + $post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB'); |
|
428 | + $data = $Common->getData($url, 'post', $post); |
|
429 | 429 | if ($data != '') { |
430 | 430 | $table = $Common->table2array($data); |
431 | 431 | //print_r($table); |
432 | 432 | if (count($table) > 0) { |
433 | 433 | $flight = $table; |
434 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
435 | - preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch); |
|
434 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
435 | + preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch); |
|
436 | 436 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
437 | 437 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
438 | - $departureTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[3][2]))),0,5); |
|
439 | - $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
|
438 | + $departureTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[3][2]))), 0, 5); |
|
439 | + $arrivalTime = trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][1]))); |
|
440 | 440 | if ($arrivalTime == 'Hora estimada de llegada') { |
441 | - $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
|
442 | - } else $arrivalTime = substr($arrivalTime,0,5); |
|
443 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
|
441 | + $arrivalTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][2]))), 0, 5); |
|
442 | + } else $arrivalTime = substr($arrivalTime, 0, 5); |
|
443 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia'); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | return array(); |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | * @return Flight departure and arrival airports and time |
454 | 454 | */ |
455 | 455 | |
456 | - private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
|
456 | + private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') { |
|
457 | 457 | $Common = new Common(); |
458 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
458 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
459 | 459 | $check_date = new Datetime($date); |
460 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
460 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
461 | 461 | $url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y'); |
462 | 462 | $data = $Common->getData($url); |
463 | 463 | if ($data != '') { |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | $flight = $table; |
467 | 467 | //print_r($table); |
468 | 468 | if (isset($flight[25]) && isset($flight[29])) { |
469 | - preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch); |
|
470 | - preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch); |
|
469 | + preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch); |
|
470 | + preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch); |
|
471 | 471 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
472 | 472 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
473 | - $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
|
474 | - $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
|
475 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
|
473 | + $departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5); |
|
474 | + $arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5); |
|
475 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance'); |
|
476 | 476 | } else return array(); |
477 | 477 | } |
478 | 478 | |
@@ -490,10 +490,10 @@ discard block |
||
490 | 490 | */ |
491 | 491 | private function getAlitalia($callsign, $date = 'NOW') { |
492 | 492 | $Common = new Common(); |
493 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
493 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
494 | 494 | $check_date = new Datetime($date); |
495 | - $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
496 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
495 | + $url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
496 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
497 | 497 | $data = $Common->getData($url); |
498 | 498 | if ($data != '') { |
499 | 499 | $table = $Common->text2array($data); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $ArrivalAirportIata = ''; |
502 | 502 | $departureTime = $table[4]; |
503 | 503 | $arrivalTime = $table[5]; |
504 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia'); |
|
504 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia'); |
|
505 | 505 | } |
506 | 506 | } |
507 | 507 | |
@@ -513,21 +513,21 @@ discard block |
||
513 | 513 | */ |
514 | 514 | private function getBrussels($callsign, $date = 'NOW') { |
515 | 515 | $Common = new Common(); |
516 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
516 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
517 | 517 | $check_date = new Datetime($date); |
518 | - $url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
|
518 | + $url = "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
|
519 | 519 | //http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber"; |
520 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
520 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
521 | 521 | $data = $Common->getData($url); |
522 | 522 | if ($data != '') { |
523 | 523 | //echo $data; |
524 | - $parsed_json = json_decode($data,true); |
|
524 | + $parsed_json = json_decode($data, true); |
|
525 | 525 | if (isset($parsed_json[0]['FromAirportCode'])) { |
526 | 526 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
527 | 527 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
528 | - $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
529 | - $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
530 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
|
528 | + $departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
529 | + $arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
530 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels'); |
|
531 | 531 | } |
532 | 532 | } |
533 | 533 | } |
@@ -604,21 +604,21 @@ discard block |
||
604 | 604 | */ |
605 | 605 | private function getFlyTap($callsign) { |
606 | 606 | $Common = new Common(); |
607 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
608 | - $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
607 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
608 | + $url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
609 | 609 | //$check_date = new Datetime($date); |
610 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
611 | - $post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1'); |
|
612 | - $data = $Common->getData($url,'post',$post); |
|
610 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
611 | + $post = array('arrivalsdepartures_content' => 'number', 'arrivalsdepartures_tp' => $numvol, 'arrivalsdepartures_trk' => 'ARR', 'arrivalsdepartures_date_trk' => '1', 'aptCode' => '', 'arrivalsdepartures' => 'DEP', 'arrivalsdepartures_date' => '1', 'aptCodeFrom' => '', 'aptCodeTo' => '', 'arrivalsdepartures2' => 'DEP', 'arrivalsdepartures_date2' => '1'); |
|
612 | + $data = $Common->getData($url, 'post', $post); |
|
613 | 613 | if ($data != '') { |
614 | 614 | $table = $Common->table2array($data); |
615 | - $departureTime = trim(substr($table[15][0],0,5)); |
|
616 | - $arrivalTime = trim(substr($table[35][0],0,5)); |
|
617 | - preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch); |
|
618 | - preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch); |
|
615 | + $departureTime = trim(substr($table[15][0], 0, 5)); |
|
616 | + $arrivalTime = trim(substr($table[35][0], 0, 5)); |
|
617 | + preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch); |
|
618 | + preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch); |
|
619 | 619 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
620 | 620 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
621 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap'); |
|
621 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap'); |
|
622 | 622 | } |
623 | 623 | return array(); |
624 | 624 | } |
@@ -640,10 +640,10 @@ discard block |
||
640 | 640 | } |
641 | 641 | } |
642 | 642 | if ($airline_icao == '') return array(); |
643 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
644 | - $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
643 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
644 | + $url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
645 | 645 | //$check_date = new Datetime($date); |
646 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
646 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
647 | 647 | $data = $Common->getData($url); |
648 | 648 | if ($data != '') { |
649 | 649 | $table = $Common->table2array($data); |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | $darr = ''; |
654 | 654 | $ahour = ''; |
655 | 655 | $aarr = ''; |
656 | - $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
|
656 | + $n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr); |
|
657 | 657 | if ($n == 7) { |
658 | 658 | $departureTime = $dhour; |
659 | 659 | $arrivalTime = $ahour; |
660 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
661 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
662 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
660 | + $DepartureAirportIata = str_replace(array('(', ')'), '', $darr); |
|
661 | + $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr); |
|
662 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper'); |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
@@ -683,20 +683,20 @@ discard block |
||
683 | 683 | } |
684 | 684 | } |
685 | 685 | */ |
686 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
687 | - $url= "http://fr.flightaware.com/live/flight/".$callsign; |
|
686 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
687 | + $url = "http://fr.flightaware.com/live/flight/".$callsign; |
|
688 | 688 | //$check_date = new Datetime($date); |
689 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
689 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
690 | 690 | $data = $Common->getData($url); |
691 | 691 | if ($data != '') { |
692 | 692 | $table = $Common->table2array($data); |
693 | 693 | if (isset($table[11][0])) { |
694 | - $departureTime = str_replace('h',':',substr($table[5][0],0,5)); |
|
695 | - $arrivalTime = str_replace('h',':',substr($table[5][1],0,5)); |
|
694 | + $departureTime = str_replace('h', ':', substr($table[5][0], 0, 5)); |
|
695 | + $arrivalTime = str_replace('h', ':', substr($table[5][1], 0, 5)); |
|
696 | 696 | echo $table[3][0]; |
697 | - sscanf($table[3][0],'%*[^(] (%3[A-Z] / %*4[A-Z])',$DepartureAirportIata); |
|
698 | - sscanf($table[3][1],'%*[^(] (%3[A-Z] / %*4[A-Z])',$ArrivalAirportIata); |
|
699 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightaware'); |
|
697 | + sscanf($table[3][0], '%*[^(] (%3[A-Z] / %*4[A-Z])', $DepartureAirportIata); |
|
698 | + sscanf($table[3][1], '%*[^(] (%3[A-Z] / %*4[A-Z])', $ArrivalAirportIata); |
|
699 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightaware'); |
|
700 | 700 | } |
701 | 701 | } |
702 | 702 | return array(); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function getCostToTravel($callsign) { |
711 | 711 | $Common = new Common(); |
712 | - $url= "http://www.costtotravel.com/flight-number/".$callsign; |
|
712 | + $url = "http://www.costtotravel.com/flight-number/".$callsign; |
|
713 | 713 | //$check_date = new Datetime($date); |
714 | 714 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
715 | 715 | $data = $Common->getData($url); |
@@ -717,11 +717,11 @@ discard block |
||
717 | 717 | $table = $Common->table2array($data); |
718 | 718 | //print_r($table); |
719 | 719 | if (isset($table[11][1])) { |
720 | - $departureTime = substr($table[11][1],0,5); |
|
721 | - $arrivalTime = substr($table[17][1],0,5); |
|
722 | - $DepartureAirportIata = substr($table[13][1],0,3); |
|
723 | - $ArrivalAirportIata = substr($table[15][1],0,3); |
|
724 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
|
720 | + $departureTime = substr($table[11][1], 0, 5); |
|
721 | + $arrivalTime = substr($table[17][1], 0, 5); |
|
722 | + $DepartureAirportIata = substr($table[13][1], 0, 3); |
|
723 | + $ArrivalAirportIata = substr($table[15][1], 0, 3); |
|
724 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel'); |
|
725 | 725 | } |
726 | 726 | } |
727 | 727 | return array(); |
@@ -733,13 +733,13 @@ discard block |
||
733 | 733 | * @param String $date date we want flight number info |
734 | 734 | * @return Flight departure and arrival airports and time |
735 | 735 | */ |
736 | - private function getAirCanada($callsign,$date = 'NOW') { |
|
736 | + private function getAirCanada($callsign, $date = 'NOW') { |
|
737 | 737 | $Common = new Common(); |
738 | 738 | date_default_timezone_set('UTC'); |
739 | 739 | $check_date = new Datetime($date); |
740 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
741 | - $url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
|
742 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
740 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
741 | + $url = "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
|
742 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
743 | 743 | $data = $Common->getData($url); |
744 | 744 | $dom = new DomDocument(); |
745 | 745 | $dom->loadXML($data); |
@@ -747,11 +747,11 @@ discard block |
||
747 | 747 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
748 | 748 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
749 | 749 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
750 | - $departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
750 | + $departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
751 | 751 | $arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0); |
752 | 752 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
753 | - $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
754 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
|
753 | + $arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
754 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada'); |
|
755 | 755 | } else return array(); |
756 | 756 | } |
757 | 757 | |
@@ -763,21 +763,21 @@ discard block |
||
763 | 763 | */ |
764 | 764 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
765 | 765 | $Common = new Common(); |
766 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
766 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
767 | 767 | $check_date = new Datetime($date); |
768 | - $url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
|
769 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
768 | + $url = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
|
769 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
770 | 770 | $data = $Common->getData($url); |
771 | 771 | if ($data != '') { |
772 | 772 | $table = $Common->table2array($data); |
773 | 773 | $flight = $table; |
774 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
775 | - preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch); |
|
774 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
775 | + preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch); |
|
776 | 776 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
777 | 777 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
778 | 778 | $departureTime = $flight[5][1]; |
779 | 779 | $arrivalTime = $flight[23][1]; |
780 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines'); |
|
780 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines'); |
|
781 | 781 | } |
782 | 782 | } |
783 | 783 | |
@@ -788,16 +788,16 @@ discard block |
||
788 | 788 | * @param String $carrier airline code |
789 | 789 | * @return Flight departure and arrival airports and time |
790 | 790 | */ |
791 | - private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
|
791 | + private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') { |
|
792 | 792 | $Common = new Common(); |
793 | 793 | date_default_timezone_set('UTC'); |
794 | 794 | //AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair |
795 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
795 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
796 | 796 | $check_date = new Datetime($date); |
797 | - $url= "http://www.airberlin.com/en-US/site/aims.php"; |
|
798 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
799 | - $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
|
800 | - $data = $Common->getData($url,'post',$post); |
|
797 | + $url = "http://www.airberlin.com/en-US/site/aims.php"; |
|
798 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
799 | + $post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier); |
|
800 | + $data = $Common->getData($url, 'post', $post); |
|
801 | 801 | //echo $data; |
802 | 802 | $DepartureAirportIata = ''; |
803 | 803 | $ArrivalAirportIata = ''; |
@@ -810,8 +810,8 @@ discard block |
||
810 | 810 | if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
811 | 811 | else $departureAirport = ''; |
812 | 812 | } else return array(); |
813 | - $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
|
814 | - $data = $Common->getData($url,'post',$post); |
|
813 | + $post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB'); |
|
814 | + $data = $Common->getData($url, 'post', $post); |
|
815 | 815 | if ($data != '') { |
816 | 816 | $table = $Common->table2array($data); |
817 | 817 | $flight = $table; |
@@ -839,13 +839,13 @@ discard block |
||
839 | 839 | } |
840 | 840 | } |
841 | 841 | if (isset($DepartureAirportIata)) { |
842 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
|
842 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin'); |
|
843 | 843 | } else return array(); |
844 | 844 | } |
845 | 845 | |
846 | 846 | |
847 | 847 | |
848 | - public function fetchSchedule($ident,$date = 'NOW') { |
|
848 | + public function fetchSchedule($ident, $date = 'NOW') { |
|
849 | 849 | global $globalSchedulesSources, $globalSchedulesFetch; |
850 | 850 | //$Common = new Common(); |
851 | 851 | if (!$globalSchedulesFetch) return array(); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | // Brussels Airlines |
916 | 916 | case "BEL": |
917 | 917 | case "SN": |
918 | - return $this->getBrussels($ident,$date); |
|
918 | + return $this->getBrussels($ident, $date); |
|
919 | 919 | /* |
920 | 920 | // Copa Airlines |
921 | 921 | case "CMP": |
@@ -1000,17 +1000,17 @@ discard block |
||
1000 | 1000 | // Air France |
1001 | 1001 | case "AF": |
1002 | 1002 | case "AFR": |
1003 | - return $this->getAirFrance($ident,$date,'AF'); |
|
1003 | + return $this->getAirFrance($ident, $date, 'AF'); |
|
1004 | 1004 | // HOP |
1005 | 1005 | case "A5": |
1006 | 1006 | case "HOP": |
1007 | - return $this->getAirFrance($ident,$date,'A5'); |
|
1007 | + return $this->getAirFrance($ident, $date, 'A5'); |
|
1008 | 1008 | // EasyJet |
1009 | 1009 | case "U2": |
1010 | 1010 | case "DS": |
1011 | 1011 | case "EZY": |
1012 | 1012 | case "EZS": |
1013 | - return $this->getEasyJet($ident,$date); |
|
1013 | + return $this->getEasyJet($ident, $date); |
|
1014 | 1014 | // Ryanair |
1015 | 1015 | case "FR": |
1016 | 1016 | case "RYR": |
@@ -1060,25 +1060,25 @@ discard block |
||
1060 | 1060 | return $this->getIberia($ident); |
1061 | 1061 | // Vietnam Airlines |
1062 | 1062 | case "HVN": |
1063 | - return $this->getVietnamAirlines($ident,$date); |
|
1063 | + return $this->getVietnamAirlines($ident, $date); |
|
1064 | 1064 | // Air Berlin |
1065 | 1065 | case "AB": |
1066 | 1066 | case "BER": |
1067 | - return $this->getAirBerlin($ident,$date,'AB'); |
|
1067 | + return $this->getAirBerlin($ident, $date, 'AB'); |
|
1068 | 1068 | // NIKI |
1069 | 1069 | case "HG": |
1070 | 1070 | case "NLY": |
1071 | - return $this->getAirBerlin($ident,$date,'HG'); |
|
1071 | + return $this->getAirBerlin($ident, $date, 'HG'); |
|
1072 | 1072 | // BelAir |
1073 | 1073 | case "4T": |
1074 | 1074 | case "BHP": |
1075 | - return $this->getAirBerlin($ident,$date,'4T'); |
|
1075 | + return $this->getAirBerlin($ident, $date, '4T'); |
|
1076 | 1076 | default: |
1077 | 1077 | // Randomly use a generic function to get hours |
1078 | 1078 | if (strlen($airline_icao) == 2) { |
1079 | - if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1079 | + if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1080 | 1080 | if (count($globalSchedulesSources) > 0) { |
1081 | - $rand = mt_rand(0,count($globalSchedulesSources)-1); |
|
1081 | + $rand = mt_rand(0, count($globalSchedulesSources) - 1); |
|
1082 | 1082 | $source = $globalSchedulesSources[$rand]; |
1083 | 1083 | if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
1084 | 1084 | elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | $min = false; |
26 | 26 | $allhistory = false; |
27 | 27 | $filter['source'] = array(); |
28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
33 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
34 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
35 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
36 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
28 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
29 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
30 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
31 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs')); |
|
32 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
33 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
34 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
35 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
36 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
37 | 37 | |
38 | 38 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
39 | 39 | $min = true; |
40 | 40 | } |
41 | 41 | |
42 | 42 | if (isset($_GET['ident'])) { |
43 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
43 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
44 | 44 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
45 | 45 | if (empty($spotter_array)) { |
46 | 46 | $from_archive = true; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | $allhistory = true; |
50 | 50 | } elseif (isset($_GET['flightaware_id'])) { |
51 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
51 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
52 | 52 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
53 | 53 | if (empty($spotter_array)) { |
54 | 54 | $from_archive = true; |
@@ -57,25 +57,25 @@ discard block |
||
57 | 57 | $allhistory = true; |
58 | 58 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
59 | 59 | //if (isset($_GET['coord'])) { |
60 | - $coord = explode(',',$_GET['coord']); |
|
61 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
60 | + $coord = explode(',', $_GET['coord']); |
|
61 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
62 | 62 | |
63 | 63 | #} elseif (isset($globalMapPopup) && !$globalMapPopup) { |
64 | 64 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
65 | 65 | $from_archive = true; |
66 | 66 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
67 | 67 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
68 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
69 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
70 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
71 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
72 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
73 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
68 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
69 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
70 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
71 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
72 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
73 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
74 | 74 | } elseif ($min) { |
75 | 75 | $spotter_array = $SpotterLive->getMinLiveSpotterData($filter); |
76 | 76 | # $min = true; |
77 | 77 | } else { |
78 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
78 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if (!empty($spotter_array)) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($flightcnt == '') $flightcnt = 0; |
91 | 91 | } else $flightcnt = 0; |
92 | 92 | |
93 | -$sqltime = round(microtime(true)-$begintime,2); |
|
93 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
94 | 94 | |
95 | 95 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
96 | 96 | else $usenextlatlon = true; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if (!empty($spotter_array) && is_array($spotter_array)) |
108 | 108 | { |
109 | 109 | $output .= '"features": ['; |
110 | - foreach($spotter_array as $spotter_item) |
|
110 | + foreach ($spotter_array as $spotter_item) |
|
111 | 111 | { |
112 | 112 | $j++; |
113 | 113 | date_default_timezone_set('UTC'); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
159 | 159 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
160 | 160 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
161 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
161 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
162 | 162 | } elseif (isset($spotter_item['aircraft_type'])) { |
163 | 163 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
164 | 164 | } elseif (!$min) { |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
228 | 228 | |
229 | 229 | if (isset($archivespeed)) { |
230 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
230 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
231 | 231 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
232 | 232 | } elseif ($usenextlatlon) { |
233 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
233 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
234 | 234 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
235 | 235 | } |
236 | 236 | |
237 | 237 | if (!$min) $output .= '"image": "'.$image.'",'; |
238 | 238 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
239 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
239 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
240 | 240 | } |
241 | 241 | if (isset($spotter_item['image_source_website'])) { |
242 | 242 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
259 | 259 | } |
260 | 260 | if (isset($spotter_item['acars'])) { |
261 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
261 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
262 | 262 | } |
263 | 263 | // type when not aircraft ? |
264 | 264 | if ($compress) $output .= '"t": "aircraft"'; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | } |
330 | 330 | */ |
331 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
331 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
332 | 332 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
333 | 333 | |
334 | 334 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
356 | 356 | } |
357 | 357 | $output_history .= '['; |
358 | - $output_history .= $spotter_history['longitude'].', '; |
|
359 | - $output_history .= $spotter_history['latitude'].', '; |
|
360 | - $output_history .= $spotter_history['altitude']*30.48; |
|
358 | + $output_history .= $spotter_history['longitude'].', '; |
|
359 | + $output_history .= $spotter_history['latitude'].', '; |
|
360 | + $output_history .= $spotter_history['altitude']*30.48; |
|
361 | 361 | $output_history .= '],'; |
362 | 362 | $prev_alt = $alt; |
363 | 363 | //} |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $output = substr($output, 0, -1); |
398 | 398 | $output .= ']'; |
399 | 399 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
400 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
400 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
401 | 401 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
402 | 402 | $output .= '"fc": "'.$j.'"'; |
403 | 403 | } else { |
@@ -16,64 +16,64 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | - foreach($filters as $flt) { |
|
32 | + foreach ($filters as $flt) { |
|
33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
34 | 34 | if ($flt['airlines'][0] != '') { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
43 | 43 | if (isset($flt['source'])) { |
44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
45 | 45 | } else { |
46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
50 | 50 | if (isset($flt['source'])) { |
51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
55 | 55 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
56 | 56 | if ($filter['airlines'][0] != '') { |
57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
61 | 61 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
62 | 62 | } |
63 | 63 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
65 | 65 | } |
66 | 66 | if (isset($filter['source']) && !empty($filter['source'])) { |
67 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
67 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
68 | 68 | } |
69 | 69 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
70 | 70 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
71 | 71 | } |
72 | 72 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
73 | 73 | if ($filter_query_where == '') { |
74 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } else { |
76 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
76 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | if ($limit != '') |
100 | 100 | { |
101 | 101 | $limit_array = explode(',', $limit); |
102 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
103 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
102 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
103 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
104 | 104 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
105 | 105 | { |
106 | 106 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } else { |
121 | 121 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
122 | 122 | } |
123 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
123 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
124 | 124 | |
125 | 125 | return $spotter_array; |
126 | 126 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | global $globalDBdriver, $globalLiveInterval; |
137 | 137 | date_default_timezone_set('UTC'); |
138 | 138 | |
139 | - $filter_query = $this->getFilter($filter,true,true); |
|
139 | + $filter_query = $this->getFilter($filter, true, true); |
|
140 | 140 | |
141 | 141 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
142 | 142 | if ($globalDBdriver == 'mysql') { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
148 | 148 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
149 | 149 | */ |
150 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
150 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
151 | 151 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
152 | 152 | |
153 | 153 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
163 | 163 | */ |
164 | 164 | |
165 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
165 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
166 | 166 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
167 | 167 | |
168 | 168 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | try { |
174 | 174 | $sth = $this->db->prepare($query); |
175 | 175 | $sth->execute(); |
176 | - } catch(PDOException $e) { |
|
176 | + } catch (PDOException $e) { |
|
177 | 177 | echo $e->getMessage(); |
178 | 178 | die; |
179 | 179 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | global $globalDBdriver, $globalLiveInterval; |
194 | 194 | date_default_timezone_set('UTC'); |
195 | 195 | |
196 | - $filter_query = $this->getFilter($filter,true,true); |
|
196 | + $filter_query = $this->getFilter($filter, true, true); |
|
197 | 197 | |
198 | 198 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
199 | 199 | if ($globalDBdriver == 'mysql') { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
203 | 203 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
204 | 204 | */ |
205 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
205 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
206 | 206 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
207 | 207 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
208 | 208 | } else { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
212 | 212 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
213 | 213 | */ |
214 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
214 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
215 | 215 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
216 | 216 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
217 | 217 | // echo $query; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | try { |
221 | 221 | $sth = $this->db->prepare($query); |
222 | 222 | $sth->execute(); |
223 | - } catch(PDOException $e) { |
|
223 | + } catch (PDOException $e) { |
|
224 | 224 | echo $e->getMessage(); |
225 | 225 | die; |
226 | 226 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | public function getLiveSpotterCount($filter = array()) |
238 | 238 | { |
239 | 239 | global $globalDBdriver, $globalLiveInterval; |
240 | - $filter_query = $this->getFilter($filter,true,true); |
|
240 | + $filter_query = $this->getFilter($filter, true, true); |
|
241 | 241 | |
242 | 242 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
243 | 243 | if ($globalDBdriver == 'mysql') { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | try { |
251 | 251 | $sth = $this->db->prepare($query); |
252 | 252 | $sth->execute(); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | echo $e->getMessage(); |
255 | 255 | die; |
256 | 256 | } |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | $filter_query = $this->getFilter($filter); |
274 | 274 | |
275 | 275 | if (is_array($coord)) { |
276 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
277 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
278 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
279 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
276 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
277 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
278 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
279 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
280 | 280 | } else return array(); |
281 | 281 | if ($globalDBdriver == 'mysql') { |
282 | 282 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | if ($interval == '1m') |
330 | 330 | { |
331 | 331 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
332 | - } else if ($interval == '15m'){ |
|
332 | + } else if ($interval == '15m') { |
|
333 | 333 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
334 | 334 | } |
335 | 335 | } |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
338 | 338 | } |
339 | 339 | |
340 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
340 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
341 | 341 | WHERE spotter_live.latitude <> '' |
342 | 342 | AND spotter_live.longitude <> '' |
343 | 343 | ".$additional_query." |
344 | 344 | HAVING distance < :radius |
345 | 345 | ORDER BY distance"; |
346 | 346 | |
347 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
347 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
348 | 348 | |
349 | 349 | return $spotter_array; |
350 | 350 | } |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | date_default_timezone_set('UTC'); |
363 | 363 | |
364 | 364 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
365 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
365 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
366 | 366 | |
367 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
367 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
368 | 368 | |
369 | 369 | return $spotter_array; |
370 | 370 | } |
@@ -375,16 +375,16 @@ discard block |
||
375 | 375 | * @return Array the spotter information |
376 | 376 | * |
377 | 377 | */ |
378 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
378 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
379 | 379 | { |
380 | 380 | $Spotter = new Spotter($this->db); |
381 | 381 | date_default_timezone_set('UTC'); |
382 | 382 | |
383 | 383 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
384 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
384 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
385 | 385 | |
386 | - $date = date('c',$date); |
|
387 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
386 | + $date = date('c', $date); |
|
387 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
388 | 388 | |
389 | 389 | return $spotter_array; |
390 | 390 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | date_default_timezone_set('UTC'); |
402 | 402 | |
403 | 403 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
404 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
404 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
405 | 405 | |
406 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
406 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
407 | 407 | |
408 | 408 | return $spotter_array; |
409 | 409 | } |
@@ -414,15 +414,15 @@ discard block |
||
414 | 414 | * @return Array the spotter information |
415 | 415 | * |
416 | 416 | */ |
417 | - public function getDateLiveSpotterDataById($id,$date) |
|
417 | + public function getDateLiveSpotterDataById($id, $date) |
|
418 | 418 | { |
419 | 419 | $Spotter = new Spotter($this->db); |
420 | 420 | date_default_timezone_set('UTC'); |
421 | 421 | |
422 | 422 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
423 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
424 | - $date = date('c',$date); |
|
425 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
423 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
424 | + $date = date('c', $date); |
|
425 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
426 | 426 | |
427 | 427 | return $spotter_array; |
428 | 428 | } |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | date_default_timezone_set('UTC'); |
440 | 440 | |
441 | 441 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
442 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
442 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
443 | 443 | |
444 | 444 | try { |
445 | 445 | |
446 | 446 | $sth = $this->db->prepare($query); |
447 | 447 | $sth->execute(array(':ident' => $ident)); |
448 | - } catch(PDOException $e) { |
|
448 | + } catch (PDOException $e) { |
|
449 | 449 | echo $e->getMessage(); |
450 | 450 | die; |
451 | 451 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return Array the spotter information |
461 | 461 | * |
462 | 462 | */ |
463 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
463 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
464 | 464 | { |
465 | 465 | global $globalDBdriver, $globalLiveInterval; |
466 | 466 | date_default_timezone_set('UTC'); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | try { |
480 | 480 | $sth = $this->db->prepare($query); |
481 | 481 | $sth->execute(array(':id' => $id)); |
482 | - } catch(PDOException $e) { |
|
482 | + } catch (PDOException $e) { |
|
483 | 483 | echo $e->getMessage(); |
484 | 484 | die; |
485 | 485 | } |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | { |
498 | 498 | date_default_timezone_set('UTC'); |
499 | 499 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
500 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
500 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
501 | 501 | try { |
502 | 502 | |
503 | 503 | $sth = $this->db->prepare($query); |
504 | 504 | $sth->execute(array(':ident' => $ident)); |
505 | - } catch(PDOException $e) { |
|
505 | + } catch (PDOException $e) { |
|
506 | 506 | echo $e->getMessage(); |
507 | 507 | die; |
508 | 508 | } |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | $sth = $this->db->prepare($query); |
534 | 534 | $sth->execute(); |
535 | - } catch(PDOException $e) { |
|
535 | + } catch (PDOException $e) { |
|
536 | 536 | return "error"; |
537 | 537 | } |
538 | 538 | |
@@ -555,14 +555,14 @@ discard block |
||
555 | 555 | |
556 | 556 | $sth = $this->db->prepare($query); |
557 | 557 | $sth->execute(); |
558 | - } catch(PDOException $e) { |
|
558 | + } catch (PDOException $e) { |
|
559 | 559 | return "error"; |
560 | 560 | } |
561 | 561 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
562 | 562 | $i = 0; |
563 | - $j =0; |
|
563 | + $j = 0; |
|
564 | 564 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
565 | - foreach($all as $row) |
|
565 | + foreach ($all as $row) |
|
566 | 566 | { |
567 | 567 | $i++; |
568 | 568 | $j++; |
@@ -570,9 +570,9 @@ discard block |
||
570 | 570 | if ($globalDebug) echo "."; |
571 | 571 | try { |
572 | 572 | |
573 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
573 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
574 | 574 | $sth->execute(); |
575 | - } catch(PDOException $e) { |
|
575 | + } catch (PDOException $e) { |
|
576 | 576 | return "error"; |
577 | 577 | } |
578 | 578 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -583,9 +583,9 @@ discard block |
||
583 | 583 | if ($i > 0) { |
584 | 584 | try { |
585 | 585 | |
586 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
586 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
587 | 587 | $sth->execute(); |
588 | - } catch(PDOException $e) { |
|
588 | + } catch (PDOException $e) { |
|
589 | 589 | return "error"; |
590 | 590 | } |
591 | 591 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | $sth = $this->db->prepare($query); |
600 | 600 | $sth->execute(); |
601 | - } catch(PDOException $e) { |
|
601 | + } catch (PDOException $e) { |
|
602 | 602 | return "error"; |
603 | 603 | } |
604 | 604 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -646,13 +646,13 @@ discard block |
||
646 | 646 | public function deleteLiveSpotterDataByIdent($ident) |
647 | 647 | { |
648 | 648 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
649 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
649 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
650 | 650 | |
651 | 651 | try { |
652 | 652 | |
653 | 653 | $sth = $this->db->prepare($query); |
654 | 654 | $sth->execute(array(':ident' => $ident)); |
655 | - } catch(PDOException $e) { |
|
655 | + } catch (PDOException $e) { |
|
656 | 656 | return "error"; |
657 | 657 | } |
658 | 658 | |
@@ -668,13 +668,13 @@ discard block |
||
668 | 668 | public function deleteLiveSpotterDataById($id) |
669 | 669 | { |
670 | 670 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
671 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
671 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
672 | 672 | |
673 | 673 | try { |
674 | 674 | |
675 | 675 | $sth = $this->db->prepare($query); |
676 | 676 | $sth->execute(array(':id' => $id)); |
677 | - } catch(PDOException $e) { |
|
677 | + } catch (PDOException $e) { |
|
678 | 678 | return "error"; |
679 | 679 | } |
680 | 680 | |
@@ -692,13 +692,13 @@ discard block |
||
692 | 692 | { |
693 | 693 | global $globalDBdriver, $globalTimezone; |
694 | 694 | if ($globalDBdriver == 'mysql') { |
695 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
695 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
696 | 696 | WHERE spotter_live.ident = :ident |
697 | 697 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
698 | 698 | AND spotter_live.date < UTC_TIMESTAMP()'; |
699 | 699 | $query_data = array(':ident' => $ident); |
700 | 700 | } else { |
701 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
701 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
702 | 702 | WHERE spotter_live.ident = :ident |
703 | 703 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
704 | 704 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -707,8 +707,8 @@ discard block |
||
707 | 707 | |
708 | 708 | $sth = $this->db->prepare($query); |
709 | 709 | $sth->execute($query_data); |
710 | - $ident_result=''; |
|
711 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
710 | + $ident_result = ''; |
|
711 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
712 | 712 | { |
713 | 713 | $ident_result = $row['ident']; |
714 | 714 | } |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | { |
726 | 726 | global $globalDBdriver, $globalTimezone; |
727 | 727 | if ($globalDBdriver == 'mysql') { |
728 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
728 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
729 | 729 | WHERE spotter_live.ident = :ident |
730 | 730 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
731 | 731 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
732 | 732 | $query_data = array(':ident' => $ident); |
733 | 733 | } else { |
734 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
734 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
735 | 735 | WHERE spotter_live.ident = :ident |
736 | 736 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
737 | 737 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -740,8 +740,8 @@ discard block |
||
740 | 740 | |
741 | 741 | $sth = $this->db->prepare($query); |
742 | 742 | $sth->execute($query_data); |
743 | - $ident_result=''; |
|
744 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
743 | + $ident_result = ''; |
|
744 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
745 | 745 | { |
746 | 746 | $ident_result = $row['flightaware_id']; |
747 | 747 | } |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | { |
759 | 759 | global $globalDBdriver, $globalTimezone; |
760 | 760 | if ($globalDBdriver == 'mysql') { |
761 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
761 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
762 | 762 | WHERE spotter_live.flightaware_id = :id |
763 | 763 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
764 | 764 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
765 | 765 | $query_data = array(':id' => $id); |
766 | 766 | } else { |
767 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
767 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
768 | 768 | WHERE spotter_live.flightaware_id = :id |
769 | 769 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
770 | 770 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | |
774 | 774 | $sth = $this->db->prepare($query); |
775 | 775 | $sth->execute($query_data); |
776 | - $ident_result=''; |
|
777 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
776 | + $ident_result = ''; |
|
777 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
778 | 778 | { |
779 | 779 | $ident_result = $row['flightaware_id']; |
780 | 780 | } |
@@ -791,13 +791,13 @@ discard block |
||
791 | 791 | { |
792 | 792 | global $globalDBdriver, $globalTimezone; |
793 | 793 | if ($globalDBdriver == 'mysql') { |
794 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
794 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
795 | 795 | WHERE spotter_live.ModeS = :modes |
796 | 796 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
797 | 797 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
798 | 798 | $query_data = array(':modes' => $modes); |
799 | 799 | } else { |
800 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
800 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
801 | 801 | WHERE spotter_live.ModeS = :modes |
802 | 802 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
803 | 803 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | |
807 | 807 | $sth = $this->db->prepare($query); |
808 | 808 | $sth->execute($query_data); |
809 | - $ident_result=''; |
|
810 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
809 | + $ident_result = ''; |
|
810 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
811 | 811 | { |
812 | 812 | //$ident_result = $row['spotter_live_id']; |
813 | 813 | $ident_result = $row['flightaware_id']; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | * @return String success or false |
827 | 827 | * |
828 | 828 | */ |
829 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
829 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
830 | 830 | { |
831 | 831 | global $globalURL, $globalArchive, $globalDebug; |
832 | 832 | $Common = new Common(); |
@@ -919,26 +919,26 @@ discard block |
||
919 | 919 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
920 | 920 | |
921 | 921 | |
922 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
923 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
924 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
925 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
926 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
927 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
928 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
929 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
930 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
931 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
932 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
933 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
934 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
935 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
936 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
937 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
938 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
939 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
940 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
941 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
922 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
923 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
924 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
925 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
926 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
927 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
928 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
929 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
930 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
931 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
932 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
933 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
934 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
935 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
936 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
937 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
938 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
939 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
940 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
941 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
942 | 942 | |
943 | 943 | $airline_name = ''; |
944 | 944 | $airline_icao = ''; |
@@ -960,26 +960,26 @@ discard block |
||
960 | 960 | $arrival_airport_country = ''; |
961 | 961 | |
962 | 962 | |
963 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
964 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
965 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
966 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
963 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
964 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
965 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
966 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
967 | 967 | |
968 | - $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
968 | + $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
969 | 969 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
970 | 970 | |
971 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
971 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
972 | 972 | try { |
973 | 973 | |
974 | 974 | $sth = $this->db->prepare($query); |
975 | 975 | $sth->execute($query_values); |
976 | - } catch(PDOException $e) { |
|
976 | + } catch (PDOException $e) { |
|
977 | 977 | return "error : ".$e->getMessage(); |
978 | 978 | } |
979 | 979 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
980 | 980 | if ($globalDebug) echo '(Add to SBS archive : '; |
981 | 981 | $SpotterArchive = new SpotterArchive($this->db); |
982 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
982 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
983 | 983 | if ($globalDebug) echo $result.')'; |
984 | 984 | } |
985 | 985 | return "success"; |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | |
989 | 989 | public function getOrderBy() |
990 | 990 | { |
991 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
991 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
992 | 992 | return $orderby; |
993 | 993 | } |
994 | 994 |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | $title = _("Statistics"); |
8 | 8 | |
9 | 9 | if (!isset($filter_name)) $filter_name = ''; |
10 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | if ($airline_icao == 'all') { |
12 | 12 | unset($_COOKIE['stats_airline_icao']); |
13 | - setcookie('stats_airline_icao', '', time()-3600); |
|
13 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
14 | 14 | $airline_icao = ''; |
15 | 15 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
16 | 16 | $airline_icao = $_COOKIE['stats_airline_icao']; |
17 | 17 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
18 | 18 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
19 | 19 | } |
20 | -setcookie('stats_airline_icao',$airline_icao); |
|
20 | +setcookie('stats_airline_icao', $airline_icao); |
|
21 | 21 | require_once('header.php'); |
22 | 22 | |
23 | 23 | ?> |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | date_default_timezone_set('UTC'); |
38 | 38 | $lastupdate = strtotime($last_update[0]['value']); |
39 | 39 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
40 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
40 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
41 | 41 | } |
42 | 42 | ?> |
43 | 43 | </div> |
@@ -46,30 +46,30 @@ discard block |
||
46 | 46 | ?> |
47 | 47 | <?php include('statistics-sub-menu.php'); ?> |
48 | 48 | <p class="global-stats"> |
49 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span> |
|
50 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
51 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
52 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
49 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name)); ?></span> <?php echo _("Flights"); ?></span> |
|
50 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
51 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
52 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
53 | 53 | <?php |
54 | 54 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
55 | 55 | ?> |
56 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span> |
|
57 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
56 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name)); ?></span> <?php echo _("Pilots"); ?></span> |
|
57 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
58 | 58 | <?php |
59 | 59 | } else { |
60 | 60 | ?> |
61 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span> |
|
62 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
61 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name)); ?></span> <?php echo _("Owners"); ?></span> |
|
62 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
63 | 63 | <?php |
64 | 64 | } |
65 | 65 | ?> |
66 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
67 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
66 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
67 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
68 | 68 | <?php |
69 | 69 | if ($airline_icao == '') { |
70 | 70 | ?> |
71 | 71 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span> |
72 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
72 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
73 | 73 | <?php |
74 | 74 | } |
75 | 75 | ?> |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) { |
78 | 78 | ?> |
79 | 79 | <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name)); ?></span> <?php echo _("Military"); ?></span> |
80 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
80 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
81 | 81 | <?php |
82 | 82 | } |
83 | 83 | ?> |
84 | 84 | </p> |
85 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
85 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
86 | 86 | <div class="specific-stats"> |
87 | 87 | <div class="row column"> |
88 | 88 | <div class="col-md-6"> |
89 | 89 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
90 | 90 | <?php |
91 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
91 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name); |
|
92 | 92 | if (count($aircraft_array) == 0) print _("No data available"); |
93 | 93 | else { |
94 | 94 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | var data = google.visualization.arrayToDataTable([ |
101 | 101 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
102 | 102 | $aircraft_data = ''; |
103 | - foreach($aircraft_array as $aircraft_item) |
|
103 | + foreach ($aircraft_array as $aircraft_item) |
|
104 | 104 | { |
105 | 105 | $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
106 | 106 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
128 | 128 | </div> |
129 | 129 | </div> |
130 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
130 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
131 | 131 | <?php |
132 | 132 | // echo $airline_icao; |
133 | 133 | if ($airline_icao == '' || $airline_icao == 'all') { |
134 | - $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
134 | + $airline_array = $Stats->countAllAirlines(true, $filter_name); |
|
135 | 135 | if (count($airline_array) > 0) { |
136 | 136 | print '<div class="col-md-6">'; |
137 | 137 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | var data = google.visualization.arrayToDataTable([ |
144 | 144 | ["'._("Airline").'", "'._("# of times").'"], '; |
145 | 145 | $airline_data = ''; |
146 | - foreach($airline_array as $airline_item) |
|
146 | + foreach ($airline_array as $airline_item) |
|
147 | 147 | { |
148 | 148 | $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
149 | 149 | } |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | } |
170 | 170 | ?> |
171 | 171 | </div> |
172 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
172 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
173 | 173 | <?php |
174 | 174 | } |
175 | 175 | ?> |
176 | 176 | <div class="row column"> |
177 | 177 | <?php |
178 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
178 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name); |
|
179 | 179 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
180 | 180 | if (empty($flightover_array)) { |
181 | 181 | print '<div class="col-md-12">'; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | ?> |
186 | 186 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
187 | 187 | <?php |
188 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
188 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name); |
|
189 | 189 | if (count($pilot_array) == 0) print _("No data available"); |
190 | 190 | else { |
191 | 191 | print '<div id="chart7" class="chart" width="100%"></div> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | var data = google.visualization.arrayToDataTable([ |
197 | 197 | ["'._("Pilots").'", "'._("# of times").'"], '; |
198 | 198 | $pilot_data = ''; |
199 | - foreach($pilot_array as $pilot_item) |
|
199 | + foreach ($pilot_array as $pilot_item) |
|
200 | 200 | { |
201 | 201 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
202 | 202 | } |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | </div> |
225 | 225 | </div> |
226 | 226 | |
227 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
227 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
228 | 228 | <?php |
229 | 229 | } else { |
230 | 230 | ?> |
231 | 231 | <div class="col-md-6"> |
232 | 232 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
233 | 233 | <?php |
234 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
234 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name); |
|
235 | 235 | if (count($owner_array) == 0) print _("No data available"); |
236 | 236 | else { |
237 | 237 | print '<div id="chart7" class="chart" width="100%"></div> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | var data = google.visualization.arrayToDataTable([ |
243 | 243 | ["'._("Owner").'", "'._("# of times").'"], '; |
244 | 244 | $owner_data = ''; |
245 | - foreach($owner_array as $owner_item) |
|
245 | + foreach ($owner_array as $owner_item) |
|
246 | 246 | { |
247 | 247 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
248 | 248 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | |
273 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
273 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
274 | 274 | <?php |
275 | 275 | } |
276 | 276 | if (!empty($flightover_array)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | var data = google.visualization.arrayToDataTable([ |
290 | 290 | ["'._("Country").'", "'._("# of times").'"], '; |
291 | 291 | $flightover_data = ''; |
292 | - foreach($flightover_array as $flightover_item) |
|
292 | + foreach ($flightover_array as $flightover_item) |
|
293 | 293 | { |
294 | 294 | $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
295 | 295 | } |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | } |
323 | 323 | ?> |
324 | 324 | </div> |
325 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
325 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
326 | 326 | |
327 | 327 | |
328 | 328 | </div> |
329 | 329 | <div class="row column"> |
330 | 330 | <div class="col-md-6"> |
331 | 331 | <?php |
332 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
332 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name); |
|
333 | 333 | if (count($airport_airport_array) > 0) { |
334 | 334 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
335 | 335 | print '<div id="chart3" class="chart" width="100%"></div> |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | var data = google.visualization.arrayToDataTable([ |
345 | 345 | ["'._("Airport").'", "'._("# of times").'"],'; |
346 | 346 | $airport_data = ''; |
347 | - foreach($airport_airport_array as $airport_item) |
|
347 | + foreach ($airport_airport_array as $airport_item) |
|
348 | 348 | { |
349 | 349 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
350 | 350 | $name = str_replace("'", "", $name); |
@@ -371,11 +371,11 @@ discard block |
||
371 | 371 | } |
372 | 372 | ?> |
373 | 373 | </div> |
374 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
374 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
375 | 375 | |
376 | 376 | <div class="col-md-6"> |
377 | 377 | <?php |
378 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
378 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name); |
|
379 | 379 | if (count($airport_airport_array2) > 0) { |
380 | 380 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
381 | 381 | print '<div id="chart4" class="chart" width="100%"></div> |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | var data = google.visualization.arrayToDataTable([ |
391 | 391 | ["'._("Airport").'", "'._("# of times").'"],'; |
392 | 392 | $airport_data2 = ''; |
393 | - foreach($airport_airport_array2 as $airport_item2) |
|
393 | + foreach ($airport_airport_array2 as $airport_item2) |
|
394 | 394 | { |
395 | 395 | $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
396 | - $name2 = str_replace(array("'",'"'), '', $name2); |
|
396 | + $name2 = str_replace(array("'", '"'), '', $name2); |
|
397 | 397 | $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
398 | 398 | } |
399 | 399 | $airport_data2 = substr($airport_data2, 0, -1); |
@@ -417,13 +417,13 @@ discard block |
||
417 | 417 | ?> |
418 | 418 | </div> |
419 | 419 | </div> |
420 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
420 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
421 | 421 | |
422 | 422 | <div class="row column"> |
423 | 423 | <div class="col-md-6"> |
424 | 424 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
425 | 425 | <?php |
426 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
426 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
427 | 427 | if (count($year_array) == 0) print _("No data available"); |
428 | 428 | else { |
429 | 429 | print '<div id="chart8" class="chart" width="100%"></div> |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | var data = google.visualization.arrayToDataTable([ |
435 | 435 | ["'._("Month").'", "'._("# of Flights").'"], '; |
436 | 436 | $year_data = ''; |
437 | - foreach($year_array as $year_item) |
|
437 | + foreach ($year_array as $year_item) |
|
438 | 438 | { |
439 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
439 | + $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
440 | 440 | } |
441 | 441 | $year_data = substr($year_data, 0, -1); |
442 | 442 | print $year_data; |
@@ -464,12 +464,12 @@ discard block |
||
464 | 464 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
465 | 465 | </div> |
466 | 466 | </div> |
467 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
467 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
468 | 468 | |
469 | 469 | <div class="col-md-6"> |
470 | 470 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
471 | 471 | <?php |
472 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
472 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
473 | 473 | if (count($month_array) == 0) print _("No data available"); |
474 | 474 | else { |
475 | 475 | print '<div id="chart9" class="chart" width="100%"></div> |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | var data = google.visualization.arrayToDataTable([ |
481 | 481 | ["'._("Day").'", "'._("# of Flights").'"], '; |
482 | 482 | $month_data = ''; |
483 | - foreach($month_array as $month_item) |
|
483 | + foreach ($month_array as $month_item) |
|
484 | 484 | { |
485 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
485 | + $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
486 | 486 | } |
487 | 487 | $month_data = substr($month_data, 0, -1); |
488 | 488 | print $month_data; |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
511 | 511 | </div> |
512 | 512 | </div> |
513 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
513 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
514 | 514 | |
515 | 515 | <div class="col-md-6"> |
516 | 516 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
517 | 517 | <?php |
518 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
518 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
519 | 519 | if (empty($date_array)) print _("No data available"); |
520 | 520 | else { |
521 | 521 | print '<div id="chart5" class="chart" width="100%"></div> |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | ["'._("Date").'", "'._("# of Flights").'"], '; |
528 | 528 | $date_data = ''; |
529 | 529 | |
530 | - foreach($date_array as $date_item) |
|
530 | + foreach ($date_array as $date_item) |
|
531 | 531 | { |
532 | 532 | $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
533 | 533 | } |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
558 | 558 | </div> |
559 | 559 | </div> |
560 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
560 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
561 | 561 | |
562 | 562 | <div class="col-md-6"> |
563 | 563 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
564 | 564 | <?php |
565 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
565 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
566 | 566 | if (empty($hour_array)) print _("No data available"); |
567 | 567 | else { |
568 | 568 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | var data = google.visualization.arrayToDataTable([ |
575 | 575 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
576 | 576 | $hour_data = ''; |
577 | - foreach($hour_array as $hour_item) |
|
577 | + foreach ($hour_array as $hour_item) |
|
578 | 578 | { |
579 | 579 | $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
580 | 580 | } |
@@ -604,21 +604,21 @@ discard block |
||
604 | 604 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
605 | 605 | </div> |
606 | 606 | </div> |
607 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
607 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
608 | 608 | </div> |
609 | 609 | <?php |
610 | 610 | if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
611 | 611 | ?> |
612 | 612 | <div class="row column"> |
613 | 613 | <?php |
614 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
614 | + $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar'); |
|
615 | 615 | if (!empty($polar)) { |
616 | 616 | print '<h2>'._("Coverage pattern").'</h2>'; |
617 | 617 | foreach ($polar as $eachpolar) { |
618 | 618 | unset($polar_data); |
619 | 619 | $Spotter = new Spotter(); |
620 | 620 | $data = json_decode($eachpolar['source_data']); |
621 | - foreach($data as $value => $key) { |
|
621 | + foreach ($data as $value => $key) { |
|
622 | 622 | $direction = $Spotter->parseDirection(($value*22.5)); |
623 | 623 | $distance = $key; |
624 | 624 | $unit = 'km'; |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | ?> |
639 | 639 | <div class="col-md-6"> |
640 | 640 | <h4><?php print $eachpolar['source_name']; ?></h4> |
641 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
641 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
642 | 642 | <script> |
643 | 643 | (function() { |
644 | 644 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | color: color, |
663 | 663 | unit: '<?php echo $unit; ?>' |
664 | 664 | }; |
665 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
665 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
666 | 666 | })(); |
667 | 667 | </script> |
668 | 668 | </div> |
@@ -674,19 +674,19 @@ discard block |
||
674 | 674 | <div class="row column"> |
675 | 675 | <div class="col-md-6"> |
676 | 676 | <?php |
677 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
677 | + $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg'); |
|
678 | 678 | if (!empty($msg)) { |
679 | 679 | print '<h2>'._("Messages received").'</h2>'; |
680 | 680 | foreach ($msg as $eachmsg) { |
681 | 681 | //$eachmsg = $msg[0]; |
682 | 682 | $data = $eachmsg['source_data']; |
683 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
683 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
684 | 684 | else $max = 500; |
685 | 685 | ?> |
686 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
686 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
687 | 687 | <script> |
688 | 688 | var g = new JustGage({ |
689 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
689 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
690 | 690 | value: <?php echo $data; ?>, |
691 | 691 | min: 0, |
692 | 692 | max: <?php print $max; ?>, |
@@ -706,12 +706,12 @@ discard block |
||
706 | 706 | <div class="row column"> |
707 | 707 | |
708 | 708 | <?php |
709 | - $hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
|
709 | + $hist = $Stats->getStatsSource(date('Y-m-d'), 'hist'); |
|
710 | 710 | foreach ($hist as $hists) { |
711 | 711 | $hist_data = ''; |
712 | 712 | $source = $hists['source_name']; |
713 | 713 | $hist_array = json_decode($hists['source_data']); |
714 | - foreach($hist_array as $distance => $nb) |
|
714 | + foreach ($hist_array as $distance => $nb) |
|
715 | 715 | { |
716 | 716 | $unit = 'km'; |
717 | 717 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -729,13 +729,13 @@ discard block |
||
729 | 729 | $hist_data = substr($hist_data, 0, -1); |
730 | 730 | ?> |
731 | 731 | <div class="col-md-6"> |
732 | - <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
|
732 | + <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2> |
|
733 | 733 | <?php |
734 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
734 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div> |
|
735 | 735 | <script> |
736 | 736 | google.load("visualization", "1", {packages:["corechart"]}); |
737 | - google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
|
738 | - function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
|
737 | + google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).'); |
|
738 | + function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() { |
|
739 | 739 | var data = google.visualization.arrayToDataTable([ |
740 | 740 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
741 | 741 | print $hist_data; |
@@ -750,16 +750,16 @@ discard block |
||
750 | 750 | colors: ["#1a3151"] |
751 | 751 | }; |
752 | 752 | |
753 | - var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'")); |
|
753 | + var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'")); |
|
754 | 754 | chart.draw(data, options); |
755 | 755 | } |
756 | 756 | $(window).resize(function(){ |
757 | - drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
|
757 | + drawCharthist_'.str_replace(' ', '_', strtolower($source)).'(); |
|
758 | 758 | }); |
759 | 759 | </script>'; |
760 | 760 | ?> |
761 | 761 | </div> |
762 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
762 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
763 | 763 | <?php |
764 | 764 | } |
765 | 765 | ?> |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -if (!isset($_GET['departure_airport']) || !isset($_GET['arrival_airport'])){ |
|
6 | +if (!isset($_GET['departure_airport']) || !isset($_GET['arrival_airport'])) { |
|
7 | 7 | header('Location: '.$globalURL.''); |
8 | 8 | } else { |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | $limit_previous_1 = $limit_start - $absolute_difference; |
28 | 28 | $limit_previous_2 = $limit_end - $absolute_difference; |
29 | 29 | |
30 | - $departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
31 | - $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
30 | + $departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
31 | + $arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/route/'.$departure_airport.'/'.$arrival_airport; |
33 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
33 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
34 | 34 | if ($sort != '') { |
35 | 35 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, $limit_start.",".$absolute_difference, $sort); |
36 | 36 | } else { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if (!empty($spotter_array)) |
41 | 41 | { |
42 | - $title = sprintf(_("Detailed View for flights between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
42 | + $title = sprintf(_("Detailed View for flights between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
43 | 43 | require_once('header.php'); |
44 | 44 | print '<div class="info column">'; |
45 | 45 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | include('route-sub-menu.php'); |
51 | 51 | print '<div class="table column">'; |
52 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights that used the route <strong>%s - %s</strong>."),$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['arrival_airport_icao']).'</p>'; |
|
52 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights that used the route <strong>%s - %s</strong>."), $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['arrival_airport_icao']).'</p>'; |
|
53 | 53 | |
54 | 54 | include('table-output.php'); |
55 | 55 | print '<div class="pagination">'; |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | else $spotter_array = array(); |
10 | 10 | |
11 | 11 | if (!empty($spotter_array)) |
12 | 12 | { |
13 | - $title = sprintf(_("Most Common Aircraft on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | + $title = sprintf(_("Most Common Aircraft on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
14 | 14 | require_once('header.php'); |
15 | 15 | print '<div class="select-item">'; |
16 | 16 | print '<form action="'.$globalURL.'/date" method="post">'; |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | print '</div>'; |
22 | 22 | |
23 | 23 | print '<div class="info column">'; |
24 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | 25 | print '</div>'; |
26 | 26 | |
27 | 27 | include('date-sub-menu.php'); |
28 | 28 | print '<div class="column">'; |
29 | 29 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
30 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | 31 | |
32 | 32 | $aircraft_array = $Spotter->countAllAircraftTypesByDate($date); |
33 | 33 | if (!empty($aircraft_array)) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | print '</thead>'; |
43 | 43 | print '<tbody>'; |
44 | 44 | $i = 1; |
45 | - foreach($aircraft_array as $aircraft_item) |
|
45 | + foreach ($aircraft_array as $aircraft_item) |
|
46 | 46 | { |
47 | 47 | print '<tr>'; |
48 | 48 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | 6 | $Spotter = new Spotter(); |
7 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
8 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
9 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
7 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
8 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
9 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
10 | 10 | |
11 | 11 | if (!empty($spotter_array)) |
12 | 12 | { |
13 | - $title = sprintf(_("Most Common Departure Airports on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | + $title = sprintf(_("Most Common Departure Airports on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
14 | 14 | |
15 | 15 | require_once('header.php'); |
16 | 16 | print '<div class="select-item">'; |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | print '</div>'; |
23 | 23 | |
24 | 24 | print '<div class="info column">'; |
25 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
26 | 26 | print '</div>'; |
27 | 27 | |
28 | 28 | include('date-sub-menu.php'); |
29 | 29 | print '<div class="column">'; |
30 | 30 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
31 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
32 | 32 | |
33 | 33 | $airport_airport_array = $Spotter->countAllDepartureAirportsByDate($date); |
34 | 34 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ["'._("Airport").'", "'._("# of times").'"],'; |
45 | 45 | |
46 | 46 | $airport_data = ''; |
47 | - foreach($airport_airport_array as $airport_item) |
|
47 | + foreach ($airport_airport_array as $airport_item) |
|
48 | 48 | { |
49 | 49 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
50 | 50 | $name = str_replace("'", "", $name); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | print '</thead>'; |
84 | 84 | print '<tbody>'; |
85 | 85 | $i = 1; |
86 | - foreach($airport_airport_array as $airport_item) |
|
86 | + foreach ($airport_airport_array as $airport_item) |
|
87 | 87 | { |
88 | 88 | print '<tr>'; |
89 | 89 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Arrival Airports on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Arrival Airports on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | |
14 | 14 | require_once('header.php'); |
15 | 15 | print '<div class="select-item">'; |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | print '</div>'; |
22 | 22 | |
23 | 23 | print '<div class="info column">'; |
24 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | 25 | print '</div>'; |
26 | 26 | |
27 | 27 | include('date-sub-menu.php'); |
28 | 28 | print '<div class="column">'; |
29 | 29 | print '<h2>'._("Most Common Arrival Airports").'</h2>'; |
30 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | 31 | $airport_airport_array = $Spotter->countAllArrivalAirportsByDate($date); |
32 | 32 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
33 | 33 | <script> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ["'._("Airport").'", "'._("# of times").'"],'; |
43 | 43 | |
44 | 44 | $airport_data = ''; |
45 | - foreach($airport_airport_array as $airport_item) |
|
45 | + foreach ($airport_airport_array as $airport_item) |
|
46 | 46 | { |
47 | 47 | $name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')'; |
48 | 48 | $name = str_replace("'", "", $name); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | print '</thead>'; |
82 | 82 | print '<tbody>'; |
83 | 83 | $i = 1; |
84 | - foreach($airport_airport_array as $airport_item) |
|
84 | + foreach ($airport_airport_array as $airport_item) |
|
85 | 85 | { |
86 | 86 | print '<tr>'; |
87 | 87 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $title = _("Unknown Date"); |
107 | 107 | require_once('header.php'); |
108 | 108 | print '<h1>'._("Error").'</h1>'; |
109 | - print '<p>'._("Sorry, this date does not exist in this database. :(");'</p>'; |
|
109 | + print '<p>'._("Sorry, this date does not exist in this database. :("); '</p>'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | require_once('footer.php'); |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | print '</div>'; |
22 | 22 | |
23 | 23 | print '<div class="info column">'; |
24 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | 25 | print '</div>'; |
26 | 26 | |
27 | 27 | include('date-sub-menu.php'); |
28 | 28 | print '<div class="column">'; |
29 | 29 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
30 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | 31 | |
32 | 32 | $aircraft_array = $Spotter->countAllAircraftRegistrationByDate($date); |
33 | 33 | if (!empty($aircraft_array)) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | print '</thead>'; |
45 | 45 | print '<tbody>'; |
46 | 46 | $i = 1; |
47 | - foreach($aircraft_array as $aircraft_item) |
|
47 | + foreach ($aircraft_array as $aircraft_item) |
|
48 | 48 | { |
49 | 49 | print '<tr>'; |
50 | 50 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if (isset($aircraft_item['aircraft_type'])) { |
55 | 55 | print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
56 | 56 | } else { |
57 | - print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
|
57 | + print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
|
58 | 58 | } |
59 | 59 | print '</td>'; |
60 | 60 | } else { |