@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -794,10 +794,6 @@ discard block |
||
| 794 | 794 | * |
| 795 | 795 | * @param String $fammarine_id the ID from flightaware |
| 796 | 796 | * @param String $ident the flight ident |
| 797 | - * @param String $aircraft_icao the aircraft type |
|
| 798 | - * @param String $departure_airport_icao the departure airport |
|
| 799 | - * @param String $arrival_airport_icao the arrival airport |
|
| 800 | - * @return String success or false |
|
| 801 | 797 | * |
| 802 | 798 | */ |
| 803 | 799 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Get SQL query part for filter used |
|
| 16 | - * @param Array $filter the filter |
|
| 17 | - * @return Array the SQL part |
|
| 18 | - */ |
|
| 15 | + * Get SQL query part for filter used |
|
| 16 | + * @param Array $filter the filter |
|
| 17 | + * @return Array the SQL part |
|
| 18 | + */ |
|
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 21 | 21 | $filters = array(); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Gets all the spotter information based on the latest data entry |
|
| 90 | - * |
|
| 91 | - * @return Array the spotter information |
|
| 92 | - * |
|
| 93 | - */ |
|
| 89 | + * Gets all the spotter information based on the latest data entry |
|
| 90 | + * |
|
| 91 | + * @return Array the spotter information |
|
| 92 | + * |
|
| 93 | + */ |
|
| 94 | 94 | public function getLiveMarineData($limit = '', $sort = '', $filter = array()) |
| 95 | 95 | { |
| 96 | 96 | global $globalDBdriver, $globalLiveInterval; |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * Gets Minimal Live Spotter data |
|
| 136 | - * |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 135 | + * Gets Minimal Live Spotter data |
|
| 136 | + * |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getMinLiveMarineData($filter = array()) |
| 141 | 141 | { |
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
@@ -166,11 +166,11 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 170 | - * |
|
| 171 | - * @return Array the spotter information |
|
| 172 | - * |
|
| 173 | - */ |
|
| 169 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 170 | + * |
|
| 171 | + * @return Array the spotter information |
|
| 172 | + * |
|
| 173 | + */ |
|
| 174 | 174 | public function getMinLastLiveMarineData($filter = array()) |
| 175 | 175 | { |
| 176 | 176 | global $globalDBdriver, $globalLiveInterval; |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 184 | 184 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 185 | 185 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 186 | - } else { |
|
| 186 | + } else { |
|
| 187 | 187 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 188 | 188 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 189 | 189 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - try { |
|
| 192 | + try { |
|
| 193 | 193 | $sth = $this->db->prepare($query); |
| 194 | 194 | $sth->execute(); |
| 195 | 195 | } catch(PDOException $e) { |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | - * Gets number of latest data entry |
|
| 205 | - * |
|
| 206 | - * @return String number of entry |
|
| 207 | - * |
|
| 208 | - */ |
|
| 204 | + * Gets number of latest data entry |
|
| 205 | + * |
|
| 206 | + * @return String number of entry |
|
| 207 | + * |
|
| 208 | + */ |
|
| 209 | 209 | public function getLiveMarineCount($filter = array()) |
| 210 | 210 | { |
| 211 | 211 | global $globalDBdriver, $globalLiveInterval; |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 234 | - * |
|
| 235 | - * @return Array the spotter information |
|
| 236 | - * |
|
| 237 | - */ |
|
| 233 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 234 | + * |
|
| 235 | + * @return Array the spotter information |
|
| 236 | + * |
|
| 237 | + */ |
|
| 238 | 238 | public function getLiveMarineDatabyCoord($coord, $filter = array()) |
| 239 | 239 | { |
| 240 | 240 | global $globalDBdriver, $globalLiveInterval; |
@@ -258,11 +258,11 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 262 | - * |
|
| 263 | - * @return Array the spotter information |
|
| 264 | - * |
|
| 265 | - */ |
|
| 261 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 262 | + * |
|
| 263 | + * @return Array the spotter information |
|
| 264 | + * |
|
| 265 | + */ |
|
| 266 | 266 | public function getMinLiveMarineDatabyCoord($coord, $filter = array()) |
| 267 | 267 | { |
| 268 | 268 | global $globalDBdriver, $globalLiveInterval; |
@@ -290,11 +290,11 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 294 | - * |
|
| 295 | - * @return Array the spotter information |
|
| 296 | - * |
|
| 297 | - */ |
|
| 293 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 294 | + * |
|
| 295 | + * @return Array the spotter information |
|
| 296 | + * |
|
| 297 | + */ |
|
| 298 | 298 | public function getLatestMarineForLayar($lat, $lng, $radius, $interval) |
| 299 | 299 | { |
| 300 | 300 | $Marine = new Marine($this->db); |
@@ -307,134 +307,134 @@ discard block |
||
| 307 | 307 | if ($lng != '') |
| 308 | 308 | { |
| 309 | 309 | if (!is_numeric($lng)) |
| 310 | - { |
|
| 311 | - return false; |
|
| 312 | - } |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - if ($radius != '') |
|
| 316 | - { |
|
| 317 | - if (!is_numeric($radius)) |
|
| 318 | - { |
|
| 319 | - return false; |
|
| 320 | - } |
|
| 321 | - } |
|
| 310 | + { |
|
| 311 | + return false; |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + if ($radius != '') |
|
| 316 | + { |
|
| 317 | + if (!is_numeric($radius)) |
|
| 318 | + { |
|
| 319 | + return false; |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | 322 | $additional_query = ''; |
| 323 | 323 | if ($interval != '') |
| 324 | - { |
|
| 325 | - if (!is_string($interval)) |
|
| 326 | - { |
|
| 327 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 328 | - return false; |
|
| 329 | - } else { |
|
| 330 | - if ($interval == '1m') |
|
| 331 | - { |
|
| 332 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 333 | - } else if ($interval == '15m'){ |
|
| 334 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - } else { |
|
| 338 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 324 | + { |
|
| 325 | + if (!is_string($interval)) |
|
| 326 | + { |
|
| 327 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 328 | + return false; |
|
| 329 | + } else { |
|
| 330 | + if ($interval == '1m') |
|
| 331 | + { |
|
| 332 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 333 | + } else if ($interval == '15m'){ |
|
| 334 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + } else { |
|
| 338 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 342 | 342 | WHERE marine_live.latitude <> '' |
| 343 | 343 | AND marine_live.longitude <> '' |
| 344 | 344 | ".$additional_query." |
| 345 | 345 | HAVING distance < :radius |
| 346 | 346 | ORDER BY distance"; |
| 347 | 347 | |
| 348 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 348 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 349 | 349 | |
| 350 | - return $spotter_array; |
|
| 351 | - } |
|
| 350 | + return $spotter_array; |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | 353 | |
| 354 | - /** |
|
| 355 | - * Gets all the spotter information based on a particular callsign |
|
| 356 | - * |
|
| 357 | - * @return Array the spotter information |
|
| 358 | - * |
|
| 359 | - */ |
|
| 354 | + /** |
|
| 355 | + * Gets all the spotter information based on a particular callsign |
|
| 356 | + * |
|
| 357 | + * @return Array the spotter information |
|
| 358 | + * |
|
| 359 | + */ |
|
| 360 | 360 | public function getLastLiveMarineDataByIdent($ident) |
| 361 | 361 | { |
| 362 | 362 | $Marine = new Marine($this->db); |
| 363 | 363 | date_default_timezone_set('UTC'); |
| 364 | 364 | |
| 365 | 365 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 366 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 366 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 367 | 367 | |
| 368 | 368 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 369 | 369 | |
| 370 | 370 | return $spotter_array; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - /** |
|
| 374 | - * Gets all the spotter information based on a particular callsign |
|
| 375 | - * |
|
| 376 | - * @return Array the spotter information |
|
| 377 | - * |
|
| 378 | - */ |
|
| 373 | + /** |
|
| 374 | + * Gets all the spotter information based on a particular callsign |
|
| 375 | + * |
|
| 376 | + * @return Array the spotter information |
|
| 377 | + * |
|
| 378 | + */ |
|
| 379 | 379 | public function getDateLiveMarineDataByIdent($ident,$date) |
| 380 | 380 | { |
| 381 | 381 | $Marine = new Marine($this->db); |
| 382 | 382 | date_default_timezone_set('UTC'); |
| 383 | 383 | |
| 384 | 384 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 385 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 385 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 386 | 386 | |
| 387 | - $date = date('c',$date); |
|
| 387 | + $date = date('c',$date); |
|
| 388 | 388 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 389 | 389 | |
| 390 | 390 | return $spotter_array; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - /** |
|
| 394 | - * Gets last spotter information based on a particular callsign |
|
| 395 | - * |
|
| 396 | - * @return Array the spotter information |
|
| 397 | - * |
|
| 398 | - */ |
|
| 393 | + /** |
|
| 394 | + * Gets last spotter information based on a particular callsign |
|
| 395 | + * |
|
| 396 | + * @return Array the spotter information |
|
| 397 | + * |
|
| 398 | + */ |
|
| 399 | 399 | public function getLastLiveMarineDataById($id) |
| 400 | 400 | { |
| 401 | 401 | $Marine = new Marine($this->db); |
| 402 | 402 | date_default_timezone_set('UTC'); |
| 403 | 403 | |
| 404 | 404 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 405 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 405 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 406 | 406 | |
| 407 | 407 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
| 408 | 408 | |
| 409 | 409 | return $spotter_array; |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - /** |
|
| 413 | - * Gets last spotter information based on a particular callsign |
|
| 414 | - * |
|
| 415 | - * @return Array the spotter information |
|
| 416 | - * |
|
| 417 | - */ |
|
| 412 | + /** |
|
| 413 | + * Gets last spotter information based on a particular callsign |
|
| 414 | + * |
|
| 415 | + * @return Array the spotter information |
|
| 416 | + * |
|
| 417 | + */ |
|
| 418 | 418 | public function getDateLiveMarineDataById($id,$date) |
| 419 | 419 | { |
| 420 | 420 | $Marine = new Marine($this->db); |
| 421 | 421 | date_default_timezone_set('UTC'); |
| 422 | 422 | |
| 423 | 423 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 424 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 425 | - $date = date('c',$date); |
|
| 424 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 425 | + $date = date('c',$date); |
|
| 426 | 426 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 427 | 427 | |
| 428 | 428 | return $spotter_array; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | |
| 432 | - /** |
|
| 433 | - * Gets all the spotter information based on a particular id |
|
| 434 | - * |
|
| 435 | - * @return Array the spotter information |
|
| 436 | - * |
|
| 437 | - */ |
|
| 432 | + /** |
|
| 433 | + * Gets all the spotter information based on a particular id |
|
| 434 | + * |
|
| 435 | + * @return Array the spotter information |
|
| 436 | + * |
|
| 437 | + */ |
|
| 438 | 438 | public function getAllLiveMarineDataById($id,$liveinterval = false) |
| 439 | 439 | { |
| 440 | 440 | global $globalDBdriver, $globalLiveInterval; |
@@ -462,18 +462,18 @@ discard block |
||
| 462 | 462 | return $spotter_array; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - /** |
|
| 466 | - * Gets all the spotter information based on a particular ident |
|
| 467 | - * |
|
| 468 | - * @return Array the spotter information |
|
| 469 | - * |
|
| 470 | - */ |
|
| 465 | + /** |
|
| 466 | + * Gets all the spotter information based on a particular ident |
|
| 467 | + * |
|
| 468 | + * @return Array the spotter information |
|
| 469 | + * |
|
| 470 | + */ |
|
| 471 | 471 | public function getAllLiveMarineDataByIdent($ident) |
| 472 | 472 | { |
| 473 | 473 | date_default_timezone_set('UTC'); |
| 474 | 474 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 475 | 475 | $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
| 476 | - try { |
|
| 476 | + try { |
|
| 477 | 477 | |
| 478 | 478 | $sth = $this->db->prepare($query); |
| 479 | 479 | $sth->execute(array(':ident' => $ident)); |
@@ -487,23 +487,23 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | - * Deletes all info in the table |
|
| 491 | - * |
|
| 492 | - * @return String success or false |
|
| 493 | - * |
|
| 494 | - */ |
|
| 490 | + * Deletes all info in the table |
|
| 491 | + * |
|
| 492 | + * @return String success or false |
|
| 493 | + * |
|
| 494 | + */ |
|
| 495 | 495 | public function deleteLiveMarineData() |
| 496 | 496 | { |
| 497 | 497 | global $globalDBdriver; |
| 498 | 498 | if ($globalDBdriver == 'mysql') { |
| 499 | 499 | //$query = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date"; |
| 500 | 500 | $query = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date'; |
| 501 | - //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
| 501 | + //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
| 502 | 502 | } else { |
| 503 | 503 | $query = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date"; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - try { |
|
| 506 | + try { |
|
| 507 | 507 | |
| 508 | 508 | $sth = $this->db->prepare($query); |
| 509 | 509 | $sth->execute(); |
@@ -515,18 +515,18 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
| 518 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 519 | - * |
|
| 520 | - * @return String success or false |
|
| 521 | - * |
|
| 522 | - */ |
|
| 518 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 519 | + * |
|
| 520 | + * @return String success or false |
|
| 521 | + * |
|
| 522 | + */ |
|
| 523 | 523 | public function deleteLiveMarineDataNotUpdated() |
| 524 | 524 | { |
| 525 | 525 | global $globalDBdriver, $globalDebug; |
| 526 | 526 | if ($globalDBdriver == 'mysql') { |
| 527 | 527 | //$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0'; |
| 528 | - $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 529 | - try { |
|
| 528 | + $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 529 | + try { |
|
| 530 | 530 | |
| 531 | 531 | $sth = $this->db->prepare($query); |
| 532 | 532 | $sth->execute(); |
@@ -534,8 +534,8 @@ discard block |
||
| 534 | 534 | return "error"; |
| 535 | 535 | } |
| 536 | 536 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 537 | - $i = 0; |
|
| 538 | - $j =0; |
|
| 537 | + $i = 0; |
|
| 538 | + $j =0; |
|
| 539 | 539 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 540 | 540 | foreach($all as $row) |
| 541 | 541 | { |
@@ -543,20 +543,20 @@ discard block |
||
| 543 | 543 | $j++; |
| 544 | 544 | if ($j == 30) { |
| 545 | 545 | if ($globalDebug) echo "."; |
| 546 | - try { |
|
| 546 | + try { |
|
| 547 | 547 | |
| 548 | 548 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 549 | 549 | $sth->execute(); |
| 550 | 550 | } catch(PDOException $e) { |
| 551 | 551 | return "error"; |
| 552 | 552 | } |
| 553 | - $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
| 554 | - $j = 0; |
|
| 553 | + $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
| 554 | + $j = 0; |
|
| 555 | 555 | } |
| 556 | 556 | $query_delete .= "'".$row['fammarine_id']."',"; |
| 557 | 557 | } |
| 558 | 558 | if ($i > 0) { |
| 559 | - try { |
|
| 559 | + try { |
|
| 560 | 560 | |
| 561 | 561 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 562 | 562 | $sth->execute(); |
@@ -567,9 +567,9 @@ discard block |
||
| 567 | 567 | return "success"; |
| 568 | 568 | } elseif ($globalDBdriver == 'pgsql') { |
| 569 | 569 | //$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0"; |
| 570 | - //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 571 | - $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 572 | - try { |
|
| 570 | + //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 571 | + $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 572 | + try { |
|
| 573 | 573 | |
| 574 | 574 | $sth = $this->db->prepare($query); |
| 575 | 575 | $sth->execute(); |
@@ -613,17 +613,17 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | /** |
| 616 | - * Deletes all info in the table for an ident |
|
| 617 | - * |
|
| 618 | - * @return String success or false |
|
| 619 | - * |
|
| 620 | - */ |
|
| 616 | + * Deletes all info in the table for an ident |
|
| 617 | + * |
|
| 618 | + * @return String success or false |
|
| 619 | + * |
|
| 620 | + */ |
|
| 621 | 621 | public function deleteLiveMarineDataByIdent($ident) |
| 622 | 622 | { |
| 623 | 623 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 624 | 624 | $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
| 625 | 625 | |
| 626 | - try { |
|
| 626 | + try { |
|
| 627 | 627 | |
| 628 | 628 | $sth = $this->db->prepare($query); |
| 629 | 629 | $sth->execute(array(':ident' => $ident)); |
@@ -635,17 +635,17 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | /** |
| 638 | - * Deletes all info in the table for an id |
|
| 639 | - * |
|
| 640 | - * @return String success or false |
|
| 641 | - * |
|
| 642 | - */ |
|
| 638 | + * Deletes all info in the table for an id |
|
| 639 | + * |
|
| 640 | + * @return String success or false |
|
| 641 | + * |
|
| 642 | + */ |
|
| 643 | 643 | public function deleteLiveMarineDataById($id) |
| 644 | 644 | { |
| 645 | 645 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 646 | 646 | $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
| 647 | 647 | |
| 648 | - try { |
|
| 648 | + try { |
|
| 649 | 649 | |
| 650 | 650 | $sth = $this->db->prepare($query); |
| 651 | 651 | $sth->execute(array(':id' => $id)); |
@@ -658,11 +658,11 @@ discard block |
||
| 658 | 658 | |
| 659 | 659 | |
| 660 | 660 | /** |
| 661 | - * Gets the aircraft ident within the last hour |
|
| 662 | - * |
|
| 663 | - * @return String the ident |
|
| 664 | - * |
|
| 665 | - */ |
|
| 661 | + * Gets the aircraft ident within the last hour |
|
| 662 | + * |
|
| 663 | + * @return String the ident |
|
| 664 | + * |
|
| 665 | + */ |
|
| 666 | 666 | public function getIdentFromLastHour($ident) |
| 667 | 667 | { |
| 668 | 668 | global $globalDBdriver, $globalTimezone; |
@@ -688,14 +688,14 @@ discard block |
||
| 688 | 688 | $ident_result = $row['ident']; |
| 689 | 689 | } |
| 690 | 690 | return $ident_result; |
| 691 | - } |
|
| 691 | + } |
|
| 692 | 692 | |
| 693 | 693 | /** |
| 694 | - * Check recent aircraft |
|
| 695 | - * |
|
| 696 | - * @return String the ident |
|
| 697 | - * |
|
| 698 | - */ |
|
| 694 | + * Check recent aircraft |
|
| 695 | + * |
|
| 696 | + * @return String the ident |
|
| 697 | + * |
|
| 698 | + */ |
|
| 699 | 699 | public function checkIdentRecent($ident) |
| 700 | 700 | { |
| 701 | 701 | global $globalDBdriver, $globalTimezone; |
@@ -721,14 +721,14 @@ discard block |
||
| 721 | 721 | $ident_result = $row['fammarine_id']; |
| 722 | 722 | } |
| 723 | 723 | return $ident_result; |
| 724 | - } |
|
| 724 | + } |
|
| 725 | 725 | |
| 726 | 726 | /** |
| 727 | - * Check recent aircraft by id |
|
| 728 | - * |
|
| 729 | - * @return String the ident |
|
| 730 | - * |
|
| 731 | - */ |
|
| 727 | + * Check recent aircraft by id |
|
| 728 | + * |
|
| 729 | + * @return String the ident |
|
| 730 | + * |
|
| 731 | + */ |
|
| 732 | 732 | public function checkIdRecent($id) |
| 733 | 733 | { |
| 734 | 734 | global $globalDBdriver, $globalTimezone; |
@@ -754,14 +754,14 @@ discard block |
||
| 754 | 754 | $ident_result = $row['fammarine_id']; |
| 755 | 755 | } |
| 756 | 756 | return $ident_result; |
| 757 | - } |
|
| 757 | + } |
|
| 758 | 758 | |
| 759 | 759 | /** |
| 760 | - * Check recent aircraft by mmsi |
|
| 761 | - * |
|
| 762 | - * @return String the ident |
|
| 763 | - * |
|
| 764 | - */ |
|
| 760 | + * Check recent aircraft by mmsi |
|
| 761 | + * |
|
| 762 | + * @return String the ident |
|
| 763 | + * |
|
| 764 | + */ |
|
| 765 | 765 | public function checkMMSIRecent($mmsi) |
| 766 | 766 | { |
| 767 | 767 | global $globalDBdriver, $globalTimezone; |
@@ -787,19 +787,19 @@ discard block |
||
| 787 | 787 | $ident_result = $row['fammarine_id']; |
| 788 | 788 | } |
| 789 | 789 | return $ident_result; |
| 790 | - } |
|
| 790 | + } |
|
| 791 | 791 | |
| 792 | 792 | /** |
| 793 | - * Adds a new spotter data |
|
| 794 | - * |
|
| 795 | - * @param String $fammarine_id the ID from flightaware |
|
| 796 | - * @param String $ident the flight ident |
|
| 797 | - * @param String $aircraft_icao the aircraft type |
|
| 798 | - * @param String $departure_airport_icao the departure airport |
|
| 799 | - * @param String $arrival_airport_icao the arrival airport |
|
| 800 | - * @return String success or false |
|
| 801 | - * |
|
| 802 | - */ |
|
| 793 | + * Adds a new spotter data |
|
| 794 | + * |
|
| 795 | + * @param String $fammarine_id the ID from flightaware |
|
| 796 | + * @param String $ident the flight ident |
|
| 797 | + * @param String $aircraft_icao the aircraft type |
|
| 798 | + * @param String $departure_airport_icao the departure airport |
|
| 799 | + * @param String $arrival_airport_icao the arrival airport |
|
| 800 | + * @return String success or false |
|
| 801 | + * |
|
| 802 | + */ |
|
| 803 | 803 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
| 804 | 804 | { |
| 805 | 805 | global $globalURL, $globalArchive, $globalDebug; |
@@ -870,10 +870,10 @@ discard block |
||
| 870 | 870 | $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
| 871 | 871 | |
| 872 | 872 | |
| 873 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 874 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 875 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 876 | - $query = ''; |
|
| 873 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 874 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 875 | + if ($arrival_date == '') $arrival_date = NULL; |
|
| 876 | + $query = ''; |
|
| 877 | 877 | if ($globalArchive) { |
| 878 | 878 | if ($globalDebug) echo '-- Delete previous data -- '; |
| 879 | 879 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | * @param Array $filter the filter |
| 17 | 17 | * @return Array the SQL part |
| 18 | 18 | */ |
| 19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 21 | 21 | $filters = array(); |
| 22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
| 25 | 25 | } else { |
| 26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | if (isset($filter[0]['source'])) { |
| 30 | - $filters = array_merge($filters,$filter); |
|
| 30 | + $filters = array_merge($filters, $filter); |
|
| 31 | 31 | } |
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 33 | 33 | $filter_query_join = ''; |
| 34 | 34 | $filter_query_where = ''; |
| 35 | - foreach($filters as $flt) { |
|
| 35 | + foreach ($filters as $flt) { |
|
| 36 | 36 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 37 | 37 | if (isset($flt['source'])) { |
| 38 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 38 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 39 | 39 | } else { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 45 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 45 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 48 | 48 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 74 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 75 | 75 | } |
| 76 | 76 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 78 | 78 | } |
| 79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 80 | 80 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 81 | 81 | if ($filter_query_where != '') { |
| 82 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 82 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 83 | 83 | } |
| 84 | 84 | $filter_query = $filter_query_join.$filter_query_where; |
| 85 | 85 | return $filter_query; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if ($limit != '') |
| 103 | 103 | { |
| 104 | 104 | $limit_array = explode(',', $limit); |
| 105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 108 | 108 | { |
| 109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 121 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
| 122 | 122 | |
| 123 | 123 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 124 | 124 | if ($globalDBdriver == 'mysql') { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } else { |
| 128 | 128 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
| 129 | 129 | } |
| 130 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 130 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 131 | 131 | |
| 132 | 132 | return $spotter_array; |
| 133 | 133 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | global $globalDBdriver, $globalLiveInterval; |
| 144 | 144 | date_default_timezone_set('UTC'); |
| 145 | 145 | |
| 146 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 146 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 147 | 147 | |
| 148 | 148 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 149 | 149 | if ($globalDBdriver == 'mysql') { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | try { |
| 158 | 158 | $sth = $this->db->prepare($query); |
| 159 | 159 | $sth->execute(); |
| 160 | - } catch(PDOException $e) { |
|
| 160 | + } catch (PDOException $e) { |
|
| 161 | 161 | echo $e->getMessage(); |
| 162 | 162 | die; |
| 163 | 163 | } |
@@ -177,15 +177,15 @@ discard block |
||
| 177 | 177 | global $globalDBdriver, $globalLiveInterval; |
| 178 | 178 | date_default_timezone_set('UTC'); |
| 179 | 179 | |
| 180 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 180 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 181 | 181 | |
| 182 | 182 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 183 | 183 | if ($globalDBdriver == 'mysql') { |
| 184 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 184 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 185 | 185 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 186 | 186 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 187 | 187 | } else { |
| 188 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 188 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 189 | 189 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 190 | 190 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 191 | 191 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | try { |
| 194 | 194 | $sth = $this->db->prepare($query); |
| 195 | 195 | $sth->execute(); |
| 196 | - } catch(PDOException $e) { |
|
| 196 | + } catch (PDOException $e) { |
|
| 197 | 197 | echo $e->getMessage(); |
| 198 | 198 | die; |
| 199 | 199 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | public function getLiveMarineCount($filter = array()) |
| 211 | 211 | { |
| 212 | 212 | global $globalDBdriver, $globalLiveInterval; |
| 213 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 213 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 214 | 214 | |
| 215 | 215 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 216 | 216 | if ($globalDBdriver == 'mysql') { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | try { |
| 222 | 222 | $sth = $this->db->prepare($query); |
| 223 | 223 | $sth->execute(); |
| 224 | - } catch(PDOException $e) { |
|
| 224 | + } catch (PDOException $e) { |
|
| 225 | 225 | echo $e->getMessage(); |
| 226 | 226 | die; |
| 227 | 227 | } |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | $filter_query = $this->getFilter($filter); |
| 245 | 245 | |
| 246 | 246 | if (is_array($coord)) { |
| 247 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 248 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 249 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 250 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 247 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 248 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 249 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 250 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 251 | 251 | } else return array(); |
| 252 | 252 | if ($globalDBdriver == 'mysql') { |
| 253 | 253 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
@@ -272,17 +272,17 @@ discard block |
||
| 272 | 272 | $filter_query = $this->getFilter($filter); |
| 273 | 273 | |
| 274 | 274 | if (is_array($coord)) { |
| 275 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 276 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 277 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 278 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 275 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 276 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 277 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 278 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 279 | 279 | } else return array(); |
| 280 | 280 | if ($globalDBdriver == 'mysql') { |
| 281 | 281 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 282 | 282 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
| 283 | 283 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 284 | 284 | } else { |
| 285 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 285 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 286 | 286 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 287 | 287 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 288 | 288 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | if ($interval == '1m') |
| 332 | 332 | { |
| 333 | 333 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 334 | - } else if ($interval == '15m'){ |
|
| 334 | + } else if ($interval == '15m') { |
|
| 335 | 335 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
| 336 | 336 | } |
| 337 | 337 | } |
@@ -339,14 +339,14 @@ discard block |
||
| 339 | 339 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 342 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 343 | 343 | WHERE marine_live.latitude <> '' |
| 344 | 344 | AND marine_live.longitude <> '' |
| 345 | 345 | ".$additional_query." |
| 346 | 346 | HAVING distance < :radius |
| 347 | 347 | ORDER BY distance"; |
| 348 | 348 | |
| 349 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 349 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 350 | 350 | |
| 351 | 351 | return $spotter_array; |
| 352 | 352 | } |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | date_default_timezone_set('UTC'); |
| 365 | 365 | |
| 366 | 366 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 367 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 367 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 368 | 368 | |
| 369 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 369 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 370 | 370 | |
| 371 | 371 | return $spotter_array; |
| 372 | 372 | } |
@@ -377,16 +377,16 @@ discard block |
||
| 377 | 377 | * @return Array the spotter information |
| 378 | 378 | * |
| 379 | 379 | */ |
| 380 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
| 380 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
| 381 | 381 | { |
| 382 | 382 | $Marine = new Marine($this->db); |
| 383 | 383 | date_default_timezone_set('UTC'); |
| 384 | 384 | |
| 385 | 385 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 386 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 386 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 387 | 387 | |
| 388 | - $date = date('c',$date); |
|
| 389 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 388 | + $date = date('c', $date); |
|
| 389 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 390 | 390 | |
| 391 | 391 | return $spotter_array; |
| 392 | 392 | } |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | date_default_timezone_set('UTC'); |
| 404 | 404 | |
| 405 | 405 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 406 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 406 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 407 | 407 | |
| 408 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 408 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 409 | 409 | |
| 410 | 410 | return $spotter_array; |
| 411 | 411 | } |
@@ -416,15 +416,15 @@ discard block |
||
| 416 | 416 | * @return Array the spotter information |
| 417 | 417 | * |
| 418 | 418 | */ |
| 419 | - public function getDateLiveMarineDataById($id,$date) |
|
| 419 | + public function getDateLiveMarineDataById($id, $date) |
|
| 420 | 420 | { |
| 421 | 421 | $Marine = new Marine($this->db); |
| 422 | 422 | date_default_timezone_set('UTC'); |
| 423 | 423 | |
| 424 | 424 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 425 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 426 | - $date = date('c',$date); |
|
| 427 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 425 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 426 | + $date = date('c', $date); |
|
| 427 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 428 | 428 | |
| 429 | 429 | return $spotter_array; |
| 430 | 430 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | * @return Array the spotter information |
| 437 | 437 | * |
| 438 | 438 | */ |
| 439 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
| 439 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
| 440 | 440 | { |
| 441 | 441 | global $globalDBdriver, $globalLiveInterval; |
| 442 | 442 | date_default_timezone_set('UTC'); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | try { |
| 456 | 456 | $sth = $this->db->prepare($query); |
| 457 | 457 | $sth->execute(array(':id' => $id)); |
| 458 | - } catch(PDOException $e) { |
|
| 458 | + } catch (PDOException $e) { |
|
| 459 | 459 | echo $e->getMessage(); |
| 460 | 460 | die; |
| 461 | 461 | } |
@@ -473,12 +473,12 @@ discard block |
||
| 473 | 473 | { |
| 474 | 474 | date_default_timezone_set('UTC'); |
| 475 | 475 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 476 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 476 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 477 | 477 | try { |
| 478 | 478 | |
| 479 | 479 | $sth = $this->db->prepare($query); |
| 480 | 480 | $sth->execute(array(':ident' => $ident)); |
| 481 | - } catch(PDOException $e) { |
|
| 481 | + } catch (PDOException $e) { |
|
| 482 | 482 | echo $e->getMessage(); |
| 483 | 483 | die; |
| 484 | 484 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | $sth = $this->db->prepare($query); |
| 510 | 510 | $sth->execute(); |
| 511 | - } catch(PDOException $e) { |
|
| 511 | + } catch (PDOException $e) { |
|
| 512 | 512 | return "error"; |
| 513 | 513 | } |
| 514 | 514 | |
@@ -531,14 +531,14 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | $sth = $this->db->prepare($query); |
| 533 | 533 | $sth->execute(); |
| 534 | - } catch(PDOException $e) { |
|
| 534 | + } catch (PDOException $e) { |
|
| 535 | 535 | return "error"; |
| 536 | 536 | } |
| 537 | 537 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 538 | 538 | $i = 0; |
| 539 | - $j =0; |
|
| 539 | + $j = 0; |
|
| 540 | 540 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 541 | - foreach($all as $row) |
|
| 541 | + foreach ($all as $row) |
|
| 542 | 542 | { |
| 543 | 543 | $i++; |
| 544 | 544 | $j++; |
@@ -546,9 +546,9 @@ discard block |
||
| 546 | 546 | if ($globalDebug) echo "."; |
| 547 | 547 | try { |
| 548 | 548 | |
| 549 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 549 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 550 | 550 | $sth->execute(); |
| 551 | - } catch(PDOException $e) { |
|
| 551 | + } catch (PDOException $e) { |
|
| 552 | 552 | return "error"; |
| 553 | 553 | } |
| 554 | 554 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -559,9 +559,9 @@ discard block |
||
| 559 | 559 | if ($i > 0) { |
| 560 | 560 | try { |
| 561 | 561 | |
| 562 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 562 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 563 | 563 | $sth->execute(); |
| 564 | - } catch(PDOException $e) { |
|
| 564 | + } catch (PDOException $e) { |
|
| 565 | 565 | return "error"; |
| 566 | 566 | } |
| 567 | 567 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | $sth = $this->db->prepare($query); |
| 576 | 576 | $sth->execute(); |
| 577 | - } catch(PDOException $e) { |
|
| 577 | + } catch (PDOException $e) { |
|
| 578 | 578 | return "error"; |
| 579 | 579 | } |
| 580 | 580 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -622,13 +622,13 @@ discard block |
||
| 622 | 622 | public function deleteLiveMarineDataByIdent($ident) |
| 623 | 623 | { |
| 624 | 624 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 625 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 625 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 626 | 626 | |
| 627 | 627 | try { |
| 628 | 628 | |
| 629 | 629 | $sth = $this->db->prepare($query); |
| 630 | 630 | $sth->execute(array(':ident' => $ident)); |
| 631 | - } catch(PDOException $e) { |
|
| 631 | + } catch (PDOException $e) { |
|
| 632 | 632 | return "error"; |
| 633 | 633 | } |
| 634 | 634 | |
@@ -644,13 +644,13 @@ discard block |
||
| 644 | 644 | public function deleteLiveMarineDataById($id) |
| 645 | 645 | { |
| 646 | 646 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 647 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 647 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 648 | 648 | |
| 649 | 649 | try { |
| 650 | 650 | |
| 651 | 651 | $sth = $this->db->prepare($query); |
| 652 | 652 | $sth->execute(array(':id' => $id)); |
| 653 | - } catch(PDOException $e) { |
|
| 653 | + } catch (PDOException $e) { |
|
| 654 | 654 | return "error"; |
| 655 | 655 | } |
| 656 | 656 | |
@@ -668,13 +668,13 @@ discard block |
||
| 668 | 668 | { |
| 669 | 669 | global $globalDBdriver, $globalTimezone; |
| 670 | 670 | if ($globalDBdriver == 'mysql') { |
| 671 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
| 671 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
| 672 | 672 | WHERE marine_live.ident = :ident |
| 673 | 673 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 674 | 674 | AND marine_live.date < UTC_TIMESTAMP()'; |
| 675 | 675 | $query_data = array(':ident' => $ident); |
| 676 | 676 | } else { |
| 677 | - $query = "SELECT marine_live.ident FROM marine_live |
|
| 677 | + $query = "SELECT marine_live.ident FROM marine_live |
|
| 678 | 678 | WHERE marine_live.ident = :ident |
| 679 | 679 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 680 | 680 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -683,8 +683,8 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | $sth = $this->db->prepare($query); |
| 685 | 685 | $sth->execute($query_data); |
| 686 | - $ident_result=''; |
|
| 687 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 686 | + $ident_result = ''; |
|
| 687 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 688 | 688 | { |
| 689 | 689 | $ident_result = $row['ident']; |
| 690 | 690 | } |
@@ -701,13 +701,13 @@ discard block |
||
| 701 | 701 | { |
| 702 | 702 | global $globalDBdriver, $globalTimezone; |
| 703 | 703 | if ($globalDBdriver == 'mysql') { |
| 704 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 704 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 705 | 705 | WHERE marine_live.ident = :ident |
| 706 | 706 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 707 | 707 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 708 | 708 | $query_data = array(':ident' => $ident); |
| 709 | 709 | } else { |
| 710 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 710 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 711 | 711 | WHERE marine_live.ident = :ident |
| 712 | 712 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 713 | 713 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -716,8 +716,8 @@ discard block |
||
| 716 | 716 | |
| 717 | 717 | $sth = $this->db->prepare($query); |
| 718 | 718 | $sth->execute($query_data); |
| 719 | - $ident_result=''; |
|
| 720 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 719 | + $ident_result = ''; |
|
| 720 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 721 | 721 | { |
| 722 | 722 | $ident_result = $row['fammarine_id']; |
| 723 | 723 | } |
@@ -734,13 +734,13 @@ discard block |
||
| 734 | 734 | { |
| 735 | 735 | global $globalDBdriver, $globalTimezone; |
| 736 | 736 | if ($globalDBdriver == 'mysql') { |
| 737 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 737 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 738 | 738 | WHERE marine_live.fammarine_id = :id |
| 739 | 739 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 740 | 740 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 741 | 741 | $query_data = array(':id' => $id); |
| 742 | 742 | } else { |
| 743 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 743 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 744 | 744 | WHERE marine_live.fammarine_id = :id |
| 745 | 745 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 746 | 746 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -749,8 +749,8 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | $sth = $this->db->prepare($query); |
| 751 | 751 | $sth->execute($query_data); |
| 752 | - $ident_result=''; |
|
| 753 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 752 | + $ident_result = ''; |
|
| 753 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 754 | 754 | { |
| 755 | 755 | $ident_result = $row['fammarine_id']; |
| 756 | 756 | } |
@@ -767,13 +767,13 @@ discard block |
||
| 767 | 767 | { |
| 768 | 768 | global $globalDBdriver, $globalTimezone; |
| 769 | 769 | if ($globalDBdriver == 'mysql') { |
| 770 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 770 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 771 | 771 | WHERE marine_live.mmsi = :mmsi |
| 772 | 772 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 773 | 773 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 774 | 774 | $query_data = array(':mmsi' => $mmsi); |
| 775 | 775 | } else { |
| 776 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 776 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 777 | 777 | WHERE marine_live.mmsi = :mmsi |
| 778 | 778 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 779 | 779 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -782,8 +782,8 @@ discard block |
||
| 782 | 782 | |
| 783 | 783 | $sth = $this->db->prepare($query); |
| 784 | 784 | $sth->execute($query_data); |
| 785 | - $ident_result=''; |
|
| 786 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 785 | + $ident_result = ''; |
|
| 786 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 787 | 787 | { |
| 788 | 788 | $ident_result = $row['fammarine_id']; |
| 789 | 789 | } |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | * @return String success or false |
| 802 | 802 | * |
| 803 | 803 | */ |
| 804 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 804 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 805 | 805 | { |
| 806 | 806 | global $globalURL, $globalArchive, $globalDebug; |
| 807 | 807 | $Common = new Common(); |
@@ -853,26 +853,26 @@ discard block |
||
| 853 | 853 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 854 | 854 | |
| 855 | 855 | |
| 856 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 857 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 858 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 859 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 860 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 861 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 862 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 863 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 864 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 865 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 866 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 867 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
| 868 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 869 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 870 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
| 871 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
| 856 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 857 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 858 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 859 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 860 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 861 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 862 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 863 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 864 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 865 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 866 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 867 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
| 868 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 869 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 870 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
| 871 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
| 872 | 872 | |
| 873 | 873 | |
| 874 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 875 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 874 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 875 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 876 | 876 | if ($arrival_date == '') $arrival_date = NULL; |
| 877 | 877 | $query = ''; |
| 878 | 878 | if ($globalArchive) { |
@@ -882,18 +882,18 @@ discard block |
||
| 882 | 882 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
| 883 | 883 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)'; |
| 884 | 884 | |
| 885 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
| 885 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
| 886 | 886 | try { |
| 887 | 887 | $sth = $this->db->prepare($query); |
| 888 | 888 | $sth->execute($query_values); |
| 889 | - } catch(PDOException $e) { |
|
| 889 | + } catch (PDOException $e) { |
|
| 890 | 890 | return "error : ".$e->getMessage(); |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 894 | 894 | if ($globalDebug) echo '(Add to Marine archive : '; |
| 895 | 895 | $MarineArchive = new MarineArchive($this->db); |
| 896 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
|
| 896 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $noarchive, $format_source, $source_name, $over_country); |
|
| 897 | 897 | if ($globalDebug) echo $result.')'; |
| 898 | 898 | } |
| 899 | 899 | return "success"; |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | |
| 902 | 902 | public function getOrderBy() |
| 903 | 903 | { |
| 904 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 904 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 905 | 905 | return $orderby; |
| 906 | 906 | } |
| 907 | 907 | |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | if (isset($filter[0]['source'])) { |
| 30 | 30 | $filters = array_merge($filters,$filter); |
| 31 | 31 | } |
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) { |
|
| 33 | + $filter = array_merge($filter,$globalFilter); |
|
| 34 | + } |
|
| 33 | 35 | $filter_query_join = ''; |
| 34 | 36 | $filter_query_where = ''; |
| 35 | 37 | foreach($filters as $flt) { |
@@ -76,8 +78,11 @@ discard block |
||
| 76 | 78 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 78 | 80 | } |
| 79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 81 | + if ($filter_query_where == '' && $where) { |
|
| 82 | + $filter_query_where = ' WHERE'; |
|
| 83 | + } elseif ($filter_query_where != '' && $and) { |
|
| 84 | + $filter_query_where .= ' AND'; |
|
| 85 | + } |
|
| 81 | 86 | if ($filter_query_where != '') { |
| 82 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 83 | 88 | } |
@@ -118,9 +123,13 @@ discard block |
||
| 118 | 123 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 119 | 124 | } |
| 120 | 125 | } |
| 121 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 126 | + if ($orderby_query == '') { |
|
| 127 | + $orderby_query= ' ORDER BY date DESC'; |
|
| 128 | + } |
|
| 122 | 129 | |
| 123 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 130 | + if (!isset($globalLiveInterval)) { |
|
| 131 | + $globalLiveInterval = '200'; |
|
| 132 | + } |
|
| 124 | 133 | if ($globalDBdriver == 'mysql') { |
| 125 | 134 | //$query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
| 126 | 135 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -145,7 +154,9 @@ discard block |
||
| 145 | 154 | |
| 146 | 155 | $filter_query = $this->getFilter($filter,true,true); |
| 147 | 156 | |
| 148 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 157 | + if (!isset($globalLiveInterval)) { |
|
| 158 | + $globalLiveInterval = '200'; |
|
| 159 | + } |
|
| 149 | 160 | if ($globalDBdriver == 'mysql') { |
| 150 | 161 | $query = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 151 | 162 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0"; |
@@ -179,7 +190,9 @@ discard block |
||
| 179 | 190 | |
| 180 | 191 | $filter_query = $this->getFilter($filter,true,true); |
| 181 | 192 | |
| 182 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 193 | + if (!isset($globalLiveInterval)) { |
|
| 194 | + $globalLiveInterval = '200'; |
|
| 195 | + } |
|
| 183 | 196 | if ($globalDBdriver == 'mysql') { |
| 184 | 197 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 185 | 198 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
@@ -212,7 +225,9 @@ discard block |
||
| 212 | 225 | global $globalDBdriver, $globalLiveInterval; |
| 213 | 226 | $filter_query = $this->getFilter($filter,true,true); |
| 214 | 227 | |
| 215 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 228 | + if (!isset($globalLiveInterval)) { |
|
| 229 | + $globalLiveInterval = '200'; |
|
| 230 | + } |
|
| 216 | 231 | if ($globalDBdriver == 'mysql') { |
| 217 | 232 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 218 | 233 | } else { |
@@ -240,7 +255,9 @@ discard block |
||
| 240 | 255 | { |
| 241 | 256 | global $globalDBdriver, $globalLiveInterval; |
| 242 | 257 | $Spotter = new Spotter($this->db); |
| 243 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 258 | + if (!isset($globalLiveInterval)) { |
|
| 259 | + $globalLiveInterval = '200'; |
|
| 260 | + } |
|
| 244 | 261 | $filter_query = $this->getFilter($filter); |
| 245 | 262 | |
| 246 | 263 | if (is_array($coord)) { |
@@ -248,7 +265,9 @@ discard block |
||
| 248 | 265 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 249 | 266 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 250 | 267 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 251 | - } else return array(); |
|
| 268 | + } else { |
|
| 269 | + return array(); |
|
| 270 | + } |
|
| 252 | 271 | if ($globalDBdriver == 'mysql') { |
| 253 | 272 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
| 254 | 273 | } else { |
@@ -268,7 +287,9 @@ discard block |
||
| 268 | 287 | { |
| 269 | 288 | global $globalDBdriver, $globalLiveInterval; |
| 270 | 289 | $Spotter = new Spotter($this->db); |
| 271 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 290 | + if (!isset($globalLiveInterval)) { |
|
| 291 | + $globalLiveInterval = '200'; |
|
| 292 | + } |
|
| 272 | 293 | $filter_query = $this->getFilter($filter); |
| 273 | 294 | |
| 274 | 295 | if (is_array($coord)) { |
@@ -276,7 +297,9 @@ discard block |
||
| 276 | 297 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 277 | 298 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 278 | 299 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 279 | - } else return array(); |
|
| 300 | + } else { |
|
| 301 | + return array(); |
|
| 302 | + } |
|
| 280 | 303 | if ($globalDBdriver == 'mysql') { |
| 281 | 304 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 282 | 305 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
@@ -444,11 +467,15 @@ discard block |
||
| 444 | 467 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
| 445 | 468 | if ($globalDBdriver == 'mysql') { |
| 446 | 469 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 447 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 470 | + if ($liveinterval) { |
|
| 471 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 472 | + } |
|
| 448 | 473 | $query .= ' ORDER BY date'; |
| 449 | 474 | } else { |
| 450 | 475 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 451 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 476 | + if ($liveinterval) { |
|
| 477 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 478 | + } |
|
| 452 | 479 | $query .= ' ORDER BY date'; |
| 453 | 480 | } |
| 454 | 481 | |
@@ -543,7 +570,9 @@ discard block |
||
| 543 | 570 | $i++; |
| 544 | 571 | $j++; |
| 545 | 572 | if ($j == 30) { |
| 546 | - if ($globalDebug) echo "."; |
|
| 573 | + if ($globalDebug) { |
|
| 574 | + echo "."; |
|
| 575 | + } |
|
| 547 | 576 | try { |
| 548 | 577 | |
| 549 | 578 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -823,7 +852,9 @@ discard block |
||
| 823 | 852 | { |
| 824 | 853 | return false; |
| 825 | 854 | } |
| 826 | - } else return ''; |
|
| 855 | + } else { |
|
| 856 | + return ''; |
|
| 857 | + } |
|
| 827 | 858 | |
| 828 | 859 | if ($longitude != '') |
| 829 | 860 | { |
@@ -831,7 +862,9 @@ discard block |
||
| 831 | 862 | { |
| 832 | 863 | return false; |
| 833 | 864 | } |
| 834 | - } else return ''; |
|
| 865 | + } else { |
|
| 866 | + return ''; |
|
| 867 | + } |
|
| 835 | 868 | |
| 836 | 869 | |
| 837 | 870 | if ($heading != '') |
@@ -840,7 +873,9 @@ discard block |
||
| 840 | 873 | { |
| 841 | 874 | return false; |
| 842 | 875 | } |
| 843 | - } else $heading = 0; |
|
| 876 | + } else { |
|
| 877 | + $heading = 0; |
|
| 878 | + } |
|
| 844 | 879 | |
| 845 | 880 | if ($groundspeed != '') |
| 846 | 881 | { |
@@ -848,9 +883,13 @@ discard block |
||
| 848 | 883 | { |
| 849 | 884 | return false; |
| 850 | 885 | } |
| 851 | - } else $groundspeed = 0; |
|
| 886 | + } else { |
|
| 887 | + $groundspeed = 0; |
|
| 888 | + } |
|
| 852 | 889 | date_default_timezone_set('UTC'); |
| 853 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 890 | + if ($date == '') { |
|
| 891 | + $date = date("Y-m-d H:i:s", time()); |
|
| 892 | + } |
|
| 854 | 893 | |
| 855 | 894 | |
| 856 | 895 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -871,12 +910,20 @@ discard block |
||
| 871 | 910 | $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
| 872 | 911 | |
| 873 | 912 | |
| 874 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 875 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 876 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 913 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 914 | + $groundspeed = 0; |
|
| 915 | + } |
|
| 916 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 917 | + $heading = 0; |
|
| 918 | + } |
|
| 919 | + if ($arrival_date == '') { |
|
| 920 | + $arrival_date = NULL; |
|
| 921 | + } |
|
| 877 | 922 | $query = ''; |
| 878 | 923 | if ($globalArchive) { |
| 879 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 924 | + if ($globalDebug) { |
|
| 925 | + echo '-- Delete previous data -- '; |
|
| 926 | + } |
|
| 880 | 927 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
| 881 | 928 | } |
| 882 | 929 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
@@ -891,10 +938,14 @@ discard block |
||
| 891 | 938 | } |
| 892 | 939 | |
| 893 | 940 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 894 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
| 941 | + if ($globalDebug) { |
|
| 942 | + echo '(Add to Marine archive : '; |
|
| 943 | + } |
|
| 895 | 944 | $MarineArchive = new MarineArchive($this->db); |
| 896 | 945 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
| 897 | - if ($globalDebug) echo $result.')'; |
|
| 946 | + if ($globalDebug) { |
|
| 947 | + echo $result.')'; |
|
| 948 | + } |
|
| 898 | 949 | } |
| 899 | 950 | return "success"; |
| 900 | 951 | } |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | 3 | $ident = ''; |
| 4 | -if (isset($_POST['ident'])) $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING); |
|
| 5 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 4 | +if (isset($_POST['ident'])) $ident = filter_input(INPUT_POST, 'ident', FILTER_SANITIZE_STRING); |
|
| 5 | +if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 6 | 6 | if ($ident != '') |
| 7 | 7 | { |
| 8 | 8 | if (isset($_GET['marine'])) header('Location: '.$globalURL.'/marine/ident/'.$ident); |
@@ -1,13 +1,20 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | 3 | $ident = ''; |
| 4 | -if (isset($_POST['ident'])) $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING); |
|
| 5 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 4 | +if (isset($_POST['ident'])) { |
|
| 5 | + $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING); |
|
| 6 | +} |
|
| 7 | +if (isset($_GET['ident'])) { |
|
| 8 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 9 | +} |
|
| 6 | 10 | if ($ident != '') |
| 7 | 11 | { |
| 8 | - if (isset($_GET['marine'])) header('Location: '.$globalURL.'/marine/ident/'.$ident); |
|
| 9 | - else header('Location: '.$globalURL.'/ident/'.$ident); |
|
| 10 | -} else { |
|
| 12 | + if (isset($_GET['marine'])) { |
|
| 13 | + header('Location: '.$globalURL.'/marine/ident/'.$ident); |
|
| 14 | + } else { |
|
| 15 | + header('Location: '.$globalURL.'/ident/'.$ident); |
|
| 16 | + } |
|
| 17 | + } else { |
|
| 11 | 18 | header('Location: '.$globalURL); |
| 12 | 19 | } |
| 13 | 20 | ?> |
| 14 | 21 | \ No newline at end of file |
@@ -4,21 +4,21 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | $type = ''; |
| 6 | 6 | if (isset($_GET['marine'])) { |
| 7 | - require_once('require/class.Marine.php');; |
|
| 7 | + require_once('require/class.Marine.php'); ; |
|
| 8 | 8 | require_once('require/class.MarineLive.php'); |
| 9 | - $MarineLive=new MarineLive(); |
|
| 9 | + $MarineLive = new MarineLive(); |
|
| 10 | 10 | $type = 'marine'; |
| 11 | 11 | $page_url = $globalURL.'/marine/currently'; |
| 12 | 12 | } elseif (isset($_GET['tracker'])) { |
| 13 | - require_once('require/class.Tracker.php');; |
|
| 13 | + require_once('require/class.Tracker.php'); ; |
|
| 14 | 14 | require_once('require/class.TrackerLive.php'); |
| 15 | - $TrackerLive=new TrackerLive(); |
|
| 15 | + $TrackerLive = new TrackerLive(); |
|
| 16 | 16 | $type = 'tracker'; |
| 17 | 17 | $page_url = $globalURL.'/tracker/currently'; |
| 18 | 18 | } else { |
| 19 | - require_once('require/class.Spotter.php');; |
|
| 19 | + require_once('require/class.Spotter.php'); ; |
|
| 20 | 20 | require_once('require/class.SpotterLive.php'); |
| 21 | - $SpotterLive=new SpotterLive(); |
|
| 21 | + $SpotterLive = new SpotterLive(); |
|
| 22 | 22 | $type = 'aircraft'; |
| 23 | 23 | $page_url = $globalURL.'/currently'; |
| 24 | 24 | } |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | $title = "Current Activity"; |
| 27 | 27 | require_once('header.php'); |
| 28 | 28 | //calculuation for the pagination |
| 29 | -if(!isset($_GET['limit'])) |
|
| 29 | +if (!isset($_GET['limit'])) |
|
| 30 | 30 | { |
| 31 | 31 | $limit_start = 0; |
| 32 | 32 | $limit_end = 25; |
| 33 | 33 | $absolute_difference = 25; |
| 34 | -} else { |
|
| 34 | +} else { |
|
| 35 | 35 | $limit_explode = explode(",", $_GET['limit']); |
| 36 | 36 | $limit_start = $limit_explode[0]; |
| 37 | 37 | $limit_end = $limit_explode[1]; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | elseif ($type == 'marine') print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>'; |
| 55 | 55 | elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>'; |
| 56 | 56 | |
| 57 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 57 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 58 | 58 | if ($sort != '') { |
| 59 | 59 | if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort); |
| 60 | 60 | elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $limit_start = 0; |
| 32 | 32 | $limit_end = 25; |
| 33 | 33 | $absolute_difference = 25; |
| 34 | -} else { |
|
| 34 | +} else { |
|
| 35 | 35 | $limit_explode = explode(",", $_GET['limit']); |
| 36 | 36 | $limit_start = $limit_explode[0]; |
| 37 | 37 | $limit_end = $limit_explode[1]; |
@@ -50,20 +50,32 @@ discard block |
||
| 50 | 50 | print '</div>'; |
| 51 | 51 | |
| 52 | 52 | print '<div class="table column">'; |
| 53 | -if ($type == 'aircraft') print '<p>'._("The table below shows the detailed information of all current flights.").'</p>'; |
|
| 54 | -elseif ($type == 'marine') print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>'; |
|
| 55 | -elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>'; |
|
| 53 | +if ($type == 'aircraft') { |
|
| 54 | + print '<p>'._("The table below shows the detailed information of all current flights.").'</p>'; |
|
| 55 | +} elseif ($type == 'marine') { |
|
| 56 | + print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>'; |
|
| 57 | +} elseif ($type == 'tracker') { |
|
| 58 | + print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>'; |
|
| 59 | +} |
|
| 56 | 60 | |
| 57 | 61 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 58 | 62 | if ($sort != '') { |
| 59 | - if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort); |
|
| 60 | - elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort); |
|
| 61 | - elseif ($type == 'tracker') $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference, $sort); |
|
| 62 | -} else { |
|
| 63 | - if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference); |
|
| 64 | - elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference); |
|
| 65 | - elseif ($type == 'tracker') $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference); |
|
| 66 | -} |
|
| 63 | + if ($type == 'aircraft') { |
|
| 64 | + $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort); |
|
| 65 | + } elseif ($type == 'marine') { |
|
| 66 | + $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort); |
|
| 67 | + } elseif ($type == 'tracker') { |
|
| 68 | + $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference, $sort); |
|
| 69 | + } |
|
| 70 | + } else { |
|
| 71 | + if ($type == 'aircraft') { |
|
| 72 | + $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference); |
|
| 73 | + } elseif ($type == 'marine') { |
|
| 74 | + $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference); |
|
| 75 | + } elseif ($type == 'tracker') { |
|
| 76 | + $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference); |
|
| 77 | + } |
|
| 78 | + } |
|
| 67 | 79 | |
| 68 | 80 | if (!empty($spotter_array)) |
| 69 | 81 | { |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | $type = 'aircraft'; |
| 4 | 4 | if (isset($_GET['marine'])) $type = 'marine'; |
| 5 | 5 | elseif (isset($_GET['tracker'])) $type = 'tracker'; |
| 6 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
| 6 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
| 7 | 7 | if ($date == '') $date = date('Y-m-d'); |
| 8 | 8 | if ($type == 'marine') header('Location: '.$globalURL.'/marine/date/'.$date); |
| 9 | 9 | elseif ($type == 'tracker') header('Location: '.$globalURL.'/tracker/date/'.$date); |
@@ -1,11 +1,20 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | 3 | $type = 'aircraft'; |
| 4 | -if (isset($_GET['marine'])) $type = 'marine'; |
|
| 5 | -elseif (isset($_GET['tracker'])) $type = 'tracker'; |
|
| 4 | +if (isset($_GET['marine'])) { |
|
| 5 | + $type = 'marine'; |
|
| 6 | +} elseif (isset($_GET['tracker'])) { |
|
| 7 | + $type = 'tracker'; |
|
| 8 | +} |
|
| 6 | 9 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
| 7 | -if ($date == '') $date = date('Y-m-d'); |
|
| 8 | -if ($type == 'marine') header('Location: '.$globalURL.'/marine/date/'.$date); |
|
| 9 | -elseif ($type == 'tracker') header('Location: '.$globalURL.'/tracker/date/'.$date); |
|
| 10 | -else header('Location: '.$globalURL.'/date/'.$date); |
|
| 10 | +if ($date == '') { |
|
| 11 | + $date = date('Y-m-d'); |
|
| 12 | +} |
|
| 13 | +if ($type == 'marine') { |
|
| 14 | + header('Location: '.$globalURL.'/marine/date/'.$date); |
|
| 15 | +} elseif ($type == 'tracker') { |
|
| 16 | + header('Location: '.$globalURL.'/tracker/date/'.$date); |
|
| 17 | +} else { |
|
| 18 | + header('Location: '.$globalURL.'/date/'.$date); |
|
| 19 | +} |
|
| 11 | 20 | ?> |
| 12 | 21 | \ No newline at end of file |
@@ -2,34 +2,34 @@ discard block |
||
| 2 | 2 | require_once('require/class.Connection.php'); |
| 3 | 3 | require_once('require/class.Language.php'); |
| 4 | 4 | $type = ''; |
| 5 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 5 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 6 | 6 | if (isset($_GET['marine'])) { |
| 7 | - require_once('require/class.Marine.php');; |
|
| 7 | + require_once('require/class.Marine.php'); ; |
|
| 8 | 8 | $Marine = new Marine(); |
| 9 | 9 | $type = 'marine'; |
| 10 | 10 | $page_url = $globalURL.'/marine/date/'.$date; |
| 11 | 11 | } elseif (isset($_GET['tracker'])) { |
| 12 | - require_once('require/class.Tracker.php');; |
|
| 12 | + require_once('require/class.Tracker.php'); ; |
|
| 13 | 13 | $Tracker = new Tracker(); |
| 14 | 14 | $type = 'tracker'; |
| 15 | 15 | $page_url = $globalURL.'/tracker/date/'.$date; |
| 16 | 16 | } else { |
| 17 | - require_once('require/class.Spotter.php');; |
|
| 17 | + require_once('require/class.Spotter.php'); ; |
|
| 18 | 18 | $Spotter = new Spotter(); |
| 19 | 19 | $type = 'aircraft'; |
| 20 | 20 | $page_url = $globalURL.'/date/'.$date; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if (!isset($_GET['date'])){ |
|
| 23 | +if (!isset($_GET['date'])) { |
|
| 24 | 24 | header('Location: '.$globalURL.''); |
| 25 | 25 | } else { |
| 26 | 26 | //calculuation for the pagination |
| 27 | - if(!isset($_GET['limit'])) |
|
| 27 | + if (!isset($_GET['limit'])) |
|
| 28 | 28 | { |
| 29 | 29 | $limit_start = 0; |
| 30 | 30 | $limit_end = 25; |
| 31 | 31 | $absolute_difference = 25; |
| 32 | - } else { |
|
| 32 | + } else { |
|
| 33 | 33 | $limit_explode = explode(",", $_GET['limit']); |
| 34 | 34 | $limit_start = $limit_explode[0]; |
| 35 | 35 | $limit_end = $limit_explode[1]; |
@@ -43,24 +43,24 @@ discard block |
||
| 43 | 43 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 44 | 44 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 45 | 45 | |
| 46 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 46 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 47 | 47 | if ($sort != '') |
| 48 | 48 | { |
| 49 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 50 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 51 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 49 | + if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date, $limit_start.",".$absolute_difference, $sort); |
|
| 50 | + elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date, $limit_start.",".$absolute_difference, $sort); |
|
| 51 | + else $spotter_array = $Spotter->getSpotterDataByDate($date, $limit_start.",".$absolute_difference, $sort); |
|
| 52 | 52 | } else { |
| 53 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 54 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 55 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 53 | + if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date, $limit_start.",".$absolute_difference); |
|
| 54 | + elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date, $limit_start.",".$absolute_difference); |
|
| 55 | + else $spotter_array = $Spotter->getSpotterDataByDate($date, $limit_start.",".$absolute_difference); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if (!empty($spotter_array)) |
| 59 | 59 | { |
| 60 | 60 | date_default_timezone_set($globalTimezone); |
| 61 | - if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 62 | - elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 63 | - else $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 61 | + if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 62 | + elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 63 | + else $title = sprintf(_("Detailed View for flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 64 | 64 | |
| 65 | 65 | require_once('header.php'); |
| 66 | 66 | print '<div class="select-item">'; |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
| 79 | 79 | print '<br />'; |
| 80 | 80 | print '<div class="info column">'; |
| 81 | - if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 82 | - else print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 81 | + if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 82 | + else print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 83 | 83 | print '</div>'; |
| 84 | 84 | |
| 85 | 85 | if ($type == 'aircraft') include('date-sub-menu.php'); |
| 86 | 86 | print '<div class="table column">'; |
| 87 | - if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 88 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 89 | - else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 87 | + if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 88 | + elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 89 | + else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 90 | 90 | |
| 91 | 91 | include('table-output.php'); |
| 92 | 92 | print '<div class="pagination">'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $limit_start = 0; |
| 30 | 30 | $limit_end = 25; |
| 31 | 31 | $absolute_difference = 25; |
| 32 | - } else { |
|
| 32 | + } else { |
|
| 33 | 33 | $limit_explode = explode(",", $_GET['limit']); |
| 34 | 34 | $limit_start = $limit_explode[0]; |
| 35 | 35 | $limit_end = $limit_explode[1]; |
@@ -46,21 +46,33 @@ discard block |
||
| 46 | 46 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 47 | 47 | if ($sort != '') |
| 48 | 48 | { |
| 49 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 50 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 51 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 49 | + if ($type == 'marine') { |
|
| 50 | + $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 51 | + } elseif ($type == 'tracker') { |
|
| 52 | + $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 53 | + } else { |
|
| 54 | + $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 55 | + } |
|
| 52 | 56 | } else { |
| 53 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 54 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 55 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 57 | + if ($type == 'marine') { |
|
| 58 | + $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 59 | + } elseif ($type == 'tracker') { |
|
| 60 | + $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 61 | + } else { |
|
| 62 | + $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 63 | + } |
|
| 56 | 64 | } |
| 57 | 65 | |
| 58 | 66 | if (!empty($spotter_array)) |
| 59 | 67 | { |
| 60 | 68 | date_default_timezone_set($globalTimezone); |
| 61 | - if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 62 | - elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 63 | - else $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 69 | + if ($type == 'marine') { |
|
| 70 | + $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 71 | + } elseif ($type == 'tracker') { |
|
| 72 | + $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 73 | + } else { |
|
| 74 | + $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 75 | + } |
|
| 64 | 76 | |
| 65 | 77 | require_once('header.php'); |
| 66 | 78 | print '<div class="select-item">'; |
@@ -78,15 +90,24 @@ discard block |
||
| 78 | 90 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
| 79 | 91 | print '<br />'; |
| 80 | 92 | print '<div class="info column">'; |
| 81 | - if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 82 | - else print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 93 | + if ($type == 'marine') { |
|
| 94 | + print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 95 | + } else { |
|
| 96 | + print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 97 | + } |
|
| 83 | 98 | print '</div>'; |
| 84 | 99 | |
| 85 | - if ($type == 'aircraft') include('date-sub-menu.php'); |
|
| 100 | + if ($type == 'aircraft') { |
|
| 101 | + include('date-sub-menu.php'); |
|
| 102 | + } |
|
| 86 | 103 | print '<div class="table column">'; |
| 87 | - if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 88 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 89 | - else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 104 | + if ($type == 'marine') { |
|
| 105 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 106 | + } elseif ($type == 'tracker') { |
|
| 107 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 108 | + } else { |
|
| 109 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 110 | + } |
|
| 90 | 111 | |
| 91 | 112 | include('table-output.php'); |
| 92 | 113 | print '<div class="pagination">'; |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | require_once('header.php'); |
| 24 | 24 | |
| 25 | 25 | //calculuation for the pagination |
| 26 | -if(!isset($_GET['limit'])) |
|
| 26 | +if (!isset($_GET['limit'])) |
|
| 27 | 27 | { |
| 28 | 28 | $limit_start = 0; |
| 29 | 29 | $limit_end = 25; |
| 30 | 30 | $absolute_difference = 25; |
| 31 | -} else { |
|
| 31 | +} else { |
|
| 32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
| 33 | 33 | $limit_start = $limit_explode[0]; |
| 34 | 34 | $limit_end = $limit_explode[1]; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
| 52 | 52 | else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
| 53 | 53 | |
| 54 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 54 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 55 | 55 | $sql_begin = microtime(true); |
| 56 | 56 | if ($type == 'marine') { |
| 57 | 57 | $spotter_array = $Marine->getLatestMarineData($limit_start.",".$absolute_difference, $sort); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } else { |
| 61 | 61 | $spotter_array = $Spotter->getLatestSpotterData($limit_start.",".$absolute_difference, $sort); |
| 62 | 62 | } |
| 63 | -$sql_time = microtime(true)-$sql_begin; |
|
| 63 | +$sql_time = microtime(true) - $sql_begin; |
|
| 64 | 64 | $page_begin = microtime(true); |
| 65 | 65 | if (!empty($spotter_array)) |
| 66 | 66 | { |
@@ -77,6 +77,6 @@ discard block |
||
| 77 | 77 | print '</div>'; |
| 78 | 78 | print '</div>'; |
| 79 | 79 | } |
| 80 | -$page_time = microtime(true)-$page_begin; |
|
| 80 | +$page_time = microtime(true) - $page_begin; |
|
| 81 | 81 | require_once('footer.php'); |
| 82 | 82 | ?> |
| 83 | 83 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $limit_start = 0; |
| 29 | 29 | $limit_end = 25; |
| 30 | 30 | $absolute_difference = 25; |
| 31 | -} else { |
|
| 31 | +} else { |
|
| 32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
| 33 | 33 | $limit_start = $limit_explode[0]; |
| 34 | 34 | $limit_end = $limit_explode[1]; |
@@ -47,9 +47,13 @@ discard block |
||
| 47 | 47 | print '<h1>'._("Latest Activity").'</h1>'; |
| 48 | 48 | print '</div>'; |
| 49 | 49 | print '<div class="table column">'; |
| 50 | -if ($type == 'marine') print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
| 51 | -elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
| 52 | -else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
| 50 | +if ($type == 'marine') { |
|
| 51 | + print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
| 52 | +} elseif ($type == 'tracker') { |
|
| 53 | + print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
| 54 | +} else { |
|
| 55 | + print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
| 56 | +} |
|
| 53 | 57 | |
| 54 | 58 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 55 | 59 | $sql_begin = microtime(true); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * Get SQL query part for filter used |
|
| 13 | - * @param Array $filter the filter |
|
| 14 | - * @return Array the SQL part |
|
| 15 | - */ |
|
| 12 | + * Get SQL query part for filter used |
|
| 13 | + * @param Array $filter the filter |
|
| 14 | + * @return Array the SQL part |
|
| 15 | + */ |
|
| 16 | 16 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 18 | 18 | $filters = array(); |
@@ -108,44 +108,44 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Gets all the spotter information based on a particular callsign |
|
| 113 | - * |
|
| 114 | - * @return Array the spotter information |
|
| 115 | - * |
|
| 116 | - */ |
|
| 117 | - public function getLastArchiveTrackerDataByIdent($ident) |
|
| 118 | - { |
|
| 111 | + /** |
|
| 112 | + * Gets all the spotter information based on a particular callsign |
|
| 113 | + * |
|
| 114 | + * @return Array the spotter information |
|
| 115 | + * |
|
| 116 | + */ |
|
| 117 | + public function getLastArchiveTrackerDataByIdent($ident) |
|
| 118 | + { |
|
| 119 | 119 | $Tracker = new Tracker($this->db); |
| 120 | - date_default_timezone_set('UTC'); |
|
| 120 | + date_default_timezone_set('UTC'); |
|
| 121 | 121 | |
| 122 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 123 | - //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 124 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 122 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 123 | + //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 124 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 125 | 125 | |
| 126 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
| 126 | + $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
| 127 | 127 | |
| 128 | - return $spotter_array; |
|
| 129 | - } |
|
| 128 | + return $spotter_array; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Gets last the spotter information based on a particular id |
|
| 134 | - * |
|
| 135 | - * @return Array the spotter information |
|
| 136 | - * |
|
| 137 | - */ |
|
| 138 | - public function getLastArchiveTrackerDataById($id) |
|
| 139 | - { |
|
| 140 | - $Tracker = new Tracker($this->db); |
|
| 141 | - date_default_timezone_set('UTC'); |
|
| 142 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 143 | - //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
| 144 | - //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 145 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
| 132 | + /** |
|
| 133 | + * Gets last the spotter information based on a particular id |
|
| 134 | + * |
|
| 135 | + * @return Array the spotter information |
|
| 136 | + * |
|
| 137 | + */ |
|
| 138 | + public function getLastArchiveTrackerDataById($id) |
|
| 139 | + { |
|
| 140 | + $Tracker = new Tracker($this->db); |
|
| 141 | + date_default_timezone_set('UTC'); |
|
| 142 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 143 | + //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
| 144 | + //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 145 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
| 146 | 146 | |
| 147 | 147 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 148 | - /* |
|
| 148 | + /* |
|
| 149 | 149 | try { |
| 150 | 150 | $Connection = new Connection(); |
| 151 | 151 | $sth = Connection->$db->prepare($query); |
@@ -155,232 +155,232 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
| 157 | 157 | */ |
| 158 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
| 159 | - |
|
| 160 | - return $spotter_array; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * Gets all the spotter information based on a particular id |
|
| 165 | - * |
|
| 166 | - * @return Array the spotter information |
|
| 167 | - * |
|
| 168 | - */ |
|
| 169 | - public function getAllArchiveTrackerDataById($id) |
|
| 158 | + $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
| 159 | + |
|
| 160 | + return $spotter_array; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * Gets all the spotter information based on a particular id |
|
| 165 | + * |
|
| 166 | + * @return Array the spotter information |
|
| 167 | + * |
|
| 168 | + */ |
|
| 169 | + public function getAllArchiveTrackerDataById($id) |
|
| 170 | 170 | { |
| 171 | - date_default_timezone_set('UTC'); |
|
| 172 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 173 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 171 | + date_default_timezone_set('UTC'); |
|
| 172 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 173 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 174 | 174 | |
| 175 | 175 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 176 | 176 | |
| 177 | - try { |
|
| 178 | - $sth = $this->db->prepare($query); |
|
| 179 | - $sth->execute(array(':id' => $id)); |
|
| 180 | - } catch(PDOException $e) { |
|
| 181 | - echo $e->getMessage(); |
|
| 182 | - die; |
|
| 183 | - } |
|
| 184 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 185 | - |
|
| 186 | - return $spotter_array; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Gets coordinate & time spotter information based on a particular id |
|
| 191 | - * |
|
| 192 | - * @return Array the spotter information |
|
| 193 | - * |
|
| 194 | - */ |
|
| 195 | - public function getCoordArchiveTrackerDataById($id) |
|
| 196 | - { |
|
| 197 | - date_default_timezone_set('UTC'); |
|
| 198 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 199 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
| 177 | + try { |
|
| 178 | + $sth = $this->db->prepare($query); |
|
| 179 | + $sth->execute(array(':id' => $id)); |
|
| 180 | + } catch(PDOException $e) { |
|
| 181 | + echo $e->getMessage(); |
|
| 182 | + die; |
|
| 183 | + } |
|
| 184 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 185 | + |
|
| 186 | + return $spotter_array; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Gets coordinate & time spotter information based on a particular id |
|
| 191 | + * |
|
| 192 | + * @return Array the spotter information |
|
| 193 | + * |
|
| 194 | + */ |
|
| 195 | + public function getCoordArchiveTrackerDataById($id) |
|
| 196 | + { |
|
| 197 | + date_default_timezone_set('UTC'); |
|
| 198 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 199 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
| 200 | 200 | |
| 201 | 201 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 202 | 202 | |
| 203 | - try { |
|
| 204 | - $sth = $this->db->prepare($query); |
|
| 205 | - $sth->execute(array(':id' => $id)); |
|
| 206 | - } catch(PDOException $e) { |
|
| 207 | - echo $e->getMessage(); |
|
| 208 | - die; |
|
| 209 | - } |
|
| 210 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 203 | + try { |
|
| 204 | + $sth = $this->db->prepare($query); |
|
| 205 | + $sth->execute(array(':id' => $id)); |
|
| 206 | + } catch(PDOException $e) { |
|
| 207 | + echo $e->getMessage(); |
|
| 208 | + die; |
|
| 209 | + } |
|
| 210 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 211 | 211 | |
| 212 | - return $spotter_array; |
|
| 213 | - } |
|
| 212 | + return $spotter_array; |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * Gets altitude information based on a particular callsign |
|
| 218 | - * |
|
| 219 | - * @return Array the spotter information |
|
| 220 | - * |
|
| 221 | - */ |
|
| 222 | - public function getAltitudeArchiveTrackerDataByIdent($ident) |
|
| 223 | - { |
|
| 216 | + /** |
|
| 217 | + * Gets altitude information based on a particular callsign |
|
| 218 | + * |
|
| 219 | + * @return Array the spotter information |
|
| 220 | + * |
|
| 221 | + */ |
|
| 222 | + public function getAltitudeArchiveTrackerDataByIdent($ident) |
|
| 223 | + { |
|
| 224 | 224 | |
| 225 | - date_default_timezone_set('UTC'); |
|
| 225 | + date_default_timezone_set('UTC'); |
|
| 226 | 226 | |
| 227 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 228 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 227 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 228 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 229 | 229 | |
| 230 | - try { |
|
| 231 | - $sth = $this->db->prepare($query); |
|
| 232 | - $sth->execute(array(':ident' => $ident)); |
|
| 233 | - } catch(PDOException $e) { |
|
| 234 | - echo $e->getMessage(); |
|
| 235 | - die; |
|
| 236 | - } |
|
| 237 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 230 | + try { |
|
| 231 | + $sth = $this->db->prepare($query); |
|
| 232 | + $sth->execute(array(':ident' => $ident)); |
|
| 233 | + } catch(PDOException $e) { |
|
| 234 | + echo $e->getMessage(); |
|
| 235 | + die; |
|
| 236 | + } |
|
| 237 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 238 | 238 | |
| 239 | - return $spotter_array; |
|
| 240 | - } |
|
| 239 | + return $spotter_array; |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Gets altitude information based on a particular id |
|
| 244 | - * |
|
| 245 | - * @return Array the spotter information |
|
| 246 | - * |
|
| 247 | - */ |
|
| 248 | - public function getAltitudeArchiveTrackerDataById($id) |
|
| 249 | - { |
|
| 242 | + /** |
|
| 243 | + * Gets altitude information based on a particular id |
|
| 244 | + * |
|
| 245 | + * @return Array the spotter information |
|
| 246 | + * |
|
| 247 | + */ |
|
| 248 | + public function getAltitudeArchiveTrackerDataById($id) |
|
| 249 | + { |
|
| 250 | 250 | |
| 251 | - date_default_timezone_set('UTC'); |
|
| 251 | + date_default_timezone_set('UTC'); |
|
| 252 | 252 | |
| 253 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 254 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 253 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 254 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 255 | 255 | |
| 256 | - try { |
|
| 257 | - $sth = $this->db->prepare($query); |
|
| 258 | - $sth->execute(array(':id' => $id)); |
|
| 259 | - } catch(PDOException $e) { |
|
| 260 | - echo $e->getMessage(); |
|
| 261 | - die; |
|
| 262 | - } |
|
| 263 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 256 | + try { |
|
| 257 | + $sth = $this->db->prepare($query); |
|
| 258 | + $sth->execute(array(':id' => $id)); |
|
| 259 | + } catch(PDOException $e) { |
|
| 260 | + echo $e->getMessage(); |
|
| 261 | + die; |
|
| 262 | + } |
|
| 263 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 264 | 264 | |
| 265 | - return $spotter_array; |
|
| 266 | - } |
|
| 265 | + return $spotter_array; |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Gets altitude & speed information based on a particular id |
|
| 270 | - * |
|
| 271 | - * @return Array the spotter information |
|
| 272 | - * |
|
| 273 | - */ |
|
| 274 | - public function getAltitudeSpeedArchiveTrackerDataById($id) |
|
| 275 | - { |
|
| 268 | + /** |
|
| 269 | + * Gets altitude & speed information based on a particular id |
|
| 270 | + * |
|
| 271 | + * @return Array the spotter information |
|
| 272 | + * |
|
| 273 | + */ |
|
| 274 | + public function getAltitudeSpeedArchiveTrackerDataById($id) |
|
| 275 | + { |
|
| 276 | 276 | |
| 277 | - date_default_timezone_set('UTC'); |
|
| 277 | + date_default_timezone_set('UTC'); |
|
| 278 | 278 | |
| 279 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 280 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 279 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 280 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 281 | 281 | |
| 282 | - try { |
|
| 283 | - $sth = $this->db->prepare($query); |
|
| 284 | - $sth->execute(array(':id' => $id)); |
|
| 285 | - } catch(PDOException $e) { |
|
| 286 | - echo $e->getMessage(); |
|
| 287 | - die; |
|
| 288 | - } |
|
| 289 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 282 | + try { |
|
| 283 | + $sth = $this->db->prepare($query); |
|
| 284 | + $sth->execute(array(':id' => $id)); |
|
| 285 | + } catch(PDOException $e) { |
|
| 286 | + echo $e->getMessage(); |
|
| 287 | + die; |
|
| 288 | + } |
|
| 289 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 290 | 290 | |
| 291 | - return $spotter_array; |
|
| 292 | - } |
|
| 291 | + return $spotter_array; |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Gets altitude information based on a particular callsign |
|
| 297 | - * |
|
| 298 | - * @return Array the spotter information |
|
| 299 | - * |
|
| 300 | - */ |
|
| 301 | - public function getLastAltitudeArchiveTrackerDataByIdent($ident) |
|
| 302 | - { |
|
| 295 | + /** |
|
| 296 | + * Gets altitude information based on a particular callsign |
|
| 297 | + * |
|
| 298 | + * @return Array the spotter information |
|
| 299 | + * |
|
| 300 | + */ |
|
| 301 | + public function getLastAltitudeArchiveTrackerDataByIdent($ident) |
|
| 302 | + { |
|
| 303 | 303 | |
| 304 | - date_default_timezone_set('UTC'); |
|
| 304 | + date_default_timezone_set('UTC'); |
|
| 305 | 305 | |
| 306 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 307 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 306 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 307 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 308 | 308 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
| 309 | 309 | |
| 310 | - try { |
|
| 311 | - $sth = $this->db->prepare($query); |
|
| 312 | - $sth->execute(array(':ident' => $ident)); |
|
| 313 | - } catch(PDOException $e) { |
|
| 314 | - echo $e->getMessage(); |
|
| 315 | - die; |
|
| 316 | - } |
|
| 317 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 310 | + try { |
|
| 311 | + $sth = $this->db->prepare($query); |
|
| 312 | + $sth->execute(array(':ident' => $ident)); |
|
| 313 | + } catch(PDOException $e) { |
|
| 314 | + echo $e->getMessage(); |
|
| 315 | + die; |
|
| 316 | + } |
|
| 317 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 318 | 318 | |
| 319 | - return $spotter_array; |
|
| 320 | - } |
|
| 319 | + return $spotter_array; |
|
| 320 | + } |
|
| 321 | 321 | |
| 322 | 322 | |
| 323 | 323 | |
| 324 | - /** |
|
| 325 | - * Gets all the archive spotter information |
|
| 326 | - * |
|
| 327 | - * @return Array the spotter information |
|
| 328 | - * |
|
| 329 | - */ |
|
| 330 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
| 331 | - { |
|
| 332 | - $Tracker = new Tracker($this->db); |
|
| 333 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 334 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
| 324 | + /** |
|
| 325 | + * Gets all the archive spotter information |
|
| 326 | + * |
|
| 327 | + * @return Array the spotter information |
|
| 328 | + * |
|
| 329 | + */ |
|
| 330 | + public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
| 331 | + { |
|
| 332 | + $Tracker = new Tracker($this->db); |
|
| 333 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 334 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
| 335 | 335 | |
| 336 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
| 336 | + $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
| 337 | 337 | |
| 338 | - return $spotter_array; |
|
| 339 | - } |
|
| 338 | + return $spotter_array; |
|
| 339 | + } |
|
| 340 | 340 | |
| 341 | - public function deleteTrackerArchiveTrackData() |
|
| 342 | - { |
|
| 341 | + public function deleteTrackerArchiveTrackData() |
|
| 342 | + { |
|
| 343 | 343 | global $globalArchiveKeepTrackMonths; |
| 344 | - date_default_timezone_set('UTC'); |
|
| 344 | + date_default_timezone_set('UTC'); |
|
| 345 | 345 | $query = 'DELETE FROM tracker_archive WHERE tracker_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)'; |
| 346 | - try { |
|
| 347 | - $sth = $this->db->prepare($query); |
|
| 348 | - $sth->execute(); |
|
| 349 | - } catch(PDOException $e) { |
|
| 350 | - echo $e->getMessage(); |
|
| 351 | - die; |
|
| 352 | - } |
|
| 346 | + try { |
|
| 347 | + $sth = $this->db->prepare($query); |
|
| 348 | + $sth->execute(); |
|
| 349 | + } catch(PDOException $e) { |
|
| 350 | + echo $e->getMessage(); |
|
| 351 | + die; |
|
| 352 | + } |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
| 356 | - * Gets Minimal Live Tracker data |
|
| 357 | - * |
|
| 358 | - * @return Array the spotter information |
|
| 359 | - * |
|
| 360 | - */ |
|
| 361 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
| 362 | - { |
|
| 363 | - global $globalDBdriver, $globalLiveInterval; |
|
| 364 | - date_default_timezone_set('UTC'); |
|
| 365 | - |
|
| 366 | - $filter_query = ''; |
|
| 367 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 368 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 369 | - } |
|
| 370 | - // Use spotter_output also ? |
|
| 371 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 372 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 373 | - } |
|
| 374 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 375 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
| 376 | - } |
|
| 377 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 378 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 379 | - } |
|
| 356 | + * Gets Minimal Live Tracker data |
|
| 357 | + * |
|
| 358 | + * @return Array the spotter information |
|
| 359 | + * |
|
| 360 | + */ |
|
| 361 | + public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
| 362 | + { |
|
| 363 | + global $globalDBdriver, $globalLiveInterval; |
|
| 364 | + date_default_timezone_set('UTC'); |
|
| 365 | + |
|
| 366 | + $filter_query = ''; |
|
| 367 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 368 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 369 | + } |
|
| 370 | + // Use spotter_output also ? |
|
| 371 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 372 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 373 | + } |
|
| 374 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 375 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
| 376 | + } |
|
| 377 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 378 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 379 | + } |
|
| 380 | 380 | |
| 381 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 382 | - if ($globalDBdriver == 'mysql') { |
|
| 383 | - /* |
|
| 381 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 382 | + if ($globalDBdriver == 'mysql') { |
|
| 383 | + /* |
|
| 384 | 384 | $query = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk |
| 385 | 385 | FROM tracker_archive |
| 386 | 386 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
@@ -399,56 +399,56 @@ discard block |
||
| 399 | 399 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
| 400 | 400 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
| 401 | 401 | '.$filter_query.' ORDER BY famtrackid'; |
| 402 | - } else { |
|
| 403 | - //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
|
| 404 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 402 | + } else { |
|
| 403 | + //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
|
| 404 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 405 | 405 | FROM tracker_archive |
| 406 | 406 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
| 407 | 407 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
| 408 | 408 | '.$filter_query.' ORDER BY famtrackid'; |
| 409 | - } |
|
| 410 | - //echo $query; |
|
| 411 | - try { |
|
| 412 | - $sth = $this->db->prepare($query); |
|
| 413 | - $sth->execute(); |
|
| 414 | - } catch(PDOException $e) { |
|
| 415 | - echo $e->getMessage(); |
|
| 416 | - die; |
|
| 417 | - } |
|
| 418 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 409 | + } |
|
| 410 | + //echo $query; |
|
| 411 | + try { |
|
| 412 | + $sth = $this->db->prepare($query); |
|
| 413 | + $sth->execute(); |
|
| 414 | + } catch(PDOException $e) { |
|
| 415 | + echo $e->getMessage(); |
|
| 416 | + die; |
|
| 417 | + } |
|
| 418 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 419 | 419 | |
| 420 | - return $spotter_array; |
|
| 421 | - } |
|
| 420 | + return $spotter_array; |
|
| 421 | + } |
|
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | - * Gets Minimal Live Tracker data |
|
| 425 | - * |
|
| 426 | - * @return Array the spotter information |
|
| 427 | - * |
|
| 428 | - */ |
|
| 429 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
| 430 | - { |
|
| 431 | - global $globalDBdriver, $globalLiveInterval; |
|
| 432 | - date_default_timezone_set('UTC'); |
|
| 433 | - |
|
| 434 | - $filter_query = ''; |
|
| 435 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 436 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 437 | - } |
|
| 438 | - // Should use spotter_output also ? |
|
| 439 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 440 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 441 | - } |
|
| 442 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 443 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
| 444 | - } |
|
| 445 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 446 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 447 | - } |
|
| 424 | + * Gets Minimal Live Tracker data |
|
| 425 | + * |
|
| 426 | + * @return Array the spotter information |
|
| 427 | + * |
|
| 428 | + */ |
|
| 429 | + public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
| 430 | + { |
|
| 431 | + global $globalDBdriver, $globalLiveInterval; |
|
| 432 | + date_default_timezone_set('UTC'); |
|
| 433 | + |
|
| 434 | + $filter_query = ''; |
|
| 435 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 436 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 437 | + } |
|
| 438 | + // Should use spotter_output also ? |
|
| 439 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 440 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 441 | + } |
|
| 442 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 443 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
| 444 | + } |
|
| 445 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 446 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 447 | + } |
|
| 448 | 448 | |
| 449 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 450 | - if ($globalDBdriver == 'mysql') { |
|
| 451 | - /* |
|
| 449 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 450 | + if ($globalDBdriver == 'mysql') { |
|
| 451 | + /* |
|
| 452 | 452 | $query = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk |
| 453 | 453 | FROM tracker_archive |
| 454 | 454 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
@@ -459,95 +459,95 @@ discard block |
||
| 459 | 459 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
| 460 | 460 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
| 461 | 461 | |
| 462 | - } else { |
|
| 463 | - //$query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao'; |
|
| 464 | - /* |
|
| 462 | + } else { |
|
| 463 | + //$query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao'; |
|
| 464 | + /* |
|
| 465 | 465 | $query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
| 466 | 466 | FROM tracker_archive_output |
| 467 | 467 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
| 468 | 468 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
| 469 | 469 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
| 470 | 470 | */ |
| 471 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
| 471 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
| 472 | 472 | FROM tracker_archive_output |
| 473 | 473 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
| 474 | 474 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
| 475 | 475 | '.$filter_query.' LIMIT 200 OFFSET 0'; |
| 476 | 476 | // .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow'; |
| 477 | 477 | |
| 478 | - } |
|
| 479 | - //echo $query; |
|
| 480 | - try { |
|
| 481 | - $sth = $this->db->prepare($query); |
|
| 482 | - $sth->execute(); |
|
| 483 | - } catch(PDOException $e) { |
|
| 484 | - echo $e->getMessage(); |
|
| 485 | - die; |
|
| 486 | - } |
|
| 487 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 478 | + } |
|
| 479 | + //echo $query; |
|
| 480 | + try { |
|
| 481 | + $sth = $this->db->prepare($query); |
|
| 482 | + $sth->execute(); |
|
| 483 | + } catch(PDOException $e) { |
|
| 484 | + echo $e->getMessage(); |
|
| 485 | + die; |
|
| 486 | + } |
|
| 487 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 488 | 488 | |
| 489 | - return $spotter_array; |
|
| 490 | - } |
|
| 489 | + return $spotter_array; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | /** |
| 493 | - * Gets count Live Tracker data |
|
| 494 | - * |
|
| 495 | - * @return Array the spotter information |
|
| 496 | - * |
|
| 497 | - */ |
|
| 498 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
| 499 | - { |
|
| 500 | - global $globalDBdriver, $globalLiveInterval; |
|
| 501 | - date_default_timezone_set('UTC'); |
|
| 502 | - |
|
| 503 | - $filter_query = ''; |
|
| 504 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 505 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 506 | - } |
|
| 507 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 508 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 509 | - } |
|
| 510 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 511 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
| 512 | - } |
|
| 513 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 514 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 515 | - } |
|
| 493 | + * Gets count Live Tracker data |
|
| 494 | + * |
|
| 495 | + * @return Array the spotter information |
|
| 496 | + * |
|
| 497 | + */ |
|
| 498 | + public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
| 499 | + { |
|
| 500 | + global $globalDBdriver, $globalLiveInterval; |
|
| 501 | + date_default_timezone_set('UTC'); |
|
| 516 | 502 | |
| 517 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 518 | - if ($globalDBdriver == 'mysql') { |
|
| 503 | + $filter_query = ''; |
|
| 504 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 505 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 506 | + } |
|
| 507 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 508 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 509 | + } |
|
| 510 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 511 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
| 512 | + } |
|
| 513 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 514 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 515 | + } |
|
| 516 | + |
|
| 517 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 518 | + if ($globalDBdriver == 'mysql') { |
|
| 519 | 519 | $query = 'SELECT COUNT(DISTINCT famtrackid) as nb |
| 520 | 520 | FROM tracker_archive l |
| 521 | 521 | WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query; |
| 522 | - } else { |
|
| 522 | + } else { |
|
| 523 | 523 | $query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query; |
| 524 | - } |
|
| 525 | - //echo $query; |
|
| 526 | - try { |
|
| 527 | - $sth = $this->db->prepare($query); |
|
| 528 | - $sth->execute(); |
|
| 529 | - } catch(PDOException $e) { |
|
| 530 | - echo $e->getMessage(); |
|
| 531 | - die; |
|
| 532 | - } |
|
| 524 | + } |
|
| 525 | + //echo $query; |
|
| 526 | + try { |
|
| 527 | + $sth = $this->db->prepare($query); |
|
| 528 | + $sth->execute(); |
|
| 529 | + } catch(PDOException $e) { |
|
| 530 | + echo $e->getMessage(); |
|
| 531 | + die; |
|
| 532 | + } |
|
| 533 | 533 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 534 | 534 | $sth->closeCursor(); |
| 535 | - return $result['nb']; |
|
| 535 | + return $result['nb']; |
|
| 536 | 536 | |
| 537 | - } |
|
| 537 | + } |
|
| 538 | 538 | |
| 539 | 539 | |
| 540 | 540 | |
| 541 | 541 | // tracker_archive_output |
| 542 | 542 | |
| 543 | - /** |
|
| 544 | - * Gets all the spotter information |
|
| 545 | - * |
|
| 546 | - * @return Array the spotter information |
|
| 547 | - * |
|
| 548 | - */ |
|
| 549 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
| 550 | - { |
|
| 543 | + /** |
|
| 544 | + * Gets all the spotter information |
|
| 545 | + * |
|
| 546 | + * @return Array the spotter information |
|
| 547 | + * |
|
| 548 | + */ |
|
| 549 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
| 550 | + { |
|
| 551 | 551 | global $globalTimezone, $globalDBdriver; |
| 552 | 552 | require_once(dirname(__FILE__).'/class.Translation.php'); |
| 553 | 553 | $Translation = new Translation(); |
@@ -561,159 +561,159 @@ discard block |
||
| 561 | 561 | $filter_query = $this->getFilter($filters); |
| 562 | 562 | if ($q != "") |
| 563 | 563 | { |
| 564 | - if (!is_string($q)) |
|
| 565 | - { |
|
| 564 | + if (!is_string($q)) |
|
| 565 | + { |
|
| 566 | 566 | return false; |
| 567 | - } else { |
|
| 567 | + } else { |
|
| 568 | 568 | |
| 569 | 569 | $q_array = explode(" ", $q); |
| 570 | 570 | |
| 571 | 571 | foreach ($q_array as $q_item){ |
| 572 | - $additional_query .= " AND ("; |
|
| 573 | - $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
| 574 | - $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
| 575 | - $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
| 576 | - $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
| 577 | - $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
| 578 | - $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR "; |
|
| 579 | - $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR "; |
|
| 580 | - $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
| 581 | - $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
| 582 | - $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
| 583 | - $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
| 584 | - $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
| 585 | - $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
| 586 | - $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
| 587 | - $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
| 588 | - $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR "; |
|
| 589 | - $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR "; |
|
| 590 | - $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
| 591 | - $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
| 592 | - $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
|
| 593 | - $translate = $Translation->ident2icao($q_item); |
|
| 594 | - if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
| 595 | - $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
|
| 596 | - $additional_query .= ")"; |
|
| 572 | + $additional_query .= " AND ("; |
|
| 573 | + $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
| 574 | + $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
| 575 | + $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
| 576 | + $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
| 577 | + $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
| 578 | + $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR "; |
|
| 579 | + $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR "; |
|
| 580 | + $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
| 581 | + $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
| 582 | + $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
| 583 | + $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
| 584 | + $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
| 585 | + $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
| 586 | + $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
| 587 | + $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
| 588 | + $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR "; |
|
| 589 | + $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR "; |
|
| 590 | + $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
| 591 | + $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
| 592 | + $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
|
| 593 | + $translate = $Translation->ident2icao($q_item); |
|
| 594 | + if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
| 595 | + $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
|
| 596 | + $additional_query .= ")"; |
|
| 597 | + } |
|
| 597 | 598 | } |
| 598 | - } |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | if ($registration != "") |
| 602 | 602 | { |
| 603 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 604 | - if (!is_string($registration)) |
|
| 605 | - { |
|
| 603 | + $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 604 | + if (!is_string($registration)) |
|
| 605 | + { |
|
| 606 | 606 | return false; |
| 607 | - } else { |
|
| 607 | + } else { |
|
| 608 | 608 | $additional_query .= " AND (tracker_archive_output.registration = '".$registration."')"; |
| 609 | - } |
|
| 609 | + } |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | if ($aircraft_icao != "") |
| 613 | 613 | { |
| 614 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 615 | - if (!is_string($aircraft_icao)) |
|
| 616 | - { |
|
| 614 | + $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 615 | + if (!is_string($aircraft_icao)) |
|
| 616 | + { |
|
| 617 | 617 | return false; |
| 618 | - } else { |
|
| 618 | + } else { |
|
| 619 | 619 | $additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')"; |
| 620 | - } |
|
| 620 | + } |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | if ($aircraft_manufacturer != "") |
| 624 | 624 | { |
| 625 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 626 | - if (!is_string($aircraft_manufacturer)) |
|
| 627 | - { |
|
| 625 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 626 | + if (!is_string($aircraft_manufacturer)) |
|
| 627 | + { |
|
| 628 | 628 | return false; |
| 629 | - } else { |
|
| 629 | + } else { |
|
| 630 | 630 | $additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')"; |
| 631 | - } |
|
| 631 | + } |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | if ($highlights == "true") |
| 635 | 635 | { |
| 636 | - if (!is_string($highlights)) |
|
| 637 | - { |
|
| 636 | + if (!is_string($highlights)) |
|
| 637 | + { |
|
| 638 | 638 | return false; |
| 639 | - } else { |
|
| 639 | + } else { |
|
| 640 | 640 | $additional_query .= " AND (tracker_archive_output.highlight <> '')"; |
| 641 | - } |
|
| 641 | + } |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | if ($airline_icao != "") |
| 645 | 645 | { |
| 646 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 647 | - if (!is_string($airline_icao)) |
|
| 648 | - { |
|
| 646 | + $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 647 | + if (!is_string($airline_icao)) |
|
| 648 | + { |
|
| 649 | 649 | return false; |
| 650 | - } else { |
|
| 650 | + } else { |
|
| 651 | 651 | $additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')"; |
| 652 | - } |
|
| 652 | + } |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | if ($airline_country != "") |
| 656 | 656 | { |
| 657 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 658 | - if (!is_string($airline_country)) |
|
| 659 | - { |
|
| 657 | + $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 658 | + if (!is_string($airline_country)) |
|
| 659 | + { |
|
| 660 | 660 | return false; |
| 661 | - } else { |
|
| 661 | + } else { |
|
| 662 | 662 | $additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')"; |
| 663 | - } |
|
| 663 | + } |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | if ($airline_type != "") |
| 667 | 667 | { |
| 668 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 669 | - if (!is_string($airline_type)) |
|
| 670 | - { |
|
| 668 | + $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 669 | + if (!is_string($airline_type)) |
|
| 670 | + { |
|
| 671 | 671 | return false; |
| 672 | - } else { |
|
| 672 | + } else { |
|
| 673 | 673 | if ($airline_type == "passenger") |
| 674 | 674 | { |
| 675 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')"; |
|
| 675 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')"; |
|
| 676 | 676 | } |
| 677 | 677 | if ($airline_type == "cargo") |
| 678 | 678 | { |
| 679 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')"; |
|
| 679 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')"; |
|
| 680 | 680 | } |
| 681 | 681 | if ($airline_type == "military") |
| 682 | 682 | { |
| 683 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'military')"; |
|
| 683 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'military')"; |
|
| 684 | + } |
|
| 684 | 685 | } |
| 685 | - } |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | if ($airport != "") |
| 689 | 689 | { |
| 690 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 691 | - if (!is_string($airport)) |
|
| 692 | - { |
|
| 690 | + $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 691 | + if (!is_string($airport)) |
|
| 692 | + { |
|
| 693 | 693 | return false; |
| 694 | - } else { |
|
| 694 | + } else { |
|
| 695 | 695 | $additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))"; |
| 696 | - } |
|
| 696 | + } |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | if ($airport_country != "") |
| 700 | 700 | { |
| 701 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 702 | - if (!is_string($airport_country)) |
|
| 703 | - { |
|
| 701 | + $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 702 | + if (!is_string($airport_country)) |
|
| 703 | + { |
|
| 704 | 704 | return false; |
| 705 | - } else { |
|
| 705 | + } else { |
|
| 706 | 706 | $additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))"; |
| 707 | - } |
|
| 707 | + } |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | if ($callsign != "") |
| 711 | 711 | { |
| 712 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 713 | - if (!is_string($callsign)) |
|
| 714 | - { |
|
| 712 | + $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 713 | + if (!is_string($callsign)) |
|
| 714 | + { |
|
| 715 | 715 | return false; |
| 716 | - } else { |
|
| 716 | + } else { |
|
| 717 | 717 | $translate = $Translation->ident2icao($callsign); |
| 718 | 718 | if ($translate != $callsign) { |
| 719 | 719 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
@@ -721,99 +721,99 @@ discard block |
||
| 721 | 721 | } else { |
| 722 | 722 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
| 723 | 723 | } |
| 724 | - } |
|
| 724 | + } |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | if ($owner != "") |
| 728 | 728 | { |
| 729 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 730 | - if (!is_string($owner)) |
|
| 731 | - { |
|
| 729 | + $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 730 | + if (!is_string($owner)) |
|
| 731 | + { |
|
| 732 | 732 | return false; |
| 733 | - } else { |
|
| 733 | + } else { |
|
| 734 | 734 | $additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')"; |
| 735 | - } |
|
| 735 | + } |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | if ($pilot_name != "") |
| 739 | 739 | { |
| 740 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 741 | - if (!is_string($pilot_name)) |
|
| 742 | - { |
|
| 740 | + $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 741 | + if (!is_string($pilot_name)) |
|
| 742 | + { |
|
| 743 | 743 | return false; |
| 744 | - } else { |
|
| 744 | + } else { |
|
| 745 | 745 | $additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')"; |
| 746 | - } |
|
| 746 | + } |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | if ($pilot_id != "") |
| 750 | 750 | { |
| 751 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 752 | - if (!is_string($pilot_id)) |
|
| 753 | - { |
|
| 751 | + $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 752 | + if (!is_string($pilot_id)) |
|
| 753 | + { |
|
| 754 | 754 | return false; |
| 755 | - } else { |
|
| 755 | + } else { |
|
| 756 | 756 | $additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')"; |
| 757 | - } |
|
| 757 | + } |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | if ($departure_airport_route != "") |
| 761 | 761 | { |
| 762 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 763 | - if (!is_string($departure_airport_route)) |
|
| 764 | - { |
|
| 762 | + $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 763 | + if (!is_string($departure_airport_route)) |
|
| 764 | + { |
|
| 765 | 765 | return false; |
| 766 | - } else { |
|
| 766 | + } else { |
|
| 767 | 767 | $additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')"; |
| 768 | - } |
|
| 768 | + } |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | if ($arrival_airport_route != "") |
| 772 | 772 | { |
| 773 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 774 | - if (!is_string($arrival_airport_route)) |
|
| 775 | - { |
|
| 773 | + $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 774 | + if (!is_string($arrival_airport_route)) |
|
| 775 | + { |
|
| 776 | 776 | return false; |
| 777 | - } else { |
|
| 777 | + } else { |
|
| 778 | 778 | $additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')"; |
| 779 | - } |
|
| 779 | + } |
|
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | if ($altitude != "") |
| 783 | 783 | { |
| 784 | - $altitude_array = explode(",", $altitude); |
|
| 784 | + $altitude_array = explode(",", $altitude); |
|
| 785 | 785 | |
| 786 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 787 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 786 | + $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 787 | + $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 788 | 788 | |
| 789 | 789 | |
| 790 | - if ($altitude_array[1] != "") |
|
| 791 | - { |
|
| 790 | + if ($altitude_array[1] != "") |
|
| 791 | + { |
|
| 792 | 792 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
| 793 | 793 | $altitude_array[1] = substr($altitude_array[1], 0, -2); |
| 794 | 794 | $additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' "; |
| 795 | - } else { |
|
| 795 | + } else { |
|
| 796 | 796 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
| 797 | 797 | $additional_query .= " AND altitude <= '".$altitude_array[0]."' "; |
| 798 | - } |
|
| 798 | + } |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | if ($date_posted != "") |
| 802 | 802 | { |
| 803 | - $date_array = explode(",", $date_posted); |
|
| 803 | + $date_array = explode(",", $date_posted); |
|
| 804 | 804 | |
| 805 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 806 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 805 | + $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 806 | + $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 807 | 807 | |
| 808 | - if ($globalTimezone != '') { |
|
| 808 | + if ($globalTimezone != '') { |
|
| 809 | 809 | date_default_timezone_set($globalTimezone); |
| 810 | 810 | $datetime = new DateTime(); |
| 811 | 811 | $offset = $datetime->format('P'); |
| 812 | - } else $offset = '+00:00'; |
|
| 812 | + } else $offset = '+00:00'; |
|
| 813 | 813 | |
| 814 | 814 | |
| 815 | - if ($date_array[1] != "") |
|
| 816 | - { |
|
| 815 | + if ($date_array[1] != "") |
|
| 816 | + { |
|
| 817 | 817 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
| 818 | 818 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
| 819 | 819 | if ($globalDBdriver == 'mysql') { |
@@ -821,28 +821,28 @@ discard block |
||
| 821 | 821 | } else { |
| 822 | 822 | $additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) "; |
| 823 | 823 | } |
| 824 | - } else { |
|
| 824 | + } else { |
|
| 825 | 825 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
| 826 | - if ($globalDBdriver == 'mysql') { |
|
| 826 | + if ($globalDBdriver == 'mysql') { |
|
| 827 | 827 | $additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' "; |
| 828 | 828 | } else { |
| 829 | 829 | $additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) "; |
| 830 | 830 | } |
| 831 | - } |
|
| 831 | + } |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | if ($limit != "") |
| 835 | 835 | { |
| 836 | - $limit_array = explode(",", $limit); |
|
| 836 | + $limit_array = explode(",", $limit); |
|
| 837 | 837 | |
| 838 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 839 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 838 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 839 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 840 | 840 | |
| 841 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 842 | - { |
|
| 841 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 842 | + { |
|
| 843 | 843 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 844 | 844 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 845 | - } |
|
| 845 | + } |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | |
@@ -873,33 +873,33 @@ discard block |
||
| 873 | 873 | $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
| 874 | 874 | |
| 875 | 875 | return $spotter_array; |
| 876 | - } |
|
| 876 | + } |
|
| 877 | 877 | |
| 878 | - public function deleteTrackerArchiveData() |
|
| 879 | - { |
|
| 878 | + public function deleteTrackerArchiveData() |
|
| 879 | + { |
|
| 880 | 880 | global $globalArchiveKeepMonths, $globalDBdriver; |
| 881 | - date_default_timezone_set('UTC'); |
|
| 882 | - if ($globalDBdriver == 'mysql') { |
|
| 881 | + date_default_timezone_set('UTC'); |
|
| 882 | + if ($globalDBdriver == 'mysql') { |
|
| 883 | 883 | $query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)'; |
| 884 | 884 | } else { |
| 885 | 885 | $query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'"; |
| 886 | 886 | } |
| 887 | - try { |
|
| 888 | - $sth = $this->db->prepare($query); |
|
| 889 | - $sth->execute(); |
|
| 890 | - } catch(PDOException $e) { |
|
| 891 | - return "error"; |
|
| 892 | - } |
|
| 887 | + try { |
|
| 888 | + $sth = $this->db->prepare($query); |
|
| 889 | + $sth->execute(); |
|
| 890 | + } catch(PDOException $e) { |
|
| 891 | + return "error"; |
|
| 892 | + } |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - /** |
|
| 896 | - * Gets all the spotter information based on the callsign |
|
| 897 | - * |
|
| 898 | - * @return Array the spotter information |
|
| 899 | - * |
|
| 900 | - */ |
|
| 901 | - public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '') |
|
| 902 | - { |
|
| 895 | + /** |
|
| 896 | + * Gets all the spotter information based on the callsign |
|
| 897 | + * |
|
| 898 | + * @return Array the spotter information |
|
| 899 | + * |
|
| 900 | + */ |
|
| 901 | + public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '') |
|
| 902 | + { |
|
| 903 | 903 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
| 904 | 904 | |
| 905 | 905 | date_default_timezone_set('UTC'); |
@@ -911,35 +911,35 @@ discard block |
||
| 911 | 911 | |
| 912 | 912 | if ($ident != "") |
| 913 | 913 | { |
| 914 | - if (!is_string($ident)) |
|
| 915 | - { |
|
| 914 | + if (!is_string($ident)) |
|
| 915 | + { |
|
| 916 | 916 | return false; |
| 917 | - } else { |
|
| 917 | + } else { |
|
| 918 | 918 | $additional_query = " AND (tracker_archive_output.ident = :ident)"; |
| 919 | 919 | $query_values = array(':ident' => $ident); |
| 920 | - } |
|
| 920 | + } |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | if ($limit != "") |
| 924 | 924 | { |
| 925 | - $limit_array = explode(",", $limit); |
|
| 925 | + $limit_array = explode(",", $limit); |
|
| 926 | 926 | |
| 927 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 928 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 927 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 928 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 929 | 929 | |
| 930 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 931 | - { |
|
| 930 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 931 | + { |
|
| 932 | 932 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 933 | 933 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 934 | - } |
|
| 934 | + } |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | if ($sort != "") |
| 938 | 938 | { |
| 939 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
| 940 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 939 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
| 940 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 941 | 941 | } else { |
| 942 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 942 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | $query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query; |
@@ -947,17 +947,17 @@ discard block |
||
| 947 | 947 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
| 948 | 948 | |
| 949 | 949 | return $spotter_array; |
| 950 | - } |
|
| 950 | + } |
|
| 951 | 951 | |
| 952 | 952 | |
| 953 | - /** |
|
| 954 | - * Gets all the spotter information based on the owner |
|
| 955 | - * |
|
| 956 | - * @return Array the spotter information |
|
| 957 | - * |
|
| 958 | - */ |
|
| 959 | - public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
| 960 | - { |
|
| 953 | + /** |
|
| 954 | + * Gets all the spotter information based on the owner |
|
| 955 | + * |
|
| 956 | + * @return Array the spotter information |
|
| 957 | + * |
|
| 958 | + */ |
|
| 959 | + public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
| 960 | + { |
|
| 961 | 961 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
| 962 | 962 | |
| 963 | 963 | date_default_timezone_set('UTC'); |
@@ -970,35 +970,35 @@ discard block |
||
| 970 | 970 | |
| 971 | 971 | if ($owner != "") |
| 972 | 972 | { |
| 973 | - if (!is_string($owner)) |
|
| 974 | - { |
|
| 973 | + if (!is_string($owner)) |
|
| 974 | + { |
|
| 975 | 975 | return false; |
| 976 | - } else { |
|
| 976 | + } else { |
|
| 977 | 977 | $additional_query = " AND (tracker_archive_output.owner_name = :owner)"; |
| 978 | 978 | $query_values = array(':owner' => $owner); |
| 979 | - } |
|
| 979 | + } |
|
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | if ($limit != "") |
| 983 | 983 | { |
| 984 | - $limit_array = explode(",", $limit); |
|
| 984 | + $limit_array = explode(",", $limit); |
|
| 985 | 985 | |
| 986 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 987 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 986 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 987 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 988 | 988 | |
| 989 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 990 | - { |
|
| 989 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 990 | + { |
|
| 991 | 991 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 992 | 992 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 993 | - } |
|
| 993 | + } |
|
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | if ($sort != "") |
| 997 | 997 | { |
| 998 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
| 999 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 998 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
| 999 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1000 | 1000 | } else { |
| 1001 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 1001 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | $query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1006,16 +1006,16 @@ discard block |
||
| 1006 | 1006 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
| 1007 | 1007 | |
| 1008 | 1008 | return $spotter_array; |
| 1009 | - } |
|
| 1010 | - |
|
| 1011 | - /** |
|
| 1012 | - * Gets all the spotter information based on the pilot |
|
| 1013 | - * |
|
| 1014 | - * @return Array the spotter information |
|
| 1015 | - * |
|
| 1016 | - */ |
|
| 1017 | - public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
| 1018 | - { |
|
| 1009 | + } |
|
| 1010 | + |
|
| 1011 | + /** |
|
| 1012 | + * Gets all the spotter information based on the pilot |
|
| 1013 | + * |
|
| 1014 | + * @return Array the spotter information |
|
| 1015 | + * |
|
| 1016 | + */ |
|
| 1017 | + public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
| 1018 | + { |
|
| 1019 | 1019 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
| 1020 | 1020 | |
| 1021 | 1021 | date_default_timezone_set('UTC'); |
@@ -1034,24 +1034,24 @@ discard block |
||
| 1034 | 1034 | |
| 1035 | 1035 | if ($limit != "") |
| 1036 | 1036 | { |
| 1037 | - $limit_array = explode(",", $limit); |
|
| 1037 | + $limit_array = explode(",", $limit); |
|
| 1038 | 1038 | |
| 1039 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1040 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1039 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1040 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1041 | 1041 | |
| 1042 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 1043 | - { |
|
| 1042 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 1043 | + { |
|
| 1044 | 1044 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 1045 | 1045 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 1046 | - } |
|
| 1046 | + } |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | if ($sort != "") |
| 1050 | 1050 | { |
| 1051 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
| 1052 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1051 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
| 1052 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1053 | 1053 | } else { |
| 1054 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 1054 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | $query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1059,16 +1059,16 @@ discard block |
||
| 1059 | 1059 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
| 1060 | 1060 | |
| 1061 | 1061 | return $spotter_array; |
| 1062 | - } |
|
| 1063 | - |
|
| 1064 | - /** |
|
| 1065 | - * Gets all number of flight over countries |
|
| 1066 | - * |
|
| 1067 | - * @return Array the airline country list |
|
| 1068 | - * |
|
| 1069 | - */ |
|
| 1070 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1071 | - { |
|
| 1062 | + } |
|
| 1063 | + |
|
| 1064 | + /** |
|
| 1065 | + * Gets all number of flight over countries |
|
| 1066 | + * |
|
| 1067 | + * @return Array the airline country list |
|
| 1068 | + * |
|
| 1069 | + */ |
|
| 1070 | + public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1071 | + { |
|
| 1072 | 1072 | global $globalDBdriver; |
| 1073 | 1073 | /* |
| 1074 | 1074 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1078,14 +1078,14 @@ discard block |
||
| 1078 | 1078 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 1079 | 1079 | FROM countries c, tracker_archive s |
| 1080 | 1080 | WHERE c.iso2 = s.over_country "; |
| 1081 | - if ($olderthanmonths > 0) { |
|
| 1082 | - if ($globalDBdriver == 'mysql') { |
|
| 1081 | + if ($olderthanmonths > 0) { |
|
| 1082 | + if ($globalDBdriver == 'mysql') { |
|
| 1083 | 1083 | $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 1084 | 1084 | } else { |
| 1085 | 1085 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1086 | 1086 | } |
| 1087 | 1087 | } |
| 1088 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 1088 | + if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 1089 | 1089 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1090 | 1090 | if ($limit) $query .= " LIMIT 0,10"; |
| 1091 | 1091 | |
@@ -1098,23 +1098,23 @@ discard block |
||
| 1098 | 1098 | |
| 1099 | 1099 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 1100 | 1100 | { |
| 1101 | - $temp_array['flight_count'] = $row['nb']; |
|
| 1102 | - $temp_array['flight_country'] = $row['name']; |
|
| 1103 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
| 1104 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
| 1105 | - $flight_array[] = $temp_array; |
|
| 1101 | + $temp_array['flight_count'] = $row['nb']; |
|
| 1102 | + $temp_array['flight_country'] = $row['name']; |
|
| 1103 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
| 1104 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
| 1105 | + $flight_array[] = $temp_array; |
|
| 1106 | 1106 | } |
| 1107 | 1107 | return $flight_array; |
| 1108 | - } |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * Gets all number of flight over countries |
|
| 1112 | - * |
|
| 1113 | - * @return Array the airline country list |
|
| 1114 | - * |
|
| 1115 | - */ |
|
| 1116 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1117 | - { |
|
| 1108 | + } |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * Gets all number of flight over countries |
|
| 1112 | + * |
|
| 1113 | + * @return Array the airline country list |
|
| 1114 | + * |
|
| 1115 | + */ |
|
| 1116 | + public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1117 | + { |
|
| 1118 | 1118 | global $globalDBdriver; |
| 1119 | 1119 | /* |
| 1120 | 1120 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1124,14 +1124,14 @@ discard block |
||
| 1124 | 1124 | $query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb |
| 1125 | 1125 | FROM countries c, tracker_archive s, spotter_output o |
| 1126 | 1126 | WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid "; |
| 1127 | - if ($olderthanmonths > 0) { |
|
| 1128 | - if ($globalDBdriver == 'mysql') { |
|
| 1127 | + if ($olderthanmonths > 0) { |
|
| 1128 | + if ($globalDBdriver == 'mysql') { |
|
| 1129 | 1129 | $query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 1130 | 1130 | } else { |
| 1131 | 1131 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| 1134 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
| 1134 | + if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
| 1135 | 1135 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1136 | 1136 | if ($limit) $query .= " LIMIT 0,10"; |
| 1137 | 1137 | |
@@ -1144,24 +1144,24 @@ discard block |
||
| 1144 | 1144 | |
| 1145 | 1145 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 1146 | 1146 | { |
| 1147 | - $temp_array['airline_icao'] = $row['airline_icao']; |
|
| 1148 | - $temp_array['flight_count'] = $row['nb']; |
|
| 1149 | - $temp_array['flight_country'] = $row['name']; |
|
| 1150 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
| 1151 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
| 1152 | - $flight_array[] = $temp_array; |
|
| 1147 | + $temp_array['airline_icao'] = $row['airline_icao']; |
|
| 1148 | + $temp_array['flight_count'] = $row['nb']; |
|
| 1149 | + $temp_array['flight_country'] = $row['name']; |
|
| 1150 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
| 1151 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
| 1152 | + $flight_array[] = $temp_array; |
|
| 1153 | 1153 | } |
| 1154 | 1154 | return $flight_array; |
| 1155 | - } |
|
| 1156 | - |
|
| 1157 | - /** |
|
| 1158 | - * Gets last spotter information based on a particular callsign |
|
| 1159 | - * |
|
| 1160 | - * @return Array the spotter information |
|
| 1161 | - * |
|
| 1162 | - */ |
|
| 1163 | - public function getDateArchiveTrackerDataById($id,$date) |
|
| 1164 | - { |
|
| 1155 | + } |
|
| 1156 | + |
|
| 1157 | + /** |
|
| 1158 | + * Gets last spotter information based on a particular callsign |
|
| 1159 | + * |
|
| 1160 | + * @return Array the spotter information |
|
| 1161 | + * |
|
| 1162 | + */ |
|
| 1163 | + public function getDateArchiveTrackerDataById($id,$date) |
|
| 1164 | + { |
|
| 1165 | 1165 | $Tracker = new Tracker($this->db); |
| 1166 | 1166 | date_default_timezone_set('UTC'); |
| 1167 | 1167 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -1169,16 +1169,16 @@ discard block |
||
| 1169 | 1169 | $date = date('c',$date); |
| 1170 | 1170 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
| 1171 | 1171 | return $spotter_array; |
| 1172 | - } |
|
| 1173 | - |
|
| 1174 | - /** |
|
| 1175 | - * Gets all the spotter information based on a particular callsign |
|
| 1176 | - * |
|
| 1177 | - * @return Array the spotter information |
|
| 1178 | - * |
|
| 1179 | - */ |
|
| 1180 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
| 1181 | - { |
|
| 1172 | + } |
|
| 1173 | + |
|
| 1174 | + /** |
|
| 1175 | + * Gets all the spotter information based on a particular callsign |
|
| 1176 | + * |
|
| 1177 | + * @return Array the spotter information |
|
| 1178 | + * |
|
| 1179 | + */ |
|
| 1180 | + public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
| 1181 | + { |
|
| 1182 | 1182 | $Tracker = new Tracker($this->db); |
| 1183 | 1183 | date_default_timezone_set('UTC'); |
| 1184 | 1184 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -1186,16 +1186,16 @@ discard block |
||
| 1186 | 1186 | $date = date('c',$date); |
| 1187 | 1187 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 1188 | 1188 | return $spotter_array; |
| 1189 | - } |
|
| 1190 | - |
|
| 1191 | - /** |
|
| 1192 | - * Gets all the spotter information based on the airport |
|
| 1193 | - * |
|
| 1194 | - * @return Array the spotter information |
|
| 1195 | - * |
|
| 1196 | - */ |
|
| 1197 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1198 | - { |
|
| 1189 | + } |
|
| 1190 | + |
|
| 1191 | + /** |
|
| 1192 | + * Gets all the spotter information based on the airport |
|
| 1193 | + * |
|
| 1194 | + * @return Array the spotter information |
|
| 1195 | + * |
|
| 1196 | + */ |
|
| 1197 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1198 | + { |
|
| 1199 | 1199 | global $global_query; |
| 1200 | 1200 | $Tracker = new Tracker(); |
| 1201 | 1201 | date_default_timezone_set('UTC'); |
@@ -1206,35 +1206,35 @@ discard block |
||
| 1206 | 1206 | |
| 1207 | 1207 | if ($airport != "") |
| 1208 | 1208 | { |
| 1209 | - if (!is_string($airport)) |
|
| 1210 | - { |
|
| 1209 | + if (!is_string($airport)) |
|
| 1210 | + { |
|
| 1211 | 1211 | return false; |
| 1212 | - } else { |
|
| 1212 | + } else { |
|
| 1213 | 1213 | $additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))"; |
| 1214 | 1214 | $query_values = array(':airport' => $airport); |
| 1215 | - } |
|
| 1215 | + } |
|
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | 1218 | if ($limit != "") |
| 1219 | 1219 | { |
| 1220 | - $limit_array = explode(",", $limit); |
|
| 1220 | + $limit_array = explode(",", $limit); |
|
| 1221 | 1221 | |
| 1222 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1223 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1222 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1223 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1224 | 1224 | |
| 1225 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 1226 | - { |
|
| 1225 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 1226 | + { |
|
| 1227 | 1227 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 1228 | 1228 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 1229 | - } |
|
| 1229 | + } |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | if ($sort != "") |
| 1233 | 1233 | { |
| 1234 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
| 1235 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1234 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
| 1235 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1236 | 1236 | } else { |
| 1237 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 1237 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | $query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query; |
@@ -1242,6 +1242,6 @@ discard block |
||
| 1242 | 1242 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
| 1243 | 1243 | |
| 1244 | 1244 | return $spotter_array; |
| 1245 | - } |
|
| 1245 | + } |
|
| 1246 | 1246 | } |
| 1247 | 1247 | ?> |
| 1248 | 1248 | \ No newline at end of file |
@@ -13,33 +13,33 @@ discard block |
||
| 13 | 13 | * @param Array $filter the filter |
| 14 | 14 | * @return Array the SQL part |
| 15 | 15 | */ |
| 16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 16 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 18 | 18 | $filters = array(); |
| 19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 21 | 21 | $filters = $globalStatsFilters[$globalFilterName]; |
| 22 | 22 | } else { |
| 23 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 23 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | if (isset($filter[0]['source'])) { |
| 27 | - $filters = array_merge($filters,$filter); |
|
| 27 | + $filters = array_merge($filters, $filter); |
|
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 30 | 30 | $filter_query_join = ''; |
| 31 | 31 | $filter_query_where = ''; |
| 32 | - foreach($filters as $flt) { |
|
| 32 | + foreach ($filters as $flt) { |
|
| 33 | 33 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 34 | 34 | if (isset($flt['source'])) { |
| 35 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 35 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 36 | 36 | } else { |
| 37 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 37 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 42 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 42 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 43 | 43 | } |
| 44 | 44 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 45 | 45 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -67,38 +67,38 @@ discard block |
||
| 67 | 67 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
| 70 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
| 71 | 71 | } |
| 72 | 72 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 73 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 73 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 74 | 74 | } |
| 75 | 75 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 76 | 76 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 77 | 77 | if ($filter_query_where != '') { |
| 78 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 78 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 79 | 79 | } |
| 80 | 80 | $filter_query = $filter_query_join.$filter_query_where; |
| 81 | 81 | return $filter_query; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // tracker_archive |
| 85 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
| 85 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
| 86 | 86 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
| 87 | 87 | if ($over_country == '') { |
| 88 | 88 | $Tracker = new Tracker($this->db); |
| 89 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
| 89 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
| 90 | 90 | if (!empty($data_country)) $country = $data_country['iso2']; |
| 91 | 91 | else $country = ''; |
| 92 | 92 | } else $country = $over_country; |
| 93 | 93 | // Route is not added in tracker_archive |
| 94 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
| 94 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
| 95 | 95 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
| 96 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
| 96 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
| 97 | 97 | try { |
| 98 | 98 | $sth = $this->db->prepare($query); |
| 99 | 99 | $sth->execute($query_values); |
| 100 | 100 | $sth->closeCursor(); |
| 101 | - } catch(PDOException $e) { |
|
| 101 | + } catch (PDOException $e) { |
|
| 102 | 102 | return "error : ".$e->getMessage(); |
| 103 | 103 | } |
| 104 | 104 | return "success"; |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 120 | 120 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
| 121 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 121 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 122 | 122 | |
| 123 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
| 123 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
| 124 | 124 | |
| 125 | 125 | return $spotter_array; |
| 126 | 126 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 140 | 140 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
| 141 | 141 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
| 142 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
| 142 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
| 143 | 143 | |
| 144 | 144 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 145 | 145 | /* |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
| 154 | 154 | */ |
| 155 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
| 155 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
| 156 | 156 | |
| 157 | 157 | return $spotter_array; |
| 158 | 158 | } |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | date_default_timezone_set('UTC'); |
| 169 | 169 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 170 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 170 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 171 | 171 | |
| 172 | 172 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 173 | 173 | |
| 174 | 174 | try { |
| 175 | 175 | $sth = $this->db->prepare($query); |
| 176 | 176 | $sth->execute(array(':id' => $id)); |
| 177 | - } catch(PDOException $e) { |
|
| 177 | + } catch (PDOException $e) { |
|
| 178 | 178 | echo $e->getMessage(); |
| 179 | 179 | die; |
| 180 | 180 | } |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | date_default_timezone_set('UTC'); |
| 195 | 195 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 196 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
| 196 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
| 197 | 197 | |
| 198 | 198 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 199 | 199 | |
| 200 | 200 | try { |
| 201 | 201 | $sth = $this->db->prepare($query); |
| 202 | 202 | $sth->execute(array(':id' => $id)); |
| 203 | - } catch(PDOException $e) { |
|
| 203 | + } catch (PDOException $e) { |
|
| 204 | 204 | echo $e->getMessage(); |
| 205 | 205 | die; |
| 206 | 206 | } |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | date_default_timezone_set('UTC'); |
| 223 | 223 | |
| 224 | 224 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 225 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 225 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 226 | 226 | |
| 227 | 227 | try { |
| 228 | 228 | $sth = $this->db->prepare($query); |
| 229 | 229 | $sth->execute(array(':ident' => $ident)); |
| 230 | - } catch(PDOException $e) { |
|
| 230 | + } catch (PDOException $e) { |
|
| 231 | 231 | echo $e->getMessage(); |
| 232 | 232 | die; |
| 233 | 233 | } |
@@ -248,12 +248,12 @@ discard block |
||
| 248 | 248 | date_default_timezone_set('UTC'); |
| 249 | 249 | |
| 250 | 250 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 251 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 251 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 252 | 252 | |
| 253 | 253 | try { |
| 254 | 254 | $sth = $this->db->prepare($query); |
| 255 | 255 | $sth->execute(array(':id' => $id)); |
| 256 | - } catch(PDOException $e) { |
|
| 256 | + } catch (PDOException $e) { |
|
| 257 | 257 | echo $e->getMessage(); |
| 258 | 258 | die; |
| 259 | 259 | } |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | date_default_timezone_set('UTC'); |
| 275 | 275 | |
| 276 | 276 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 277 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 277 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 278 | 278 | |
| 279 | 279 | try { |
| 280 | 280 | $sth = $this->db->prepare($query); |
| 281 | 281 | $sth->execute(array(':id' => $id)); |
| 282 | - } catch(PDOException $e) { |
|
| 282 | + } catch (PDOException $e) { |
|
| 283 | 283 | echo $e->getMessage(); |
| 284 | 284 | die; |
| 285 | 285 | } |
@@ -301,13 +301,13 @@ discard block |
||
| 301 | 301 | date_default_timezone_set('UTC'); |
| 302 | 302 | |
| 303 | 303 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 304 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 304 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 305 | 305 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
| 306 | 306 | |
| 307 | 307 | try { |
| 308 | 308 | $sth = $this->db->prepare($query); |
| 309 | 309 | $sth->execute(array(':ident' => $ident)); |
| 310 | - } catch(PDOException $e) { |
|
| 310 | + } catch (PDOException $e) { |
|
| 311 | 311 | echo $e->getMessage(); |
| 312 | 312 | die; |
| 313 | 313 | } |
@@ -324,13 +324,13 @@ discard block |
||
| 324 | 324 | * @return Array the spotter information |
| 325 | 325 | * |
| 326 | 326 | */ |
| 327 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
| 327 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
| 328 | 328 | { |
| 329 | 329 | $Tracker = new Tracker($this->db); |
| 330 | 330 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 331 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
| 331 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
| 332 | 332 | |
| 333 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
| 333 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
| 334 | 334 | |
| 335 | 335 | return $spotter_array; |
| 336 | 336 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | try { |
| 344 | 344 | $sth = $this->db->prepare($query); |
| 345 | 345 | $sth->execute(); |
| 346 | - } catch(PDOException $e) { |
|
| 346 | + } catch (PDOException $e) { |
|
| 347 | 347 | echo $e->getMessage(); |
| 348 | 348 | die; |
| 349 | 349 | } |
@@ -355,24 +355,24 @@ discard block |
||
| 355 | 355 | * @return Array the spotter information |
| 356 | 356 | * |
| 357 | 357 | */ |
| 358 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
| 358 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
| 359 | 359 | { |
| 360 | 360 | global $globalDBdriver, $globalLiveInterval; |
| 361 | 361 | date_default_timezone_set('UTC'); |
| 362 | 362 | |
| 363 | 363 | $filter_query = ''; |
| 364 | 364 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 365 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 365 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 366 | 366 | } |
| 367 | 367 | // Use spotter_output also ? |
| 368 | 368 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 369 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 369 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 370 | 370 | } |
| 371 | 371 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 372 | 372 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
| 373 | 373 | } |
| 374 | 374 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 375 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 375 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -391,14 +391,14 @@ discard block |
||
| 391 | 391 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
| 392 | 392 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
| 393 | 393 | */ |
| 394 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 394 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 395 | 395 | FROM tracker_archive |
| 396 | 396 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
| 397 | 397 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
| 398 | 398 | '.$filter_query.' ORDER BY famtrackid'; |
| 399 | 399 | } else { |
| 400 | 400 | //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
| 401 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 401 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 402 | 402 | FROM tracker_archive |
| 403 | 403 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
| 404 | 404 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | try { |
| 409 | 409 | $sth = $this->db->prepare($query); |
| 410 | 410 | $sth->execute(); |
| 411 | - } catch(PDOException $e) { |
|
| 411 | + } catch (PDOException $e) { |
|
| 412 | 412 | echo $e->getMessage(); |
| 413 | 413 | die; |
| 414 | 414 | } |
@@ -423,24 +423,24 @@ discard block |
||
| 423 | 423 | * @return Array the spotter information |
| 424 | 424 | * |
| 425 | 425 | */ |
| 426 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
| 426 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
| 427 | 427 | { |
| 428 | 428 | global $globalDBdriver, $globalLiveInterval; |
| 429 | 429 | date_default_timezone_set('UTC'); |
| 430 | 430 | |
| 431 | 431 | $filter_query = ''; |
| 432 | 432 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 433 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 433 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 434 | 434 | } |
| 435 | 435 | // Should use spotter_output also ? |
| 436 | 436 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 437 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 437 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 438 | 438 | } |
| 439 | 439 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 440 | 440 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
| 441 | 441 | } |
| 442 | 442 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 443 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 443 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | FROM tracker_archive |
| 451 | 451 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
| 452 | 452 | */ |
| 453 | - $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
| 453 | + $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
| 454 | 454 | FROM tracker_archive_output |
| 455 | 455 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
| 456 | 456 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
| 466 | 466 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
| 467 | 467 | */ |
| 468 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
| 468 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
| 469 | 469 | FROM tracker_archive_output |
| 470 | 470 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
| 471 | 471 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | try { |
| 478 | 478 | $sth = $this->db->prepare($query); |
| 479 | 479 | $sth->execute(); |
| 480 | - } catch(PDOException $e) { |
|
| 480 | + } catch (PDOException $e) { |
|
| 481 | 481 | echo $e->getMessage(); |
| 482 | 482 | die; |
| 483 | 483 | } |
@@ -492,23 +492,23 @@ discard block |
||
| 492 | 492 | * @return Array the spotter information |
| 493 | 493 | * |
| 494 | 494 | */ |
| 495 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
| 495 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
| 496 | 496 | { |
| 497 | 497 | global $globalDBdriver, $globalLiveInterval; |
| 498 | 498 | date_default_timezone_set('UTC'); |
| 499 | 499 | |
| 500 | 500 | $filter_query = ''; |
| 501 | 501 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 502 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 502 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 503 | 503 | } |
| 504 | 504 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 505 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 505 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 506 | 506 | } |
| 507 | 507 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 508 | 508 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
| 509 | 509 | } |
| 510 | 510 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 511 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 511 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | try { |
| 524 | 524 | $sth = $this->db->prepare($query); |
| 525 | 525 | $sth->execute(); |
| 526 | - } catch(PDOException $e) { |
|
| 526 | + } catch (PDOException $e) { |
|
| 527 | 527 | echo $e->getMessage(); |
| 528 | 528 | die; |
| 529 | 529 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | * @return Array the spotter information |
| 544 | 544 | * |
| 545 | 545 | */ |
| 546 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
| 546 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 547 | 547 | { |
| 548 | 548 | global $globalTimezone, $globalDBdriver; |
| 549 | 549 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | $q_array = explode(" ", $q); |
| 567 | 567 | |
| 568 | - foreach ($q_array as $q_item){ |
|
| 568 | + foreach ($q_array as $q_item) { |
|
| 569 | 569 | $additional_query .= " AND ("; |
| 570 | 570 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
| 571 | 571 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | |
| 598 | 598 | if ($registration != "") |
| 599 | 599 | { |
| 600 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 600 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 601 | 601 | if (!is_string($registration)) |
| 602 | 602 | { |
| 603 | 603 | return false; |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | if ($aircraft_icao != "") |
| 610 | 610 | { |
| 611 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 611 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 612 | 612 | if (!is_string($aircraft_icao)) |
| 613 | 613 | { |
| 614 | 614 | return false; |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | |
| 620 | 620 | if ($aircraft_manufacturer != "") |
| 621 | 621 | { |
| 622 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 622 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 623 | 623 | if (!is_string($aircraft_manufacturer)) |
| 624 | 624 | { |
| 625 | 625 | return false; |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | if ($airline_icao != "") |
| 642 | 642 | { |
| 643 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 643 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 644 | 644 | if (!is_string($airline_icao)) |
| 645 | 645 | { |
| 646 | 646 | return false; |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | if ($airline_country != "") |
| 653 | 653 | { |
| 654 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 654 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 655 | 655 | if (!is_string($airline_country)) |
| 656 | 656 | { |
| 657 | 657 | return false; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | |
| 663 | 663 | if ($airline_type != "") |
| 664 | 664 | { |
| 665 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 665 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 666 | 666 | if (!is_string($airline_type)) |
| 667 | 667 | { |
| 668 | 668 | return false; |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | if ($airport != "") |
| 686 | 686 | { |
| 687 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 687 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 688 | 688 | if (!is_string($airport)) |
| 689 | 689 | { |
| 690 | 690 | return false; |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | if ($airport_country != "") |
| 697 | 697 | { |
| 698 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 698 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 699 | 699 | if (!is_string($airport_country)) |
| 700 | 700 | { |
| 701 | 701 | return false; |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | if ($callsign != "") |
| 708 | 708 | { |
| 709 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 709 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 710 | 710 | if (!is_string($callsign)) |
| 711 | 711 | { |
| 712 | 712 | return false; |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | $translate = $Translation->ident2icao($callsign); |
| 715 | 715 | if ($translate != $callsign) { |
| 716 | 716 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
| 717 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 717 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 718 | 718 | } else { |
| 719 | 719 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
| 720 | 720 | } |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | |
| 724 | 724 | if ($owner != "") |
| 725 | 725 | { |
| 726 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 726 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 727 | 727 | if (!is_string($owner)) |
| 728 | 728 | { |
| 729 | 729 | return false; |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | |
| 735 | 735 | if ($pilot_name != "") |
| 736 | 736 | { |
| 737 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 737 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 738 | 738 | if (!is_string($pilot_name)) |
| 739 | 739 | { |
| 740 | 740 | return false; |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | |
| 746 | 746 | if ($pilot_id != "") |
| 747 | 747 | { |
| 748 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 748 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 749 | 749 | if (!is_string($pilot_id)) |
| 750 | 750 | { |
| 751 | 751 | return false; |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | |
| 757 | 757 | if ($departure_airport_route != "") |
| 758 | 758 | { |
| 759 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 759 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 760 | 760 | if (!is_string($departure_airport_route)) |
| 761 | 761 | { |
| 762 | 762 | return false; |
@@ -767,7 +767,7 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | if ($arrival_airport_route != "") |
| 769 | 769 | { |
| 770 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 770 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 771 | 771 | if (!is_string($arrival_airport_route)) |
| 772 | 772 | { |
| 773 | 773 | return false; |
@@ -780,8 +780,8 @@ discard block |
||
| 780 | 780 | { |
| 781 | 781 | $altitude_array = explode(",", $altitude); |
| 782 | 782 | |
| 783 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 784 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 783 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 784 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 785 | 785 | |
| 786 | 786 | |
| 787 | 787 | if ($altitude_array[1] != "") |
@@ -799,8 +799,8 @@ discard block |
||
| 799 | 799 | { |
| 800 | 800 | $date_array = explode(",", $date_posted); |
| 801 | 801 | |
| 802 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 803 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 802 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 803 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 804 | 804 | |
| 805 | 805 | if ($globalTimezone != '') { |
| 806 | 806 | date_default_timezone_set($globalTimezone); |
@@ -832,8 +832,8 @@ discard block |
||
| 832 | 832 | { |
| 833 | 833 | $limit_array = explode(",", $limit); |
| 834 | 834 | |
| 835 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 836 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 835 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 836 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 837 | 837 | |
| 838 | 838 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 839 | 839 | { |
@@ -844,8 +844,8 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | |
| 846 | 846 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 847 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
| 848 | - $query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 847 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
| 848 | + $query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 849 | 849 | FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 850 | 850 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
| 851 | 851 | } else { |
@@ -862,12 +862,12 @@ discard block |
||
| 862 | 862 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
| 865 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
| 866 | 866 | WHERE tracker_archive_output.ident <> '' |
| 867 | 867 | ".$additional_query." |
| 868 | 868 | ".$filter_query.$orderby_query; |
| 869 | 869 | } |
| 870 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
| 870 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
| 871 | 871 | |
| 872 | 872 | return $spotter_array; |
| 873 | 873 | } |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | try { |
| 885 | 885 | $sth = $this->db->prepare($query); |
| 886 | 886 | $sth->execute(); |
| 887 | - } catch(PDOException $e) { |
|
| 887 | + } catch (PDOException $e) { |
|
| 888 | 888 | return "error"; |
| 889 | 889 | } |
| 890 | 890 | } |
@@ -921,8 +921,8 @@ discard block |
||
| 921 | 921 | { |
| 922 | 922 | $limit_array = explode(",", $limit); |
| 923 | 923 | |
| 924 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 925 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 924 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 925 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 926 | 926 | |
| 927 | 927 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 928 | 928 | { |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | $query_values = array(); |
| 964 | 964 | $limit_query = ''; |
| 965 | 965 | $additional_query = ''; |
| 966 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 966 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 967 | 967 | |
| 968 | 968 | if ($owner != "") |
| 969 | 969 | { |
@@ -980,8 +980,8 @@ discard block |
||
| 980 | 980 | { |
| 981 | 981 | $limit_array = explode(",", $limit); |
| 982 | 982 | |
| 983 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 984 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 983 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 984 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 985 | 985 | |
| 986 | 986 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 987 | 987 | { |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | $query_values = array(); |
| 1022 | 1022 | $limit_query = ''; |
| 1023 | 1023 | $additional_query = ''; |
| 1024 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1024 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1025 | 1025 | |
| 1026 | 1026 | if ($pilot != "") |
| 1027 | 1027 | { |
@@ -1033,8 +1033,8 @@ discard block |
||
| 1033 | 1033 | { |
| 1034 | 1034 | $limit_array = explode(",", $limit); |
| 1035 | 1035 | |
| 1036 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1037 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1036 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1037 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1038 | 1038 | |
| 1039 | 1039 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1040 | 1040 | { |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | * @return Array the airline country list |
| 1065 | 1065 | * |
| 1066 | 1066 | */ |
| 1067 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1067 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
| 1068 | 1068 | { |
| 1069 | 1069 | global $globalDBdriver; |
| 1070 | 1070 | /* |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | $flight_array = array(); |
| 1094 | 1094 | $temp_array = array(); |
| 1095 | 1095 | |
| 1096 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1096 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1097 | 1097 | { |
| 1098 | 1098 | $temp_array['flight_count'] = $row['nb']; |
| 1099 | 1099 | $temp_array['flight_country'] = $row['name']; |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | * @return Array the airline country list |
| 1111 | 1111 | * |
| 1112 | 1112 | */ |
| 1113 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1113 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
| 1114 | 1114 | { |
| 1115 | 1115 | global $globalDBdriver; |
| 1116 | 1116 | /* |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | $flight_array = array(); |
| 1140 | 1140 | $temp_array = array(); |
| 1141 | 1141 | |
| 1142 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1142 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1143 | 1143 | { |
| 1144 | 1144 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 1145 | 1145 | $temp_array['flight_count'] = $row['nb']; |
@@ -1157,14 +1157,14 @@ discard block |
||
| 1157 | 1157 | * @return Array the spotter information |
| 1158 | 1158 | * |
| 1159 | 1159 | */ |
| 1160 | - public function getDateArchiveTrackerDataById($id,$date) |
|
| 1160 | + public function getDateArchiveTrackerDataById($id, $date) |
|
| 1161 | 1161 | { |
| 1162 | 1162 | $Tracker = new Tracker($this->db); |
| 1163 | 1163 | date_default_timezone_set('UTC'); |
| 1164 | 1164 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 1165 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1166 | - $date = date('c',$date); |
|
| 1167 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
| 1165 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1166 | + $date = date('c', $date); |
|
| 1167 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
| 1168 | 1168 | return $spotter_array; |
| 1169 | 1169 | } |
| 1170 | 1170 | |
@@ -1174,14 +1174,14 @@ discard block |
||
| 1174 | 1174 | * @return Array the spotter information |
| 1175 | 1175 | * |
| 1176 | 1176 | */ |
| 1177 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
| 1177 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
| 1178 | 1178 | { |
| 1179 | 1179 | $Tracker = new Tracker($this->db); |
| 1180 | 1180 | date_default_timezone_set('UTC'); |
| 1181 | 1181 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 1182 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1183 | - $date = date('c',$date); |
|
| 1184 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 1182 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1183 | + $date = date('c', $date); |
|
| 1184 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 1185 | 1185 | return $spotter_array; |
| 1186 | 1186 | } |
| 1187 | 1187 | |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | * @return Array the spotter information |
| 1192 | 1192 | * |
| 1193 | 1193 | */ |
| 1194 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1194 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | global $global_query; |
| 1197 | 1197 | $Tracker = new Tracker(); |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | $query_values = array(); |
| 1200 | 1200 | $limit_query = ''; |
| 1201 | 1201 | $additional_query = ''; |
| 1202 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1202 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1203 | 1203 | |
| 1204 | 1204 | if ($airport != "") |
| 1205 | 1205 | { |
@@ -1216,8 +1216,8 @@ discard block |
||
| 1216 | 1216 | { |
| 1217 | 1217 | $limit_array = explode(",", $limit); |
| 1218 | 1218 | |
| 1219 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1220 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1219 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1220 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1221 | 1221 | |
| 1222 | 1222 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1223 | 1223 | { |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | if (isset($filter[0]['source'])) { |
| 27 | 27 | $filters = array_merge($filters,$filter); |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) { |
|
| 30 | + $filter = array_merge($filter,$globalFilter); |
|
| 31 | + } |
|
| 30 | 32 | $filter_query_join = ''; |
| 31 | 33 | $filter_query_where = ''; |
| 32 | 34 | foreach($filters as $flt) { |
@@ -72,8 +74,11 @@ discard block |
||
| 72 | 74 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 73 | 75 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 74 | 76 | } |
| 75 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 76 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 77 | + if ($filter_query_where == '' && $where) { |
|
| 78 | + $filter_query_where = ' WHERE'; |
|
| 79 | + } elseif ($filter_query_where != '' && $and) { |
|
| 80 | + $filter_query_where .= ' AND'; |
|
| 81 | + } |
|
| 77 | 82 | if ($filter_query_where != '') { |
| 78 | 83 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 79 | 84 | } |
@@ -87,9 +92,14 @@ discard block |
||
| 87 | 92 | if ($over_country == '') { |
| 88 | 93 | $Tracker = new Tracker($this->db); |
| 89 | 94 | $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
| 90 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
| 91 | - else $country = ''; |
|
| 92 | - } else $country = $over_country; |
|
| 95 | + if (!empty($data_country)) { |
|
| 96 | + $country = $data_country['iso2']; |
|
| 97 | + } else { |
|
| 98 | + $country = ''; |
|
| 99 | + } |
|
| 100 | + } else { |
|
| 101 | + $country = $over_country; |
|
| 102 | + } |
|
| 93 | 103 | // Route is not added in tracker_archive |
| 94 | 104 | $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
| 95 | 105 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
@@ -588,7 +598,9 @@ discard block |
||
| 588 | 598 | $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
| 589 | 599 | $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
| 590 | 600 | $translate = $Translation->ident2icao($q_item); |
| 591 | - if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
| 601 | + if ($translate != $q_item) { |
|
| 602 | + $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
| 603 | + } |
|
| 592 | 604 | $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
| 593 | 605 | $additional_query .= ")"; |
| 594 | 606 | } |
@@ -806,7 +818,9 @@ discard block |
||
| 806 | 818 | date_default_timezone_set($globalTimezone); |
| 807 | 819 | $datetime = new DateTime(); |
| 808 | 820 | $offset = $datetime->format('P'); |
| 809 | - } else $offset = '+00:00'; |
|
| 821 | + } else { |
|
| 822 | + $offset = '+00:00'; |
|
| 823 | + } |
|
| 810 | 824 | |
| 811 | 825 | |
| 812 | 826 | if ($date_array[1] != "") |
@@ -1082,9 +1096,13 @@ discard block |
||
| 1082 | 1096 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1083 | 1097 | } |
| 1084 | 1098 | } |
| 1085 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 1099 | + if ($sincedate != '') { |
|
| 1100 | + $query .= "AND date > '".$sincedate."' "; |
|
| 1101 | + } |
|
| 1086 | 1102 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1087 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1103 | + if ($limit) { |
|
| 1104 | + $query .= " LIMIT 0,10"; |
|
| 1105 | + } |
|
| 1088 | 1106 | |
| 1089 | 1107 | |
| 1090 | 1108 | $sth = $this->db->prepare($query); |
@@ -1128,9 +1146,13 @@ discard block |
||
| 1128 | 1146 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1129 | 1147 | } |
| 1130 | 1148 | } |
| 1131 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
| 1149 | + if ($sincedate != '') { |
|
| 1150 | + $query .= "AND s.date > '".$sincedate."' "; |
|
| 1151 | + } |
|
| 1132 | 1152 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1133 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1153 | + if ($limit) { |
|
| 1154 | + $query .= " LIMIT 0,10"; |
|
| 1155 | + } |
|
| 1134 | 1156 | |
| 1135 | 1157 | |
| 1136 | 1158 | $sth = $this->db->prepare($query); |
@@ -7,7 +7,9 @@ discard block |
||
| 7 | 7 | $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
| 8 | 8 | $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
| 9 | 9 | |
| 10 | -if (!isset($type)) $type = 'aircraft'; |
|
| 10 | +if (!isset($type)) { |
|
| 11 | + $type = 'aircraft'; |
|
| 12 | +} |
|
| 11 | 13 | |
| 12 | 14 | if (!isset($_GET['sort'])) |
| 13 | 15 | { |
@@ -440,7 +442,9 @@ discard block |
||
| 440 | 442 | if (isset($globalTimezone)) |
| 441 | 443 | { |
| 442 | 444 | date_default_timezone_set($globalTimezone); |
| 443 | - } else date_default_timezone_set('UTC'); |
|
| 445 | + } else { |
|
| 446 | + date_default_timezone_set('UTC'); |
|
| 447 | + } |
|
| 444 | 448 | if ($showSpecial === true) |
| 445 | 449 | { |
| 446 | 450 | print '<tr class="special">'."\n"; |
@@ -455,7 +459,9 @@ discard block |
||
| 455 | 459 | print '<tr class="active">'; |
| 456 | 460 | } elseif (isset($spotter_item['spotted_registration'])) { |
| 457 | 461 | print '<tr class="info">'; |
| 458 | - } else print '<tr>'; |
|
| 462 | + } else { |
|
| 463 | + print '<tr>'; |
|
| 464 | + } |
|
| 459 | 465 | } |
| 460 | 466 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") { |
| 461 | 467 | if ($type == 'aircraft') { |
@@ -463,8 +469,9 @@ discard block |
||
| 463 | 469 | { |
| 464 | 470 | print '<td class="aircraft_thumbnail">'."\n"; |
| 465 | 471 | if ($spotter_item['image_source'] == 'planespotters') { |
| 466 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 467 | - else { |
|
| 472 | + if ($spotter_item['image_source_website'] != '') { |
|
| 473 | + $image_src = $spotter_item['image_source_website']; |
|
| 474 | + } else { |
|
| 468 | 475 | $planespotter_url_array = explode("_", $spotter_item['image']); |
| 469 | 476 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 470 | 477 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -477,7 +484,9 @@ discard block |
||
| 477 | 484 | } else { |
| 478 | 485 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 479 | 486 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 480 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 487 | + } else { |
|
| 488 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 489 | + } |
|
| 481 | 490 | if (isset($spotter_item['airline_name'])) { |
| 482 | 491 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 483 | 492 | } else { |
@@ -496,7 +505,9 @@ discard block |
||
| 496 | 505 | print '<td class="aircraft_thumbnail">'."\n"; |
| 497 | 506 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 498 | 507 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 499 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 508 | + } else { |
|
| 509 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 510 | + } |
|
| 500 | 511 | if (isset($spotter_item['airline_name'])) { |
| 501 | 512 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 502 | 513 | } else { |
@@ -514,7 +525,9 @@ discard block |
||
| 514 | 525 | print '<td class="aircraft_thumbnail">'."\n"; |
| 515 | 526 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 516 | 527 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 517 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 528 | + } else { |
|
| 529 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 530 | + } |
|
| 518 | 531 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 519 | 532 | print '</td>'."\n"; |
| 520 | 533 | } else { |
@@ -565,8 +578,9 @@ discard block |
||
| 565 | 578 | print '<td class="aircraft_thumbnail">'."\n"; |
| 566 | 579 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
| 567 | 580 | if ($spotter_item['image_source'] == 'planespotters') { |
| 568 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 569 | - else { |
|
| 581 | + if ($spotter_item['image_source_website'] != '') { |
|
| 582 | + $image_src = $spotter_item['image_source_website']; |
|
| 583 | + } else { |
|
| 570 | 584 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
| 571 | 585 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 572 | 586 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -583,7 +597,9 @@ discard block |
||
| 583 | 597 | } else { |
| 584 | 598 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 585 | 599 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 586 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 600 | + } else { |
|
| 601 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 602 | + } |
|
| 587 | 603 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 588 | 604 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 589 | 605 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -616,7 +632,9 @@ discard block |
||
| 616 | 632 | print '<td class="aircraft_thumbnail">'."\n"; |
| 617 | 633 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 618 | 634 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 619 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 635 | + } else { |
|
| 636 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 637 | + } |
|
| 620 | 638 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 621 | 639 | print '</td>'."\n"; |
| 622 | 640 | } else { |
@@ -630,7 +648,9 @@ discard block |
||
| 630 | 648 | print '<td class="aircraft_thumbnail">'."\n"; |
| 631 | 649 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 632 | 650 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 633 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 651 | + } else { |
|
| 652 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 653 | + } |
|
| 634 | 654 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 635 | 655 | print '</td>'."\n"; |
| 636 | 656 | } else { |
@@ -783,15 +803,21 @@ discard block |
||
| 783 | 803 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 784 | 804 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 785 | 805 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
| 786 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 806 | + } else { |
|
| 807 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 808 | + } |
|
| 787 | 809 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 788 | 810 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 789 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 811 | + } else { |
|
| 812 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 813 | + } |
|
| 790 | 814 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 791 | 815 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 792 | 816 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 793 | 817 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 794 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 818 | + } else { |
|
| 819 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 820 | + } |
|
| 795 | 821 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 796 | 822 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 797 | 823 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -813,7 +839,9 @@ discard block |
||
| 813 | 839 | $longitude = $spotter_item['longitude']; |
| 814 | 840 | } |
| 815 | 841 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
| 816 | - } else $distance = ''; |
|
| 842 | + } else { |
|
| 843 | + $distance = ''; |
|
| 844 | + } |
|
| 817 | 845 | if ($distance != '') { |
| 818 | 846 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 819 | 847 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -840,7 +868,9 @@ discard block |
||
| 840 | 868 | } else { |
| 841 | 869 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
| 842 | 870 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
| 843 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
| 871 | + if (!isset($Spotter)) { |
|
| 872 | + $Spotter = new Spotter(); |
|
| 873 | + } |
|
| 844 | 874 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
| 845 | 875 | print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
| 846 | 876 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
@@ -856,20 +886,28 @@ discard block |
||
| 856 | 886 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 857 | 887 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 858 | 888 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 859 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 889 | + } else { |
|
| 890 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 891 | + } |
|
| 860 | 892 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 861 | 893 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 862 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 894 | + } else { |
|
| 895 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 896 | + } |
|
| 863 | 897 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 864 | 898 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 865 | 899 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 866 | 900 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 867 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 901 | + } else { |
|
| 902 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 903 | + } |
|
| 868 | 904 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 869 | 905 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 870 | 906 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 871 | 907 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 872 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 908 | + } else { |
|
| 909 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 910 | + } |
|
| 873 | 911 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 874 | 912 | } |
| 875 | 913 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -882,7 +920,9 @@ discard block |
||
| 882 | 920 | $longitude = $spotter_item['longitude']; |
| 883 | 921 | } |
| 884 | 922 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
| 885 | - } else $distance = ''; |
|
| 923 | + } else { |
|
| 924 | + $distance = ''; |
|
| 925 | + } |
|
| 886 | 926 | if ($distance != '') { |
| 887 | 927 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 888 | 928 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | print '<th class="arrival"><span class="nomobile">'._("Going to").'</span><span class="mobile">'._("To").'</span></th>'; |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - if ($type == 'aircraft') { |
|
| 280 | + if ($type == 'aircraft') { |
|
| 281 | 281 | if ((isset($globalUsePilot) && $globalUsePilot) || (!isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)))) { |
| 282 | 282 | print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>'; |
| 283 | 283 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
| 580 | 580 | if ($type == 'aircraft') { |
| 581 | 581 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 582 | - $spotter_item['squawk'] = '-'; |
|
| 582 | + $spotter_item['squawk'] = '-'; |
|
| 583 | 583 | } |
| 584 | 584 | if ($spotter_item['image_thumbnail'] != "") |
| 585 | 585 | { |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | print '</td>'."\n"; |
| 619 | 619 | } else { |
| 620 | 620 | print '<td class="aircraft_thumbnail">'."\n"; |
| 621 | - // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
| 621 | + // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
| 622 | 622 | //} |
| 623 | 623 | if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) { |
| 624 | 624 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n"; |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
| 6 | 6 | $Common = new Common(); |
| 7 | -$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
|
| 8 | -$showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
| 7 | +$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop'); |
|
| 8 | +$showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
| 9 | 9 | |
| 10 | 10 | if (!isset($type)) $type = 'aircraft'; |
| 11 | 11 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | print '<th class="more"></th>'; |
| 108 | 108 | print '</thead>'; |
| 109 | -} else if (strtolower($current_page) == "upcoming"){ |
|
| 109 | +} else if (strtolower($current_page) == "upcoming") { |
|
| 110 | 110 | print '<thead>'; |
| 111 | 111 | if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
| 112 | 112 | if ($_GET['sort'] == "airline_name_asc") |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | */ |
| 162 | 162 | print '</thead>'; |
| 163 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
| 163 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
| 164 | 164 | print '<thead>'; |
| 165 | 165 | print '<th class="aircraft_thumbnail"></th>'; |
| 166 | 166 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | print '</thead>'; |
| 198 | 198 | } else { |
| 199 | 199 | |
| 200 | - if ($hide_th_links === true){ |
|
| 200 | + if ($hide_th_links === true) { |
|
| 201 | 201 | print '<thead>'; |
| 202 | 202 | print '<th class="aircraft_thumbnail"></th>'; |
| 203 | 203 | if ($type == 'aircraft') { |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | print '<tbody>'."\n"; |
| 457 | -foreach($spotter_array as $spotter_item) |
|
| 457 | +foreach ($spotter_array as $spotter_item) |
|
| 458 | 458 | { |
| 459 | 459 | if (isset($globalTimezone)) |
| 460 | 460 | { |
@@ -489,13 +489,13 @@ discard block |
||
| 489 | 489 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 490 | 490 | } |
| 491 | 491 | if (isset($spotter_item['airline_name'])) { |
| 492 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 492 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 493 | 493 | } else { |
| 494 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 494 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 495 | 495 | } |
| 496 | 496 | } else { |
| 497 | 497 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 498 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 498 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 499 | 499 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 500 | 500 | if (isset($spotter_item['airline_name'])) { |
| 501 | 501 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | { |
| 515 | 515 | print '<td class="aircraft_thumbnail">'."\n"; |
| 516 | 516 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 517 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 517 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 518 | 518 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 519 | 519 | if (isset($spotter_item['airline_name'])) { |
| 520 | 520 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | { |
| 533 | 533 | print '<td class="aircraft_thumbnail">'."\n"; |
| 534 | 534 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 535 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 535 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 536 | 536 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 537 | 537 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 538 | 538 | print '</td>'."\n"; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | print '</td>'."\n"; |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
| 579 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
| 580 | 580 | if ($type == 'aircraft') { |
| 581 | 581 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 582 | 582 | $spotter_item['squawk'] = '-'; |
@@ -593,17 +593,17 @@ discard block |
||
| 593 | 593 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 594 | 594 | } |
| 595 | 595 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 596 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 596 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 597 | 597 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
| 598 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 598 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 599 | 599 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
| 600 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 600 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 601 | 601 | } else { |
| 602 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 602 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 603 | 603 | } |
| 604 | 604 | } else { |
| 605 | 605 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 606 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 606 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 607 | 607 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 608 | 608 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 609 | 609 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | { |
| 637 | 637 | print '<td class="aircraft_thumbnail">'."\n"; |
| 638 | 638 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 639 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 639 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 640 | 640 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 641 | 641 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 642 | 642 | print '</td>'."\n"; |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | { |
| 651 | 651 | print '<td class="aircraft_thumbnail">'."\n"; |
| 652 | 652 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 653 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 653 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 654 | 654 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 655 | 655 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 656 | 656 | print '</td>'."\n"; |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | print '</td>'."\n"; |
| 760 | 760 | } |
| 761 | 761 | // Aircraft type |
| 762 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
| 762 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
| 763 | 763 | print '<td class="type">'."\n"; |
| 764 | 764 | if ($type == 'aircraft') { |
| 765 | 765 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
@@ -810,22 +810,22 @@ discard block |
||
| 810 | 810 | } |
| 811 | 811 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 812 | 812 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 813 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 814 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 813 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 814 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 815 | 815 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 816 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 816 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 817 | 817 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 818 | 818 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 819 | 819 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 820 | 820 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 821 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 821 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 822 | 822 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 823 | 823 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 824 | 824 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 825 | 825 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 826 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 826 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 827 | 827 | } else { |
| 828 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 828 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 829 | 829 | } |
| 830 | 830 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
| 831 | 831 | } |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | $latitude = $spotter_item['latitude']; |
| 841 | 841 | $longitude = $spotter_item['longitude']; |
| 842 | 842 | } |
| 843 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
| 843 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
| 844 | 844 | } else $distance = ''; |
| 845 | 845 | if ($distance != '') { |
| 846 | 846 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -883,20 +883,20 @@ discard block |
||
| 883 | 883 | } |
| 884 | 884 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 885 | 885 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 886 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 886 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 887 | 887 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 888 | 888 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 889 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 889 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 890 | 890 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 891 | 891 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 892 | 892 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 893 | 893 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 894 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 894 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 895 | 895 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 896 | 896 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 897 | 897 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 898 | 898 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 899 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 899 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 900 | 900 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 901 | 901 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 902 | 902 | } |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | $latitude = $spotter_item['latitude']; |
| 910 | 910 | $longitude = $spotter_item['longitude']; |
| 911 | 911 | } |
| 912 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
| 912 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
| 913 | 913 | } else $distance = ''; |
| 914 | 914 | if ($distance != '') { |
| 915 | 915 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -952,19 +952,19 @@ discard block |
||
| 952 | 952 | print '<span class="mobile">-</span>'."\n"; |
| 953 | 953 | } else { |
| 954 | 954 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
| 955 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
| 956 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
| 955 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
| 956 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
| 957 | 957 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
| 958 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
| 959 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
| 958 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
| 959 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
| 960 | 960 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 961 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
| 962 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
| 961 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
| 962 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
| 963 | 963 | } |
| 964 | 964 | } |
| 965 | 965 | print '</td>'."\n"; |
| 966 | 966 | } |
| 967 | - if(strtolower($current_page) != "upcoming"){ |
|
| 967 | + if (strtolower($current_page) != "upcoming") { |
|
| 968 | 968 | if ($type == 'aircraft') { |
| 969 | 969 | //if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 970 | 970 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | |
| 1008 | 1008 | if ($showRouteStop) { |
| 1009 | 1009 | // Route stop |
| 1010 | - if(strtolower($current_page) != "upcoming"){ |
|
| 1010 | + if (strtolower($current_page) != "upcoming") { |
|
| 1011 | 1011 | print '<td class="route_stop">'."\n"; |
| 1012 | 1012 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
| 1013 | 1013 | print '<span class="nomobile">-</span>'."\n"; |
@@ -1026,11 +1026,11 @@ discard block |
||
| 1026 | 1026 | } |
| 1027 | 1027 | if ($showDuration) { |
| 1028 | 1028 | // Duration |
| 1029 | - if(strtolower($current_page) != "upcoming"){ |
|
| 1029 | + if (strtolower($current_page) != "upcoming") { |
|
| 1030 | 1030 | print '<td class="duration">'."\n"; |
| 1031 | 1031 | if (isset($spotter_item['duration'])) { |
| 1032 | - print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
| 1033 | - print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
| 1032 | + print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
| 1033 | + print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
| 1034 | 1034 | } else { |
| 1035 | 1035 | print '<span class="nomobile">-</span>'."\n"; |
| 1036 | 1036 | print '<span class="mobile">-</span>'."\n"; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
| 1044 | 1044 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
| 1045 | 1045 | print '<td class="message"><p>'."\n"; |
| 1046 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1046 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1047 | 1047 | print '</p><p class="decode">'; |
| 1048 | 1048 | $decode_array = json_decode($spotter_item['decode']); |
| 1049 | 1049 | foreach ($decode_array as $key => $value) { |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | print '</td>'."\n"; |
| 1054 | 1054 | } else { |
| 1055 | 1055 | print '<td class="message">'."\n"; |
| 1056 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1056 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1057 | 1057 | print '</td>'."\n"; |
| 1058 | 1058 | } |
| 1059 | 1059 | } |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | } |
| 1079 | 1079 | print '</td>'."\n"; |
| 1080 | 1080 | print '<td class="message">'."\n"; |
| 1081 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1081 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1082 | 1082 | print '</td>'."\n"; |
| 1083 | 1083 | } |
| 1084 | 1084 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | print '</td>'."\n"; |
| 1105 | 1105 | */ |
| 1106 | 1106 | print '<td class="message">'."\n"; |
| 1107 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1107 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1108 | 1108 | print '</td>'."\n"; |
| 1109 | 1109 | } |
| 1110 | 1110 | |
@@ -8,31 +8,31 @@ discard block |
||
| 8 | 8 | if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
| 9 | 9 | else $MapType = $globalMapProvider; |
| 10 | 10 | if (isset($_GET['3d'])) { |
| 11 | - setcookie('MapFormat','3d'); |
|
| 11 | + setcookie('MapFormat', '3d'); |
|
| 12 | 12 | } else if (isset($_GET['2d'])) { |
| 13 | - setcookie('MapFormat','2d'); |
|
| 13 | + setcookie('MapFormat', '2d'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | if (isset($_POST['archive'])) { |
| 17 | - setcookie('archive','true'); |
|
| 18 | - setcookie('archive_begin',strtotime($_POST['start_date'])); |
|
| 19 | - setcookie('archive_end',strtotime($_POST['end_date'])); |
|
| 20 | - setcookie('archive_speed',$_POST['archivespeed']); |
|
| 17 | + setcookie('archive', 'true'); |
|
| 18 | + setcookie('archive_begin', strtotime($_POST['start_date'])); |
|
| 19 | + setcookie('archive_end', strtotime($_POST['end_date'])); |
|
| 20 | + setcookie('archive_speed', $_POST['archivespeed']); |
|
| 21 | 21 | } |
| 22 | 22 | if (isset($_POST['noarchive'])) { |
| 23 | - setcookie('archive','false',-1); |
|
| 24 | - setcookie('archive_begin','',-1); |
|
| 25 | - setcookie('archive_end','',-1); |
|
| 26 | - setcookie('archive_speed','',-1); |
|
| 23 | + setcookie('archive', 'false', -1); |
|
| 24 | + setcookie('archive_begin', '', -1); |
|
| 25 | + setcookie('archive_end', '', -1); |
|
| 26 | + setcookie('archive_speed', '', -1); |
|
| 27 | 27 | } |
| 28 | 28 | // When button "Remove all filters" is clicked |
| 29 | 29 | if (isset($_POST['removefilters'])) { |
| 30 | - $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
|
| 31 | - return strpos($key,'filter_') === 0; |
|
| 30 | + $allfilters = array_filter(array_keys($_COOKIE), function($key) { |
|
| 31 | + return strpos($key, 'filter_') === 0; |
|
| 32 | 32 | }); |
| 33 | 33 | foreach ($allfilters as $filt) { |
| 34 | 34 | unset($_COOKIE[$filt]); |
| 35 | - setcookie($filt,null,-1); |
|
| 35 | + setcookie($filt, null, -1); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | ?> |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 241 | 241 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 242 | 242 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 243 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 243 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 244 | 244 | <?php |
| 245 | 245 | if (!isset($type) || $type == 'aircraft') { |
| 246 | 246 | ?> |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 311 | 311 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 312 | 312 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 313 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 313 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 314 | 314 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
| 315 | 315 | <?php |
| 316 | 316 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | ?> |
| 590 | 590 | <div class="search"> |
| 591 | 591 | <form action="<?php print $globalURL; ?>/search" method="get"> |
| 592 | - <input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
| 592 | + <input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
| 593 | 593 | </form> |
| 594 | 594 | </div> |
| 595 | 595 | <div class="social"> |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | print '</div>'; |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
| 610 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
| 611 | 611 | ?> |
| 612 | 612 | <div class="top-header clear" role="main"> |
| 613 | 613 | <?php |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | </div> |
| 621 | 621 | <?php |
| 622 | 622 | } |
| 623 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
| 623 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
| 624 | 624 | { |
| 625 | 625 | ?> |
| 626 | 626 | <div class="top-header clear" role="main"> |
@@ -633,15 +633,15 @@ discard block |
||
| 633 | 633 | var zoom = 13; |
| 634 | 634 | //create the map |
| 635 | 635 | <?php |
| 636 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 636 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 637 | 637 | ?> |
| 638 | 638 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 639 | 639 | <?php |
| 640 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 640 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
| 641 | 641 | ?> |
| 642 | 642 | map = L.map('map', { zoomControl:true }); |
| 643 | 643 | <?php |
| 644 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 644 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 645 | 645 | ?> |
| 646 | 646 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 647 | 647 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 650 | 650 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 651 | 651 | <?php |
| 652 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 652 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 653 | 653 | ?> |
| 654 | 654 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 655 | 655 | <?php |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // When button "Remove all filters" is clicked |
| 29 | 29 | if (isset($_POST['removefilters'])) { |
| 30 | 30 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
| 31 | - return strpos($key,'filter_') === 0; |
|
| 31 | + return strpos($key,'filter_') === 0; |
|
| 32 | 32 | }); |
| 33 | 33 | foreach ($allfilters as $filt) { |
| 34 | 34 | unset($_COOKIE[$filt]); |
@@ -167,17 +167,17 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | ?> |
| 169 | 169 | <?php |
| 170 | - if (isset($_POST['archive'])) { |
|
| 170 | + if (isset($_POST['archive'])) { |
|
| 171 | 171 | ?> |
| 172 | 172 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 173 | 173 | <?php |
| 174 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 174 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 175 | 175 | ?> |
| 176 | 176 | |
| 177 | 177 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
| 178 | 178 | <?php |
| 179 | - } |
|
| 180 | - } else { |
|
| 179 | + } |
|
| 180 | + } else { |
|
| 181 | 181 | ?> |
| 182 | 182 | <?php |
| 183 | 183 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | ?> |
| 191 | 191 | <?php |
| 192 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 192 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 193 | 193 | ?> |
| 194 | 194 | <?php |
| 195 | 195 | // if (isset($globalBeta) && $globalBeta) { |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script> |
| 217 | 217 | <?php |
| 218 | 218 | } |
| 219 | - } |
|
| 219 | + } |
|
| 220 | 220 | ?> |
| 221 | 221 | <?php |
| 222 | 222 | // } |
| 223 | 223 | ?> |
| 224 | 224 | <?php |
| 225 | - } |
|
| 225 | + } |
|
| 226 | 226 | } |
| 227 | 227 | ?> |
| 228 | 228 | <?php |
@@ -398,48 +398,48 @@ discard block |
||
| 398 | 398 | <ul class="nav navbar-nav"> |
| 399 | 399 | |
| 400 | 400 | <?php |
| 401 | - $sub = false; |
|
| 402 | - if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) { |
|
| 401 | + $sub = false; |
|
| 402 | + if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) { |
|
| 403 | 403 | $sub = true; |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | ?> |
| 406 | 406 | <?php |
| 407 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 407 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 408 | 408 | ?> |
| 409 | 409 | <li class="dropdown"> |
| 410 | 410 | <?php |
| 411 | - if ($sub) { |
|
| 411 | + if ($sub) { |
|
| 412 | 412 | ?> |
| 413 | 413 | <li class="dropdown"> |
| 414 | 414 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a> |
| 415 | 415 | <ul class="dropdown-menu multi-level"> |
| 416 | 416 | <li class="dropdown-submenu"> |
| 417 | 417 | <?php |
| 418 | - } |
|
| 418 | + } |
|
| 419 | 419 | ?> |
| 420 | 420 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
| 421 | 421 | <ul class="dropdown-menu"> |
| 422 | 422 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li> |
| 423 | 423 | <?php |
| 424 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
| 424 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
| 425 | 425 | ?> |
| 426 | 426 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
| 427 | 427 | <?php |
| 428 | - } |
|
| 428 | + } |
|
| 429 | 429 | ?> |
| 430 | 430 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
| 431 | 431 | <?php |
| 432 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
| 432 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
| 433 | 433 | ?> |
| 434 | 434 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
| 435 | 435 | <?php |
| 436 | - } |
|
| 437 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
| 436 | + } |
|
| 437 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
| 438 | 438 | |
| 439 | 439 | ?> |
| 440 | 440 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
| 441 | 441 | <?php |
| 442 | - } |
|
| 442 | + } |
|
| 443 | 443 | ?> |
| 444 | 444 | <li><hr /></li> |
| 445 | 445 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -447,43 +447,43 @@ discard block |
||
| 447 | 447 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
| 448 | 448 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
| 449 | 449 | <?php |
| 450 | - if ($globalACARS) { |
|
| 451 | - if (isset($globalDemo) && $globalDemo) { |
|
| 452 | - ?> |
|
| 450 | + if ($globalACARS) { |
|
| 451 | + if (isset($globalDemo) && $globalDemo) { |
|
| 452 | + ?> |
|
| 453 | 453 | <li><hr /></li> |
| 454 | 454 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
| 455 | 455 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
| 456 | 456 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
| 457 | 457 | <?php |
| 458 | - } else { |
|
| 459 | - ?> |
|
| 458 | + } else { |
|
| 459 | + ?> |
|
| 460 | 460 | <li><hr /></li> |
| 461 | 461 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
| 462 | 462 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
| 463 | 463 | <?php |
| 464 | - } |
|
| 465 | - } |
|
| 466 | - ?> |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + ?> |
|
| 467 | 467 | <?php |
| 468 | - if (isset($globalAccidents) && $globalAccidents) { |
|
| 469 | - ?> |
|
| 468 | + if (isset($globalAccidents) && $globalAccidents) { |
|
| 469 | + ?> |
|
| 470 | 470 | <li><hr /></li> |
| 471 | 471 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
| 472 | 472 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
| 473 | 473 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
| 474 | 474 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
| 475 | 475 | <?php |
| 476 | - } |
|
| 477 | - ?> |
|
| 476 | + } |
|
| 477 | + ?> |
|
| 478 | 478 | <li><hr /></li> |
| 479 | 479 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
| 480 | 480 | <?php |
| 481 | 481 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
| 482 | - ?> |
|
| 482 | + ?> |
|
| 483 | 483 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
| 484 | 484 | <?php |
| 485 | 485 | } |
| 486 | - ?> |
|
| 486 | + ?> |
|
| 487 | 487 | </ul> |
| 488 | 488 | </li> |
| 489 | 489 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -503,14 +503,14 @@ discard block |
||
| 503 | 503 | </ul> |
| 504 | 504 | <?php |
| 505 | 505 | } |
| 506 | - } |
|
| 506 | + } |
|
| 507 | 507 | ?> |
| 508 | 508 | <?php |
| 509 | - if (isset($globalMarine) && $globalMarine) { |
|
| 509 | + if (isset($globalMarine) && $globalMarine) { |
|
| 510 | 510 | ?> |
| 511 | 511 | <li class="dropdown"> |
| 512 | 512 | <?php |
| 513 | - if ($sub) { |
|
| 513 | + if ($sub) { |
|
| 514 | 514 | ?> |
| 515 | 515 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a> |
| 516 | 516 | <ul class="dropdown-menu multi-level"> |
@@ -535,14 +535,14 @@ discard block |
||
| 535 | 535 | } |
| 536 | 536 | ?> |
| 537 | 537 | <?php |
| 538 | - } |
|
| 538 | + } |
|
| 539 | 539 | ?> |
| 540 | 540 | <?php |
| 541 | - if (isset($globalTracker) && $globalTracker) { |
|
| 541 | + if (isset($globalTracker) && $globalTracker) { |
|
| 542 | 542 | ?> |
| 543 | 543 | <li class="dropdown"> |
| 544 | 544 | <?php |
| 545 | - if ($sub) { |
|
| 545 | + if ($sub) { |
|
| 546 | 546 | ?> |
| 547 | 547 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
| 548 | 548 | <ul class="dropdown-menu multi-level"> |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | ?> |
| 569 | 569 | <?php |
| 570 | - } |
|
| 570 | + } |
|
| 571 | 571 | ?> |
| 572 | 572 | |
| 573 | 573 | <li class="dropdown"> |
@@ -576,12 +576,12 @@ discard block |
||
| 576 | 576 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
| 577 | 577 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
| 578 | 578 | <?php |
| 579 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 579 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 580 | 580 | ?> |
| 581 | 581 | <li><hr /></li> |
| 582 | 582 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
| 583 | 583 | <?php |
| 584 | - } |
|
| 584 | + } |
|
| 585 | 585 | ?> |
| 586 | 586 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
| 587 | 587 | <li><hr /></li> |
@@ -602,14 +602,14 @@ discard block |
||
| 602 | 602 | <form> |
| 603 | 603 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
| 604 | 604 | <?php |
| 605 | - $Language = new Language(); |
|
| 606 | - $alllang = $Language->getLanguages(); |
|
| 607 | - foreach ($alllang as $key => $lang) { |
|
| 608 | - print '<option value="'.$key.'"'; |
|
| 609 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 610 | - print '>'.$lang[0].'</option>'; |
|
| 611 | - } |
|
| 612 | - ?> |
|
| 605 | + $Language = new Language(); |
|
| 606 | + $alllang = $Language->getLanguages(); |
|
| 607 | + foreach ($alllang as $key => $lang) { |
|
| 608 | + print '<option value="'.$key.'"'; |
|
| 609 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 610 | + print '>'.$lang[0].'</option>'; |
|
| 611 | + } |
|
| 612 | + ?> |
|
| 613 | 613 | </select> |
| 614 | 614 | </form> |
| 615 | 615 | </div> |
@@ -640,18 +640,18 @@ discard block |
||
| 640 | 640 | ?> |
| 641 | 641 | <div class="top-header clear" role="main"> |
| 642 | 642 | <?php |
| 643 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 643 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 644 | 644 | ?> |
| 645 | 645 | <div id="archive-map"></div> |
| 646 | 646 | <?php |
| 647 | - } |
|
| 647 | + } |
|
| 648 | 648 | ?> |
| 649 | 649 | </div> |
| 650 | 650 | <?php |
| 651 | 651 | } |
| 652 | 652 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
| 653 | 653 | { |
| 654 | - ?> |
|
| 654 | + ?> |
|
| 655 | 655 | <div class="top-header clear" role="main"> |
| 656 | 656 | <div id="map"></div> |
| 657 | 657 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -662,15 +662,15 @@ discard block |
||
| 662 | 662 | var zoom = 13; |
| 663 | 663 | //create the map |
| 664 | 664 | <?php |
| 665 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 665 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 666 | 666 | ?> |
| 667 | 667 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 668 | 668 | <?php |
| 669 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 669 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 670 | 670 | ?> |
| 671 | 671 | map = L.map('map', { zoomControl:true }); |
| 672 | 672 | <?php |
| 673 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 673 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 674 | 674 | ?> |
| 675 | 675 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 676 | 676 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -678,22 +678,22 @@ discard block |
||
| 678 | 678 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 679 | 679 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 680 | 680 | <?php |
| 681 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 681 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 682 | 682 | ?> |
| 683 | 683 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 684 | 684 | <?php |
| 685 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 685 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 686 | 686 | ?> |
| 687 | 687 | map = L.map('map', { zoomControl:true }); |
| 688 | 688 | <?php |
| 689 | - } |
|
| 689 | + } |
|
| 690 | 690 | ?> |
| 691 | 691 | //initialize the layer group for the aircrft markers |
| 692 | 692 | var layer_data = L.layerGroup(); |
| 693 | 693 | |
| 694 | 694 | //a few title layers |
| 695 | 695 | <?php |
| 696 | - if ($globalMapProvider == 'Mapbox') { |
|
| 696 | + if ($globalMapProvider == 'Mapbox') { |
|
| 697 | 697 | ?> |
| 698 | 698 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 699 | 699 | maxZoom: 18, |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | token : '<?php print $globalMapboxToken; ?>' |
| 705 | 705 | }).addTo(map); |
| 706 | 706 | <?php |
| 707 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 707 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 708 | 708 | ?> |
| 709 | 709 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
| 710 | 710 | maxZoom: 18, |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
| 714 | 714 | }).addTo(map); |
| 715 | 715 | <?php |
| 716 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 716 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 717 | 717 | ?> |
| 718 | 718 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
| 719 | 719 | maxZoom: 18, |
@@ -722,27 +722,27 @@ discard block |
||
| 722 | 722 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
| 723 | 723 | }).addTo(map); |
| 724 | 724 | <?php |
| 725 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 725 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 726 | 726 | ?> |
| 727 | 727 | var googleLayer = new L.Google('ROADMAP'); |
| 728 | 728 | map.addLayer(googleLayer); |
| 729 | 729 | <?php |
| 730 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 730 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 731 | 731 | ?> |
| 732 | 732 | var googleLayer = new L.Google('SATELLITE'); |
| 733 | 733 | map.addLayer(googleLayer); |
| 734 | 734 | <?php |
| 735 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 735 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 736 | 736 | ?> |
| 737 | 737 | var googleLayer = new L.Google('HYBRID'); |
| 738 | 738 | map.addLayer(googleLayer); |
| 739 | 739 | <?php |
| 740 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 740 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 741 | 741 | ?> |
| 742 | 742 | var googleLayer = new L.Google('Terrain'); |
| 743 | 743 | map.addLayer(googleLayer); |
| 744 | 744 | <?php |
| 745 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
| 745 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
| 746 | 746 | $customid = $globalMapProvider; |
| 747 | 747 | ?> |
| 748 | 748 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -752,8 +752,8 @@ discard block |
||
| 752 | 752 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
| 753 | 753 | }).addTo(map); |
| 754 | 754 | <?php |
| 755 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 756 | - } else { |
|
| 755 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 756 | + } else { |
|
| 757 | 757 | ?> |
| 758 | 758 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 759 | 759 | maxZoom: 18, |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | }).addTo(map); |
| 763 | 763 | |
| 764 | 764 | <?php |
| 765 | - } |
|
| 765 | + } |
|
| 766 | 766 | ?> |
| 767 | 767 | </script> |
| 768 | 768 | </div> |
@@ -5,8 +5,11 @@ discard block |
||
| 5 | 5 | $file_path = pathinfo($_SERVER['SCRIPT_NAME']); |
| 6 | 6 | $current_page = $file_path['filename']; |
| 7 | 7 | date_default_timezone_set($globalTimezone); |
| 8 | -if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
|
| 9 | -else $MapType = $globalMapProvider; |
|
| 8 | +if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') { |
|
| 9 | + $MapType = $_COOKIE['MapType']; |
|
| 10 | +} else { |
|
| 11 | + $MapType = $globalMapProvider; |
|
| 12 | +} |
|
| 10 | 13 | if (isset($_GET['3d'])) { |
| 11 | 14 | setcookie('MapFormat','3d'); |
| 12 | 15 | } else if (isset($_GET['2d'])) { |
@@ -240,7 +243,13 @@ discard block |
||
| 240 | 243 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 241 | 244 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 242 | 245 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 243 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 246 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
| 247 | + print '&latitude='.$latitude; |
|
| 248 | +} |
|
| 249 | +?><?php if(isset($longitude)) { |
|
| 250 | + print '&longitude='.$longitude; |
|
| 251 | +} |
|
| 252 | +?>&<?php print time(); ?>"></script> |
|
| 244 | 253 | <?php |
| 245 | 254 | if (!isset($type) || $type == 'aircraft') { |
| 246 | 255 | ?> |
@@ -310,7 +319,13 @@ discard block |
||
| 310 | 319 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 311 | 320 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 312 | 321 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 313 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 322 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
| 323 | + print '&latitude='.$latitude; |
|
| 324 | +} |
|
| 325 | +?><?php if(isset($longitude)) { |
|
| 326 | + print '&longitude='.$longitude; |
|
| 327 | +} |
|
| 328 | +?>&<?php print time(); ?>"></script> |
|
| 314 | 329 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
| 315 | 330 | <?php |
| 316 | 331 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -391,7 +406,12 @@ discard block |
||
| 391 | 406 | <span class="icon-bar"></span> |
| 392 | 407 | </button> |
| 393 | 408 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a> |
| 394 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
| 409 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
| 410 | + print '/'; |
|
| 411 | +} else { |
|
| 412 | + print $globalURL; |
|
| 413 | +} |
|
| 414 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
| 395 | 415 | </div> |
| 396 | 416 | <div class="collapse navbar-collapse"> |
| 397 | 417 | |
@@ -417,7 +437,10 @@ discard block |
||
| 417 | 437 | <?php |
| 418 | 438 | } |
| 419 | 439 | ?> |
| 420 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 440 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 441 | + echo 'right-'; |
|
| 442 | +} |
|
| 443 | +?>caret"></b></a> |
|
| 421 | 444 | <ul class="dropdown-menu"> |
| 422 | 445 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li> |
| 423 | 446 | <?php |
@@ -488,8 +511,14 @@ discard block |
||
| 488 | 511 | </li> |
| 489 | 512 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
| 490 | 513 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
| 491 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
| 492 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 514 | + <li class="dropdown<?php if ($sub) { |
|
| 515 | + echo '-submenu'; |
|
| 516 | +} |
|
| 517 | +?>"> |
|
| 518 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
| 519 | + echo 'right-'; |
|
| 520 | +} |
|
| 521 | +?>caret"></b></a> |
|
| 493 | 522 | <ul class="dropdown-menu"> |
| 494 | 523 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
| 495 | 524 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -518,7 +547,10 @@ discard block |
||
| 518 | 547 | <?php |
| 519 | 548 | } |
| 520 | 549 | ?> |
| 521 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 550 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 551 | + echo 'right-'; |
|
| 552 | +} |
|
| 553 | +?>caret"></b></a> |
|
| 522 | 554 | <ul class="dropdown-menu"> |
| 523 | 555 | <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li> |
| 524 | 556 | <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -550,7 +582,10 @@ discard block |
||
| 550 | 582 | <?php |
| 551 | 583 | } |
| 552 | 584 | ?> |
| 553 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 585 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 586 | + echo 'right-'; |
|
| 587 | +} |
|
| 588 | +?>caret"></b></a> |
|
| 554 | 589 | <ul class="dropdown-menu"> |
| 555 | 590 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
| 556 | 591 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -606,7 +641,9 @@ discard block |
||
| 606 | 641 | $alllang = $Language->getLanguages(); |
| 607 | 642 | foreach ($alllang as $key => $lang) { |
| 608 | 643 | print '<option value="'.$key.'"'; |
| 609 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 644 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
| 645 | + print ' selected '; |
|
| 646 | + } |
|
| 610 | 647 | print '>'.$lang[0].'</option>'; |
| 611 | 648 | } |
| 612 | 649 | ?> |
@@ -746,9 +783,24 @@ discard block |
||
| 746 | 783 | $customid = $globalMapProvider; |
| 747 | 784 | ?> |
| 748 | 785 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
| 749 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
| 750 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
| 751 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 786 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
| 787 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
| 788 | +} else { |
|
| 789 | + print '18'; |
|
| 790 | +} |
|
| 791 | +?>, |
|
| 792 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
| 793 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
| 794 | +} else { |
|
| 795 | + print '0'; |
|
| 796 | +} |
|
| 797 | +?>, |
|
| 798 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 799 | + print 'false'; |
|
| 800 | +} else { |
|
| 801 | + print 'true'; |
|
| 802 | +} |
|
| 803 | +?>, |
|
| 752 | 804 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
| 753 | 805 | }).addTo(map); |
| 754 | 806 | <?php |
@@ -771,4 +823,7 @@ discard block |
||
| 771 | 823 | |
| 772 | 824 | ?> |
| 773 | 825 | |
| 774 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
| 826 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
| 827 | + print 'index '; |
|
| 828 | +} |
|
| 829 | +?>clear"> |
|