@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class Schedule { |
| 10 | 10 | protected $cookies = array(); |
| 11 | - public $db; |
|
| 11 | + public $db; |
|
| 12 | 12 | public function __construct($dbc = null) { |
| 13 | 13 | $Connection = new Connection($dbc); |
| 14 | 14 | $this->db = $Connection->db(); |
@@ -16,22 +16,22 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * Add schedule data to database |
|
| 20 | - * @param String $ident aircraft ident |
|
| 21 | - * @param String $departure_airport_icao departure airport icao |
|
| 22 | - * @param String $departure_airport_time departure airport time |
|
| 23 | - * @param String $arrival_airport_icao arrival airport icao |
|
| 24 | - * @param String $arrival_airport_time arrival airport time |
|
| 19 | + * Add schedule data to database |
|
| 20 | + * @param String $ident aircraft ident |
|
| 21 | + * @param String $departure_airport_icao departure airport icao |
|
| 22 | + * @param String $departure_airport_time departure airport time |
|
| 23 | + * @param String $arrival_airport_icao arrival airport icao |
|
| 24 | + * @param String $arrival_airport_time arrival airport time |
|
| 25 | 25 | / @param String $source source of data |
| 26 | - */ |
|
| 26 | + */ |
|
| 27 | 27 | |
| 28 | 28 | public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
| 29 | 29 | date_default_timezone_set('UTC'); |
| 30 | 30 | $date = date("Y-m-d H:i:s",time()); |
| 31 | - //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
|
| 32 | - //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
|
| 33 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
|
| 34 | - $query_values = array(':ident' => $ident); |
|
| 31 | + //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
|
| 32 | + //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
|
| 33 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
|
| 34 | + $query_values = array(':ident' => $ident); |
|
| 35 | 35 | try { |
| 36 | 36 | $sth = $this->db->prepare($query); |
| 37 | 37 | $sth->execute($query_values); |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | if ($sth->fetchColumn() > 0) { |
| 42 | 42 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
| 43 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
|
| 44 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
| 43 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
|
| 44 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
| 45 | 45 | } elseif ($arrival_airport_time == '') { |
| 46 | - $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"; |
|
| 47 | - $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 = "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"; |
|
| 47 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
| 48 | 48 | } elseif ($departure_airport_time == '') { |
| 49 | - $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"; |
|
| 50 | - $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 = "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"; |
|
| 50 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
| 51 | 51 | } else { |
| 52 | - //$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"; |
|
| 53 | - $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"; |
|
| 54 | - $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); |
|
| 52 | + //$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"; |
|
| 53 | + $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"; |
|
| 54 | + $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); |
|
| 55 | 55 | } |
| 56 | 56 | try { |
| 57 | 57 | $sth = $this->db->prepare($query); |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | if ($sth->fetchColumn() == 0) { |
| 63 | 63 | //$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'; |
| 64 | 64 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
| 65 | - $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
| 66 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
| 65 | + $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
| 66 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
| 67 | 67 | } elseif ($arrival_airport_time == '') { |
| 68 | - $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'; |
|
| 69 | - $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 = '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'; |
|
| 69 | + $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); |
|
| 70 | 70 | } elseif ($departure_airport_time == '') { |
| 71 | - $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'; |
|
| 72 | - $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 = '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'; |
|
| 72 | + $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); |
|
| 73 | 73 | } else { |
| 74 | - $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'; |
|
| 75 | - $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 = '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'; |
|
| 75 | + $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); |
|
| 76 | 76 | } |
| 77 | 77 | try { |
| 78 | 78 | $sth = $this->db->prepare($query); |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function getSchedule($ident) { |
| 108 | - $Translation = new Translation($this->db); |
|
| 109 | - $operator = $Translation->checkTranslation($ident,false); |
|
| 110 | - if ($ident != $operator) { |
|
| 111 | - $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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1"; |
|
| 112 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
| 113 | - } else { |
|
| 114 | - $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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1"; |
|
| 115 | - $query_values = array(':ident' => $ident); |
|
| 116 | - } |
|
| 108 | + $Translation = new Translation($this->db); |
|
| 109 | + $operator = $Translation->checkTranslation($ident,false); |
|
| 110 | + if ($ident != $operator) { |
|
| 111 | + $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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1"; |
|
| 112 | + $query_values = array(':ident' => $ident,'operator' => $operator); |
|
| 113 | + } else { |
|
| 114 | + $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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1"; |
|
| 115 | + $query_values = array(':ident' => $ident); |
|
| 116 | + } |
|
| 117 | 117 | try { |
| 118 | 118 | $sth = $this->db->prepare($query); |
| 119 | 119 | $sth->execute($query_values); |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | public function checkSchedule($ident) { |
| 131 | 131 | global $globalDBdriver; |
| 132 | - //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1"; |
|
| 133 | - if ($globalDBdriver == 'mysql') { |
|
| 132 | + //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1"; |
|
| 133 | + if ($globalDBdriver == 'mysql') { |
|
| 134 | 134 | $query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1"; |
| 135 | 135 | } else { |
| 136 | 136 | $query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident |
| 137 | 137 | AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL) |
| 138 | 138 | OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1"; |
| 139 | 139 | } |
| 140 | - $query_values = array(':ident' => $ident); |
|
| 140 | + $query_values = array(':ident' => $ident); |
|
| 141 | 141 | try { |
| 142 | 142 | $sth = $this->db->prepare($query); |
| 143 | 143 | $sth->execute($query_values); |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | - * Get flight info from Air France |
|
| 154 | - * @param String $callsign The callsign |
|
| 155 | - * @param String $date date we want flight number info |
|
| 156 | - * @param String $carrier IATA code |
|
| 157 | - * @return Flight departure and arrival airports and time |
|
| 158 | - */ |
|
| 153 | + * Get flight info from Air France |
|
| 154 | + * @param String $callsign The callsign |
|
| 155 | + * @param String $date date we want flight number info |
|
| 156 | + * @param String $carrier IATA code |
|
| 157 | + * @return Flight departure and arrival airports and time |
|
| 158 | + */ |
|
| 159 | 159 | private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
| 160 | 160 | $Common = new Common(); |
| 161 | 161 | $check_date = new Datetime($date); |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * Get flight info from EasyJet |
|
| 195 | - * @param String $callsign The callsign |
|
| 196 | - * @param String $date date we want flight number info |
|
| 197 | - * @return Flight departure and arrival airports and time |
|
| 198 | - */ |
|
| 194 | + * Get flight info from EasyJet |
|
| 195 | + * @param String $callsign The callsign |
|
| 196 | + * @param String $date date we want flight number info |
|
| 197 | + * @return Flight departure and arrival airports and time |
|
| 198 | + */ |
|
| 199 | 199 | private function getEasyJet($callsign, $date = 'NOW') { |
| 200 | 200 | global $globalTimezone; |
| 201 | 201 | $Common = new Common(); |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | - * Get flight info from Ryanair |
|
| 223 | - * @param String $callsign The callsign |
|
| 224 | - * @return Flight departure and arrival airports and time |
|
| 225 | - */ |
|
| 222 | + * Get flight info from Ryanair |
|
| 223 | + * @param String $callsign The callsign |
|
| 224 | + * @return Flight departure and arrival airports and time |
|
| 225 | + */ |
|
| 226 | 226 | private function getRyanair($callsign) { |
| 227 | 227 | $Common = new Common(); |
| 228 | 228 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | - * Get flight info from Swiss |
|
| 249 | - * @param String $callsign The callsign |
|
| 250 | - * @return Flight departure and arrival airports and time |
|
| 251 | - */ |
|
| 248 | + * Get flight info from Swiss |
|
| 249 | + * @param String $callsign The callsign |
|
| 250 | + * @return Flight departure and arrival airports and time |
|
| 251 | + */ |
|
| 252 | 252 | private function getSwiss($callsign) { |
| 253 | 253 | $Common = new Common(); |
| 254 | 254 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | - * Get flight info from British Airways API |
|
| 281 | - * @param String $callsign The callsign |
|
| 282 | - * @param String $date date we want flight number info |
|
| 283 | - * @return Flight departure and arrival airports and time |
|
| 284 | - */ |
|
| 280 | + * Get flight info from British Airways API |
|
| 281 | + * @param String $callsign The callsign |
|
| 282 | + * @param String $date date we want flight number info |
|
| 283 | + * @return Flight departure and arrival airports and time |
|
| 284 | + */ |
|
| 285 | 285 | public function getBritishAirways($callsign, $date = 'NOW') { |
| 286 | 286 | global $globalBritishAirwaysKey; |
| 287 | 287 | $Common = new Common(); |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | - * Get flight info from Lutfhansa API |
|
| 309 | - * @param String $callsign The callsign |
|
| 310 | - * @param String $date date we want flight number info |
|
| 311 | - * @return Flight departure and arrival airports and time |
|
| 312 | - */ |
|
| 308 | + * Get flight info from Lutfhansa API |
|
| 309 | + * @param String $callsign The callsign |
|
| 310 | + * @param String $date date we want flight number info |
|
| 311 | + * @return Flight departure and arrival airports and time |
|
| 312 | + */ |
|
| 313 | 313 | public function getLufthansa($callsign, $date = 'NOW') { |
| 314 | 314 | global $globalLufthansaKey; |
| 315 | 315 | $Common = new Common(); |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
| 342 | - * Get flight info from Transavia API |
|
| 343 | - * @param String $callsign The callsign |
|
| 344 | - * @param String $date date we want flight number info |
|
| 345 | - * @return Flight departure and arrival airports and time |
|
| 346 | - */ |
|
| 342 | + * Get flight info from Transavia API |
|
| 343 | + * @param String $callsign The callsign |
|
| 344 | + * @param String $date date we want flight number info |
|
| 345 | + * @return Flight departure and arrival airports and time |
|
| 346 | + */ |
|
| 347 | 347 | public function getTransavia($callsign, $date = 'NOW') { |
| 348 | 348 | global $globalTransaviaKey; |
| 349 | 349 | $Common = new Common(); |
@@ -369,10 +369,10 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
| 372 | - * Get flight info from Tunisair |
|
| 373 | - * @param String $callsign The callsign |
|
| 374 | - * @return Flight departure and arrival airports and time |
|
| 375 | - */ |
|
| 372 | + * Get flight info from Tunisair |
|
| 373 | + * @param String $callsign The callsign |
|
| 374 | + * @return Flight departure and arrival airports and time |
|
| 375 | + */ |
|
| 376 | 376 | public function getTunisair($callsign) { |
| 377 | 377 | $Common = new Common(); |
| 378 | 378 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | - * Get flight info from Vueling |
|
| 393 | - * @param String $callsign The callsign |
|
| 394 | - * @return Flight departure and arrival airports and time |
|
| 395 | - */ |
|
| 392 | + * Get flight info from Vueling |
|
| 393 | + * @param String $callsign The callsign |
|
| 394 | + * @return Flight departure and arrival airports and time |
|
| 395 | + */ |
|
| 396 | 396 | public function getVueling($callsign,$date = 'NOW') { |
| 397 | 397 | $Common = new Common(); |
| 398 | 398 | $check_date = new Datetime($date); |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
| 417 | - * Get flight info from Iberia |
|
| 418 | - * @param String $callsign The callsign |
|
| 419 | - * @param String $date date we want flight number info |
|
| 420 | - * @return Flight departure and arrival airports and time |
|
| 421 | - */ |
|
| 417 | + * Get flight info from Iberia |
|
| 418 | + * @param String $callsign The callsign |
|
| 419 | + * @param String $date date we want flight number info |
|
| 420 | + * @return Flight departure and arrival airports and time |
|
| 421 | + */ |
|
| 422 | 422 | public function getIberia($callsign, $date = 'NOW') { |
| 423 | 423 | $Common = new Common(); |
| 424 | 424 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -448,11 +448,11 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
| 451 | - * Get flight info from Star Alliance |
|
| 452 | - * @param String $callsign The callsign |
|
| 453 | - * @param String $date date we want flight number info |
|
| 454 | - * @return Flight departure and arrival airports and time |
|
| 455 | - */ |
|
| 451 | + * Get flight info from Star Alliance |
|
| 452 | + * @param String $callsign The callsign |
|
| 453 | + * @param String $date date we want flight number info |
|
| 454 | + * @return Flight departure and arrival airports and time |
|
| 455 | + */ |
|
| 456 | 456 | |
| 457 | 457 | private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
| 458 | 458 | $Common = new Common(); |
@@ -484,11 +484,11 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | - * Get flight info from Alitalia |
|
| 488 | - * @param String $callsign The callsign |
|
| 489 | - * @param String $date date we want flight number info |
|
| 490 | - * @return Flight departure and arrival airports and time |
|
| 491 | - */ |
|
| 487 | + * Get flight info from Alitalia |
|
| 488 | + * @param String $callsign The callsign |
|
| 489 | + * @param String $date date we want flight number info |
|
| 490 | + * @return Flight departure and arrival airports and time |
|
| 491 | + */ |
|
| 492 | 492 | private function getAlitalia($callsign, $date = 'NOW') { |
| 493 | 493 | $Common = new Common(); |
| 494 | 494 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -507,11 +507,11 @@ discard block |
||
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
| 510 | - * Get flight info from Brussels airlines |
|
| 511 | - * @param String $callsign The callsign |
|
| 512 | - * @param String $date date we want flight number info |
|
| 513 | - * @return Flight departure and arrival airports and time |
|
| 514 | - */ |
|
| 510 | + * Get flight info from Brussels airlines |
|
| 511 | + * @param String $callsign The callsign |
|
| 512 | + * @param String $date date we want flight number info |
|
| 513 | + * @return Flight departure and arrival airports and time |
|
| 514 | + */ |
|
| 515 | 515 | private function getBrussels($callsign, $date = 'NOW') { |
| 516 | 516 | $Common = new Common(); |
| 517 | 517 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -521,24 +521,24 @@ discard block |
||
| 521 | 521 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
| 522 | 522 | $data = $Common->getData($url); |
| 523 | 523 | if ($data != '') { |
| 524 | - //echo $data; |
|
| 525 | - $parsed_json = json_decode($data,true); |
|
| 526 | - if (isset($parsed_json[0]['FromAirportCode'])) { |
|
| 524 | + //echo $data; |
|
| 525 | + $parsed_json = json_decode($data,true); |
|
| 526 | + if (isset($parsed_json[0]['FromAirportCode'])) { |
|
| 527 | 527 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
| 528 | 528 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
| 529 | 529 | $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
| 530 | 530 | $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
| 531 | 531 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
| 532 | - } |
|
| 532 | + } |
|
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | /** |
| 537 | - * Get flight info from FlightRadar24 |
|
| 538 | - * @param String $callsign The callsign |
|
| 539 | - * @param String $date date we want flight number info |
|
| 540 | - * @return Flight departure and arrival airports and time |
|
| 541 | - */ |
|
| 537 | + * Get flight info from FlightRadar24 |
|
| 538 | + * @param String $callsign The callsign |
|
| 539 | + * @param String $date date we want flight number info |
|
| 540 | + * @return Flight departure and arrival airports and time |
|
| 541 | + */ |
|
| 542 | 542 | /* |
| 543 | 543 | public function getFlightRadar24($callsign, $date = 'NOW') { |
| 544 | 544 | $Common = new Common(); |
@@ -567,11 +567,11 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | */ |
| 569 | 569 | /** |
| 570 | - * Get flight info from Lufthansa |
|
| 571 | - * @param String $callsign The callsign |
|
| 572 | - * @param String $date date we want flight number info |
|
| 573 | - * @return Flight departure and arrival airports and time |
|
| 574 | - */ |
|
| 570 | + * Get flight info from Lufthansa |
|
| 571 | + * @param String $callsign The callsign |
|
| 572 | + * @param String $date date we want flight number info |
|
| 573 | + * @return Flight departure and arrival airports and time |
|
| 574 | + */ |
|
| 575 | 575 | |
| 576 | 576 | /* private function getLufthansa($callsign, $date = 'NOW') { |
| 577 | 577 | $Common = new Common(); |
@@ -599,10 +599,10 @@ discard block |
||
| 599 | 599 | } |
| 600 | 600 | */ |
| 601 | 601 | /** |
| 602 | - * Get flight info from flytap |
|
| 603 | - * @param String $callsign The callsign |
|
| 604 | - * @return Flight departure and arrival airports and time |
|
| 605 | - */ |
|
| 602 | + * Get flight info from flytap |
|
| 603 | + * @param String $callsign The callsign |
|
| 604 | + * @return Flight departure and arrival airports and time |
|
| 605 | + */ |
|
| 606 | 606 | private function getFlyTap($callsign) { |
| 607 | 607 | $Common = new Common(); |
| 608 | 608 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -625,10 +625,10 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | /** |
| 628 | - * Get flight info from flightmapper |
|
| 629 | - * @param String $callsign The callsign |
|
| 630 | - * @return Flight departure and arrival airports and time |
|
| 631 | - */ |
|
| 628 | + * Get flight info from flightmapper |
|
| 629 | + * @param String $callsign The callsign |
|
| 630 | + * @return Flight departure and arrival airports and time |
|
| 631 | + */ |
|
| 632 | 632 | public function getFlightMapper($callsign) { |
| 633 | 633 | $Common = new Common(); |
| 634 | 634 | $airline_icao = ''; |
@@ -656,11 +656,11 @@ discard block |
||
| 656 | 656 | $aarr = ''; |
| 657 | 657 | $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
| 658 | 658 | if ($n == 7) { |
| 659 | - $departureTime = $dhour; |
|
| 660 | - $arrivalTime = $ahour; |
|
| 661 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
| 662 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
| 663 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
| 659 | + $departureTime = $dhour; |
|
| 660 | + $arrivalTime = $ahour; |
|
| 661 | + $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
| 662 | + $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
| 663 | + return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | } |
@@ -668,10 +668,10 @@ discard block |
||
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
| 671 | - * Get flight info from flightaware |
|
| 672 | - * @param String $callsign The callsign |
|
| 673 | - * @return Flight departure and arrival airports and time |
|
| 674 | - */ |
|
| 671 | + * Get flight info from flightaware |
|
| 672 | + * @param String $callsign The callsign |
|
| 673 | + * @return Flight departure and arrival airports and time |
|
| 674 | + */ |
|
| 675 | 675 | public function getFlightAware($callsign) { |
| 676 | 676 | global $globalFlightAwareUsername, $globalFlightAwarePassword; |
| 677 | 677 | date_default_timezone_set('UTC'); |
@@ -695,11 +695,11 @@ discard block |
||
| 695 | 695 | $flight = $result['FlightInfoStatusResult']['flights'][0]; |
| 696 | 696 | if (isset($flight['origin'])) { |
| 697 | 697 | return array( |
| 698 | - 'DepartureAirportIATA' => $flight['origin']['alternate_ident'], |
|
| 699 | - 'DepartureTime' => $flight['filed_departure_time']['time'], |
|
| 700 | - 'ArrivalAirportIATA' => $flight['destination']['alternate_ident'], |
|
| 701 | - 'ArrivalTime' => $flight['filed_arrival_time']['time'], |
|
| 702 | - 'Source' => 'website_flightaware'); |
|
| 698 | + 'DepartureAirportIATA' => $flight['origin']['alternate_ident'], |
|
| 699 | + 'DepartureTime' => $flight['filed_departure_time']['time'], |
|
| 700 | + 'ArrivalAirportIATA' => $flight['destination']['alternate_ident'], |
|
| 701 | + 'ArrivalTime' => $flight['filed_arrival_time']['time'], |
|
| 702 | + 'Source' => 'website_flightaware'); |
|
| 703 | 703 | } |
| 704 | 704 | } |
| 705 | 705 | } |
@@ -713,21 +713,21 @@ discard block |
||
| 713 | 713 | $flight = reset($flights['flights']); |
| 714 | 714 | if (isset($flight['activityLog']['flights'][0]['origin'])) { |
| 715 | 715 | return array( |
| 716 | - 'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'], |
|
| 717 | - 'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
|
| 718 | - 'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'], |
|
| 719 | - 'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
|
| 720 | - 'Source' => 'website_flightaware'); |
|
| 716 | + 'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'], |
|
| 717 | + 'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
|
| 718 | + 'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'], |
|
| 719 | + 'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
|
| 720 | + 'Source' => 'website_flightaware'); |
|
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | 723 | return array(); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
| 727 | - * Get flight info from CostToTravel |
|
| 728 | - * @param String $callsign The callsign |
|
| 729 | - * @return Flight departure and arrival airports and time |
|
| 730 | - */ |
|
| 727 | + * Get flight info from CostToTravel |
|
| 728 | + * @param String $callsign The callsign |
|
| 729 | + * @return Flight departure and arrival airports and time |
|
| 730 | + */ |
|
| 731 | 731 | public function getCostToTravel($callsign) { |
| 732 | 732 | $Common = new Common(); |
| 733 | 733 | $url= "http://www.costtotravel.com/flight-number/".$callsign; |
@@ -750,11 +750,11 @@ discard block |
||
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | /** |
| 753 | - * Get flight info from Air Canada |
|
| 754 | - * @param String $callsign The callsign |
|
| 755 | - * @param String $date date we want flight number info |
|
| 756 | - * @return Flight departure and arrival airports and time |
|
| 757 | - */ |
|
| 753 | + * Get flight info from Air Canada |
|
| 754 | + * @param String $callsign The callsign |
|
| 755 | + * @param String $date date we want flight number info |
|
| 756 | + * @return Flight departure and arrival airports and time |
|
| 757 | + */ |
|
| 758 | 758 | private function getAirCanada($callsign,$date = 'NOW') { |
| 759 | 759 | $Common = new Common(); |
| 760 | 760 | if (class_exists("DomDocument") === FALSE) return array(); |
@@ -779,11 +779,11 @@ discard block |
||
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | - * Get flight info from Vietnam Airlines |
|
| 783 | - * @param String $callsign The callsign |
|
| 784 | - * @param String $date date we want flight number info |
|
| 785 | - * @return Flight departure and arrival airports and time |
|
| 786 | - */ |
|
| 782 | + * Get flight info from Vietnam Airlines |
|
| 783 | + * @param String $callsign The callsign |
|
| 784 | + * @param String $date date we want flight number info |
|
| 785 | + * @return Flight departure and arrival airports and time |
|
| 786 | + */ |
|
| 787 | 787 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
| 788 | 788 | $Common = new Common(); |
| 789 | 789 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -805,12 +805,12 @@ discard block |
||
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | /** |
| 808 | - * Get flight info from Air Berlin |
|
| 809 | - * @param String $callsign The callsign |
|
| 810 | - * @param String $date date we want flight number info |
|
| 811 | - * @param String $carrier airline code |
|
| 812 | - * @return Flight departure and arrival airports and time |
|
| 813 | - */ |
|
| 808 | + * Get flight info from Air Berlin |
|
| 809 | + * @param String $callsign The callsign |
|
| 810 | + * @param String $date date we want flight number info |
|
| 811 | + * @param String $carrier airline code |
|
| 812 | + * @return Flight departure and arrival airports and time |
|
| 813 | + */ |
|
| 814 | 814 | private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
| 815 | 815 | $Common = new Common(); |
| 816 | 816 | date_default_timezone_set('UTC'); |
@@ -839,11 +839,11 @@ discard block |
||
| 839 | 839 | $table = $Common->table2array($data); |
| 840 | 840 | $flight = $table; |
| 841 | 841 | if (isset($flight[5][4])) { |
| 842 | - $arrivalTime = $flight[5][4]; |
|
| 843 | - $arrivalAirport = $flight[5][3]; |
|
| 842 | + $arrivalTime = $flight[5][4]; |
|
| 843 | + $arrivalAirport = $flight[5][3]; |
|
| 844 | 844 | } else { |
| 845 | - $arrivalTime = ''; |
|
| 846 | - $arrivalAirport = ''; |
|
| 845 | + $arrivalTime = ''; |
|
| 846 | + $arrivalAirport = ''; |
|
| 847 | 847 | } |
| 848 | 848 | } else return array(); |
| 849 | 849 | $url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner'; |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | - return array(); |
|
| 1114 | + return array(); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | } |
| 1117 | 1117 | |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | / @param String $source source of data |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | - public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
|
| 28 | + public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') { |
|
| 29 | 29 | date_default_timezone_set('UTC'); |
| 30 | - $date = date("Y-m-d H:i:s",time()); |
|
| 30 | + $date = date("Y-m-d H:i:s", time()); |
|
| 31 | 31 | //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
| 32 | 32 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
| 33 | 33 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
@@ -35,69 +35,69 @@ discard block |
||
| 35 | 35 | try { |
| 36 | 36 | $sth = $this->db->prepare($query); |
| 37 | 37 | $sth->execute($query_values); |
| 38 | - } catch(PDOException $e) { |
|
| 38 | + } catch (PDOException $e) { |
|
| 39 | 39 | return "error : ".$e->getMessage(); |
| 40 | 40 | } |
| 41 | 41 | if ($sth->fetchColumn() > 0) { |
| 42 | 42 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
| 43 | 43 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
| 44 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
| 44 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao); |
|
| 45 | 45 | } elseif ($arrival_airport_time == '') { |
| 46 | 46 | $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"; |
| 47 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
| 47 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao); |
|
| 48 | 48 | } elseif ($departure_airport_time == '') { |
| 49 | 49 | $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"; |
| 50 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
| 50 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
| 51 | 51 | } else { |
| 52 | 52 | //$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"; |
| 53 | 53 | $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"; |
| 54 | - $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 | + $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); |
|
| 55 | 55 | } |
| 56 | 56 | try { |
| 57 | 57 | $sth = $this->db->prepare($query); |
| 58 | 58 | $sth->execute($query_values); |
| 59 | - } catch(PDOException $e) { |
|
| 59 | + } catch (PDOException $e) { |
|
| 60 | 60 | return "error : ".$e->getMessage(); |
| 61 | 61 | } |
| 62 | 62 | if ($sth->fetchColumn() == 0) { |
| 63 | 63 | //$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'; |
| 64 | 64 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
| 65 | 65 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
| 66 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
| 66 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
| 67 | 67 | } elseif ($arrival_airport_time == '') { |
| 68 | 68 | $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'; |
| 69 | - $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 | + $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); |
|
| 70 | 70 | } elseif ($departure_airport_time == '') { |
| 71 | 71 | $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'; |
| 72 | - $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 | + $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); |
|
| 73 | 73 | } else { |
| 74 | 74 | $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'; |
| 75 | - $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 | + $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); |
|
| 76 | 76 | } |
| 77 | 77 | try { |
| 78 | 78 | $sth = $this->db->prepare($query); |
| 79 | 79 | $sth->execute($query_values); |
| 80 | - } catch(PDOException $e) { |
|
| 80 | + } catch (PDOException $e) { |
|
| 81 | 81 | return "error : ".$e->getMessage(); |
| 82 | 82 | } |
| 83 | 83 | } else { |
| 84 | 84 | //$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident'; |
| 85 | 85 | $query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident'; |
| 86 | - $query_values = array(':ident' => $ident,':date' => $date); |
|
| 86 | + $query_values = array(':ident' => $ident, ':date' => $date); |
|
| 87 | 87 | try { |
| 88 | 88 | $sth = $this->db->prepare($query); |
| 89 | 89 | $sth->execute($query_values); |
| 90 | - } catch(PDOException $e) { |
|
| 90 | + } catch (PDOException $e) { |
|
| 91 | 91 | return "error : ".$e->getMessage(); |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } else { |
| 95 | 95 | $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)'; |
| 96 | - $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 | + $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); |
|
| 97 | 97 | try { |
| 98 | 98 | $sth = $this->db->prepare($query); |
| 99 | 99 | $sth->execute($query_values); |
| 100 | - } catch(PDOException $e) { |
|
| 100 | + } catch (PDOException $e) { |
|
| 101 | 101 | return "error : ".$e->getMessage(); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function getSchedule($ident) { |
| 108 | 108 | $Translation = new Translation($this->db); |
| 109 | - $operator = $Translation->checkTranslation($ident,false); |
|
| 109 | + $operator = $Translation->checkTranslation($ident, false); |
|
| 110 | 110 | if ($ident != $operator) { |
| 111 | 111 | $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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1"; |
| 112 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
| 112 | + $query_values = array(':ident' => $ident, 'operator' => $operator); |
|
| 113 | 113 | } else { |
| 114 | 114 | $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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1"; |
| 115 | 115 | $query_values = array(':ident' => $ident); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | try { |
| 118 | 118 | $sth = $this->db->prepare($query); |
| 119 | 119 | $sth->execute($query_values); |
| 120 | - } catch(PDOException $e) { |
|
| 120 | + } catch (PDOException $e) { |
|
| 121 | 121 | return "error : ".$e->getMessage(); |
| 122 | 122 | } |
| 123 | 123 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | try { |
| 142 | 142 | $sth = $this->db->prepare($query); |
| 143 | 143 | $sth->execute($query_values); |
| 144 | - } catch(PDOException $e) { |
|
| 144 | + } catch (PDOException $e) { |
|
| 145 | 145 | return "error : ".$e->getMessage(); |
| 146 | 146 | } |
| 147 | 147 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -156,16 +156,16 @@ discard block |
||
| 156 | 156 | * @param String $carrier IATA code |
| 157 | 157 | * @return Flight departure and arrival airports and time |
| 158 | 158 | */ |
| 159 | - private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
|
| 159 | + private function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') { |
|
| 160 | 160 | $Common = new Common(); |
| 161 | 161 | $check_date = new Datetime($date); |
| 162 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 163 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 162 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 163 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 164 | 164 | $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'); |
| 165 | 165 | $json = $Common->getData($url); |
| 166 | 166 | |
| 167 | 167 | $parsed_json = json_decode($json); |
| 168 | - if (property_exists($parsed_json,'errors') === false) { |
|
| 168 | + if (property_exists($parsed_json, 'errors') === false) { |
|
| 169 | 169 | //$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'}; |
| 170 | 170 | $originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'}; |
| 171 | 171 | //$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'}; |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | //$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'}; |
| 176 | 176 | $arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'}; |
| 177 | 177 | |
| 178 | - preg_match('/\((.*?)\)/',$originShort,$originiata); |
|
| 178 | + preg_match('/\((.*?)\)/', $originShort, $originiata); |
|
| 179 | 179 | $DepartureAirportIata = $originiata[1]; |
| 180 | - preg_match('/\((.*?)\)/',$destinationShort,$destinationiata); |
|
| 180 | + preg_match('/\((.*?)\)/', $destinationShort, $destinationiata); |
|
| 181 | 181 | $ArrivalAirportIata = $destinationiata[1]; |
| 182 | 182 | |
| 183 | 183 | /* |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $arrivalTime = gmdate('H:i',strtotime($arrivalTime)); |
| 187 | 187 | */ |
| 188 | 188 | |
| 189 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
|
| 189 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance'); |
|
| 190 | 190 | } else return array(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | $Common = new Common(); |
| 202 | 202 | date_default_timezone_set($globalTimezone); |
| 203 | 203 | $check_date = new Datetime($date); |
| 204 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 205 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 204 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 205 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 206 | 206 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
| 207 | 207 | $json = $Common->getData($url); |
| 208 | 208 | $parsed_json = json_decode($json); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'}; |
| 215 | 215 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
| 216 | 216 | |
| 217 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
|
| 217 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet'); |
|
| 218 | 218 | } else return array(); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | private function getRyanair($callsign) { |
| 227 | 227 | $Common = new Common(); |
| 228 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 229 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 228 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 229 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 230 | 230 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
| 231 | 231 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
| 232 | - $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
|
| 233 | - $json = $Common->getData($url,'post',$post,$headers); |
|
| 232 | + $headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post)); |
|
| 233 | + $json = $Common->getData($url, 'post', $post, $headers); |
|
| 234 | 234 | $parsed_json = json_decode($json); |
| 235 | 235 | if (isset($parsed_json->{'flightInfo'})) { |
| 236 | 236 | $flights = $parsed_json->{'flightInfo'}; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name |
| 240 | 240 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
| 241 | 241 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
| 242 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
| 242 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
| 243 | 243 | } else return array(); |
| 244 | 244 | } else return array(); |
| 245 | 245 | } |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | private function getSwiss($callsign) { |
| 253 | 253 | $Common = new Common(); |
| 254 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 255 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 254 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 255 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 256 | 256 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
| 257 | 257 | $json = $Common->getData($url); |
| 258 | 258 | $parsed_json = json_decode($json); |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | if ($flight->{'no'} == "Vol LX ".$numvol) { |
| 267 | 267 | $DepartureAirportIata = $flight->{'from'}->{'code'}; //city |
| 268 | 268 | $ArrivalAirportIata = $flight->{'to'}->{'code'}; //city |
| 269 | - $departureTime = substr($flight->{'from'}->{'hour'},0,5); |
|
| 270 | - $arrivalTime = substr($flight->{'to'}->{'hour'},0,5); |
|
| 269 | + $departureTime = substr($flight->{'from'}->{'hour'},0, 5); |
|
| 270 | + $arrivalTime = substr($flight->{'to'}->{'hour'},0, 5); |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
| 274 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
|
| 274 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss'); |
|
| 275 | 275 | } else return array(); |
| 276 | 276 | } else return array(); |
| 277 | 277 | } |
@@ -286,21 +286,21 @@ discard block |
||
| 286 | 286 | global $globalBritishAirwaysKey; |
| 287 | 287 | $Common = new Common(); |
| 288 | 288 | $check_date = new Datetime($date); |
| 289 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
| 290 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
| 289 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
| 290 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
| 291 | 291 | if ($globalBritishAirwaysKey == '') return array(); |
| 292 | 292 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
| 293 | 293 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
| 294 | - $json = $Common->getData($url,'get','',$headers); |
|
| 294 | + $json = $Common->getData($url, 'get', '', $headers); |
|
| 295 | 295 | if ($json == '') return array(); |
| 296 | 296 | $parsed_json = json_decode($json); |
| 297 | 297 | $flights = $parsed_json->{'FlightsResponse'}; |
| 298 | 298 | if (count($flights) > 0) { |
| 299 | 299 | $DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'}; |
| 300 | 300 | $ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'}; |
| 301 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
| 302 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
| 303 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
|
| 301 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
| 302 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
| 303 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways'); |
|
| 304 | 304 | } else return array(); |
| 305 | 305 | } |
| 306 | 306 | |
@@ -314,27 +314,27 @@ discard block |
||
| 314 | 314 | global $globalLufthansaKey; |
| 315 | 315 | $Common = new Common(); |
| 316 | 316 | $check_date = new Datetime($date); |
| 317 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
| 318 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
| 317 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
| 318 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
| 319 | 319 | if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
| 320 | 320 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
| 321 | - $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
|
| 322 | - $data = $Common->getData($url,'post',$post); |
|
| 321 | + $post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials'); |
|
| 322 | + $data = $Common->getData($url, 'post', $post); |
|
| 323 | 323 | $parsed_data = json_decode($data); |
| 324 | 324 | if (!isset($parsed_data->{'access_token'})) return array(); |
| 325 | 325 | $token = $parsed_data->{'access_token'}; |
| 326 | 326 | |
| 327 | 327 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
| 328 | - $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
|
| 329 | - $json = $Common->getData($url,'get','',$headers); |
|
| 328 | + $headers = array('Authorization: Bearer '.$token, 'Accept: application/json'); |
|
| 329 | + $json = $Common->getData($url, 'get', '', $headers); |
|
| 330 | 330 | if ($json == '') return array(); |
| 331 | 331 | $parsed_json = json_decode($json); |
| 332 | 332 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
| 333 | 333 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
| 334 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
| 334 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
| 335 | 335 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
| 336 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
| 337 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
|
| 336 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
| 337 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa'); |
|
| 338 | 338 | } else return array(); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -348,23 +348,23 @@ discard block |
||
| 348 | 348 | global $globalTransaviaKey; |
| 349 | 349 | $Common = new Common(); |
| 350 | 350 | $check_date = new Datetime($date); |
| 351 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
| 352 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
| 351 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
| 352 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
| 353 | 353 | if ($globalTransaviaKey == '') return array(); |
| 354 | 354 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
| 355 | 355 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
| 356 | 356 | $headers = array('apikey: '.$globalTransaviaKey); |
| 357 | - $json = $Common->getData($url,'get','',$headers); |
|
| 357 | + $json = $Common->getData($url, 'get', '', $headers); |
|
| 358 | 358 | //echo 'result : '.$json; |
| 359 | 359 | if ($json == '') return array(); |
| 360 | 360 | $parsed_json = json_decode($json); |
| 361 | 361 | |
| 362 | 362 | if (isset($parsed_json->{'data'}[0])) { |
| 363 | 363 | $DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'}; |
| 364 | - $departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
| 364 | + $departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
| 365 | 365 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
| 366 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
| 367 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
|
| 366 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
| 367 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia'); |
|
| 368 | 368 | } else return array(); |
| 369 | 369 | } |
| 370 | 370 | |
@@ -375,14 +375,14 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function getTunisair($callsign) { |
| 377 | 377 | $Common = new Common(); |
| 378 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 379 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 378 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 379 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 380 | 380 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
| 381 | 381 | $data = $Common->getData($url); |
| 382 | 382 | $table = $Common->table2array($data); |
| 383 | 383 | foreach ($table as $flight) { |
| 384 | - if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) { |
|
| 385 | - return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair'); |
|
| 384 | + if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) { |
|
| 385 | + return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair'); |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | return array(); |
@@ -393,21 +393,21 @@ discard block |
||
| 393 | 393 | * @param String $callsign The callsign |
| 394 | 394 | * @return Flight departure and arrival airports and time |
| 395 | 395 | */ |
| 396 | - public function getVueling($callsign,$date = 'NOW') { |
|
| 396 | + public function getVueling($callsign, $date = 'NOW') { |
|
| 397 | 397 | $Common = new Common(); |
| 398 | 398 | $check_date = new Datetime($date); |
| 399 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 400 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 401 | - $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
|
| 399 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 400 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 401 | + $final_date = str_replace('/', '%2F', $check_date->format('d/m/Y')); |
|
| 402 | 402 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
| 403 | 403 | $data = $Common->getData($url); |
| 404 | - $data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data)); |
|
| 404 | + $data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data)); |
|
| 405 | 405 | if ($data != '') { |
| 406 | - preg_match('/flightOri=[A-Z]{3}/',$data,$result); |
|
| 407 | - $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
|
| 408 | - preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
|
| 409 | - $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
|
| 410 | - if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
| 406 | + preg_match('/flightOri=[A-Z]{3}/', $data, $result); |
|
| 407 | + $DepartureAirportIata = str_replace('flightOri=', '', $result[0]); |
|
| 408 | + preg_match('/flightDest=[A-Z]{3}/', $data, $result); |
|
| 409 | + $ArrivalAirportIata = str_replace('flightDest=', '', $result[0]); |
|
| 410 | + if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling'); |
|
| 411 | 411 | else return array(); |
| 412 | 412 | } |
| 413 | 413 | return array(); |
@@ -421,27 +421,27 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function getIberia($callsign, $date = 'NOW') { |
| 423 | 423 | $Common = new Common(); |
| 424 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 424 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 425 | 425 | $check_date = new Datetime($date); |
| 426 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 426 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 427 | 427 | $url = "https://www.iberia.com/web/flightDetail.do"; |
| 428 | - $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
|
| 429 | - $data = $Common->getData($url,'post',$post); |
|
| 428 | + $post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB'); |
|
| 429 | + $data = $Common->getData($url, 'post', $post); |
|
| 430 | 430 | if ($data != '') { |
| 431 | 431 | $table = $Common->table2array($data); |
| 432 | 432 | //print_r($table); |
| 433 | 433 | if (count($table) > 0) { |
| 434 | 434 | $flight = $table; |
| 435 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
| 436 | - preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch); |
|
| 435 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
| 436 | + preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch); |
|
| 437 | 437 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
| 438 | 438 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
| 439 | - $departureTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[3][2]))),0,5); |
|
| 440 | - $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
|
| 439 | + $departureTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[3][2]))), 0, 5); |
|
| 440 | + $arrivalTime = trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][1]))); |
|
| 441 | 441 | if ($arrivalTime == 'Hora estimada de llegada') { |
| 442 | - $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
|
| 443 | - } else $arrivalTime = substr($arrivalTime,0,5); |
|
| 444 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
|
| 442 | + $arrivalTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][2]))), 0, 5); |
|
| 443 | + } else $arrivalTime = substr($arrivalTime, 0, 5); |
|
| 444 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia'); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | return array(); |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | * @return Flight departure and arrival airports and time |
| 455 | 455 | */ |
| 456 | 456 | |
| 457 | - private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
|
| 457 | + private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') { |
|
| 458 | 458 | $Common = new Common(); |
| 459 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 459 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 460 | 460 | $check_date = new Datetime($date); |
| 461 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 461 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 462 | 462 | $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'); |
| 463 | 463 | $data = $Common->getData($url); |
| 464 | 464 | if ($data != '') { |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | $flight = $table; |
| 468 | 468 | //print_r($table); |
| 469 | 469 | if (isset($flight[25]) && isset($flight[29])) { |
| 470 | - preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch); |
|
| 471 | - preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch); |
|
| 470 | + preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch); |
|
| 471 | + preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch); |
|
| 472 | 472 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
| 473 | 473 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
| 474 | - $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
|
| 475 | - $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
|
| 476 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
|
| 474 | + $departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5); |
|
| 475 | + $arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5); |
|
| 476 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance'); |
|
| 477 | 477 | } else return array(); |
| 478 | 478 | } |
| 479 | 479 | |
@@ -491,10 +491,10 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | private function getAlitalia($callsign, $date = 'NOW') { |
| 493 | 493 | $Common = new Common(); |
| 494 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 494 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 495 | 495 | $check_date = new Datetime($date); |
| 496 | - $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
| 497 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 496 | + $url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
| 497 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 498 | 498 | $data = $Common->getData($url); |
| 499 | 499 | if ($data != '') { |
| 500 | 500 | $table = $Common->text2array($data); |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $ArrivalAirportIata = ''; |
| 503 | 503 | $departureTime = $table[4]; |
| 504 | 504 | $arrivalTime = $table[5]; |
| 505 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia'); |
|
| 505 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia'); |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
@@ -514,21 +514,21 @@ discard block |
||
| 514 | 514 | */ |
| 515 | 515 | private function getBrussels($callsign, $date = 'NOW') { |
| 516 | 516 | $Common = new Common(); |
| 517 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 517 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 518 | 518 | $check_date = new Datetime($date); |
| 519 | - $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 | + $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"; |
|
| 520 | 520 | //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"; |
| 521 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 521 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 522 | 522 | $data = $Common->getData($url); |
| 523 | 523 | if ($data != '') { |
| 524 | 524 | //echo $data; |
| 525 | - $parsed_json = json_decode($data,true); |
|
| 525 | + $parsed_json = json_decode($data, true); |
|
| 526 | 526 | if (isset($parsed_json[0]['FromAirportCode'])) { |
| 527 | 527 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
| 528 | 528 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
| 529 | - $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
| 530 | - $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
| 531 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
|
| 529 | + $departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
| 530 | + $arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
| 531 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels'); |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -605,21 +605,21 @@ discard block |
||
| 605 | 605 | */ |
| 606 | 606 | private function getFlyTap($callsign) { |
| 607 | 607 | $Common = new Common(); |
| 608 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 609 | - $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
| 608 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 609 | + $url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
| 610 | 610 | //$check_date = new Datetime($date); |
| 611 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 612 | - $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'); |
|
| 613 | - $data = $Common->getData($url,'post',$post); |
|
| 611 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 612 | + $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'); |
|
| 613 | + $data = $Common->getData($url, 'post', $post); |
|
| 614 | 614 | if ($data != '') { |
| 615 | 615 | $table = $Common->table2array($data); |
| 616 | - $departureTime = trim(substr($table[15][0],0,5)); |
|
| 617 | - $arrivalTime = trim(substr($table[35][0],0,5)); |
|
| 618 | - preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch); |
|
| 619 | - preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch); |
|
| 616 | + $departureTime = trim(substr($table[15][0], 0, 5)); |
|
| 617 | + $arrivalTime = trim(substr($table[35][0], 0, 5)); |
|
| 618 | + preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch); |
|
| 619 | + preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch); |
|
| 620 | 620 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
| 621 | 621 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
| 622 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap'); |
|
| 622 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap'); |
|
| 623 | 623 | } |
| 624 | 624 | return array(); |
| 625 | 625 | } |
@@ -641,10 +641,10 @@ discard block |
||
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | if ($airline_icao == '') return array(); |
| 644 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 645 | - $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
| 644 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 645 | + $url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
| 646 | 646 | //$check_date = new Datetime($date); |
| 647 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 647 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 648 | 648 | $data = $Common->getData($url); |
| 649 | 649 | if ($data != '') { |
| 650 | 650 | $table = $Common->table2array($data); |
@@ -654,13 +654,13 @@ discard block |
||
| 654 | 654 | $darr = ''; |
| 655 | 655 | $ahour = ''; |
| 656 | 656 | $aarr = ''; |
| 657 | - $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
|
| 657 | + $n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr); |
|
| 658 | 658 | if ($n == 7) { |
| 659 | 659 | $departureTime = $dhour; |
| 660 | 660 | $arrivalTime = $ahour; |
| 661 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
| 662 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
| 663 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
| 661 | + $DepartureAirportIata = str_replace(array('(', ')'), '', $darr); |
|
| 662 | + $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr); |
|
| 663 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper'); |
|
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | } |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $url = 'http://'.$globalFlightAwareUsername.':'.$globalFlightAwarePassword.'@flightxml.flightaware.com/json/FlightXML3/FlightInfoStatus?ident='.$callsign; |
| 692 | 692 | $data = $Common->getData($url); |
| 693 | 693 | if ($data != '') { |
| 694 | - $result = json_decode($data,true); |
|
| 694 | + $result = json_decode($data, true); |
|
| 695 | 695 | $flight = $result['FlightInfoStatusResult']['flights'][0]; |
| 696 | 696 | if (isset($flight['origin'])) { |
| 697 | 697 | return array( |
@@ -704,19 +704,19 @@ discard block |
||
| 704 | 704 | } |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | - $url= "http://flightaware.com/live/flight/".$callsign; |
|
| 708 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 707 | + $url = "http://flightaware.com/live/flight/".$callsign; |
|
| 708 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 709 | 709 | $data = $Common->getData($url); |
| 710 | 710 | if ($data != '') { |
| 711 | - preg_match(':<script>var trackpollBootstrap = (.*?);</script>:',$data,$result); |
|
| 712 | - $flights = json_decode($result[1],true); |
|
| 711 | + preg_match(':<script>var trackpollBootstrap = (.*?);</script>:', $data, $result); |
|
| 712 | + $flights = json_decode($result[1], true); |
|
| 713 | 713 | $flight = reset($flights['flights']); |
| 714 | 714 | if (isset($flight['activityLog']['flights'][0]['origin'])) { |
| 715 | 715 | return array( |
| 716 | 716 | 'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'], |
| 717 | - 'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
|
| 717 | + 'DepartureTime' => date('H:i', $flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
|
| 718 | 718 | 'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'], |
| 719 | - 'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
|
| 719 | + 'ArrivalTime' => date('H:i', $flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
|
| 720 | 720 | 'Source' => 'website_flightaware'); |
| 721 | 721 | } |
| 722 | 722 | } |
@@ -730,20 +730,20 @@ discard block |
||
| 730 | 730 | */ |
| 731 | 731 | public function getCostToTravel($callsign) { |
| 732 | 732 | $Common = new Common(); |
| 733 | - $url= "http://www.costtotravel.com/flight-number/".$callsign; |
|
| 733 | + $url = "http://www.costtotravel.com/flight-number/".$callsign; |
|
| 734 | 734 | //$check_date = new Datetime($date); |
| 735 | 735 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
| 736 | 736 | $data = $Common->getData($url); |
| 737 | 737 | if ($data != '') { |
| 738 | 738 | $table = $Common->table2array($data); |
| 739 | 739 | if (isset($table[11][1])) { |
| 740 | - if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5); |
|
| 740 | + if (is_numeric(substr($table[11][1], 0, 1))) $departureTime = substr($table[11][1], 0, 5); |
|
| 741 | 741 | $departureTime = ''; |
| 742 | - if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5); |
|
| 742 | + if (is_numeric(substr($table[17][1], 0, 1))) $arrivalTime = substr($table[17][1], 0, 5); |
|
| 743 | 743 | else $arrivalTime = ''; |
| 744 | - $DepartureAirportIata = substr($table[13][1],0,3); |
|
| 745 | - $ArrivalAirportIata = substr($table[15][1],0,3); |
|
| 746 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
|
| 744 | + $DepartureAirportIata = substr($table[13][1], 0, 3); |
|
| 745 | + $ArrivalAirportIata = substr($table[15][1], 0, 3); |
|
| 746 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel'); |
|
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | return array(); |
@@ -755,14 +755,14 @@ discard block |
||
| 755 | 755 | * @param String $date date we want flight number info |
| 756 | 756 | * @return Flight departure and arrival airports and time |
| 757 | 757 | */ |
| 758 | - private function getAirCanada($callsign,$date = 'NOW') { |
|
| 758 | + private function getAirCanada($callsign, $date = 'NOW') { |
|
| 759 | 759 | $Common = new Common(); |
| 760 | 760 | if (class_exists("DomDocument") === FALSE) return array(); |
| 761 | 761 | date_default_timezone_set('UTC'); |
| 762 | 762 | $check_date = new Datetime($date); |
| 763 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 764 | - $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"; |
|
| 765 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 763 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 764 | + $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"; |
|
| 765 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 766 | 766 | $data = $Common->getData($url); |
| 767 | 767 | $dom = new DomDocument(); |
| 768 | 768 | $dom->loadXML($data); |
@@ -770,11 +770,11 @@ discard block |
||
| 770 | 770 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
| 771 | 771 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
| 772 | 772 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
| 773 | - $departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
| 773 | + $departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
| 774 | 774 | $arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0); |
| 775 | 775 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
| 776 | - $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
| 777 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
|
| 776 | + $arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
| 777 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada'); |
|
| 778 | 778 | } else return array(); |
| 779 | 779 | } |
| 780 | 780 | |
@@ -786,21 +786,21 @@ discard block |
||
| 786 | 786 | */ |
| 787 | 787 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
| 788 | 788 | $Common = new Common(); |
| 789 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 789 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 790 | 790 | $check_date = new Datetime($date); |
| 791 | - $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."&"; |
|
| 792 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 791 | + $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."&"; |
|
| 792 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 793 | 793 | $data = $Common->getData($url); |
| 794 | 794 | if ($data != '') { |
| 795 | 795 | $table = $Common->table2array($data); |
| 796 | 796 | $flight = $table; |
| 797 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
| 798 | - preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch); |
|
| 797 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
| 798 | + preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch); |
|
| 799 | 799 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
| 800 | 800 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
| 801 | 801 | $departureTime = $flight[5][1]; |
| 802 | 802 | $arrivalTime = $flight[23][1]; |
| 803 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines'); |
|
| 803 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines'); |
|
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | |
@@ -811,16 +811,16 @@ discard block |
||
| 811 | 811 | * @param String $carrier airline code |
| 812 | 812 | * @return Flight departure and arrival airports and time |
| 813 | 813 | */ |
| 814 | - private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
|
| 814 | + private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') { |
|
| 815 | 815 | $Common = new Common(); |
| 816 | 816 | date_default_timezone_set('UTC'); |
| 817 | 817 | //AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair |
| 818 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
| 818 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
| 819 | 819 | $check_date = new Datetime($date); |
| 820 | - $url= "http://www.airberlin.com/en-US/site/aims.php"; |
|
| 821 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 822 | - $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
|
| 823 | - $data = $Common->getData($url,'post',$post); |
|
| 820 | + $url = "http://www.airberlin.com/en-US/site/aims.php"; |
|
| 821 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
| 822 | + $post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier); |
|
| 823 | + $data = $Common->getData($url, 'post', $post); |
|
| 824 | 824 | //echo $data; |
| 825 | 825 | $DepartureAirportIata = ''; |
| 826 | 826 | $ArrivalAirportIata = ''; |
@@ -833,8 +833,8 @@ discard block |
||
| 833 | 833 | if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
| 834 | 834 | else $departureAirport = ''; |
| 835 | 835 | } else return array(); |
| 836 | - $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
|
| 837 | - $data = $Common->getData($url,'post',$post); |
|
| 836 | + $post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB'); |
|
| 837 | + $data = $Common->getData($url, 'post', $post); |
|
| 838 | 838 | if ($data != '') { |
| 839 | 839 | $table = $Common->table2array($data); |
| 840 | 840 | $flight = $table; |
@@ -862,13 +862,13 @@ discard block |
||
| 862 | 862 | } |
| 863 | 863 | } |
| 864 | 864 | if (isset($DepartureAirportIata)) { |
| 865 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
|
| 865 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin'); |
|
| 866 | 866 | } else return array(); |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | |
| 870 | 870 | |
| 871 | - public function fetchSchedule($ident,$date = 'NOW') { |
|
| 871 | + public function fetchSchedule($ident, $date = 'NOW') { |
|
| 872 | 872 | global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline; |
| 873 | 873 | //$Common = new Common(); |
| 874 | 874 | if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array(); |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | // Brussels Airlines |
| 939 | 939 | case "BEL": |
| 940 | 940 | case "SN": |
| 941 | - return $this->getBrussels($ident,$date); |
|
| 941 | + return $this->getBrussels($ident, $date); |
|
| 942 | 942 | /* |
| 943 | 943 | // Copa Airlines |
| 944 | 944 | case "CMP": |
@@ -1023,17 +1023,17 @@ discard block |
||
| 1023 | 1023 | // Air France |
| 1024 | 1024 | case "AF": |
| 1025 | 1025 | case "AFR": |
| 1026 | - return $this->getAirFrance($ident,$date,'AF'); |
|
| 1026 | + return $this->getAirFrance($ident, $date, 'AF'); |
|
| 1027 | 1027 | // HOP |
| 1028 | 1028 | case "A5": |
| 1029 | 1029 | case "HOP": |
| 1030 | - return $this->getAirFrance($ident,$date,'A5'); |
|
| 1030 | + return $this->getAirFrance($ident, $date, 'A5'); |
|
| 1031 | 1031 | // EasyJet |
| 1032 | 1032 | case "U2": |
| 1033 | 1033 | case "DS": |
| 1034 | 1034 | case "EZY": |
| 1035 | 1035 | case "EZS": |
| 1036 | - return $this->getEasyJet($ident,$date); |
|
| 1036 | + return $this->getEasyJet($ident, $date); |
|
| 1037 | 1037 | // Ryanair |
| 1038 | 1038 | case "FR": |
| 1039 | 1039 | case "RYR": |
@@ -1083,25 +1083,25 @@ discard block |
||
| 1083 | 1083 | return $this->getIberia($ident); |
| 1084 | 1084 | // Vietnam Airlines |
| 1085 | 1085 | case "HVN": |
| 1086 | - return $this->getVietnamAirlines($ident,$date); |
|
| 1086 | + return $this->getVietnamAirlines($ident, $date); |
|
| 1087 | 1087 | // Air Berlin |
| 1088 | 1088 | case "AB": |
| 1089 | 1089 | case "BER": |
| 1090 | - return $this->getAirBerlin($ident,$date,'AB'); |
|
| 1090 | + return $this->getAirBerlin($ident, $date, 'AB'); |
|
| 1091 | 1091 | // NIKI |
| 1092 | 1092 | case "HG": |
| 1093 | 1093 | case "NLY": |
| 1094 | - return $this->getAirBerlin($ident,$date,'HG'); |
|
| 1094 | + return $this->getAirBerlin($ident, $date, 'HG'); |
|
| 1095 | 1095 | // BelAir |
| 1096 | 1096 | case "4T": |
| 1097 | 1097 | case "BHP": |
| 1098 | - return $this->getAirBerlin($ident,$date,'4T'); |
|
| 1098 | + return $this->getAirBerlin($ident, $date, '4T'); |
|
| 1099 | 1099 | default: |
| 1100 | 1100 | // Randomly use a generic function to get hours |
| 1101 | 1101 | if (strlen($airline_icao) == 2) { |
| 1102 | - if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1102 | + if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
| 1103 | 1103 | if (count($globalSchedulesSources) > 0) { |
| 1104 | - $rand = mt_rand(0,count($globalSchedulesSources)-1); |
|
| 1104 | + $rand = mt_rand(0, count($globalSchedulesSources) - 1); |
|
| 1105 | 1105 | $source = $globalSchedulesSources[$rand]; |
| 1106 | 1106 | if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
| 1107 | 1107 | elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | public function __construct($dbc = null) { |
| 13 | 13 | $Connection = new Connection($dbc); |
| 14 | 14 | $this->db = $Connection->db(); |
| 15 | - if ($this->db === null) die('Error: No DB connection.'); |
|
| 15 | + if ($this->db === null) { |
|
| 16 | + die('Error: No DB connection.'); |
|
| 17 | + } |
|
| 16 | 18 | } |
| 17 | 19 | |
| 18 | 20 | /** |
@@ -124,7 +126,9 @@ discard block |
||
| 124 | 126 | $sth->closeCursor(); |
| 125 | 127 | if (count($row) > 0) { |
| 126 | 128 | return $row; |
| 127 | - } else return array(); |
|
| 129 | + } else { |
|
| 130 | + return array(); |
|
| 131 | + } |
|
| 128 | 132 | } |
| 129 | 133 | |
| 130 | 134 | public function checkSchedule($ident) { |
@@ -160,7 +164,9 @@ discard block |
||
| 160 | 164 | $Common = new Common(); |
| 161 | 165 | $check_date = new Datetime($date); |
| 162 | 166 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 163 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 167 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 168 | + return array(); |
|
| 169 | + } |
|
| 164 | 170 | $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'); |
| 165 | 171 | $json = $Common->getData($url); |
| 166 | 172 | |
@@ -187,7 +193,9 @@ discard block |
||
| 187 | 193 | */ |
| 188 | 194 | |
| 189 | 195 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
| 190 | - } else return array(); |
|
| 196 | + } else { |
|
| 197 | + return array(); |
|
| 198 | + } |
|
| 191 | 199 | } |
| 192 | 200 | |
| 193 | 201 | /** |
@@ -202,7 +210,9 @@ discard block |
||
| 202 | 210 | date_default_timezone_set($globalTimezone); |
| 203 | 211 | $check_date = new Datetime($date); |
| 204 | 212 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 205 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 213 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 214 | + return array(); |
|
| 215 | + } |
|
| 206 | 216 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
| 207 | 217 | $json = $Common->getData($url); |
| 208 | 218 | $parsed_json = json_decode($json); |
@@ -215,7 +225,9 @@ discard block |
||
| 215 | 225 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
| 216 | 226 | |
| 217 | 227 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
| 218 | - } else return array(); |
|
| 228 | + } else { |
|
| 229 | + return array(); |
|
| 230 | + } |
|
| 219 | 231 | } |
| 220 | 232 | |
| 221 | 233 | /** |
@@ -226,7 +238,9 @@ discard block |
||
| 226 | 238 | private function getRyanair($callsign) { |
| 227 | 239 | $Common = new Common(); |
| 228 | 240 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 229 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 241 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 242 | + return array(); |
|
| 243 | + } |
|
| 230 | 244 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
| 231 | 245 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
| 232 | 246 | $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
@@ -240,8 +254,12 @@ discard block |
||
| 240 | 254 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
| 241 | 255 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
| 242 | 256 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
| 243 | - } else return array(); |
|
| 244 | - } else return array(); |
|
| 257 | + } else { |
|
| 258 | + return array(); |
|
| 259 | + } |
|
| 260 | + } else { |
|
| 261 | + return array(); |
|
| 262 | + } |
|
| 245 | 263 | } |
| 246 | 264 | |
| 247 | 265 | /** |
@@ -252,7 +270,9 @@ discard block |
||
| 252 | 270 | private function getSwiss($callsign) { |
| 253 | 271 | $Common = new Common(); |
| 254 | 272 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 255 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 273 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 274 | + return array(); |
|
| 275 | + } |
|
| 256 | 276 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
| 257 | 277 | $json = $Common->getData($url); |
| 258 | 278 | $parsed_json = json_decode($json); |
@@ -272,8 +292,12 @@ discard block |
||
| 272 | 292 | } |
| 273 | 293 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
| 274 | 294 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
| 275 | - } else return array(); |
|
| 276 | - } else return array(); |
|
| 295 | + } else { |
|
| 296 | + return array(); |
|
| 297 | + } |
|
| 298 | + } else { |
|
| 299 | + return array(); |
|
| 300 | + } |
|
| 277 | 301 | } |
| 278 | 302 | |
| 279 | 303 | /** |
@@ -287,12 +311,18 @@ discard block |
||
| 287 | 311 | $Common = new Common(); |
| 288 | 312 | $check_date = new Datetime($date); |
| 289 | 313 | $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
| 290 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
| 291 | - if ($globalBritishAirwaysKey == '') return array(); |
|
| 314 | + if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) { |
|
| 315 | + return array(); |
|
| 316 | + } |
|
| 317 | + if ($globalBritishAirwaysKey == '') { |
|
| 318 | + return array(); |
|
| 319 | + } |
|
| 292 | 320 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
| 293 | 321 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
| 294 | 322 | $json = $Common->getData($url,'get','',$headers); |
| 295 | - if ($json == '') return array(); |
|
| 323 | + if ($json == '') { |
|
| 324 | + return array(); |
|
| 325 | + } |
|
| 296 | 326 | $parsed_json = json_decode($json); |
| 297 | 327 | $flights = $parsed_json->{'FlightsResponse'}; |
| 298 | 328 | if (count($flights) > 0) { |
@@ -301,7 +331,9 @@ discard block |
||
| 301 | 331 | $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
| 302 | 332 | $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
| 303 | 333 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
| 304 | - } else return array(); |
|
| 334 | + } else { |
|
| 335 | + return array(); |
|
| 336 | + } |
|
| 305 | 337 | } |
| 306 | 338 | |
| 307 | 339 | /** |
@@ -315,19 +347,27 @@ discard block |
||
| 315 | 347 | $Common = new Common(); |
| 316 | 348 | $check_date = new Datetime($date); |
| 317 | 349 | $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
| 318 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
| 319 | - if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
|
| 350 | + if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) { |
|
| 351 | + return array(); |
|
| 352 | + } |
|
| 353 | + if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') { |
|
| 354 | + return array(); |
|
| 355 | + } |
|
| 320 | 356 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
| 321 | 357 | $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
| 322 | 358 | $data = $Common->getData($url,'post',$post); |
| 323 | 359 | $parsed_data = json_decode($data); |
| 324 | - if (!isset($parsed_data->{'access_token'})) return array(); |
|
| 360 | + if (!isset($parsed_data->{'access_token'})) { |
|
| 361 | + return array(); |
|
| 362 | + } |
|
| 325 | 363 | $token = $parsed_data->{'access_token'}; |
| 326 | 364 | |
| 327 | 365 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
| 328 | 366 | $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
| 329 | 367 | $json = $Common->getData($url,'get','',$headers); |
| 330 | - if ($json == '') return array(); |
|
| 368 | + if ($json == '') { |
|
| 369 | + return array(); |
|
| 370 | + } |
|
| 331 | 371 | $parsed_json = json_decode($json); |
| 332 | 372 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
| 333 | 373 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
@@ -335,7 +375,9 @@ discard block |
||
| 335 | 375 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
| 336 | 376 | $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
| 337 | 377 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
| 338 | - } else return array(); |
|
| 378 | + } else { |
|
| 379 | + return array(); |
|
| 380 | + } |
|
| 339 | 381 | } |
| 340 | 382 | |
| 341 | 383 | /** |
@@ -349,14 +391,20 @@ discard block |
||
| 349 | 391 | $Common = new Common(); |
| 350 | 392 | $check_date = new Datetime($date); |
| 351 | 393 | $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
| 352 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
| 353 | - if ($globalTransaviaKey == '') return array(); |
|
| 394 | + if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) { |
|
| 395 | + return array(); |
|
| 396 | + } |
|
| 397 | + if ($globalTransaviaKey == '') { |
|
| 398 | + return array(); |
|
| 399 | + } |
|
| 354 | 400 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
| 355 | 401 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
| 356 | 402 | $headers = array('apikey: '.$globalTransaviaKey); |
| 357 | 403 | $json = $Common->getData($url,'get','',$headers); |
| 358 | 404 | //echo 'result : '.$json; |
| 359 | - if ($json == '') return array(); |
|
| 405 | + if ($json == '') { |
|
| 406 | + return array(); |
|
| 407 | + } |
|
| 360 | 408 | $parsed_json = json_decode($json); |
| 361 | 409 | |
| 362 | 410 | if (isset($parsed_json->{'data'}[0])) { |
@@ -365,7 +413,9 @@ discard block |
||
| 365 | 413 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
| 366 | 414 | $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
| 367 | 415 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
| 368 | - } else return array(); |
|
| 416 | + } else { |
|
| 417 | + return array(); |
|
| 418 | + } |
|
| 369 | 419 | } |
| 370 | 420 | |
| 371 | 421 | /** |
@@ -376,7 +426,9 @@ discard block |
||
| 376 | 426 | public function getTunisair($callsign) { |
| 377 | 427 | $Common = new Common(); |
| 378 | 428 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 379 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 429 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 430 | + return array(); |
|
| 431 | + } |
|
| 380 | 432 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
| 381 | 433 | $data = $Common->getData($url); |
| 382 | 434 | $table = $Common->table2array($data); |
@@ -397,7 +449,9 @@ discard block |
||
| 397 | 449 | $Common = new Common(); |
| 398 | 450 | $check_date = new Datetime($date); |
| 399 | 451 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 400 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 452 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 453 | + return array(); |
|
| 454 | + } |
|
| 401 | 455 | $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
| 402 | 456 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
| 403 | 457 | $data = $Common->getData($url); |
@@ -407,8 +461,11 @@ discard block |
||
| 407 | 461 | $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
| 408 | 462 | preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
| 409 | 463 | $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
| 410 | - if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
| 411 | - else return array(); |
|
| 464 | + if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') { |
|
| 465 | + return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
| 466 | + } else { |
|
| 467 | + return array(); |
|
| 468 | + } |
|
| 412 | 469 | } |
| 413 | 470 | return array(); |
| 414 | 471 | } |
@@ -423,7 +480,9 @@ discard block |
||
| 423 | 480 | $Common = new Common(); |
| 424 | 481 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 425 | 482 | $check_date = new Datetime($date); |
| 426 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 483 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 484 | + return array(); |
|
| 485 | + } |
|
| 427 | 486 | $url = "https://www.iberia.com/web/flightDetail.do"; |
| 428 | 487 | $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
| 429 | 488 | $data = $Common->getData($url,'post',$post); |
@@ -440,7 +499,9 @@ discard block |
||
| 440 | 499 | $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
| 441 | 500 | if ($arrivalTime == 'Hora estimada de llegada') { |
| 442 | 501 | $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
| 443 | - } else $arrivalTime = substr($arrivalTime,0,5); |
|
| 502 | + } else { |
|
| 503 | + $arrivalTime = substr($arrivalTime,0,5); |
|
| 504 | + } |
|
| 444 | 505 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
| 445 | 506 | } |
| 446 | 507 | } |
@@ -458,7 +519,9 @@ discard block |
||
| 458 | 519 | $Common = new Common(); |
| 459 | 520 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 460 | 521 | $check_date = new Datetime($date); |
| 461 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 522 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 523 | + return array(); |
|
| 524 | + } |
|
| 462 | 525 | $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'); |
| 463 | 526 | $data = $Common->getData($url); |
| 464 | 527 | if ($data != '') { |
@@ -474,7 +537,9 @@ discard block |
||
| 474 | 537 | $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
| 475 | 538 | $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
| 476 | 539 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
| 477 | - } else return array(); |
|
| 540 | + } else { |
|
| 541 | + return array(); |
|
| 542 | + } |
|
| 478 | 543 | } |
| 479 | 544 | |
| 480 | 545 | |
@@ -494,7 +559,9 @@ discard block |
||
| 494 | 559 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 495 | 560 | $check_date = new Datetime($date); |
| 496 | 561 | $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
| 497 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 562 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 563 | + return array(); |
|
| 564 | + } |
|
| 498 | 565 | $data = $Common->getData($url); |
| 499 | 566 | if ($data != '') { |
| 500 | 567 | $table = $Common->text2array($data); |
@@ -518,7 +585,9 @@ discard block |
||
| 518 | 585 | $check_date = new Datetime($date); |
| 519 | 586 | $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"; |
| 520 | 587 | //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"; |
| 521 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 588 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 589 | + return array(); |
|
| 590 | + } |
|
| 522 | 591 | $data = $Common->getData($url); |
| 523 | 592 | if ($data != '') { |
| 524 | 593 | //echo $data; |
@@ -608,7 +677,9 @@ discard block |
||
| 608 | 677 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 609 | 678 | $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
| 610 | 679 | //$check_date = new Datetime($date); |
| 611 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 680 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 681 | + return array(); |
|
| 682 | + } |
|
| 612 | 683 | $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'); |
| 613 | 684 | $data = $Common->getData($url,'post',$post); |
| 614 | 685 | if ($data != '') { |
@@ -640,11 +711,15 @@ discard block |
||
| 640 | 711 | $airline_icao = substr($callsign, 0, 3); |
| 641 | 712 | } |
| 642 | 713 | } |
| 643 | - if ($airline_icao == '') return array(); |
|
| 714 | + if ($airline_icao == '') { |
|
| 715 | + return array(); |
|
| 716 | + } |
|
| 644 | 717 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 645 | 718 | $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
| 646 | 719 | //$check_date = new Datetime($date); |
| 647 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 720 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 721 | + return array(); |
|
| 722 | + } |
|
| 648 | 723 | $data = $Common->getData($url); |
| 649 | 724 | if ($data != '') { |
| 650 | 725 | $table = $Common->table2array($data); |
@@ -705,7 +780,9 @@ discard block |
||
| 705 | 780 | } |
| 706 | 781 | |
| 707 | 782 | $url= "http://flightaware.com/live/flight/".$callsign; |
| 708 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 783 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 784 | + return array(); |
|
| 785 | + } |
|
| 709 | 786 | $data = $Common->getData($url); |
| 710 | 787 | if ($data != '') { |
| 711 | 788 | preg_match(':<script>var trackpollBootstrap = (.*?);</script>:',$data,$result); |
@@ -737,10 +814,15 @@ discard block |
||
| 737 | 814 | if ($data != '') { |
| 738 | 815 | $table = $Common->table2array($data); |
| 739 | 816 | if (isset($table[11][1])) { |
| 740 | - if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5); |
|
| 817 | + if (is_numeric(substr($table[11][1],0,1))) { |
|
| 818 | + $departureTime = substr($table[11][1],0,5); |
|
| 819 | + } |
|
| 741 | 820 | $departureTime = ''; |
| 742 | - if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5); |
|
| 743 | - else $arrivalTime = ''; |
|
| 821 | + if (is_numeric(substr($table[17][1],0,1))) { |
|
| 822 | + $arrivalTime = substr($table[17][1],0,5); |
|
| 823 | + } else { |
|
| 824 | + $arrivalTime = ''; |
|
| 825 | + } |
|
| 744 | 826 | $DepartureAirportIata = substr($table[13][1],0,3); |
| 745 | 827 | $ArrivalAirportIata = substr($table[15][1],0,3); |
| 746 | 828 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
@@ -757,16 +839,22 @@ discard block |
||
| 757 | 839 | */ |
| 758 | 840 | private function getAirCanada($callsign,$date = 'NOW') { |
| 759 | 841 | $Common = new Common(); |
| 760 | - if (class_exists("DomDocument") === FALSE) return array(); |
|
| 842 | + if (class_exists("DomDocument") === FALSE) { |
|
| 843 | + return array(); |
|
| 844 | + } |
|
| 761 | 845 | date_default_timezone_set('UTC'); |
| 762 | 846 | $check_date = new Datetime($date); |
| 763 | 847 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 764 | 848 | $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"; |
| 765 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 849 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 850 | + return array(); |
|
| 851 | + } |
|
| 766 | 852 | $data = $Common->getData($url); |
| 767 | 853 | $dom = new DomDocument(); |
| 768 | 854 | $dom->loadXML($data); |
| 769 | - if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) return array(); |
|
| 855 | + if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) { |
|
| 856 | + return array(); |
|
| 857 | + } |
|
| 770 | 858 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
| 771 | 859 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
| 772 | 860 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
@@ -775,7 +863,9 @@ discard block |
||
| 775 | 863 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
| 776 | 864 | $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
| 777 | 865 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
| 778 | - } else return array(); |
|
| 866 | + } else { |
|
| 867 | + return array(); |
|
| 868 | + } |
|
| 779 | 869 | } |
| 780 | 870 | |
| 781 | 871 | /** |
@@ -789,7 +879,9 @@ discard block |
||
| 789 | 879 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 790 | 880 | $check_date = new Datetime($date); |
| 791 | 881 | $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."&"; |
| 792 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 882 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 883 | + return array(); |
|
| 884 | + } |
|
| 793 | 885 | $data = $Common->getData($url); |
| 794 | 886 | if ($data != '') { |
| 795 | 887 | $table = $Common->table2array($data); |
@@ -818,7 +910,9 @@ discard block |
||
| 818 | 910 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
| 819 | 911 | $check_date = new Datetime($date); |
| 820 | 912 | $url= "http://www.airberlin.com/en-US/site/aims.php"; |
| 821 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
| 913 | + if (!filter_var($numvol,FILTER_VALIDATE_INT)) { |
|
| 914 | + return array(); |
|
| 915 | + } |
|
| 822 | 916 | $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
| 823 | 917 | $data = $Common->getData($url,'post',$post); |
| 824 | 918 | //echo $data; |
@@ -828,11 +922,19 @@ discard block |
||
| 828 | 922 | if ($data != '') { |
| 829 | 923 | $table = $Common->table2array($data); |
| 830 | 924 | $flight = $table; |
| 831 | - if (isset($flight[5][4])) $departureTime = $flight[5][4]; |
|
| 832 | - else $departureTime = ''; |
|
| 833 | - if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
|
| 834 | - else $departureAirport = ''; |
|
| 835 | - } else return array(); |
|
| 925 | + if (isset($flight[5][4])) { |
|
| 926 | + $departureTime = $flight[5][4]; |
|
| 927 | + } else { |
|
| 928 | + $departureTime = ''; |
|
| 929 | + } |
|
| 930 | + if (isset($flight[5][2])) { |
|
| 931 | + $departureAirport = $flight[5][2]; |
|
| 932 | + } else { |
|
| 933 | + $departureAirport = ''; |
|
| 934 | + } |
|
| 935 | + } else { |
|
| 936 | + return array(); |
|
| 937 | + } |
|
| 836 | 938 | $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
| 837 | 939 | $data = $Common->getData($url,'post',$post); |
| 838 | 940 | if ($data != '') { |
@@ -845,10 +947,14 @@ discard block |
||
| 845 | 947 | $arrivalTime = ''; |
| 846 | 948 | $arrivalAirport = ''; |
| 847 | 949 | } |
| 848 | - } else return array(); |
|
| 950 | + } else { |
|
| 951 | + return array(); |
|
| 952 | + } |
|
| 849 | 953 | $url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner'; |
| 850 | 954 | $json = $Common->getData($url); |
| 851 | - if ($json == '') return array(); |
|
| 955 | + if ($json == '') { |
|
| 956 | + return array(); |
|
| 957 | + } |
|
| 852 | 958 | $parsed_json = json_decode($json); |
| 853 | 959 | $airports = $parsed_json->{'suggestList'}; |
| 854 | 960 | if (count($airports) > 0) { |
@@ -863,7 +969,9 @@ discard block |
||
| 863 | 969 | } |
| 864 | 970 | if (isset($DepartureAirportIata)) { |
| 865 | 971 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
| 866 | - } else return array(); |
|
| 972 | + } else { |
|
| 973 | + return array(); |
|
| 974 | + } |
|
| 867 | 975 | } |
| 868 | 976 | |
| 869 | 977 | |
@@ -871,7 +979,9 @@ discard block |
||
| 871 | 979 | public function fetchSchedule($ident,$date = 'NOW') { |
| 872 | 980 | global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline; |
| 873 | 981 | //$Common = new Common(); |
| 874 | - if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array(); |
|
| 982 | + if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) { |
|
| 983 | + return array(); |
|
| 984 | + } |
|
| 875 | 985 | $airline_icao = ''; |
| 876 | 986 | if (!is_numeric(substr($ident, 0, 3))) |
| 877 | 987 | { |
@@ -1099,14 +1209,21 @@ discard block |
||
| 1099 | 1209 | default: |
| 1100 | 1210 | // Randomly use a generic function to get hours |
| 1101 | 1211 | if (strlen($airline_icao) == 2) { |
| 1102 | - if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1212 | + if (!isset($globalSchedulesSources)) { |
|
| 1213 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1214 | + } |
|
| 1103 | 1215 | if (count($globalSchedulesSources) > 0) { |
| 1104 | 1216 | $rand = mt_rand(0,count($globalSchedulesSources)-1); |
| 1105 | 1217 | $source = $globalSchedulesSources[$rand]; |
| 1106 | - if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
|
| 1107 | - elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |
|
| 1218 | + if ($source == 'flightmapper') { |
|
| 1219 | + return $this->getFlightMapper($ident); |
|
| 1220 | + } elseif ($source == 'costtotravel') { |
|
| 1221 | + return $this->getCostToTravel($ident); |
|
| 1222 | + } |
|
| 1108 | 1223 | //elseif ($source == 'flightradar24') return $this->getFlightRadar24($ident,$date); |
| 1109 | - elseif ($source == 'flightaware') return $this->getFlightAware($ident); |
|
| 1224 | + elseif ($source == 'flightaware') { |
|
| 1225 | + return $this->getFlightAware($ident); |
|
| 1226 | + } |
|
| 1110 | 1227 | } |
| 1111 | 1228 | } |
| 1112 | 1229 | } |
@@ -4,11 +4,19 @@ discard block |
||
| 4 | 4 | if (isset($_SESSION['error'])) { |
| 5 | 5 | header('Content-Encoding: none;'); |
| 6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
| 7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
| 8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
| 9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
| 10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
| 11 | -} |
|
| 7 | + if (isset($_SESSION['error'])) { |
|
| 8 | + unset($_SESSION['error']); |
|
| 9 | + } |
|
| 10 | + if (isset($_SESSION['errorlst'])) { |
|
| 11 | + unset($_SESSION['errorlst']); |
|
| 12 | + } |
|
| 13 | + if (isset($_SESSION['next'])) { |
|
| 14 | + unset($_SESSION['next']); |
|
| 15 | + } |
|
| 16 | + if (isset($_SESSION['install'])) { |
|
| 17 | + unset($_SESSION['install']); |
|
| 18 | + } |
|
| 19 | + } |
|
| 12 | 20 | /* |
| 13 | 21 | if (isset($_SESSION['errorlst'])) { |
| 14 | 22 | header('Content-Encoding: none;'); |
@@ -159,45 +167,72 @@ discard block |
||
| 159 | 167 | </div> |
| 160 | 168 | <p> |
| 161 | 169 | <label for="dbhost">Database hostname</label> |
| 162 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 170 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 171 | + print $globalDBhost; |
|
| 172 | +} |
|
| 173 | +?>" /> |
|
| 163 | 174 | </p> |
| 164 | 175 | <p> |
| 165 | 176 | <label for="dbport">Database port</label> |
| 166 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 177 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 178 | + print $globalDBport; |
|
| 179 | +} |
|
| 180 | +?>" /> |
|
| 167 | 181 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 168 | 182 | </p> |
| 169 | 183 | <p> |
| 170 | 184 | <label for="dbname">Database name</label> |
| 171 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 185 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 186 | + print $globalDBname; |
|
| 187 | +} |
|
| 188 | +?>" /> |
|
| 172 | 189 | </p> |
| 173 | 190 | <p> |
| 174 | 191 | <label for="dbuser">Database user</label> |
| 175 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 192 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 193 | + print $globalDBuser; |
|
| 194 | +} |
|
| 195 | +?>" /> |
|
| 176 | 196 | </p> |
| 177 | 197 | <p> |
| 178 | 198 | <label for="dbuserpass">Database user password</label> |
| 179 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 199 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 200 | + print $globalDBpass; |
|
| 201 | +} |
|
| 202 | +?>" /> |
|
| 180 | 203 | </p> |
| 181 | 204 | </fieldset> |
| 182 | 205 | <fieldset id="site"> |
| 183 | 206 | <legend>Site configuration</legend> |
| 184 | 207 | <p> |
| 185 | 208 | <label for="sitename">Site name</label> |
| 186 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 209 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 210 | + print $globalName; |
|
| 211 | +} |
|
| 212 | +?>" /> |
|
| 187 | 213 | </p> |
| 188 | 214 | <p> |
| 189 | 215 | <label for="siteurl">Site directory</label> |
| 190 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 216 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 217 | + print $globalURL; |
|
| 218 | +} |
|
| 219 | +?>" /> |
|
| 191 | 220 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 192 | 221 | </p> |
| 193 | 222 | <p> |
| 194 | 223 | <label for="timezone">Timezone</label> |
| 195 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 224 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 225 | + print $globalTimezone; |
|
| 226 | +} |
|
| 227 | +?>" /> |
|
| 196 | 228 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 197 | 229 | </p> |
| 198 | 230 | <p> |
| 199 | 231 | <label for="language">Language</label> |
| 200 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 232 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 233 | + print $globalLanguage; |
|
| 234 | +} |
|
| 235 | +?>" /> |
|
| 201 | 236 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 202 | 237 | </p> |
| 203 | 238 | </fieldset> |
@@ -218,11 +253,17 @@ discard block |
||
| 218 | 253 | <div id="mapbox_data"> |
| 219 | 254 | <p> |
| 220 | 255 | <label for="mapboxid">Mapbox id</label> |
| 221 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 256 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 257 | + print $globalMapboxId; |
|
| 258 | +} |
|
| 259 | +?>" /> |
|
| 222 | 260 | </p> |
| 223 | 261 | <p> |
| 224 | 262 | <label for="mapboxtoken">Mapbox token</label> |
| 225 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 263 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 264 | + print $globalMapboxToken; |
|
| 265 | +} |
|
| 266 | +?>" /> |
|
| 226 | 267 | </p> |
| 227 | 268 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 228 | 269 | </div> |
@@ -230,7 +271,10 @@ discard block |
||
| 230 | 271 | <div id="google_data"> |
| 231 | 272 | <p> |
| 232 | 273 | <label for="googlekey">Google API key</label> |
| 233 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 274 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 275 | + print $globalGoogleAPIKey; |
|
| 276 | +} |
|
| 277 | +?>" /> |
|
| 234 | 278 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 235 | 279 | </p> |
| 236 | 280 | </div> |
@@ -238,7 +282,10 @@ discard block |
||
| 238 | 282 | <div id="bing_data"> |
| 239 | 283 | <p> |
| 240 | 284 | <label for="bingkey">Bing Map key</label> |
| 241 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 285 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 286 | + print $globalBingMapKey; |
|
| 287 | +} |
|
| 288 | +?>" /> |
|
| 242 | 289 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 243 | 290 | </p> |
| 244 | 291 | </div> |
@@ -246,7 +293,10 @@ discard block |
||
| 246 | 293 | <div id="mapquest_data"> |
| 247 | 294 | <p> |
| 248 | 295 | <label for="mapquestkey">MapQuest key</label> |
| 249 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 296 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 297 | + print $globalMapQuestKey; |
|
| 298 | +} |
|
| 299 | +?>" /> |
|
| 250 | 300 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 251 | 301 | </p> |
| 252 | 302 | </div> |
@@ -254,11 +304,17 @@ discard block |
||
| 254 | 304 | <div id="here_data"> |
| 255 | 305 | <p> |
| 256 | 306 | <label for="hereappid">Here App_Id</label> |
| 257 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 307 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 308 | + print $globalHereappId; |
|
| 309 | +} |
|
| 310 | +?>" /> |
|
| 258 | 311 | </p> |
| 259 | 312 | <p> |
| 260 | 313 | <label for="hereappcode">Here App_Code</label> |
| 261 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 314 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 315 | + print $globalHereappCode; |
|
| 316 | +} |
|
| 317 | +?>" /> |
|
| 262 | 318 | </p> |
| 263 | 319 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 264 | 320 | </div> |
@@ -266,7 +322,10 @@ discard block |
||
| 266 | 322 | <div id="openweathermap_data"> |
| 267 | 323 | <p> |
| 268 | 324 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 269 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 325 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 326 | + print $globalOpenWeatherMapKey; |
|
| 327 | +} |
|
| 328 | +?>" /> |
|
| 270 | 329 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 271 | 330 | </p> |
| 272 | 331 | </div> |
@@ -295,42 +354,86 @@ discard block |
||
| 295 | 354 | <legend>Coverage area</legend> |
| 296 | 355 | <p> |
| 297 | 356 | <label for="latitudemax">The maximum latitude (north)</label> |
| 298 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 357 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 358 | + print $globalLatitudeMax; |
|
| 359 | +} |
|
| 360 | +?>" /> |
|
| 299 | 361 | </p> |
| 300 | 362 | <p> |
| 301 | 363 | <label for="latitudemin">The minimum latitude (south)</label> |
| 302 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 364 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 365 | + print $globalLatitudeMin; |
|
| 366 | +} |
|
| 367 | +?>" /> |
|
| 303 | 368 | </p> |
| 304 | 369 | <p> |
| 305 | 370 | <label for="longitudemax">The maximum longitude (west)</label> |
| 306 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 371 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 372 | + print $globalLongitudeMax; |
|
| 373 | +} |
|
| 374 | +?>" /> |
|
| 307 | 375 | </p> |
| 308 | 376 | <p> |
| 309 | 377 | <label for="longitudemin">The minimum longitude (east)</label> |
| 310 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 378 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 379 | + print $globalLongitudeMin; |
|
| 380 | +} |
|
| 381 | +?>" /> |
|
| 311 | 382 | </p> |
| 312 | 383 | <p> |
| 313 | 384 | <label for="latitudecenter">The latitude center</label> |
| 314 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 385 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 386 | + print $globalCenterLatitude; |
|
| 387 | +} |
|
| 388 | +?>" /> |
|
| 315 | 389 | </p> |
| 316 | 390 | <p> |
| 317 | 391 | <label for="longitudecenter">The longitude center</label> |
| 318 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 392 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 393 | + print $globalCenterLongitude; |
|
| 394 | +} |
|
| 395 | +?>" /> |
|
| 319 | 396 | </p> |
| 320 | 397 | <p> |
| 321 | 398 | <label for="livezoom">Default Zoom on live map</label> |
| 322 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 399 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 400 | + print $globalLiveZoom; |
|
| 401 | +} else { |
|
| 402 | + print '9'; |
|
| 403 | +} |
|
| 404 | +?>" /> |
|
| 323 | 405 | </p> |
| 324 | 406 | <p> |
| 325 | 407 | <label for="squawk_country">Country for squawk usage</label> |
| 326 | 408 | <select name="squawk_country" id="squawk_country"> |
| 327 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 328 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 329 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 330 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 331 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 332 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 333 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 409 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 410 | + print ' selected '; |
|
| 411 | +} |
|
| 412 | +?>>UK</option> |
|
| 413 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 414 | + print ' selected '; |
|
| 415 | +} |
|
| 416 | +?>>NZ</option> |
|
| 417 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 418 | + print ' selected '; |
|
| 419 | +} |
|
| 420 | +?>>US</option> |
|
| 421 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 422 | + print ' selected '; |
|
| 423 | +} |
|
| 424 | +?>>AU</option> |
|
| 425 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 426 | + print ' selected '; |
|
| 427 | +} |
|
| 428 | +?>>NL</option> |
|
| 429 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 430 | + print ' selected '; |
|
| 431 | +} |
|
| 432 | +?>>FR</option> |
|
| 433 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 434 | + print ' selected '; |
|
| 435 | +} |
|
| 436 | +?>>TR</option> |
|
| 334 | 437 | </select> |
| 335 | 438 | </p> |
| 336 | 439 | </fieldset> |
@@ -339,15 +442,24 @@ discard block |
||
| 339 | 442 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 340 | 443 | <p> |
| 341 | 444 | <label for="latitude">Center latitude</label> |
| 342 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 445 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 446 | + echo $globalDistanceIgnore['latitude']; |
|
| 447 | +} |
|
| 448 | +?>" /> |
|
| 343 | 449 | </p> |
| 344 | 450 | <p> |
| 345 | 451 | <label for="longitude">Center longitude</label> |
| 346 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 452 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 453 | + echo $globalDistanceIgnore['longitude']; |
|
| 454 | +} |
|
| 455 | +?>" /> |
|
| 347 | 456 | </p> |
| 348 | 457 | <p> |
| 349 | 458 | <label for="Distance">Distance (in km)</label> |
| 350 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 459 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 460 | + echo $globalDistanceIgnore['distance']; |
|
| 461 | +} |
|
| 462 | +?>" /> |
|
| 351 | 463 | </p> |
| 352 | 464 | </fieldset> |
| 353 | 465 | <fieldset id="sourceloc"> |
@@ -460,11 +572,17 @@ discard block |
||
| 460 | 572 | <div id="flightaware_data"> |
| 461 | 573 | <p> |
| 462 | 574 | <label for="flightawareusername">FlightAware username</label> |
| 463 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 575 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 576 | + print $globalFlightAwareUsername; |
|
| 577 | +} |
|
| 578 | +?>" /> |
|
| 464 | 579 | </p> |
| 465 | 580 | <p> |
| 466 | 581 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 467 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 582 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 583 | + print $globalFlightAwarePassword; |
|
| 584 | +} |
|
| 585 | +?>" /> |
|
| 468 | 586 | </p> |
| 469 | 587 | </div> |
| 470 | 588 | --> |
@@ -506,7 +624,10 @@ discard block |
||
| 506 | 624 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 507 | 625 | ?> |
| 508 | 626 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 509 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 627 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
| 628 | + print $source['port']; |
|
| 629 | +} |
|
| 630 | +?>" /></td> |
|
| 510 | 631 | <?php |
| 511 | 632 | } else { |
| 512 | 633 | $hostport = explode(':',$source['host']); |
@@ -525,34 +646,106 @@ discard block |
||
| 525 | 646 | ?> |
| 526 | 647 | <td> |
| 527 | 648 | <select name="format[]" id="format"> |
| 528 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 529 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 530 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 531 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 532 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 533 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 534 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 535 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 536 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 537 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 538 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 539 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 540 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 541 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 542 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 543 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 544 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 545 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 546 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 547 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 548 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 649 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 650 | + print 'selected'; |
|
| 651 | +} |
|
| 652 | +?>>Auto</option> |
|
| 653 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 654 | + print 'selected'; |
|
| 655 | +} |
|
| 656 | +?>>SBS</option> |
|
| 657 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 658 | + print 'selected'; |
|
| 659 | +} |
|
| 660 | +?>>TSV</option> |
|
| 661 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 662 | + print 'selected'; |
|
| 663 | +} |
|
| 664 | +?>>Raw</option> |
|
| 665 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 666 | + print 'selected'; |
|
| 667 | +} |
|
| 668 | +?>>APRS</option> |
|
| 669 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 670 | + print 'selected'; |
|
| 671 | +} |
|
| 672 | +?>>Radarcape deltadb.txt</option> |
|
| 673 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 674 | + print 'selected'; |
|
| 675 | +} |
|
| 676 | +?>>Vatsim</option> |
|
| 677 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 678 | + print 'selected'; |
|
| 679 | +} |
|
| 680 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 681 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 682 | + print 'selected'; |
|
| 683 | +} |
|
| 684 | +?>>Virtual Radar Server TCP</option> |
|
| 685 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 686 | + print 'selected'; |
|
| 687 | +} |
|
| 688 | +?>>phpVMS</option> |
|
| 689 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 690 | + print 'selected'; |
|
| 691 | +} |
|
| 692 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 693 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 694 | + print 'selected'; |
|
| 695 | +} |
|
| 696 | +?>>Virtual Airlines Manager</option> |
|
| 697 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 698 | + print 'selected'; |
|
| 699 | +} |
|
| 700 | +?>>IVAO</option> |
|
| 701 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 702 | + print 'selected'; |
|
| 703 | +} |
|
| 704 | +?>>FlightGear Multiplayer</option> |
|
| 705 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 706 | + print 'selected'; |
|
| 707 | +} |
|
| 708 | +?>>FlightGear Singleplayer</option> |
|
| 709 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 710 | + print 'selected'; |
|
| 711 | +} |
|
| 712 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 713 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 714 | + print 'selected'; |
|
| 715 | +} |
|
| 716 | +?>>ACARS SBS-3 over TCP</option> |
|
| 717 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 718 | + print 'selected'; |
|
| 719 | +} |
|
| 720 | +?>>NMEA AIS over TCP</option> |
|
| 721 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 722 | + print 'selected'; |
|
| 723 | +} |
|
| 724 | +?>>AirWhere website</option> |
|
| 725 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 726 | + print 'selected'; |
|
| 727 | +} |
|
| 728 | +?>>HidnSeek Callback</option> |
|
| 729 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 730 | + print 'selected'; |
|
| 731 | +} |
|
| 732 | +?>>Blitzortung</option> |
|
| 549 | 733 | </select> |
| 550 | 734 | </td> |
| 551 | 735 | <td> |
| 552 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 736 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 737 | + print $source['name']; |
|
| 738 | +} |
|
| 739 | +?>" /> |
|
| 553 | 740 | </td> |
| 554 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 555 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 741 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 742 | + print 'checked'; |
|
| 743 | +} |
|
| 744 | +?> /></td> |
|
| 745 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 746 | + print 'checked'; |
|
| 747 | +} |
|
| 748 | +?> /></td> |
|
| 556 | 749 | <td> |
| 557 | 750 | <select name="timezones[]" id="timezones"> |
| 558 | 751 | <?php |
@@ -562,7 +755,9 @@ discard block |
||
| 562 | 755 | print '<option selected>'.$timezones.'</option>'; |
| 563 | 756 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 564 | 757 | print '<option selected>'.$timezones.'</option>'; |
| 565 | - } else print '<option>'.$timezones.'</option>'; |
|
| 758 | + } else { |
|
| 759 | + print '<option>'.$timezones.'</option>'; |
|
| 760 | + } |
|
| 566 | 761 | } |
| 567 | 762 | ?> |
| 568 | 763 | </select> |
@@ -613,7 +808,9 @@ discard block |
||
| 613 | 808 | foreach($timezonelist as $timezones){ |
| 614 | 809 | if ($timezones == 'UTC') { |
| 615 | 810 | print '<option selected>'.$timezones.'</option>'; |
| 616 | - } else print '<option>'.$timezones.'</option>'; |
|
| 811 | + } else { |
|
| 812 | + print '<option>'.$timezones.'</option>'; |
|
| 813 | + } |
|
| 617 | 814 | } |
| 618 | 815 | ?> |
| 619 | 816 | </select> |
@@ -637,11 +834,17 @@ discard block |
||
| 637 | 834 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 638 | 835 | <p> |
| 639 | 836 | <label for="acarshost">ACARS UDP host</label> |
| 640 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 837 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 838 | + print $globalACARSHost; |
|
| 839 | +} |
|
| 840 | +?>" /> |
|
| 641 | 841 | </p> |
| 642 | 842 | <p> |
| 643 | 843 | <label for="acarsport">ACARS UDP port</label> |
| 644 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 844 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 845 | + print $globalACARSPort; |
|
| 846 | +} |
|
| 847 | +?>" /> |
|
| 645 | 848 | </p> |
| 646 | 849 | </fieldset> |
| 647 | 850 | </div> |
@@ -667,17 +870,38 @@ discard block |
||
| 667 | 870 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
| 668 | 871 | <td> |
| 669 | 872 | <select name="newslang[]"> |
| 670 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
| 671 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
| 873 | + <option value="en"<?php if ($lng == 'en') { |
|
| 874 | + print ' selected'; |
|
| 875 | +} |
|
| 876 | +?>>English</option> |
|
| 877 | + <option value="fr"<?php if ($lng == 'fr') { |
|
| 878 | + print ' selected'; |
|
| 879 | +} |
|
| 880 | +?>>French</option> |
|
| 672 | 881 | </select> |
| 673 | 882 | </td> |
| 674 | 883 | <td> |
| 675 | 884 | <select name="newstype[]"> |
| 676 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
| 677 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
| 678 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
| 679 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
| 680 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
| 885 | + <option value="global"<?php if ($type == 'global') { |
|
| 886 | + print ' selected'; |
|
| 887 | +} |
|
| 888 | +?>>Global</option> |
|
| 889 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
| 890 | + print ' selected'; |
|
| 891 | +} |
|
| 892 | +?>>Aircraft</option> |
|
| 893 | + <option value="marine"<?php if ($type == 'marine') { |
|
| 894 | + print ' selected'; |
|
| 895 | +} |
|
| 896 | +?>>Marine</option> |
|
| 897 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
| 898 | + print ' selected'; |
|
| 899 | +} |
|
| 900 | +?>>Tracker</option> |
|
| 901 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
| 902 | + print ' selected'; |
|
| 903 | +} |
|
| 904 | +?>>Satellite</option> |
|
| 681 | 905 | </select> |
| 682 | 906 | </td> |
| 683 | 907 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -810,13 +1034,19 @@ discard block |
||
| 810 | 1034 | <div id="schedules_options"> |
| 811 | 1035 | <p> |
| 812 | 1036 | <label for="britishairways">British Airways API Key</label> |
| 813 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 1037 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 1038 | + print $globalBritishAirwaysKey; |
|
| 1039 | +} |
|
| 1040 | +?>" /> |
|
| 814 | 1041 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 815 | 1042 | </p> |
| 816 | 1043 | <!-- |
| 817 | 1044 | <p> |
| 818 | 1045 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 819 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 1046 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 1047 | + print $globalTransaviaKey; |
|
| 1048 | +} |
|
| 1049 | +?>" /> |
|
| 820 | 1050 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 821 | 1051 | </p> |
| 822 | 1052 | --> |
@@ -825,10 +1055,16 @@ discard block |
||
| 825 | 1055 | <b>Lufthansa API Key</b> |
| 826 | 1056 | <p> |
| 827 | 1057 | <label for="lufthansakey">Key</label> |
| 828 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 1058 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 1059 | + print $globalLufthansaKey['key']; |
|
| 1060 | +} |
|
| 1061 | +?>" /> |
|
| 829 | 1062 | </p><p> |
| 830 | 1063 | <label for="lufthansasecret">Secret</label> |
| 831 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 1064 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 1065 | + print $globalLufthansaKey['secret']; |
|
| 1066 | +} |
|
| 1067 | +?>" /> |
|
| 832 | 1068 | </p> |
| 833 | 1069 | </div> |
| 834 | 1070 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -838,11 +1074,17 @@ discard block |
||
| 838 | 1074 | <b>FlightAware API Key</b> |
| 839 | 1075 | <p> |
| 840 | 1076 | <label for="flightawareusername">Username</label> |
| 841 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 1077 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 1078 | + print $globalFlightAwareUsername; |
|
| 1079 | +} |
|
| 1080 | +?>" /> |
|
| 842 | 1081 | </p> |
| 843 | 1082 | <p> |
| 844 | 1083 | <label for="flightawarepassword">API key</label> |
| 845 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 1084 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 1085 | + print $globalFlightAwarePassword; |
|
| 1086 | +} |
|
| 1087 | +?>" /> |
|
| 846 | 1088 | </p> |
| 847 | 1089 | </div> |
| 848 | 1090 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -862,7 +1104,10 @@ discard block |
||
| 862 | 1104 | </p> |
| 863 | 1105 | <p> |
| 864 | 1106 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 865 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 1107 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 1108 | + print $globalNOTAMSource; |
|
| 1109 | +} |
|
| 1110 | +?>" /> |
|
| 866 | 1111 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 867 | 1112 | </p> |
| 868 | 1113 | <br /> |
@@ -878,14 +1123,20 @@ discard block |
||
| 878 | 1123 | <div id="metarsrc"> |
| 879 | 1124 | <p> |
| 880 | 1125 | <label for="metarsource">URL of your METAR source</label> |
| 881 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 1126 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 1127 | + print $globalMETARurl; |
|
| 1128 | +} |
|
| 1129 | +?>" /> |
|
| 882 | 1130 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 883 | 1131 | </p> |
| 884 | 1132 | </div> |
| 885 | 1133 | <br /> |
| 886 | 1134 | <p> |
| 887 | 1135 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 888 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1136 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1137 | + print $globalBitlyAccessToken; |
|
| 1138 | +} |
|
| 1139 | +?>" /> |
|
| 889 | 1140 | </p> |
| 890 | 1141 | <br /> |
| 891 | 1142 | <p> |
@@ -901,11 +1152,26 @@ discard block |
||
| 901 | 1152 | <p> |
| 902 | 1153 | <label for="geoid_source">Geoid Source</label> |
| 903 | 1154 | <select name="geoid_source" id="geoid_source"> |
| 904 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 905 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 906 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 907 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 908 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1155 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1156 | + print ' selected="selected"'; |
|
| 1157 | +} |
|
| 1158 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1159 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1160 | + print ' selected="selected"'; |
|
| 1161 | +} |
|
| 1162 | +?>>EGM96 5' (19MB)</option> |
|
| 1163 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1164 | + print ' selected="selected"'; |
|
| 1165 | +} |
|
| 1166 | +?>>EGM2008 5' (19MB)</option> |
|
| 1167 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1168 | + print ' selected="selected"'; |
|
| 1169 | +} |
|
| 1170 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1171 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1172 | + print ' selected="selected"'; |
|
| 1173 | +} |
|
| 1174 | +?>>EGM2008 1' (470MB)</option> |
|
| 909 | 1175 | </select> |
| 910 | 1176 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 911 | 1177 | </p> |
@@ -927,7 +1193,12 @@ discard block |
||
| 927 | 1193 | </p> |
| 928 | 1194 | <p> |
| 929 | 1195 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 930 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1196 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1197 | + print $globalArchiveMonths; |
|
| 1198 | +} else { |
|
| 1199 | + echo '1'; |
|
| 1200 | +} |
|
| 1201 | +?>" /> |
|
| 931 | 1202 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 932 | 1203 | </p> |
| 933 | 1204 | <p> |
@@ -937,12 +1208,22 @@ discard block |
||
| 937 | 1208 | </p> |
| 938 | 1209 | <p> |
| 939 | 1210 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 940 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1211 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1212 | + print $globalArchiveKeepMonths; |
|
| 1213 | +} else { |
|
| 1214 | + echo '1'; |
|
| 1215 | +} |
|
| 1216 | +?>" /> |
|
| 941 | 1217 | <p class="help-block">0 to disable</p> |
| 942 | 1218 | </p> |
| 943 | 1219 | <p> |
| 944 | 1220 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 945 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1221 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1222 | + print $globalArchiveKeepTrackMonths; |
|
| 1223 | +} else { |
|
| 1224 | + echo '1'; |
|
| 1225 | +} |
|
| 1226 | +?>" /> |
|
| 946 | 1227 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 947 | 1228 | </p> |
| 948 | 1229 | <br /> |
@@ -952,7 +1233,12 @@ discard block |
||
| 952 | 1233 | <p class="help-block">Uncheck if the script is running as cron job</p> |
| 953 | 1234 | <div id="cronends"> |
| 954 | 1235 | <label for="cronend">Run script for xx seconds</label> |
| 955 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1236 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1237 | + print $globalCronEnd; |
|
| 1238 | +} else { |
|
| 1239 | + print '0'; |
|
| 1240 | +} |
|
| 1241 | +?>" /> |
|
| 956 | 1242 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 957 | 1243 | </div> |
| 958 | 1244 | </p> |
@@ -1005,15 +1291,30 @@ discard block |
||
| 1005 | 1291 | <br /> |
| 1006 | 1292 | <p> |
| 1007 | 1293 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 1008 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1294 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1295 | + echo $globalLiveInterval; |
|
| 1296 | +} else { |
|
| 1297 | + echo '200'; |
|
| 1298 | +} |
|
| 1299 | +?>" /> |
|
| 1009 | 1300 | </p> |
| 1010 | 1301 | <p> |
| 1011 | 1302 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 1012 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1303 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1304 | + echo $globalMapRefresh; |
|
| 1305 | +} else { |
|
| 1306 | + echo '30'; |
|
| 1307 | +} |
|
| 1308 | +?>" /> |
|
| 1013 | 1309 | </p> |
| 1014 | 1310 | <p> |
| 1015 | 1311 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 1016 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1312 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1313 | + echo $globalMapIdleTimeout; |
|
| 1314 | +} else { |
|
| 1315 | + echo '30'; |
|
| 1316 | +} |
|
| 1317 | +?>" /> |
|
| 1017 | 1318 | <p class="help-block">0 to disable</p> |
| 1018 | 1319 | </p> |
| 1019 | 1320 | <p> |
@@ -1028,12 +1329,20 @@ discard block |
||
| 1028 | 1329 | <br /> |
| 1029 | 1330 | <p> |
| 1030 | 1331 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 1031 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1332 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1333 | + echo $globalClosestMinDist; |
|
| 1334 | +} else { |
|
| 1335 | + echo '50'; |
|
| 1336 | +} |
|
| 1337 | +?>" /> |
|
| 1032 | 1338 | </p> |
| 1033 | 1339 | <br /> |
| 1034 | 1340 | <p> |
| 1035 | 1341 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1036 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1342 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1343 | + echo $globalAircraftSize; |
|
| 1344 | +} |
|
| 1345 | +?>" /> |
|
| 1037 | 1346 | </p> |
| 1038 | 1347 | <br /> |
| 1039 | 1348 | <p> |
@@ -1052,7 +1361,12 @@ discard block |
||
| 1052 | 1361 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 1053 | 1362 | ?> |
| 1054 | 1363 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 1055 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1364 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1365 | + echo $globalAircraftIconColor; |
|
| 1366 | +} else { |
|
| 1367 | + echo '1a3151'; |
|
| 1368 | +} |
|
| 1369 | +?>" /> |
|
| 1056 | 1370 | <?php |
| 1057 | 1371 | if (!is_writable('../cache')) { |
| 1058 | 1372 | ?> |
@@ -1070,14 +1384,27 @@ discard block |
||
| 1070 | 1384 | <p> |
| 1071 | 1385 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 1072 | 1386 | <div class="range"> |
| 1073 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 1074 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1387 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1388 | + echo $globalAirportZoom; |
|
| 1389 | +} else { |
|
| 1390 | + echo '7'; |
|
| 1391 | +} |
|
| 1392 | +?>" /> |
|
| 1393 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1394 | + echo $globalAirportZoom; |
|
| 1395 | +} else { |
|
| 1396 | + echo '7'; |
|
| 1397 | +} |
|
| 1398 | +?></output> |
|
| 1075 | 1399 | </div> |
| 1076 | 1400 | </p> |
| 1077 | 1401 | <br /> |
| 1078 | 1402 | <p> |
| 1079 | 1403 | <label for="customcss">Custom CSS web path</label> |
| 1080 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1404 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1405 | + echo $globalCustomCSS; |
|
| 1406 | +} |
|
| 1407 | +?>" /> |
|
| 1081 | 1408 | </p> |
| 1082 | 1409 | </fieldset> |
| 1083 | 1410 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1104,8 +1431,12 @@ discard block |
||
| 1104 | 1431 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 1105 | 1432 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 1106 | 1433 | |
| 1107 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1108 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1434 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1435 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1436 | + } |
|
| 1437 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1438 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1439 | + } |
|
| 1109 | 1440 | |
| 1110 | 1441 | $_SESSION['database_root'] = $dbroot; |
| 1111 | 1442 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1173,15 +1504,23 @@ discard block |
||
| 1173 | 1504 | $source_city = $_POST['source_city']; |
| 1174 | 1505 | $source_country = $_POST['source_country']; |
| 1175 | 1506 | $source_ref = $_POST['source_ref']; |
| 1176 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1177 | - else $source_id = array(); |
|
| 1507 | + if (isset($source_id)) { |
|
| 1508 | + $source_id = $_POST['source_id']; |
|
| 1509 | + } else { |
|
| 1510 | + $source_id = array(); |
|
| 1511 | + } |
|
| 1178 | 1512 | |
| 1179 | 1513 | $sources = array(); |
| 1180 | 1514 | foreach ($source_name as $keys => $name) { |
| 1181 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1182 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1515 | + if (isset($source_id[$keys])) { |
|
| 1516 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1517 | + } else { |
|
| 1518 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1519 | + } |
|
| 1520 | + } |
|
| 1521 | + if (count($sources) > 0) { |
|
| 1522 | + $_SESSION['sources'] = $sources; |
|
| 1183 | 1523 | } |
| 1184 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1185 | 1524 | |
| 1186 | 1525 | $newsurl = $_POST['newsurl']; |
| 1187 | 1526 | $newslng = $_POST['newslang']; |
@@ -1194,7 +1533,9 @@ discard block |
||
| 1194 | 1533 | $lng = $newslng[$newskey]; |
| 1195 | 1534 | if (isset($newsfeeds[$type][$lng])) { |
| 1196 | 1535 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
| 1197 | - } else $newsfeeds[$type][$lng] = array($url); |
|
| 1536 | + } else { |
|
| 1537 | + $newsfeeds[$type][$lng] = array($url); |
|
| 1538 | + } |
|
| 1198 | 1539 | } |
| 1199 | 1540 | } |
| 1200 | 1541 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1218,17 +1559,29 @@ discard block |
||
| 1218 | 1559 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1219 | 1560 | |
| 1220 | 1561 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1221 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1222 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1562 | + if ($globalaircraft == 'aircraft') { |
|
| 1563 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1564 | + } else { |
|
| 1565 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1566 | + } |
|
| 1223 | 1567 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1224 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1225 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1568 | + if ($globaltracker == 'tracker') { |
|
| 1569 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1570 | + } else { |
|
| 1571 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1572 | + } |
|
| 1226 | 1573 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1227 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1228 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1574 | + if ($globalmarine == 'marine') { |
|
| 1575 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1576 | + } else { |
|
| 1577 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1578 | + } |
|
| 1229 | 1579 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1230 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1231 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1580 | + if ($globalsatellite == 'satellite') { |
|
| 1581 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1582 | + } else { |
|
| 1583 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1584 | + } |
|
| 1232 | 1585 | |
| 1233 | 1586 | /* |
| 1234 | 1587 | $globalSBS1Hosts = array(); |
@@ -1250,23 +1603,37 @@ discard block |
||
| 1250 | 1603 | $name = $_POST['name']; |
| 1251 | 1604 | $format = $_POST['format']; |
| 1252 | 1605 | $timezones = $_POST['timezones']; |
| 1253 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1254 | - else $sourcestats = array(); |
|
| 1255 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1256 | - else $noarchive = array(); |
|
| 1606 | + if (isset($_POST['sourcestats'])) { |
|
| 1607 | + $sourcestats = $_POST['sourcestats']; |
|
| 1608 | + } else { |
|
| 1609 | + $sourcestats = array(); |
|
| 1610 | + } |
|
| 1611 | + if (isset($_POST['noarchive'])) { |
|
| 1612 | + $noarchive = $_POST['noarchive']; |
|
| 1613 | + } else { |
|
| 1614 | + $noarchive = array(); |
|
| 1615 | + } |
|
| 1257 | 1616 | $gSources = array(); |
| 1258 | 1617 | $forcepilots = false; |
| 1259 | 1618 | foreach ($host as $key => $h) { |
| 1260 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1261 | - else $cov = 'FALSE'; |
|
| 1262 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1263 | - else $arch = 'FALSE'; |
|
| 1619 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1620 | + $cov = 'TRUE'; |
|
| 1621 | + } else { |
|
| 1622 | + $cov = 'FALSE'; |
|
| 1623 | + } |
|
| 1624 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1625 | + $arch = 'TRUE'; |
|
| 1626 | + } else { |
|
| 1627 | + $arch = 'FALSE'; |
|
| 1628 | + } |
|
| 1264 | 1629 | if (strpos($format[$key],'_callback')) { |
| 1265 | 1630 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1266 | 1631 | } elseif ($h != '' || $name[$key] != '') { |
| 1267 | 1632 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1268 | 1633 | } |
| 1269 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1634 | + if ($format[$key] == 'airwhere') { |
|
| 1635 | + $forcepilots = true; |
|
| 1636 | + } |
|
| 1270 | 1637 | } |
| 1271 | 1638 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1272 | 1639 | |
@@ -1297,7 +1664,9 @@ discard block |
||
| 1297 | 1664 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1298 | 1665 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1299 | 1666 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1300 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1667 | + } else { |
|
| 1668 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1669 | + } |
|
| 1301 | 1670 | |
| 1302 | 1671 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1303 | 1672 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1336,7 +1705,9 @@ discard block |
||
| 1336 | 1705 | |
| 1337 | 1706 | // Create in settings.php keys not yet configurable if not already here |
| 1338 | 1707 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1339 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1708 | + if (!isset($globalDebug)) { |
|
| 1709 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1710 | + } |
|
| 1340 | 1711 | |
| 1341 | 1712 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1342 | 1713 | if ($resetyearstats == 'resetyearstats') { |
@@ -1379,37 +1750,56 @@ discard block |
||
| 1379 | 1750 | } |
| 1380 | 1751 | */ |
| 1381 | 1752 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1382 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1383 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1384 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1385 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1753 | + if ($globalsbs == 'sbs') { |
|
| 1754 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1755 | + } else { |
|
| 1756 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1757 | + } |
|
| 1758 | + if ($globalaprs == 'aprs') { |
|
| 1759 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1760 | + } else { |
|
| 1761 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1762 | + } |
|
| 1386 | 1763 | $va = false; |
| 1387 | 1764 | if ($globalivao == 'ivao') { |
| 1388 | 1765 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1389 | 1766 | $va = true; |
| 1390 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1767 | + } else { |
|
| 1768 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1769 | + } |
|
| 1391 | 1770 | if ($globalvatsim == 'vatsim') { |
| 1392 | 1771 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1393 | 1772 | $va = true; |
| 1394 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1773 | + } else { |
|
| 1774 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1775 | + } |
|
| 1395 | 1776 | if ($globalphpvms == 'phpvms') { |
| 1396 | 1777 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1397 | 1778 | $va = true; |
| 1398 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1779 | + } else { |
|
| 1780 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1781 | + } |
|
| 1399 | 1782 | if ($globalvam == 'vam') { |
| 1400 | 1783 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1401 | 1784 | $va = true; |
| 1402 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1785 | + } else { |
|
| 1786 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1787 | + } |
|
| 1403 | 1788 | if ($va) { |
| 1404 | 1789 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1405 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1790 | + } else { |
|
| 1791 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1792 | + } |
|
| 1406 | 1793 | if ($globalva == 'va' || $va) { |
| 1407 | 1794 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1408 | 1795 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1409 | 1796 | } else { |
| 1410 | 1797 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1411 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1412 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1798 | + if ($forcepilots) { |
|
| 1799 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1800 | + } else { |
|
| 1801 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1802 | + } |
|
| 1413 | 1803 | } |
| 1414 | 1804 | |
| 1415 | 1805 | |
@@ -1622,7 +2012,9 @@ discard block |
||
| 1622 | 2012 | $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
| 1623 | 2013 | } |
| 1624 | 2014 | |
| 1625 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2015 | + if (!isset($globalTransaction)) { |
|
| 2016 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2017 | + } |
|
| 1626 | 2018 | |
| 1627 | 2019 | // Set some defaults values... |
| 1628 | 2020 | if (!isset($globalAircraftImageSources)) { |
@@ -1637,15 +2029,23 @@ discard block |
||
| 1637 | 2029 | |
| 1638 | 2030 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1639 | 2031 | |
| 1640 | - if ($error == '') settings::modify_settings($settings); |
|
| 1641 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 2032 | + if ($error == '') { |
|
| 2033 | + settings::modify_settings($settings); |
|
| 2034 | + } |
|
| 2035 | + if ($error == '') { |
|
| 2036 | + settings::comment_settings($settings_comment); |
|
| 2037 | + } |
|
| 1642 | 2038 | if ($error != '') { |
| 1643 | 2039 | print '<div class="info column">'.$error.'</div>'; |
| 1644 | 2040 | require('../footer.php'); |
| 1645 | 2041 | exit; |
| 1646 | 2042 | } else { |
| 1647 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1648 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 2043 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 2044 | + $_SESSION['waypoints'] = 1; |
|
| 2045 | + } |
|
| 2046 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 2047 | + $_SESSION['owner'] = 1; |
|
| 2048 | + } |
|
| 1649 | 2049 | if (isset($_POST['createdb'])) { |
| 1650 | 2050 | $_SESSION['install'] = 'database_create'; |
| 1651 | 2051 | } else { |
@@ -1682,10 +2082,18 @@ discard block |
||
| 1682 | 2082 | $popw = false; |
| 1683 | 2083 | foreach ($_SESSION['done'] as $done) { |
| 1684 | 2084 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1685 | - if ($done == 'Create database') $pop = true; |
|
| 1686 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1687 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1688 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 2085 | + if ($done == 'Create database') { |
|
| 2086 | + $pop = true; |
|
| 2087 | + } |
|
| 2088 | + if ($_SESSION['install'] == 'database_create') { |
|
| 2089 | + $pop = true; |
|
| 2090 | + } |
|
| 2091 | + if ($_SESSION['install'] == 'database_import') { |
|
| 2092 | + $popi = true; |
|
| 2093 | + } |
|
| 2094 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 2095 | + $popw = true; |
|
| 2096 | + } |
|
| 1689 | 2097 | } |
| 1690 | 2098 | if ($pop) { |
| 1691 | 2099 | sleep(5); |
@@ -1696,7 +2104,9 @@ discard block |
||
| 1696 | 2104 | } else if ($popw) { |
| 1697 | 2105 | sleep(5); |
| 1698 | 2106 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1699 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2107 | + } else { |
|
| 2108 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2109 | + } |
|
| 1700 | 2110 | print '</div></ul>'; |
| 1701 | 2111 | print '<div id="error"></div>'; |
| 1702 | 2112 | /* foreach ($_SESSION['done'] as $done) { |