@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
3 | 3 | $global_query = "SELECT marine_output.* FROM marine_output"; |
4 | 4 | |
5 | -class Marine{ |
|
5 | +class Marine { |
|
6 | 6 | public $db; |
7 | 7 | |
8 | 8 | public function __construct($dbc = null) { |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | 19 | |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
73 | 73 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
74 | 74 | if ($filter_query_where != '') { |
75 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
75 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
76 | 76 | } |
77 | 77 | $filter_query = $filter_query_join.$filter_query_where; |
78 | 78 | return $filter_query; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return Array the spotter information |
88 | 88 | * |
89 | 89 | */ |
90 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
90 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
91 | 91 | { |
92 | 92 | date_default_timezone_set('UTC'); |
93 | 93 | if (!is_string($query)) |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | $sth = $this->db->prepare($query.$limitQuery); |
108 | 108 | $sth->execute($params); |
109 | 109 | } catch (PDOException $e) { |
110 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
110 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
111 | 111 | exit(); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $num_rows = 0; |
115 | 115 | $spotter_array = array(); |
116 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
116 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
117 | 117 | { |
118 | 118 | $num_rows++; |
119 | 119 | $temp_array = array(); |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | } |
146 | 146 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
147 | 147 | |
148 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
148 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
149 | 149 | { |
150 | 150 | $Image = new Image($this->db); |
151 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
151 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
152 | 152 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
153 | 153 | unset($Image); |
154 | 154 | if (count($image_array) > 0) { |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | { |
185 | 185 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
186 | 186 | } else { |
187 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
187 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
188 | 188 | } |
189 | 189 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
190 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
191 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
190 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
191 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
192 | 192 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
193 | 193 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
194 | 194 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
195 | 195 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
196 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
197 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
196 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
197 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
198 | 198 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
199 | 199 | } |
200 | 200 | } |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | if ($limit != "") |
228 | 228 | { |
229 | 229 | $limit_array = explode(",", $limit); |
230 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
231 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
230 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
231 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
232 | 232 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
233 | 233 | { |
234 | 234 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | } else { |
243 | 243 | $orderby_query = " ORDER BY marine_output.date DESC"; |
244 | 244 | } |
245 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
246 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
245 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
246 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
247 | 247 | return $spotter_array; |
248 | 248 | } |
249 | 249 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | if ($id == '') return array(); |
262 | 262 | $additional_query = "marine_output.fammarine_id = :id"; |
263 | 263 | $query_values = array(':id' => $id); |
264 | - $query = $global_query." WHERE ".$additional_query." "; |
|
265 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
264 | + $query = $global_query." WHERE ".$additional_query." "; |
|
265 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
266 | 266 | return $spotter_array; |
267 | 267 | } |
268 | 268 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $query_values = array(); |
282 | 282 | $limit_query = ''; |
283 | 283 | $additional_query = ''; |
284 | - $filter_query = $this->getFilter($filter,true,true); |
|
284 | + $filter_query = $this->getFilter($filter, true, true); |
|
285 | 285 | if ($ident != "") |
286 | 286 | { |
287 | 287 | if (!is_string($ident)) |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | { |
298 | 298 | $limit_array = explode(",", $limit); |
299 | 299 | |
300 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
301 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
300 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
301 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
302 | 302 | |
303 | 303 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
304 | 304 | { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | return $spotter_array; |
323 | 323 | } |
324 | 324 | |
325 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
325 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
326 | 326 | { |
327 | 327 | global $global_query, $globalTimezone, $globalDBdriver; |
328 | 328 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $limit_query = ''; |
331 | 331 | $additional_query = ''; |
332 | 332 | |
333 | - $filter_query = $this->getFilter($filter,true,true); |
|
333 | + $filter_query = $this->getFilter($filter, true, true); |
|
334 | 334 | |
335 | 335 | if ($date != "") |
336 | 336 | { |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | { |
357 | 357 | $limit_array = explode(",", $limit); |
358 | 358 | |
359 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
360 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
359 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
360 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
361 | 361 | |
362 | 362 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
363 | 363 | { |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | * @return Array list of source name |
389 | 389 | * |
390 | 390 | */ |
391 | - public function getAllSourceName($type = '',$filters = array()) |
|
391 | + public function getAllSourceName($type = '', $filters = array()) |
|
392 | 392 | { |
393 | - $filter_query = $this->getFilter($filters,true,true); |
|
393 | + $filter_query = $this->getFilter($filters, true, true); |
|
394 | 394 | $query_values = array(); |
395 | - $query = "SELECT DISTINCT marine_output.source_name |
|
395 | + $query = "SELECT DISTINCT marine_output.source_name |
|
396 | 396 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
397 | 397 | if ($type != '') { |
398 | 398 | $query_values = array(':type' => $type); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $source_array = array(); |
408 | 408 | $temp_array = array(); |
409 | 409 | |
410 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
410 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
411 | 411 | { |
412 | 412 | $temp_array['source_name'] = $row['source_name']; |
413 | 413 | $source_array[] = $temp_array; |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function getAllIdents($filters = array()) |
426 | 426 | { |
427 | - $filter_query = $this->getFilter($filters,true,true); |
|
428 | - $query = "SELECT DISTINCT marine_output.ident |
|
427 | + $filter_query = $this->getFilter($filters, true, true); |
|
428 | + $query = "SELECT DISTINCT marine_output.ident |
|
429 | 429 | FROM marine_output".$filter_query." marine_output.ident <> '' |
430 | 430 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
431 | 431 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $ident_array = array(); |
436 | 436 | $temp_array = array(); |
437 | 437 | |
438 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
438 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
439 | 439 | { |
440 | 440 | $temp_array['ident'] = $row['ident']; |
441 | 441 | $ident_array[] = $temp_array; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function getIdentity($mmsi) |
454 | 454 | { |
455 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
455 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
456 | 456 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
457 | 457 | $sth = $this->db->prepare($query); |
458 | 458 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -477,12 +477,12 @@ discard block |
||
477 | 477 | } else $offset = '+00:00'; |
478 | 478 | |
479 | 479 | if ($globalDBdriver == 'mysql') { |
480 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
480 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
481 | 481 | FROM marine_output |
482 | 482 | WHERE marine_output.date <> '' |
483 | 483 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
484 | 484 | } else { |
485 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
485 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
486 | 486 | FROM marine_output |
487 | 487 | WHERE marine_output.date <> '' |
488 | 488 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $date_array = array(); |
495 | 495 | $temp_array = array(); |
496 | 496 | |
497 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
497 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
498 | 498 | { |
499 | 499 | $temp_array['date'] = $row['date']; |
500 | 500 | |
@@ -513,11 +513,11 @@ discard block |
||
513 | 513 | * @return String success or false |
514 | 514 | * |
515 | 515 | */ |
516 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
516 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
517 | 517 | { |
518 | 518 | |
519 | 519 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
520 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
520 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
521 | 521 | |
522 | 522 | try { |
523 | 523 | $sth = $this->db->prepare($query); |
@@ -539,11 +539,11 @@ discard block |
||
539 | 539 | * @return String success or false |
540 | 540 | * |
541 | 541 | */ |
542 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
542 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
543 | 543 | { |
544 | 544 | |
545 | 545 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
546 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
546 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
547 | 547 | |
548 | 548 | try { |
549 | 549 | $sth = $this->db->prepare($query); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
567 | 567 | { |
568 | 568 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
569 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
569 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
570 | 570 | |
571 | 571 | try { |
572 | 572 | $sth = $this->db->prepare($query); |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * @param String $verticalrate vertival rate of flight |
605 | 605 | * @return String success or false |
606 | 606 | */ |
607 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
|
607 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '') |
|
608 | 608 | { |
609 | 609 | global $globalURL, $globalMarineImageFetch; |
610 | 610 | |
@@ -671,31 +671,31 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | |
674 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
674 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
675 | 675 | { |
676 | 676 | $date = date("Y-m-d H:i:s", time()); |
677 | 677 | } |
678 | 678 | |
679 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
680 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
681 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
682 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
683 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
684 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
685 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
686 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
687 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
688 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
689 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
690 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
691 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
692 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
679 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
680 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
681 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
682 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
683 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
684 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
685 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
686 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
687 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
688 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
689 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
690 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
691 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
692 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
693 | 693 | |
694 | 694 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
695 | 695 | $Image = new Image($this->db); |
696 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
696 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
697 | 697 | if (!isset($image_array[0]['mmsi'])) { |
698 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
698 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
699 | 699 | } |
700 | 700 | unset($Image); |
701 | 701 | } |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
708 | 708 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
709 | 709 | if ($arrival_date == '') $arrival_date = NULL; |
710 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
710 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
711 | 711 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
712 | 712 | |
713 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
713 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
714 | 714 | try { |
715 | 715 | |
716 | 716 | $sth = $this->db->prepare($query); |
@@ -735,13 +735,13 @@ discard block |
||
735 | 735 | { |
736 | 736 | global $globalDBdriver, $globalTimezone; |
737 | 737 | if ($globalDBdriver == 'mysql') { |
738 | - $query = "SELECT marine_output.ident FROM marine_output |
|
738 | + $query = "SELECT marine_output.ident FROM marine_output |
|
739 | 739 | WHERE marine_output.ident = :ident |
740 | 740 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
741 | 741 | AND marine_output.date < UTC_TIMESTAMP()"; |
742 | 742 | $query_data = array(':ident' => $ident); |
743 | 743 | } else { |
744 | - $query = "SELECT marine_output.ident FROM marine_output |
|
744 | + $query = "SELECT marine_output.ident FROM marine_output |
|
745 | 745 | WHERE marine_output.ident = :ident |
746 | 746 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
747 | 747 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -750,8 +750,8 @@ discard block |
||
750 | 750 | |
751 | 751 | $sth = $this->db->prepare($query); |
752 | 752 | $sth->execute($query_data); |
753 | - $ident_result=''; |
|
754 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
753 | + $ident_result = ''; |
|
754 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
755 | 755 | { |
756 | 756 | $ident_result = $row['ident']; |
757 | 757 | } |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | return false; |
778 | 778 | } else { |
779 | 779 | $q_array = explode(" ", $q); |
780 | - foreach ($q_array as $q_item){ |
|
781 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
780 | + foreach ($q_array as $q_item) { |
|
781 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
782 | 782 | $additional_query .= " AND ("; |
783 | 783 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
784 | 784 | $additional_query .= ")"; |
@@ -786,11 +786,11 @@ discard block |
||
786 | 786 | } |
787 | 787 | } |
788 | 788 | if ($globalDBdriver == 'mysql') { |
789 | - $query = "SELECT marine_output.* FROM marine_output |
|
789 | + $query = "SELECT marine_output.* FROM marine_output |
|
790 | 790 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
791 | 791 | AND marine_output.date < UTC_TIMESTAMP()"; |
792 | 792 | } else { |
793 | - $query = "SELECT marine_output.* FROM marine_output |
|
793 | + $query = "SELECT marine_output.* FROM marine_output |
|
794 | 794 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
795 | 795 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
796 | 796 | } |
@@ -809,16 +809,16 @@ discard block |
||
809 | 809 | * |
810 | 810 | */ |
811 | 811 | |
812 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
812 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
813 | 813 | { |
814 | 814 | global $globalDBdriver, $globalArchive; |
815 | 815 | //$filter_query = $this->getFilter($filters,true,true); |
816 | - $Connection= new Connection($this->db); |
|
816 | + $Connection = new Connection($this->db); |
|
817 | 817 | if (!$Connection->tableExists('countries')) return array(); |
818 | 818 | require_once('class.SpotterLive.php'); |
819 | 819 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
820 | 820 | $MarineLive = new MarineLive($this->db); |
821 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
821 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
822 | 822 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
823 | 823 | if ($olderthanmonths > 0) { |
824 | 824 | if ($globalDBdriver == 'mysql') { |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | } else { |
839 | 839 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
840 | 840 | $MarineArchive = new MarineArchive($this->db); |
841 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
841 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
842 | 842 | $filter_query .= " over_country <> ''"; |
843 | 843 | if ($olderthanmonths > 0) { |
844 | 844 | if ($globalDBdriver == 'mysql') { |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $flight_array = array(); |
867 | 867 | $temp_array = array(); |
868 | 868 | |
869 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
869 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
870 | 870 | { |
871 | 871 | $temp_array['marine_count'] = $row['nb']; |
872 | 872 | $temp_array['marine_country'] = $row['name']; |
@@ -885,11 +885,11 @@ discard block |
||
885 | 885 | * @return Array the callsign list |
886 | 886 | * |
887 | 887 | */ |
888 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
888 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
889 | 889 | { |
890 | 890 | global $globalDBdriver; |
891 | - $filter_query = $this->getFilter($filters,true,true); |
|
892 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
891 | + $filter_query = $this->getFilter($filters, true, true); |
|
892 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
893 | 893 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
894 | 894 | if ($olderthanmonths > 0) { |
895 | 895 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -903,28 +903,28 @@ discard block |
||
903 | 903 | if ($year != '') { |
904 | 904 | if ($globalDBdriver == 'mysql') { |
905 | 905 | $query .= " AND YEAR(marine_output.date) = :year"; |
906 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
906 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
907 | 907 | } else { |
908 | 908 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
909 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
909 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | if ($month != '') { |
913 | 913 | if ($globalDBdriver == 'mysql') { |
914 | 914 | $query .= " AND MONTH(marine_output.date) = :month"; |
915 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
915 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
916 | 916 | } else { |
917 | 917 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
918 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
918 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | if ($day != '') { |
922 | 922 | if ($globalDBdriver == 'mysql') { |
923 | 923 | $query .= " AND DAY(marine_output.date) = :day"; |
924 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
924 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
925 | 925 | } else { |
926 | 926 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
927 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
927 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $callsign_array = array(); |
937 | 937 | $temp_array = array(); |
938 | 938 | |
939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
940 | 940 | { |
941 | 941 | $temp_array['callsign_icao'] = $row['ident']; |
942 | 942 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | $date_array = array(); |
989 | 989 | $temp_array = array(); |
990 | 990 | |
991 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
991 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
992 | 992 | { |
993 | 993 | $temp_array['date_name'] = $row['date_name']; |
994 | 994 | $temp_array['date_count'] = $row['date_count']; |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $datetime = new DateTime(); |
1015 | 1015 | $offset = $datetime->format('P'); |
1016 | 1016 | } else $offset = '+00:00'; |
1017 | - $filter_query = $this->getFilter($filters,true,true); |
|
1017 | + $filter_query = $this->getFilter($filters, true, true); |
|
1018 | 1018 | if ($globalDBdriver == 'mysql') { |
1019 | 1019 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1020 | 1020 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | $date_array = array(); |
1036 | 1036 | $temp_array = array(); |
1037 | 1037 | |
1038 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1038 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1039 | 1039 | { |
1040 | 1040 | $temp_array['date_name'] = $row['date_name']; |
1041 | 1041 | $temp_array['date_count'] = $row['date_count']; |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | $datetime = new DateTime(); |
1061 | 1061 | $offset = $datetime->format('P'); |
1062 | 1062 | } else $offset = '+00:00'; |
1063 | - $filter_query = $this->getFilter($filters,true,true); |
|
1063 | + $filter_query = $this->getFilter($filters, true, true); |
|
1064 | 1064 | if ($globalDBdriver == 'mysql') { |
1065 | 1065 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1066 | 1066 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | $date_array = array(); |
1082 | 1082 | $temp_array = array(); |
1083 | 1083 | |
1084 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1084 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1085 | 1085 | { |
1086 | 1086 | $temp_array['date_name'] = $row['date_name']; |
1087 | 1087 | $temp_array['date_count'] = $row['date_count']; |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | $date_array = array(); |
1129 | 1129 | $temp_array = array(); |
1130 | 1130 | |
1131 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1131 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1132 | 1132 | { |
1133 | 1133 | $temp_array['month_name'] = $row['month_name']; |
1134 | 1134 | $temp_array['year_name'] = $row['year_name']; |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | $datetime = new DateTime(); |
1158 | 1158 | $offset = $datetime->format('P'); |
1159 | 1159 | } else $offset = '+00:00'; |
1160 | - $filter_query = $this->getFilter($filters,true,true); |
|
1160 | + $filter_query = $this->getFilter($filters, true, true); |
|
1161 | 1161 | if ($globalDBdriver == 'mysql') { |
1162 | 1162 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1163 | 1163 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | $date_array = array(); |
1179 | 1179 | $temp_array = array(); |
1180 | 1180 | |
1181 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1181 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1182 | 1182 | { |
1183 | 1183 | $temp_array['year_name'] = $row['year_name']; |
1184 | 1184 | $temp_array['month_name'] = $row['month_name']; |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | * @return Array the hour list |
1199 | 1199 | * |
1200 | 1200 | */ |
1201 | - public function countAllHours($orderby,$filters = array()) |
|
1201 | + public function countAllHours($orderby, $filters = array()) |
|
1202 | 1202 | { |
1203 | 1203 | global $globalTimezone, $globalDBdriver; |
1204 | 1204 | if ($globalTimezone != '') { |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | $hour_array = array(); |
1247 | 1247 | $temp_array = array(); |
1248 | 1248 | |
1249 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1249 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1250 | 1250 | { |
1251 | 1251 | $temp_array['hour_name'] = $row['hour_name']; |
1252 | 1252 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1268,8 +1268,8 @@ discard block |
||
1268 | 1268 | public function countAllHoursByDate($date, $filters = array()) |
1269 | 1269 | { |
1270 | 1270 | global $globalTimezone, $globalDBdriver; |
1271 | - $filter_query = $this->getFilter($filters,true,true); |
|
1272 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1271 | + $filter_query = $this->getFilter($filters, true, true); |
|
1272 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1273 | 1273 | if ($globalTimezone != '') { |
1274 | 1274 | date_default_timezone_set($globalTimezone); |
1275 | 1275 | $datetime = new DateTime($date); |
@@ -1277,12 +1277,12 @@ discard block |
||
1277 | 1277 | } else $offset = '+00:00'; |
1278 | 1278 | |
1279 | 1279 | if ($globalDBdriver == 'mysql') { |
1280 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1280 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1281 | 1281 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1282 | 1282 | GROUP BY hour_name |
1283 | 1283 | ORDER BY hour_name ASC"; |
1284 | 1284 | } else { |
1285 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1285 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1286 | 1286 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1287 | 1287 | GROUP BY hour_name |
1288 | 1288 | ORDER BY hour_name ASC"; |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $hour_array = array(); |
1295 | 1295 | $temp_array = array(); |
1296 | 1296 | |
1297 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1297 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1298 | 1298 | { |
1299 | 1299 | $temp_array['hour_name'] = $row['hour_name']; |
1300 | 1300 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1316,8 +1316,8 @@ discard block |
||
1316 | 1316 | public function countAllHoursByIdent($ident, $filters = array()) |
1317 | 1317 | { |
1318 | 1318 | global $globalTimezone, $globalDBdriver; |
1319 | - $filter_query = $this->getFilter($filters,true,true); |
|
1320 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1319 | + $filter_query = $this->getFilter($filters, true, true); |
|
1320 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1321 | 1321 | if ($globalTimezone != '') { |
1322 | 1322 | date_default_timezone_set($globalTimezone); |
1323 | 1323 | $datetime = new DateTime(); |
@@ -1325,12 +1325,12 @@ discard block |
||
1325 | 1325 | } else $offset = '+00:00'; |
1326 | 1326 | |
1327 | 1327 | if ($globalDBdriver == 'mysql') { |
1328 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1328 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1329 | 1329 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1330 | 1330 | GROUP BY hour_name |
1331 | 1331 | ORDER BY hour_name ASC"; |
1332 | 1332 | } else { |
1333 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1333 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1334 | 1334 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1335 | 1335 | GROUP BY hour_name |
1336 | 1336 | ORDER BY hour_name ASC"; |
@@ -1338,12 +1338,12 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | |
1340 | 1340 | $sth = $this->db->prepare($query); |
1341 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1341 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1342 | 1342 | |
1343 | 1343 | $hour_array = array(); |
1344 | 1344 | $temp_array = array(); |
1345 | 1345 | |
1346 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1346 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1347 | 1347 | { |
1348 | 1348 | $temp_array['hour_name'] = $row['hour_name']; |
1349 | 1349 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1362,33 +1362,33 @@ discard block |
||
1362 | 1362 | * @return Integer the number of vessels |
1363 | 1363 | * |
1364 | 1364 | */ |
1365 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1365 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1366 | 1366 | { |
1367 | 1367 | global $globalDBdriver; |
1368 | 1368 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
1369 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1369 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1370 | 1370 | $query_values = array(); |
1371 | 1371 | $query = ''; |
1372 | 1372 | if ($year != '') { |
1373 | 1373 | if ($globalDBdriver == 'mysql') { |
1374 | 1374 | $query .= " AND YEAR(marine_output.date) = :year"; |
1375 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1375 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1376 | 1376 | } else { |
1377 | 1377 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1378 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1378 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1379 | 1379 | } |
1380 | 1380 | } |
1381 | 1381 | if ($month != '') { |
1382 | 1382 | if ($globalDBdriver == 'mysql') { |
1383 | 1383 | $query .= " AND MONTH(marine_output.date) = :month"; |
1384 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1384 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1385 | 1385 | } else { |
1386 | 1386 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1387 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1387 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1388 | 1388 | } |
1389 | 1389 | } |
1390 | 1390 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1391 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1391 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1392 | 1392 | |
1393 | 1393 | $sth = $this->db->prepare($queryi); |
1394 | 1394 | $sth->execute($query_values); |
@@ -1401,32 +1401,32 @@ discard block |
||
1401 | 1401 | * @return Integer the number of vessels |
1402 | 1402 | * |
1403 | 1403 | */ |
1404 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
1404 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
1405 | 1405 | { |
1406 | 1406 | global $globalDBdriver; |
1407 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1407 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1408 | 1408 | $query_values = array(); |
1409 | 1409 | $query = ''; |
1410 | 1410 | if ($year != '') { |
1411 | 1411 | if ($globalDBdriver == 'mysql') { |
1412 | 1412 | $query .= " AND YEAR(marine_output.date) = :year"; |
1413 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1413 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1414 | 1414 | } else { |
1415 | 1415 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1416 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1416 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1417 | 1417 | } |
1418 | 1418 | } |
1419 | 1419 | if ($month != '') { |
1420 | 1420 | if ($globalDBdriver == 'mysql') { |
1421 | 1421 | $query .= " AND MONTH(marine_output.date) = :month"; |
1422 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1422 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1423 | 1423 | } else { |
1424 | 1424 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1425 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1425 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1426 | 1426 | } |
1427 | 1427 | } |
1428 | 1428 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1429 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1429 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1430 | 1430 | |
1431 | 1431 | $sth = $this->db->prepare($queryi); |
1432 | 1432 | $sth->execute($query_values); |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | public function countAllHoursFromToday($filters = array()) |
1444 | 1444 | { |
1445 | 1445 | global $globalTimezone, $globalDBdriver; |
1446 | - $filter_query = $this->getFilter($filters,true,true); |
|
1446 | + $filter_query = $this->getFilter($filters, true, true); |
|
1447 | 1447 | if ($globalTimezone != '') { |
1448 | 1448 | date_default_timezone_set($globalTimezone); |
1449 | 1449 | $datetime = new DateTime(); |
@@ -1451,12 +1451,12 @@ discard block |
||
1451 | 1451 | } else $offset = '+00:00'; |
1452 | 1452 | |
1453 | 1453 | if ($globalDBdriver == 'mysql') { |
1454 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1454 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1455 | 1455 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
1456 | 1456 | GROUP BY hour_name |
1457 | 1457 | ORDER BY hour_name ASC"; |
1458 | 1458 | } else { |
1459 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1459 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1460 | 1460 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1461 | 1461 | GROUP BY hour_name |
1462 | 1462 | ORDER BY hour_name ASC"; |
@@ -1468,7 +1468,7 @@ discard block |
||
1468 | 1468 | $hour_array = array(); |
1469 | 1469 | $temp_array = array(); |
1470 | 1470 | |
1471 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1471 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1472 | 1472 | { |
1473 | 1473 | $temp_array['hour_name'] = $row['hour_name']; |
1474 | 1474 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1487,9 +1487,9 @@ discard block |
||
1487 | 1487 | */ |
1488 | 1488 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1489 | 1489 | { |
1490 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1490 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1491 | 1491 | |
1492 | - $query = "SELECT marine_output.marine_id |
|
1492 | + $query = "SELECT marine_output.marine_id |
|
1493 | 1493 | FROM marine_output |
1494 | 1494 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
1495 | 1495 | |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | $sth = $this->db->prepare($query); |
1498 | 1498 | $sth->execute(); |
1499 | 1499 | |
1500 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1500 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1501 | 1501 | { |
1502 | 1502 | return $row['marine_id']; |
1503 | 1503 | } |
@@ -1522,23 +1522,23 @@ discard block |
||
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | $current_date = date("Y-m-d H:i:s"); |
1525 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1525 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1526 | 1526 | |
1527 | 1527 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1528 | 1528 | |
1529 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1529 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1530 | 1530 | $years = $time_array['years']; |
1531 | 1531 | |
1532 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1532 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1533 | 1533 | $months = $time_array['months']; |
1534 | 1534 | |
1535 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1535 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1536 | 1536 | $days = $time_array['days']; |
1537 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1537 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1538 | 1538 | $hours = $time_array['hours']; |
1539 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1539 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1540 | 1540 | $minutes = $time_array['minutes']; |
1541 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1541 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1542 | 1542 | |
1543 | 1543 | return $time_array; |
1544 | 1544 | } |
@@ -1561,63 +1561,63 @@ discard block |
||
1561 | 1561 | $temp_array['direction_degree'] = $direction; |
1562 | 1562 | $temp_array['direction_shortname'] = "N"; |
1563 | 1563 | $temp_array['direction_fullname'] = "North"; |
1564 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1564 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1565 | 1565 | $temp_array['direction_degree'] = $direction; |
1566 | 1566 | $temp_array['direction_shortname'] = "NNE"; |
1567 | 1567 | $temp_array['direction_fullname'] = "North-Northeast"; |
1568 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1568 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1569 | 1569 | $temp_array['direction_degree'] = $direction; |
1570 | 1570 | $temp_array['direction_shortname'] = "NE"; |
1571 | 1571 | $temp_array['direction_fullname'] = "Northeast"; |
1572 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1572 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1573 | 1573 | $temp_array['direction_degree'] = $direction; |
1574 | 1574 | $temp_array['direction_shortname'] = "ENE"; |
1575 | 1575 | $temp_array['direction_fullname'] = "East-Northeast"; |
1576 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1576 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1577 | 1577 | $temp_array['direction_degree'] = $direction; |
1578 | 1578 | $temp_array['direction_shortname'] = "E"; |
1579 | 1579 | $temp_array['direction_fullname'] = "East"; |
1580 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1580 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1581 | 1581 | $temp_array['direction_degree'] = $direction; |
1582 | 1582 | $temp_array['direction_shortname'] = "ESE"; |
1583 | 1583 | $temp_array['direction_fullname'] = "East-Southeast"; |
1584 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1584 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1585 | 1585 | $temp_array['direction_degree'] = $direction; |
1586 | 1586 | $temp_array['direction_shortname'] = "SE"; |
1587 | 1587 | $temp_array['direction_fullname'] = "Southeast"; |
1588 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1588 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1589 | 1589 | $temp_array['direction_degree'] = $direction; |
1590 | 1590 | $temp_array['direction_shortname'] = "SSE"; |
1591 | 1591 | $temp_array['direction_fullname'] = "South-Southeast"; |
1592 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1592 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1593 | 1593 | $temp_array['direction_degree'] = $direction; |
1594 | 1594 | $temp_array['direction_shortname'] = "S"; |
1595 | 1595 | $temp_array['direction_fullname'] = "South"; |
1596 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1596 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1597 | 1597 | $temp_array['direction_degree'] = $direction; |
1598 | 1598 | $temp_array['direction_shortname'] = "SSW"; |
1599 | 1599 | $temp_array['direction_fullname'] = "South-Southwest"; |
1600 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1600 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1601 | 1601 | $temp_array['direction_degree'] = $direction; |
1602 | 1602 | $temp_array['direction_shortname'] = "SW"; |
1603 | 1603 | $temp_array['direction_fullname'] = "Southwest"; |
1604 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1604 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1605 | 1605 | $temp_array['direction_degree'] = $direction; |
1606 | 1606 | $temp_array['direction_shortname'] = "WSW"; |
1607 | 1607 | $temp_array['direction_fullname'] = "West-Southwest"; |
1608 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1608 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1609 | 1609 | $temp_array['direction_degree'] = $direction; |
1610 | 1610 | $temp_array['direction_shortname'] = "W"; |
1611 | 1611 | $temp_array['direction_fullname'] = "West"; |
1612 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1612 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1613 | 1613 | $temp_array['direction_degree'] = $direction; |
1614 | 1614 | $temp_array['direction_shortname'] = "WNW"; |
1615 | 1615 | $temp_array['direction_fullname'] = "West-Northwest"; |
1616 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1616 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1617 | 1617 | $temp_array['direction_degree'] = $direction; |
1618 | 1618 | $temp_array['direction_shortname'] = "NW"; |
1619 | 1619 | $temp_array['direction_fullname'] = "Northwest"; |
1620 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1620 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1621 | 1621 | $temp_array['direction_degree'] = $direction; |
1622 | 1622 | $temp_array['direction_shortname'] = "NNW"; |
1623 | 1623 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1634,11 +1634,11 @@ discard block |
||
1634 | 1634 | * @param Float $longitude longitute of the flight |
1635 | 1635 | * @return String the countrie |
1636 | 1636 | */ |
1637 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1637 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1638 | 1638 | { |
1639 | 1639 | global $globalDBdriver, $globalDebug; |
1640 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1641 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1640 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1641 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1642 | 1642 | |
1643 | 1643 | $Connection = new Connection($this->db); |
1644 | 1644 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | public function getCountryFromISO2($iso2) |
1679 | 1679 | { |
1680 | 1680 | global $globalDBdriver, $globalDebug; |
1681 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1681 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1682 | 1682 | |
1683 | 1683 | $Connection = new Connection($this->db); |
1684 | 1684 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | |
1727 | 1727 | $bitly_data = json_decode($bitly_data); |
1728 | 1728 | $bitly_url = ''; |
1729 | - if ($bitly_data->status_txt = "OK"){ |
|
1729 | + if ($bitly_data->status_txt = "OK") { |
|
1730 | 1730 | $bitly_url = $bitly_data->data->url; |
1731 | 1731 | } |
1732 | 1732 | |
@@ -1740,11 +1740,11 @@ discard block |
||
1740 | 1740 | * @return Array the vessel type list |
1741 | 1741 | * |
1742 | 1742 | */ |
1743 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1743 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1744 | 1744 | { |
1745 | 1745 | global $globalDBdriver; |
1746 | - $filter_query = $this->getFilter($filters,true,true); |
|
1747 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
1746 | + $filter_query = $this->getFilter($filters, true, true); |
|
1747 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
1748 | 1748 | FROM marine_output ".$filter_query." marine_output.type <> ''"; |
1749 | 1749 | if ($olderthanmonths > 0) { |
1750 | 1750 | if ($globalDBdriver == 'mysql') { |
@@ -1764,28 +1764,28 @@ discard block |
||
1764 | 1764 | if ($year != '') { |
1765 | 1765 | if ($globalDBdriver == 'mysql') { |
1766 | 1766 | $query .= " AND YEAR(marine_output.date) = :year"; |
1767 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1767 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1768 | 1768 | } else { |
1769 | 1769 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1770 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1770 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1771 | 1771 | } |
1772 | 1772 | } |
1773 | 1773 | if ($month != '') { |
1774 | 1774 | if ($globalDBdriver == 'mysql') { |
1775 | 1775 | $query .= " AND MONTH(marine_output.date) = :month"; |
1776 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1776 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1777 | 1777 | } else { |
1778 | 1778 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1779 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1779 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1780 | 1780 | } |
1781 | 1781 | } |
1782 | 1782 | if ($day != '') { |
1783 | 1783 | if ($globalDBdriver == 'mysql') { |
1784 | 1784 | $query .= " AND DAY(marine_output.date) = :day"; |
1785 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1785 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1786 | 1786 | } else { |
1787 | 1787 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1788 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1788 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1789 | 1789 | } |
1790 | 1790 | } |
1791 | 1791 | $query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC"; |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | $sth->execute($query_values); |
1795 | 1795 | $marine_array = array(); |
1796 | 1796 | $temp_array = array(); |
1797 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1797 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1798 | 1798 | { |
1799 | 1799 | $temp_array['marine_type'] = $row['marine_type']; |
1800 | 1800 | $temp_array['marine_type_count'] = $row['marine_type_count']; |
@@ -1809,13 +1809,13 @@ discard block |
||
1809 | 1809 | * @return Array the tracker information |
1810 | 1810 | * |
1811 | 1811 | */ |
1812 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
1812 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
1813 | 1813 | { |
1814 | 1814 | global $globalTimezone, $globalDBdriver; |
1815 | 1815 | date_default_timezone_set('UTC'); |
1816 | 1816 | $query_values = array(); |
1817 | 1817 | $additional_query = ''; |
1818 | - $filter_query = $this->getFilter($filters,true,true); |
|
1818 | + $filter_query = $this->getFilter($filters, true, true); |
|
1819 | 1819 | if ($q != "") |
1820 | 1820 | { |
1821 | 1821 | if (!is_string($q)) |
@@ -1823,8 +1823,8 @@ discard block |
||
1823 | 1823 | return false; |
1824 | 1824 | } else { |
1825 | 1825 | $q_array = explode(" ", $q); |
1826 | - foreach ($q_array as $q_item){ |
|
1827 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1826 | + foreach ($q_array as $q_item) { |
|
1827 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1828 | 1828 | $additional_query .= " AND ("; |
1829 | 1829 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
1830 | 1830 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -1836,42 +1836,42 @@ discard block |
||
1836 | 1836 | } |
1837 | 1837 | if ($callsign != "") |
1838 | 1838 | { |
1839 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1839 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1840 | 1840 | if (!is_string($callsign)) |
1841 | 1841 | { |
1842 | 1842 | return false; |
1843 | 1843 | } else { |
1844 | 1844 | $additional_query .= " AND marine_output.ident = :callsign"; |
1845 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
1845 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
1846 | 1846 | } |
1847 | 1847 | } |
1848 | 1848 | if ($mmsi != "") |
1849 | 1849 | { |
1850 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
1850 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
1851 | 1851 | if (!is_numeric($mmsi)) |
1852 | 1852 | { |
1853 | 1853 | return false; |
1854 | 1854 | } else { |
1855 | 1855 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
1856 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
1856 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
1857 | 1857 | } |
1858 | 1858 | } |
1859 | 1859 | if ($imo != "") |
1860 | 1860 | { |
1861 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1861 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1862 | 1862 | if (!is_numeric($imo)) |
1863 | 1863 | { |
1864 | 1864 | return false; |
1865 | 1865 | } else { |
1866 | 1866 | $additional_query .= " AND marine_output.imo = :imo"; |
1867 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
1867 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
1868 | 1868 | } |
1869 | 1869 | } |
1870 | 1870 | if ($date_posted != "") |
1871 | 1871 | { |
1872 | 1872 | $date_array = explode(",", $date_posted); |
1873 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
1874 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
1873 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
1874 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
1875 | 1875 | if ($globalTimezone != '') { |
1876 | 1876 | date_default_timezone_set($globalTimezone); |
1877 | 1877 | $datetime = new DateTime(); |
@@ -1898,8 +1898,8 @@ discard block |
||
1898 | 1898 | if ($limit != "") |
1899 | 1899 | { |
1900 | 1900 | $limit_array = explode(",", $limit); |
1901 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1902 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1901 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1902 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1903 | 1903 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1904 | 1904 | { |
1905 | 1905 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -1917,28 +1917,28 @@ discard block |
||
1917 | 1917 | } |
1918 | 1918 | } |
1919 | 1919 | if ($origLat != "" && $origLon != "" && $dist != "") { |
1920 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
1920 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
1921 | 1921 | if ($globalDBdriver == 'mysql') { |
1922 | - $query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
1922 | + $query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
1923 | 1923 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
1924 | 1924 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
1925 | 1925 | } else { |
1926 | - $query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
1926 | + $query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
1927 | 1927 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
1928 | 1928 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
1929 | 1929 | } |
1930 | 1930 | } else { |
1931 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
1931 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
1932 | 1932 | ".$additional_query." |
1933 | 1933 | ".$orderby_query; |
1934 | 1934 | } |
1935 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
1935 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
1936 | 1936 | return $marine_array; |
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | public function getOrderBy() |
1940 | 1940 | { |
1941 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
1941 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
1942 | 1942 | |
1943 | 1943 | return $orderby; |
1944 | 1944 |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $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 | + $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"; |
|
40 | 40 | } else { |
41 | - $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 | + $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"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
76 | 76 | } |
77 | 77 | } |
78 | - $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"; |
|
78 | + $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"; |
|
79 | 79 | } |
80 | 80 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
81 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
81 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
82 | 82 | } |
83 | 83 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
84 | 84 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
85 | 85 | if ($filter_query_where != '') { |
86 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
86 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
87 | 87 | } |
88 | 88 | $filter_query = $filter_query_join.$filter_query_where; |
89 | 89 | return $filter_query; |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | if ($limit != '') |
107 | 107 | { |
108 | 108 | $limit_array = explode(',', $limit); |
109 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
110 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
109 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
110 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
111 | 111 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
112 | 112 | { |
113 | 113 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
123 | 123 | } |
124 | 124 | } |
125 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
125 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
126 | 126 | |
127 | 127 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
128 | 128 | if ($globalDBdriver == 'mysql') { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } else { |
132 | 132 | $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; |
133 | 133 | } |
134 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
134 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
135 | 135 | |
136 | 136 | return $spotter_array; |
137 | 137 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | global $globalDBdriver, $globalLiveInterval; |
148 | 148 | date_default_timezone_set('UTC'); |
149 | 149 | |
150 | - $filter_query = $this->getFilter($filter,true,true); |
|
150 | + $filter_query = $this->getFilter($filter, true, true); |
|
151 | 151 | |
152 | 152 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
153 | 153 | if ($globalDBdriver == 'mysql') { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | 163 | $sth->execute(); |
164 | - } catch(PDOException $e) { |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | echo $e->getMessage(); |
166 | 166 | die; |
167 | 167 | } |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * @return Array the spotter information |
177 | 177 | * |
178 | 178 | */ |
179 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
|
179 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false) |
|
180 | 180 | { |
181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
182 | 182 | date_default_timezone_set('UTC'); |
183 | 183 | $usecoord = false; |
184 | 184 | if (is_array($coord) && !empty($coord)) { |
185 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
186 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
187 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
188 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
185 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
186 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
187 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
188 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
189 | 189 | $usecoord = true; |
190 | 190 | } |
191 | - $filter_query = $this->getFilter($filter,true,true); |
|
191 | + $filter_query = $this->getFilter($filter, true, true); |
|
192 | 192 | |
193 | 193 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
194 | 194 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | try { |
238 | 238 | $sth = $this->db->prepare($query); |
239 | 239 | $sth->execute(); |
240 | - } catch(PDOException $e) { |
|
240 | + } catch (PDOException $e) { |
|
241 | 241 | echo $e->getMessage(); |
242 | 242 | die; |
243 | 243 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | public function getLiveMarineCount($filter = array()) |
255 | 255 | { |
256 | 256 | global $globalDBdriver, $globalLiveInterval; |
257 | - $filter_query = $this->getFilter($filter,true,true); |
|
257 | + $filter_query = $this->getFilter($filter, true, true); |
|
258 | 258 | |
259 | 259 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
260 | 260 | if ($globalDBdriver == 'mysql') { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | try { |
266 | 266 | $sth = $this->db->prepare($query); |
267 | 267 | $sth->execute(); |
268 | - } catch(PDOException $e) { |
|
268 | + } catch (PDOException $e) { |
|
269 | 269 | echo $e->getMessage(); |
270 | 270 | die; |
271 | 271 | } |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | $filter_query = $this->getFilter($filter); |
289 | 289 | |
290 | 290 | if (is_array($coord)) { |
291 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
292 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
293 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
294 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
291 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
292 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
293 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
294 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
295 | 295 | } else return array(); |
296 | 296 | if ($globalDBdriver == 'mysql') { |
297 | 297 | $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; |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
314 | 314 | $Marine = new Marine($this->db); |
315 | 315 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
316 | - $filter_query = $this->getFilter($filter,true,true); |
|
316 | + $filter_query = $this->getFilter($filter, true, true); |
|
317 | 317 | |
318 | 318 | if (is_array($coord)) { |
319 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
320 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
321 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
322 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
319 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
320 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
321 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
322 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
323 | 323 | } else return array(); |
324 | 324 | /* |
325 | 325 | if ($globalDBdriver == 'mysql') { |
@@ -334,13 +334,13 @@ discard block |
||
334 | 334 | */ |
335 | 335 | if ($globalDBdriver == 'mysql') { |
336 | 336 | if (isset($globalArchive) && $globalArchive === TRUE) { |
337 | - $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 |
|
337 | + $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 |
|
338 | 338 | FROM marine_live |
339 | 339 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
340 | 340 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
341 | 341 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0'; |
342 | 342 | } else { |
343 | - $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 |
|
343 | + $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 |
|
344 | 344 | FROM marine_live |
345 | 345 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
346 | 346 | FROM marine_live l |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | } |
353 | 353 | } else { |
354 | 354 | if (isset($globalArchive) && $globalArchive === TRUE) { |
355 | - $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 |
|
355 | + $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 |
|
356 | 356 | FROM marine_live |
357 | 357 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
358 | 358 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
359 | 359 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
360 | 360 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0'"; |
361 | 361 | } else { |
362 | - $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 |
|
362 | + $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 |
|
363 | 363 | FROM marine_live |
364 | 364 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
365 | 365 | FROM marine_live l |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | if ($interval == '1m') |
417 | 417 | { |
418 | 418 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
419 | - } else if ($interval == '15m'){ |
|
419 | + } else if ($interval == '15m') { |
|
420 | 420 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
421 | 421 | } |
422 | 422 | } |
@@ -424,14 +424,14 @@ discard block |
||
424 | 424 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
425 | 425 | } |
426 | 426 | |
427 | - $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 |
|
427 | + $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 |
|
428 | 428 | WHERE marine_live.latitude <> '' |
429 | 429 | AND marine_live.longitude <> '' |
430 | 430 | ".$additional_query." |
431 | 431 | HAVING distance < :radius |
432 | 432 | ORDER BY distance"; |
433 | 433 | |
434 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
434 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
435 | 435 | |
436 | 436 | return $spotter_array; |
437 | 437 | } |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | date_default_timezone_set('UTC'); |
450 | 450 | |
451 | 451 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
452 | - $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'; |
|
452 | + $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'; |
|
453 | 453 | |
454 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
454 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
455 | 455 | |
456 | 456 | return $spotter_array; |
457 | 457 | } |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | * @return Array the spotter information |
463 | 463 | * |
464 | 464 | */ |
465 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
465 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
466 | 466 | { |
467 | 467 | $Marine = new Marine($this->db); |
468 | 468 | date_default_timezone_set('UTC'); |
469 | 469 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
470 | 470 | $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'; |
471 | - $date = date('c',$date); |
|
472 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
471 | + $date = date('c', $date); |
|
472 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
473 | 473 | return $spotter_array; |
474 | 474 | } |
475 | 475 | |
@@ -479,14 +479,14 @@ discard block |
||
479 | 479 | * @return Array the spotter information |
480 | 480 | * |
481 | 481 | */ |
482 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
482 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
483 | 483 | { |
484 | 484 | $Marine = new Marine($this->db); |
485 | 485 | date_default_timezone_set('UTC'); |
486 | 486 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
487 | 487 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi 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'; |
488 | - $date = date('c',$date); |
|
489 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
488 | + $date = date('c', $date); |
|
489 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
490 | 490 | return $spotter_array; |
491 | 491 | } |
492 | 492 | |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | |
504 | 504 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
505 | - $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'; |
|
505 | + $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'; |
|
506 | 506 | |
507 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
507 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
508 | 508 | |
509 | 509 | return $spotter_array; |
510 | 510 | } |
@@ -515,15 +515,15 @@ discard block |
||
515 | 515 | * @return Array the spotter information |
516 | 516 | * |
517 | 517 | */ |
518 | - public function getDateLiveMarineDataById($id,$date) |
|
518 | + public function getDateLiveMarineDataById($id, $date) |
|
519 | 519 | { |
520 | 520 | $Marine = new Marine($this->db); |
521 | 521 | date_default_timezone_set('UTC'); |
522 | 522 | |
523 | 523 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
524 | - $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'; |
|
525 | - $date = date('c',$date); |
|
526 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
524 | + $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'; |
|
525 | + $date = date('c', $date); |
|
526 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
527 | 527 | |
528 | 528 | return $spotter_array; |
529 | 529 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * @return Array the spotter information |
536 | 536 | * |
537 | 537 | */ |
538 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
538 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
539 | 539 | { |
540 | 540 | global $globalDBdriver, $globalLiveInterval; |
541 | 541 | date_default_timezone_set('UTC'); |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | try { |
555 | 555 | $sth = $this->db->prepare($query); |
556 | 556 | $sth->execute(array(':id' => $id)); |
557 | - } catch(PDOException $e) { |
|
557 | + } catch (PDOException $e) { |
|
558 | 558 | echo $e->getMessage(); |
559 | 559 | die; |
560 | 560 | } |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | { |
573 | 573 | date_default_timezone_set('UTC'); |
574 | 574 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
575 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
575 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
576 | 576 | try { |
577 | 577 | |
578 | 578 | $sth = $this->db->prepare($query); |
579 | 579 | $sth->execute(array(':ident' => $ident)); |
580 | - } catch(PDOException $e) { |
|
580 | + } catch (PDOException $e) { |
|
581 | 581 | echo $e->getMessage(); |
582 | 582 | die; |
583 | 583 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | |
608 | 608 | $sth = $this->db->prepare($query); |
609 | 609 | $sth->execute(); |
610 | - } catch(PDOException $e) { |
|
610 | + } catch (PDOException $e) { |
|
611 | 611 | return "error"; |
612 | 612 | } |
613 | 613 | |
@@ -630,14 +630,14 @@ discard block |
||
630 | 630 | |
631 | 631 | $sth = $this->db->prepare($query); |
632 | 632 | $sth->execute(); |
633 | - } catch(PDOException $e) { |
|
633 | + } catch (PDOException $e) { |
|
634 | 634 | return "error"; |
635 | 635 | } |
636 | 636 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
637 | 637 | $i = 0; |
638 | - $j =0; |
|
638 | + $j = 0; |
|
639 | 639 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
640 | - foreach($all as $row) |
|
640 | + foreach ($all as $row) |
|
641 | 641 | { |
642 | 642 | $i++; |
643 | 643 | $j++; |
@@ -645,9 +645,9 @@ discard block |
||
645 | 645 | if ($globalDebug) echo "."; |
646 | 646 | try { |
647 | 647 | |
648 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
648 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
649 | 649 | $sth->execute(); |
650 | - } catch(PDOException $e) { |
|
650 | + } catch (PDOException $e) { |
|
651 | 651 | return "error"; |
652 | 652 | } |
653 | 653 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -658,9 +658,9 @@ discard block |
||
658 | 658 | if ($i > 0) { |
659 | 659 | try { |
660 | 660 | |
661 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
661 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
662 | 662 | $sth->execute(); |
663 | - } catch(PDOException $e) { |
|
663 | + } catch (PDOException $e) { |
|
664 | 664 | return "error"; |
665 | 665 | } |
666 | 666 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | |
674 | 674 | $sth = $this->db->prepare($query); |
675 | 675 | $sth->execute(); |
676 | - } catch(PDOException $e) { |
|
676 | + } catch (PDOException $e) { |
|
677 | 677 | return "error"; |
678 | 678 | } |
679 | 679 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | public function deleteLiveMarineDataByIdent($ident) |
722 | 722 | { |
723 | 723 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
724 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
724 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
725 | 725 | |
726 | 726 | try { |
727 | 727 | |
728 | 728 | $sth = $this->db->prepare($query); |
729 | 729 | $sth->execute(array(':ident' => $ident)); |
730 | - } catch(PDOException $e) { |
|
730 | + } catch (PDOException $e) { |
|
731 | 731 | return "error"; |
732 | 732 | } |
733 | 733 | |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | public function deleteLiveMarineDataById($id) |
744 | 744 | { |
745 | 745 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
746 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
746 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
747 | 747 | |
748 | 748 | try { |
749 | 749 | |
750 | 750 | $sth = $this->db->prepare($query); |
751 | 751 | $sth->execute(array(':id' => $id)); |
752 | - } catch(PDOException $e) { |
|
752 | + } catch (PDOException $e) { |
|
753 | 753 | return "error"; |
754 | 754 | } |
755 | 755 | |
@@ -767,13 +767,13 @@ discard block |
||
767 | 767 | { |
768 | 768 | global $globalDBdriver, $globalTimezone; |
769 | 769 | if ($globalDBdriver == 'mysql') { |
770 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
770 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
771 | 771 | WHERE marine_live.ident = :ident |
772 | 772 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
773 | 773 | AND marine_live.date < UTC_TIMESTAMP()'; |
774 | 774 | $query_data = array(':ident' => $ident); |
775 | 775 | } else { |
776 | - $query = "SELECT marine_live.ident FROM marine_live |
|
776 | + $query = "SELECT marine_live.ident FROM marine_live |
|
777 | 777 | WHERE marine_live.ident = :ident |
778 | 778 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
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['ident']; |
789 | 789 | } |
@@ -800,13 +800,13 @@ discard block |
||
800 | 800 | { |
801 | 801 | global $globalDBdriver, $globalTimezone; |
802 | 802 | if ($globalDBdriver == 'mysql') { |
803 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
803 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
804 | 804 | WHERE marine_live.ident = :ident |
805 | 805 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
806 | 806 | // AND marine_live.date < UTC_TIMESTAMP()"; |
807 | 807 | $query_data = array(':ident' => $ident); |
808 | 808 | } else { |
809 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
809 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
810 | 810 | WHERE marine_live.ident = :ident |
811 | 811 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
812 | 812 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -815,8 +815,8 @@ discard block |
||
815 | 815 | |
816 | 816 | $sth = $this->db->prepare($query); |
817 | 817 | $sth->execute($query_data); |
818 | - $ident_result=''; |
|
819 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
818 | + $ident_result = ''; |
|
819 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
820 | 820 | { |
821 | 821 | $ident_result = $row['fammarine_id']; |
822 | 822 | } |
@@ -833,13 +833,13 @@ discard block |
||
833 | 833 | { |
834 | 834 | global $globalDBdriver, $globalTimezone; |
835 | 835 | if ($globalDBdriver == 'mysql') { |
836 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
836 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
837 | 837 | WHERE marine_live.fammarine_id = :id |
838 | 838 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
839 | 839 | // AND marine_live.date < UTC_TIMESTAMP()"; |
840 | 840 | $query_data = array(':id' => $id); |
841 | 841 | } else { |
842 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
842 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
843 | 843 | WHERE marine_live.fammarine_id = :id |
844 | 844 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
845 | 845 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | |
849 | 849 | $sth = $this->db->prepare($query); |
850 | 850 | $sth->execute($query_data); |
851 | - $ident_result=''; |
|
852 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
851 | + $ident_result = ''; |
|
852 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
853 | 853 | { |
854 | 854 | $ident_result = $row['fammarine_id']; |
855 | 855 | } |
@@ -866,13 +866,13 @@ discard block |
||
866 | 866 | { |
867 | 867 | global $globalDBdriver, $globalTimezone; |
868 | 868 | if ($globalDBdriver == 'mysql') { |
869 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
869 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
870 | 870 | WHERE marine_live.mmsi = :mmsi |
871 | 871 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
872 | 872 | // AND marine_live.date < UTC_TIMESTAMP()"; |
873 | 873 | $query_data = array(':mmsi' => $mmsi); |
874 | 874 | } else { |
875 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
875 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
876 | 876 | WHERE marine_live.mmsi = :mmsi |
877 | 877 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
878 | 878 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -881,8 +881,8 @@ discard block |
||
881 | 881 | |
882 | 882 | $sth = $this->db->prepare($query); |
883 | 883 | $sth->execute($query_data); |
884 | - $ident_result=''; |
|
885 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
884 | + $ident_result = ''; |
|
885 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
886 | 886 | { |
887 | 887 | $ident_result = $row['fammarine_id']; |
888 | 888 | } |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | * @return String success or false |
901 | 901 | * |
902 | 902 | */ |
903 | - 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 = '') |
|
903 | + 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 = '') |
|
904 | 904 | { |
905 | 905 | global $globalURL, $globalArchive, $globalDebug; |
906 | 906 | $Common = new Common(); |
@@ -952,26 +952,26 @@ discard block |
||
952 | 952 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
953 | 953 | |
954 | 954 | |
955 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
956 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
957 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
958 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
959 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
960 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
961 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
962 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
963 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
964 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
965 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
966 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
967 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
968 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
969 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
970 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
955 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
956 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
957 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
958 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
959 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
960 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
961 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
962 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
963 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
964 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
965 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
966 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
967 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
968 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
969 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
970 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
971 | 971 | |
972 | 972 | |
973 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
974 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
973 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
974 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
975 | 975 | if ($arrival_date == '') $arrival_date = NULL; |
976 | 976 | $query = ''; |
977 | 977 | if ($globalArchive) { |
@@ -981,19 +981,19 @@ discard block |
||
981 | 981 | $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) |
982 | 982 | 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)'; |
983 | 983 | |
984 | - $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); |
|
984 | + $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); |
|
985 | 985 | try { |
986 | 986 | $sth = $this->db->prepare($query); |
987 | 987 | $sth->execute($query_values); |
988 | 988 | $sth->closeCursor(); |
989 | - } catch(PDOException $e) { |
|
989 | + } catch (PDOException $e) { |
|
990 | 990 | return "error : ".$e->getMessage(); |
991 | 991 | } |
992 | 992 | |
993 | 993 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
994 | 994 | if ($globalDebug) echo '(Add to Marine archive : '; |
995 | 995 | $MarineArchive = new MarineArchive($this->db); |
996 | - $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); |
|
996 | + $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); |
|
997 | 997 | if ($globalDebug) echo $result.')'; |
998 | 998 | } |
999 | 999 | return "success"; |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | |
1002 | 1002 | public function getOrderBy() |
1003 | 1003 | { |
1004 | - $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")); |
|
1004 | + $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")); |
|
1005 | 1005 | return $orderby; |
1006 | 1006 | } |
1007 | 1007 |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $s3 = sin($bank/2); |
49 | 49 | $c1c2 = $c1*$c2; |
50 | 50 | $s1s2 = $s1*$s2; |
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | $min = false; |
74 | 74 | $allhistory = false; |
75 | 75 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
86 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
82 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
84 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
86 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
87 | 87 | /* |
88 | 88 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
89 | 89 | $min = true; |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | $from_archive = true; |
131 | 131 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
132 | 132 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
133 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
134 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
135 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
136 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
137 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
138 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
133 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
134 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
135 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
136 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
137 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
138 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
139 | 139 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
140 | 140 | $from_archive = true; |
141 | 141 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -145,34 +145,34 @@ discard block |
||
145 | 145 | $begindate = $_COOKIE['archive_begin']; |
146 | 146 | $enddate = $_COOKIE['archive_end']; |
147 | 147 | |
148 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
149 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
150 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
148 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
149 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
150 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
151 | 151 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
152 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
152 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
153 | 153 | } elseif ($tracker) { |
154 | 154 | $coord = array(); |
155 | 155 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
156 | - $coord = explode(',',$_GET['coord']); |
|
156 | + $coord = explode(',', $_GET['coord']); |
|
157 | 157 | } |
158 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
158 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
159 | 159 | } elseif ($marine) { |
160 | 160 | $coord = array(); |
161 | 161 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
162 | - $coord = explode(',',$_GET['coord']); |
|
162 | + $coord = explode(',', $_GET['coord']); |
|
163 | 163 | } |
164 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
164 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
165 | 165 | } else { |
166 | 166 | $coord = array(); |
167 | 167 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
168 | - $coord = explode(',',$_GET['coord']); |
|
168 | + $coord = explode(',', $_GET['coord']); |
|
169 | 169 | } |
170 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
170 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
171 | 171 | } |
172 | 172 | //print_r($spotter_array); |
173 | 173 | if (!empty($spotter_array) && isset($coord)) { |
174 | 174 | if (isset($_GET['archive'])) { |
175 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
175 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
176 | 176 | } elseif ($tracker) { |
177 | 177 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
178 | 178 | } elseif ($marine) { |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | if ($flightcnt == '') $flightcnt = 0; |
184 | 184 | } else $flightcnt = 0; |
185 | 185 | |
186 | -$sqltime = round(microtime(true)-$begintime,2); |
|
186 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
187 | 187 | $minitime = time(); |
188 | 188 | $maxitime = 0; |
189 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
189 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
190 | 190 | $modelsdb = array(); |
191 | 191 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
192 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
193 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
194 | - if (isset($row[1]) ){ |
|
192 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
193 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
194 | + if (isset($row[1])) { |
|
195 | 195 | $model = $row[0]; |
196 | 196 | $modelsdb[$model] = $row[1]; |
197 | 197 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | } |
202 | 202 | $modelsdb2 = array(); |
203 | 203 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
204 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
205 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
206 | - if (isset($row[1]) ){ |
|
204 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
205 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
206 | + if (isset($row[1])) { |
|
207 | 207 | $model = $row[0]; |
208 | 208 | $modelsdb2[$model] = $row[1]; |
209 | 209 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | if (!empty($spotter_array) && is_array($spotter_array)) |
242 | 242 | { |
243 | 243 | $nblatlong = 0; |
244 | - foreach($spotter_array as $spotter_item) |
|
244 | + foreach ($spotter_array as $spotter_item) |
|
245 | 245 | { |
246 | 246 | $j++; |
247 | 247 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
284 | 284 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
285 | 285 | if ($tracker) { |
286 | - $output.= '"type": "tracker"'; |
|
286 | + $output .= '"type": "tracker"'; |
|
287 | 287 | } elseif ($marine) { |
288 | - $output.= '"type": "marine"'; |
|
288 | + $output .= '"type": "marine"'; |
|
289 | 289 | } else { |
290 | 290 | if (isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
291 | 291 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | if (isset($airline_icao)) { |
300 | 300 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
301 | 301 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
302 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
302 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
306 | + if ($ident != '') $output .= '"ident": "'.$ident.'",'; |
|
307 | 307 | } |
308 | - $output.= '"gltf2": %gltf2%,'; |
|
309 | - $output.= '"type": "flight"'; |
|
308 | + $output .= '"gltf2": %gltf2%,'; |
|
309 | + $output .= '"type": "flight"'; |
|
310 | 310 | } |
311 | 311 | $output .= '},'; |
312 | 312 | |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | $output .= '},'; |
660 | 660 | } |
661 | 661 | } |
662 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
663 | - else $output = str_replace('%onground%','false',$output); |
|
662 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
663 | + else $output = str_replace('%onground%', 'false', $output); |
|
664 | 664 | |
665 | 665 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
666 | 666 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $output .= '"cartographicDegrees": ['; |
676 | 676 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
677 | 677 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
678 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
678 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
679 | 679 | $output .= $spotter_item['longitude'].', '; |
680 | 680 | $output .= $spotter_item['latitude']; |
681 | 681 | $prevlong = $spotter_item['longitude']; |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
704 | 704 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
705 | 705 | } else { |
706 | - $nblatlong = $nblatlong+1; |
|
707 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
706 | + $nblatlong = $nblatlong + 1; |
|
707 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
708 | 708 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
709 | 709 | if ($spotter_item['ground_speed'] == 0) { |
710 | 710 | $output .= $prevlong.', '; |
@@ -744,17 +744,17 @@ discard block |
||
744 | 744 | } |
745 | 745 | $output .= ']'; |
746 | 746 | if (isset($globalArchive) && $globalArchive === TRUE) { |
747 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
748 | - if (time()-$globalLiveInterval > $maxitime) { |
|
749 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
747 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
748 | + if (time() - $globalLiveInterval > $maxitime) { |
|
749 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
750 | 750 | } else { |
751 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
751 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
752 | 752 | } |
753 | 753 | } |
754 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
755 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
756 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
757 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
758 | -else $output = str_replace('%gltf2%','false',$output); |
|
754 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
755 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
756 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
757 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
758 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
759 | 759 | print $output; |
760 | 760 | ?> |
@@ -55,24 +55,24 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
68 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
68 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
69 | 69 | |
70 | 70 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
71 | 71 | $min = true; |
72 | 72 | } else $min = false; |
73 | 73 | |
74 | 74 | if (isset($_GET['ident'])) { |
75 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
75 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
76 | 76 | if ($tracker) { |
77 | 77 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
78 | 78 | } elseif ($marine) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | $allhistory = true; |
88 | 88 | } elseif (isset($_GET['flightaware_id'])) { |
89 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
89 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
90 | 90 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
91 | 91 | if (empty($spotter_array)) { |
92 | 92 | $from_archive = true; |
@@ -94,44 +94,44 @@ discard block |
||
94 | 94 | } |
95 | 95 | $allhistory = true; |
96 | 96 | } elseif (isset($_GET['famtrack_id'])) { |
97 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
97 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
98 | 98 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
99 | 99 | $allhistory = true; |
100 | 100 | } elseif (isset($_GET['fammarine_id'])) { |
101 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
101 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
102 | 102 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
103 | 103 | $allhistory = true; |
104 | 104 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
105 | 105 | //} elseif (isset($_GET['coord'])) { |
106 | 106 | $usecoord = true; |
107 | - $coord = explode(',',$_GET['coord']); |
|
107 | + $coord = explode(',', $_GET['coord']); |
|
108 | 108 | if ($tracker) { |
109 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
109 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
110 | 110 | } elseif ($marine) { |
111 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
111 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
112 | 112 | } else { |
113 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
113 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
114 | 114 | } |
115 | 115 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
116 | 116 | $usecoord = true; |
117 | - $coord = explode(',',$_GET['coord']); |
|
117 | + $coord = explode(',', $_GET['coord']); |
|
118 | 118 | if ($tracker) { |
119 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
119 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
120 | 120 | } elseif ($marine) { |
121 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
121 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
122 | 122 | } else { |
123 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
123 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
124 | 124 | } |
125 | 125 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
126 | 126 | $from_archive = true; |
127 | 127 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | 128 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
129 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
132 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
133 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
134 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
129 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
132 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
133 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
134 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
135 | 135 | } elseif ($min) { |
136 | 136 | if ($tracker) { |
137 | 137 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | # $min = true; |
144 | 144 | } else { |
145 | 145 | if ($tracker) { |
146 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
146 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
147 | 147 | } elseif ($marine) { |
148 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
148 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
149 | 149 | } else { |
150 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
150 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | if ($usecoord) { |
155 | 155 | if (isset($_GET['archive'])) { |
156 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
156 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
157 | 157 | } else { |
158 | 158 | if ($tracker) { |
159 | 159 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | if ($flightcnt == '') $flightcnt = 0; |
167 | 167 | } else $flightcnt = 0; |
168 | 168 | |
169 | -$sqltime = round(microtime(true)-$begintime,2); |
|
169 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
170 | 170 | |
171 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
171 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
172 | 172 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
173 | 173 | |
174 | 174 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | if (!empty($spotter_array) && is_array($spotter_array)) |
188 | 188 | { |
189 | 189 | $output .= '"features": ['; |
190 | - foreach($spotter_array as $spotter_item) |
|
190 | + foreach ($spotter_array as $spotter_item) |
|
191 | 191 | { |
192 | 192 | $j++; |
193 | 193 | date_default_timezone_set('UTC'); |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | */ |
244 | 244 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
245 | 245 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
246 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
247 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
246 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
247 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
248 | 248 | //" |
249 | 249 | } else { |
250 | 250 | if ($compress) $output .= '"c": "NA",'; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
254 | 254 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
255 | 255 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
256 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
256 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
257 | 257 | } elseif (isset($spotter_item['aircraft_type'])) { |
258 | 258 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
259 | 259 | } elseif (!$min) { |
@@ -396,26 +396,26 @@ discard block |
||
396 | 396 | if ($currenttime != '') { |
397 | 397 | if (strtotime($spotter_item['date']) < $currenttime) { |
398 | 398 | if (isset($archivespeed)) { |
399 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
399 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
400 | 400 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
401 | 401 | } elseif ($usenextlatlon) { |
402 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
402 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
403 | 403 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
404 | 404 | } |
405 | 405 | } |
406 | 406 | } else { |
407 | 407 | if (isset($archivespeed)) { |
408 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
408 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
409 | 409 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
410 | 410 | } elseif ($usenextlatlon) { |
411 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
411 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
412 | 412 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | 416 | if (!$min) $output .= '"image": "'.$image.'",'; |
417 | 417 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
418 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
418 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
419 | 419 | } |
420 | 420 | if (isset($spotter_item['image_source_website'])) { |
421 | 421 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
438 | 438 | } |
439 | 439 | if (isset($spotter_item['acars'])) { |
440 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
440 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
441 | 441 | } |
442 | 442 | // type when not aircraft ? |
443 | 443 | if (isset($spotter_item['type'])) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | if ($currenttime != '') { |
458 | 458 | if (strtotime($spotter_item['date']) < $currenttime) { |
459 | 459 | if (!isset($archivespeed)) $archivespeed = 1; |
460 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])); |
|
460 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date'])); |
|
461 | 461 | $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
462 | 462 | } else { |
463 | 463 | $output .= $spotter_item['longitude'].', '; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | |
527 | 527 | } |
528 | 528 | */ |
529 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
529 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
530 | 530 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
531 | 531 | |
532 | 532 | if ( |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
535 | 535 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
536 | 536 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
537 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
537 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
538 | 538 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
539 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
539 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
540 | 540 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
541 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
541 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
542 | 542 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
543 | 543 | ) { |
544 | 544 | if ($tracker) { |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
576 | 576 | } |
577 | 577 | $output_history .= '['; |
578 | - $output_history .= $spotter_history['longitude'].', '; |
|
579 | - $output_history .= $spotter_history['latitude'].', '; |
|
580 | - $output_history .= $spotter_history['altitude']*30.48; |
|
578 | + $output_history .= $spotter_history['longitude'].', '; |
|
579 | + $output_history .= $spotter_history['latitude'].', '; |
|
580 | + $output_history .= $spotter_history['altitude']*30.48; |
|
581 | 581 | $output_history .= '],'; |
582 | 582 | /* |
583 | 583 | if ($from_archive === false) { |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
596 | 596 | } else $d = true; |
597 | 597 | $output_history .= '['; |
598 | - $output_history .= $spotter_history['longitude'].', '; |
|
599 | - $output_history .= $spotter_history['latitude']; |
|
598 | + $output_history .= $spotter_history['longitude'].', '; |
|
599 | + $output_history .= $spotter_history['latitude']; |
|
600 | 600 | $output_history .= '],'; |
601 | 601 | /* |
602 | 602 | if ($from_archive === false) { |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | |
613 | 613 | if ($from_archive === false) { |
614 | 614 | $output_historyd = '['; |
615 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
616 | - $output_historyd .= $spotter_item['latitude']; |
|
617 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
615 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
616 | + $output_historyd .= $spotter_item['latitude']; |
|
617 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
618 | 618 | $output_historyd .= '],'; |
619 | 619 | //$output_history = $output_historyd.$output_history; |
620 | 620 | $output_history = $output_history.$output_historyd; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
631 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
631 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
632 | 632 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
633 | 633 | && (isset($spotter_item['departure_airport']) |
634 | 634 | && $spotter_item['departure_airport'] != 'NA' |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
664 | 664 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
665 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
665 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
666 | 666 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
667 | 667 | && (isset($spotter_item['arrival_airport']) |
668 | 668 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $output = substr($output, 0, -1); |
694 | 694 | $output .= ']'; |
695 | 695 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
696 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
696 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
697 | 697 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
698 | 698 | $output .= '"fc": "'.$j.'"'; |
699 | 699 | } else { |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | -setcookie("MapFormat",'2d'); |
|
5 | +setcookie("MapFormat", '2d'); |
|
6 | 6 | |
7 | 7 | if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
8 | 8 | // Compressed GeoJson is used if true |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | 21 | if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
22 | 22 | else $enddate = time(); |
23 | - setcookie("archive_begin",$begindate); |
|
24 | - setcookie("archive_end",$enddate); |
|
25 | - setcookie("archive_update",$lastupd); |
|
26 | - setcookie("archive_speed",$archivespeed); |
|
23 | + setcookie("archive_begin", $begindate); |
|
24 | + setcookie("archive_end", $enddate); |
|
25 | + setcookie("archive_update", $lastupd); |
|
26 | + setcookie("archive_speed", $archivespeed); |
|
27 | 27 | ?> |
28 | 28 | document.cookie = 'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'; |
29 | 29 | document.cookie = 'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'; |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | <?php |
76 | 76 | } |
77 | 77 | if (isset($_GET['ident'])) { |
78 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
78 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
79 | 79 | } |
80 | 80 | if (isset($_GET['flightaware_id'])) { |
81 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
81 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
82 | 82 | } |
83 | 83 | if (isset($_GET['latitude'])) { |
84 | - $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING); |
|
84 | + $latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING); |
|
85 | 85 | } |
86 | 86 | if (isset($_GET['longitude'])) { |
87 | - $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING); |
|
87 | + $longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING); |
|
88 | 88 | } |
89 | 89 | ?> |
90 | 90 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } else { |
113 | 113 | if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) { |
114 | 114 | if (isset($_COOKIE['lastcentercoord'])) { |
115 | - $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
|
115 | + $lastcentercoord = explode(',', $_COOKIE['lastcentercoord']); |
|
116 | 116 | $viewcenterlatitude = $lastcentercoord[0]; |
117 | 117 | $viewcenterlongitude = $lastcentercoord[1]; |
118 | 118 | $viewzoom = $lastcentercoord[2]; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | || navigator.userAgent.match(/BlackBerry/i) |
134 | 134 | || navigator.userAgent.match(/Windows Phone/i)) |
135 | 135 | { |
136 | - var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
136 | + var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom - 1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
137 | 137 | } else { |
138 | 138 | var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>; |
139 | 139 | } |
@@ -227,19 +227,19 @@ discard block |
||
227 | 227 | map.addLayer(yandexLayer); |
228 | 228 | <?php |
229 | 229 | } elseif ($MapType == 'Bing-Aerial') { |
230 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
230 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
231 | 231 | ?> |
232 | 232 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
233 | 233 | map.addLayer(bingLayer); |
234 | 234 | <?php |
235 | 235 | } elseif ($MapType == 'Bing-Hybrid') { |
236 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
236 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
237 | 237 | ?> |
238 | 238 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
239 | 239 | map.addLayer(bingLayer); |
240 | 240 | <?php |
241 | 241 | } elseif ($MapType == 'Bing-Road') { |
242 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
242 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
243 | 243 | ?> |
244 | 244 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
245 | 245 | map.addLayer(bingLayer); |