@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | |
10 | 10 | $from_archive = false; |
11 | 11 | if (isset($_GET['ident'])) { |
12 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
13 | 13 | if (isset($_GET['currenttime'])) { |
14 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
14 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | $currenttime = round($currenttime/1000); |
16 | - $spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime); |
|
16 | + $spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime); |
|
17 | 17 | /* |
18 | 18 | if (empty($spotter_array)) { |
19 | 19 | $from_archive = true; |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | if (isset($_GET['fammarine_id'])) { |
34 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
34 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
35 | 35 | if (isset($_GET['currenttime'])) { |
36 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
36 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
37 | 37 | $currenttime = round($currenttime/1000); |
38 | - $spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime); |
|
38 | + $spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime); |
|
39 | 39 | /* |
40 | 40 | if (empty($spotter_array)) { |
41 | 41 | $from_archive = true; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
65 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
66 | 66 | } else $image = $spotter_item['image_thumbnail']; |
67 | 67 | |
68 | 68 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
6 | 6 | |
7 | -class Tracker{ |
|
7 | +class Tracker { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -18,33 +18,33 @@ discard block |
||
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | 20 | |
21 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
21 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
22 | 22 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
23 | 23 | $filters = array(); |
24 | 24 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
25 | 25 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
26 | 26 | $filters = $globalStatsFilters[$globalFilterName]; |
27 | 27 | } else { |
28 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
28 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | if (isset($filter[0]['source'])) { |
32 | - $filters = array_merge($filters,$filter); |
|
32 | + $filters = array_merge($filters, $filter); |
|
33 | 33 | } |
34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
34 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
35 | 35 | $filter_query_join = ''; |
36 | 36 | $filter_query_where = ''; |
37 | - foreach($filters as $flt) { |
|
37 | + foreach ($filters as $flt) { |
|
38 | 38 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
39 | 39 | if (isset($flt['source'])) { |
40 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
41 | 41 | } else { |
42 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
42 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | if (isset($filter['source']) && !empty($filter['source'])) { |
47 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
47 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
48 | 48 | } |
49 | 49 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
50 | 50 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
74 | 74 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
75 | 75 | if ($filter_query_where != '') { |
76 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
76 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
77 | 77 | } |
78 | 78 | $filter_query = $filter_query_join.$filter_query_where; |
79 | 79 | return $filter_query; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return Array the spotter information |
89 | 89 | * |
90 | 90 | */ |
91 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
91 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
92 | 92 | { |
93 | 93 | date_default_timezone_set('UTC'); |
94 | 94 | if (!is_string($query)) |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | $sth = $this->db->prepare($query.$limitQuery); |
109 | 109 | $sth->execute($params); |
110 | 110 | } catch (PDOException $e) { |
111 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
111 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
112 | 112 | exit(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | $num_rows = 0; |
116 | 116 | $spotter_array = array(); |
117 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
117 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
118 | 118 | { |
119 | 119 | $num_rows++; |
120 | 120 | $temp_array = array(); |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | { |
171 | 171 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
172 | 172 | } else { |
173 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
173 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
174 | 174 | } |
175 | 175 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
176 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
177 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
176 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
177 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
178 | 178 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
179 | 179 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
180 | 180 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
181 | 181 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
182 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
183 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
182 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
183 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
184 | 184 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
185 | 185 | } |
186 | 186 | } |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | { |
218 | 218 | $limit_array = explode(",", $limit); |
219 | 219 | |
220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
222 | 222 | |
223 | 223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
224 | 224 | { |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
236 | 236 | } |
237 | 237 | |
238 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
238 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
239 | 239 | |
240 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
240 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
241 | 241 | |
242 | 242 | return $spotter_array; |
243 | 243 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | if ($id == '') return array(); |
257 | 257 | $additional_query = "tracker_output.famtrackid = :id"; |
258 | 258 | $query_values = array(':id' => $id); |
259 | - $query = $global_query." WHERE ".$additional_query." "; |
|
260 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
259 | + $query = $global_query." WHERE ".$additional_query." "; |
|
260 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
261 | 261 | return $spotter_array; |
262 | 262 | } |
263 | 263 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $query_values = array(); |
277 | 277 | $limit_query = ''; |
278 | 278 | $additional_query = ''; |
279 | - $filter_query = $this->getFilter($filter,true,true); |
|
279 | + $filter_query = $this->getFilter($filter, true, true); |
|
280 | 280 | if ($ident != "") |
281 | 281 | { |
282 | 282 | if (!is_string($ident)) |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | { |
293 | 293 | $limit_array = explode(",", $limit); |
294 | 294 | |
295 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
296 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
295 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
296 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
297 | 297 | |
298 | 298 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
299 | 299 | { |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | return $spotter_array; |
318 | 318 | } |
319 | 319 | |
320 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
320 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
321 | 321 | { |
322 | 322 | global $global_query, $globalTimezone, $globalDBdriver; |
323 | 323 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $limit_query = ''; |
326 | 326 | $additional_query = ''; |
327 | 327 | |
328 | - $filter_query = $this->getFilter($filter,true,true); |
|
328 | + $filter_query = $this->getFilter($filter, true, true); |
|
329 | 329 | |
330 | 330 | if ($date != "") |
331 | 331 | { |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | { |
352 | 352 | $limit_array = explode(",", $limit); |
353 | 353 | |
354 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
355 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
354 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
355 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
356 | 356 | |
357 | 357 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
358 | 358 | { |
@@ -383,11 +383,11 @@ discard block |
||
383 | 383 | * @return Array list of source name |
384 | 384 | * |
385 | 385 | */ |
386 | - public function getAllSourceName($type = '',$filters = array()) |
|
386 | + public function getAllSourceName($type = '', $filters = array()) |
|
387 | 387 | { |
388 | - $filter_query = $this->getFilter($filters,true,true); |
|
388 | + $filter_query = $this->getFilter($filters, true, true); |
|
389 | 389 | $query_values = array(); |
390 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
390 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
391 | 391 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
392 | 392 | if ($type != '') { |
393 | 393 | $query_values = array(':type' => $type); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $source_array = array(); |
403 | 403 | $temp_array = array(); |
404 | 404 | |
405 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
405 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
406 | 406 | { |
407 | 407 | $temp_array['source_name'] = $row['source_name']; |
408 | 408 | $source_array[] = $temp_array; |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function getAllIdents($filters = array()) |
421 | 421 | { |
422 | - $filter_query = $this->getFilter($filters,true,true); |
|
423 | - $query = "SELECT DISTINCT tracker_output.ident |
|
422 | + $filter_query = $this->getFilter($filters, true, true); |
|
423 | + $query = "SELECT DISTINCT tracker_output.ident |
|
424 | 424 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
425 | 425 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
426 | 426 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $ident_array = array(); |
431 | 431 | $temp_array = array(); |
432 | 432 | |
433 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
433 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
434 | 434 | { |
435 | 435 | $temp_array['ident'] = $row['ident']; |
436 | 436 | $ident_array[] = $temp_array; |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | } else $offset = '+00:00'; |
456 | 456 | |
457 | 457 | if ($globalDBdriver == 'mysql') { |
458 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
458 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
459 | 459 | FROM tracker_output |
460 | 460 | WHERE tracker_output.date <> '' |
461 | 461 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
462 | 462 | } else { |
463 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
463 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
464 | 464 | FROM tracker_output |
465 | 465 | WHERE tracker_output.date <> '' |
466 | 466 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $date_array = array(); |
473 | 473 | $temp_array = array(); |
474 | 474 | |
475 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
475 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
476 | 476 | { |
477 | 477 | $temp_array['date'] = $row['date']; |
478 | 478 | |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | * @return String success or false |
492 | 492 | * |
493 | 493 | */ |
494 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
494 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
495 | 495 | { |
496 | 496 | |
497 | 497 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
498 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
498 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
499 | 499 | |
500 | 500 | try { |
501 | 501 | $sth = $this->db->prepare($query); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
520 | 520 | { |
521 | 521 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
522 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
522 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
523 | 523 | |
524 | 524 | try { |
525 | 525 | $sth = $this->db->prepare($query); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * @param String $verticalrate vertival rate of flight |
560 | 560 | * @return String success or false |
561 | 561 | */ |
562 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
562 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
563 | 563 | { |
564 | 564 | global $globalURL; |
565 | 565 | |
@@ -627,21 +627,21 @@ discard block |
||
627 | 627 | } |
628 | 628 | |
629 | 629 | |
630 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
630 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
631 | 631 | { |
632 | 632 | $date = date("Y-m-d H:i:s", time()); |
633 | 633 | } |
634 | 634 | |
635 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
636 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
637 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
638 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
639 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
640 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
641 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
642 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
643 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
644 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
635 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
636 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
637 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
638 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
639 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
640 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
641 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
642 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
643 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
644 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
645 | 645 | |
646 | 646 | if ($latitude == '' && $longitude == '') { |
647 | 647 | $latitude = 0; |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | } |
650 | 650 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
651 | 651 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
652 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
652 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
653 | 653 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
654 | 654 | |
655 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
655 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
656 | 656 | |
657 | 657 | try { |
658 | 658 | |
@@ -678,13 +678,13 @@ discard block |
||
678 | 678 | { |
679 | 679 | global $globalDBdriver, $globalTimezone; |
680 | 680 | if ($globalDBdriver == 'mysql') { |
681 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
681 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
682 | 682 | WHERE tracker_output.ident = :ident |
683 | 683 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
684 | 684 | AND tracker_output.date < UTC_TIMESTAMP()"; |
685 | 685 | $query_data = array(':ident' => $ident); |
686 | 686 | } else { |
687 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
687 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
688 | 688 | WHERE tracker_output.ident = :ident |
689 | 689 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
690 | 690 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | |
694 | 694 | $sth = $this->db->prepare($query); |
695 | 695 | $sth->execute($query_data); |
696 | - $ident_result=''; |
|
697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
696 | + $ident_result = ''; |
|
697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
698 | 698 | { |
699 | 699 | $ident_result = $row['ident']; |
700 | 700 | } |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | return false; |
721 | 721 | } else { |
722 | 722 | $q_array = explode(" ", $q); |
723 | - foreach ($q_array as $q_item){ |
|
724 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
723 | + foreach ($q_array as $q_item) { |
|
724 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
725 | 725 | $additional_query .= " AND ("; |
726 | 726 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
727 | 727 | $additional_query .= ")"; |
@@ -729,11 +729,11 @@ discard block |
||
729 | 729 | } |
730 | 730 | } |
731 | 731 | if ($globalDBdriver == 'mysql') { |
732 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
732 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
733 | 733 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
734 | 734 | AND tracker_output.date < UTC_TIMESTAMP()"; |
735 | 735 | } else { |
736 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
736 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
737 | 737 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
738 | 738 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
739 | 739 | } |
@@ -806,11 +806,11 @@ discard block |
||
806 | 806 | * @return Array the callsign list |
807 | 807 | * |
808 | 808 | */ |
809 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
809 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
810 | 810 | { |
811 | 811 | global $globalDBdriver; |
812 | - $filter_query = $this->getFilter($filters,true,true); |
|
813 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
812 | + $filter_query = $this->getFilter($filters, true, true); |
|
813 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
814 | 814 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
815 | 815 | if ($olderthanmonths > 0) { |
816 | 816 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -824,28 +824,28 @@ discard block |
||
824 | 824 | if ($year != '') { |
825 | 825 | if ($globalDBdriver == 'mysql') { |
826 | 826 | $query .= " AND YEAR(tracker_output.date) = :year"; |
827 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
827 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
828 | 828 | } else { |
829 | 829 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
830 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
830 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | if ($month != '') { |
834 | 834 | if ($globalDBdriver == 'mysql') { |
835 | 835 | $query .= " AND MONTH(tracker_output.date) = :month"; |
836 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
836 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
837 | 837 | } else { |
838 | 838 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
839 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
839 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | if ($day != '') { |
843 | 843 | if ($globalDBdriver == 'mysql') { |
844 | 844 | $query .= " AND DAY(tracker_output.date) = :day"; |
845 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
845 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
846 | 846 | } else { |
847 | 847 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
848 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
848 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | $callsign_array = array(); |
858 | 858 | $temp_array = array(); |
859 | 859 | |
860 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
860 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
861 | 861 | { |
862 | 862 | $temp_array['callsign_icao'] = $row['ident']; |
863 | 863 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | $date_array = array(); |
910 | 910 | $temp_array = array(); |
911 | 911 | |
912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
913 | 913 | { |
914 | 914 | $temp_array['date_name'] = $row['date_name']; |
915 | 915 | $temp_array['date_count'] = $row['date_count']; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | $datetime = new DateTime(); |
936 | 936 | $offset = $datetime->format('P'); |
937 | 937 | } else $offset = '+00:00'; |
938 | - $filter_query = $this->getFilter($filters,true,true); |
|
938 | + $filter_query = $this->getFilter($filters, true, true); |
|
939 | 939 | if ($globalDBdriver == 'mysql') { |
940 | 940 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
941 | 941 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | $date_array = array(); |
957 | 957 | $temp_array = array(); |
958 | 958 | |
959 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
959 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
960 | 960 | { |
961 | 961 | $temp_array['date_name'] = $row['date_name']; |
962 | 962 | $temp_array['date_count'] = $row['date_count']; |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | $datetime = new DateTime(); |
982 | 982 | $offset = $datetime->format('P'); |
983 | 983 | } else $offset = '+00:00'; |
984 | - $filter_query = $this->getFilter($filters,true,true); |
|
984 | + $filter_query = $this->getFilter($filters, true, true); |
|
985 | 985 | if ($globalDBdriver == 'mysql') { |
986 | 986 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
987 | 987 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | $date_array = array(); |
1003 | 1003 | $temp_array = array(); |
1004 | 1004 | |
1005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1006 | 1006 | { |
1007 | 1007 | $temp_array['date_name'] = $row['date_name']; |
1008 | 1008 | $temp_array['date_count'] = $row['date_count']; |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | $date_array = array(); |
1050 | 1050 | $temp_array = array(); |
1051 | 1051 | |
1052 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1052 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1053 | 1053 | { |
1054 | 1054 | $temp_array['month_name'] = $row['month_name']; |
1055 | 1055 | $temp_array['year_name'] = $row['year_name']; |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | $datetime = new DateTime(); |
1079 | 1079 | $offset = $datetime->format('P'); |
1080 | 1080 | } else $offset = '+00:00'; |
1081 | - $filter_query = $this->getFilter($filters,true,true); |
|
1081 | + $filter_query = $this->getFilter($filters, true, true); |
|
1082 | 1082 | if ($globalDBdriver == 'mysql') { |
1083 | 1083 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1084 | 1084 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $date_array = array(); |
1100 | 1100 | $temp_array = array(); |
1101 | 1101 | |
1102 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1102 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1103 | 1103 | { |
1104 | 1104 | $temp_array['year_name'] = $row['year_name']; |
1105 | 1105 | $temp_array['month_name'] = $row['month_name']; |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | * @return Array the hour list |
1120 | 1120 | * |
1121 | 1121 | */ |
1122 | - public function countAllHours($orderby,$filters = array()) |
|
1122 | + public function countAllHours($orderby, $filters = array()) |
|
1123 | 1123 | { |
1124 | 1124 | global $globalTimezone, $globalDBdriver; |
1125 | 1125 | if ($globalTimezone != '') { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | $hour_array = array(); |
1168 | 1168 | $temp_array = array(); |
1169 | 1169 | |
1170 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1170 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1171 | 1171 | { |
1172 | 1172 | $temp_array['hour_name'] = $row['hour_name']; |
1173 | 1173 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1189,8 +1189,8 @@ discard block |
||
1189 | 1189 | public function countAllHoursByDate($date, $filters = array()) |
1190 | 1190 | { |
1191 | 1191 | global $globalTimezone, $globalDBdriver; |
1192 | - $filter_query = $this->getFilter($filters,true,true); |
|
1193 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1192 | + $filter_query = $this->getFilter($filters, true, true); |
|
1193 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1194 | 1194 | if ($globalTimezone != '') { |
1195 | 1195 | date_default_timezone_set($globalTimezone); |
1196 | 1196 | $datetime = new DateTime($date); |
@@ -1198,12 +1198,12 @@ discard block |
||
1198 | 1198 | } else $offset = '+00:00'; |
1199 | 1199 | |
1200 | 1200 | if ($globalDBdriver == 'mysql') { |
1201 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1201 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1202 | 1202 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
1203 | 1203 | GROUP BY hour_name |
1204 | 1204 | ORDER BY hour_name ASC"; |
1205 | 1205 | } else { |
1206 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1206 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1207 | 1207 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1208 | 1208 | GROUP BY hour_name |
1209 | 1209 | ORDER BY hour_name ASC"; |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | $hour_array = array(); |
1216 | 1216 | $temp_array = array(); |
1217 | 1217 | |
1218 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1218 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1219 | 1219 | { |
1220 | 1220 | $temp_array['hour_name'] = $row['hour_name']; |
1221 | 1221 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1237,8 +1237,8 @@ discard block |
||
1237 | 1237 | public function countAllHoursByIdent($ident, $filters = array()) |
1238 | 1238 | { |
1239 | 1239 | global $globalTimezone, $globalDBdriver; |
1240 | - $filter_query = $this->getFilter($filters,true,true); |
|
1241 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1240 | + $filter_query = $this->getFilter($filters, true, true); |
|
1241 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1242 | 1242 | if ($globalTimezone != '') { |
1243 | 1243 | date_default_timezone_set($globalTimezone); |
1244 | 1244 | $datetime = new DateTime(); |
@@ -1246,12 +1246,12 @@ discard block |
||
1246 | 1246 | } else $offset = '+00:00'; |
1247 | 1247 | |
1248 | 1248 | if ($globalDBdriver == 'mysql') { |
1249 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1249 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1250 | 1250 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1251 | 1251 | GROUP BY hour_name |
1252 | 1252 | ORDER BY hour_name ASC"; |
1253 | 1253 | } else { |
1254 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1254 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1255 | 1255 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1256 | 1256 | GROUP BY hour_name |
1257 | 1257 | ORDER BY hour_name ASC"; |
@@ -1259,12 +1259,12 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | |
1261 | 1261 | $sth = $this->db->prepare($query); |
1262 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1262 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1263 | 1263 | |
1264 | 1264 | $hour_array = array(); |
1265 | 1265 | $temp_array = array(); |
1266 | 1266 | |
1267 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1267 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1268 | 1268 | { |
1269 | 1269 | $temp_array['hour_name'] = $row['hour_name']; |
1270 | 1270 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1283,32 +1283,32 @@ discard block |
||
1283 | 1283 | * @return Integer the number of flights |
1284 | 1284 | * |
1285 | 1285 | */ |
1286 | - public function countOverallTracked($filters = array(),$year = '',$month = '') |
|
1286 | + public function countOverallTracked($filters = array(), $year = '', $month = '') |
|
1287 | 1287 | { |
1288 | 1288 | global $globalDBdriver; |
1289 | - $queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
|
1289 | + $queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
|
1290 | 1290 | $query_values = array(); |
1291 | 1291 | $query = ''; |
1292 | 1292 | if ($year != '') { |
1293 | 1293 | if ($globalDBdriver == 'mysql') { |
1294 | 1294 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1295 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1295 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1296 | 1296 | } else { |
1297 | 1297 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1298 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1298 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1299 | 1299 | } |
1300 | 1300 | } |
1301 | 1301 | if ($month != '') { |
1302 | 1302 | if ($globalDBdriver == 'mysql') { |
1303 | 1303 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1304 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1304 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1305 | 1305 | } else { |
1306 | 1306 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1307 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1307 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1308 | 1308 | } |
1309 | 1309 | } |
1310 | 1310 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1311 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1311 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1312 | 1312 | |
1313 | 1313 | $sth = $this->db->prepare($queryi); |
1314 | 1314 | $sth->execute($query_values); |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | public function countAllHoursFromToday($filters = array()) |
1326 | 1326 | { |
1327 | 1327 | global $globalTimezone, $globalDBdriver; |
1328 | - $filter_query = $this->getFilter($filters,true,true); |
|
1328 | + $filter_query = $this->getFilter($filters, true, true); |
|
1329 | 1329 | if ($globalTimezone != '') { |
1330 | 1330 | date_default_timezone_set($globalTimezone); |
1331 | 1331 | $datetime = new DateTime(); |
@@ -1333,12 +1333,12 @@ discard block |
||
1333 | 1333 | } else $offset = '+00:00'; |
1334 | 1334 | |
1335 | 1335 | if ($globalDBdriver == 'mysql') { |
1336 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1336 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1337 | 1337 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
1338 | 1338 | GROUP BY hour_name |
1339 | 1339 | ORDER BY hour_name ASC"; |
1340 | 1340 | } else { |
1341 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1341 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1342 | 1342 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1343 | 1343 | GROUP BY hour_name |
1344 | 1344 | ORDER BY hour_name ASC"; |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | $hour_array = array(); |
1351 | 1351 | $temp_array = array(); |
1352 | 1352 | |
1353 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1353 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1354 | 1354 | { |
1355 | 1355 | $temp_array['hour_name'] = $row['hour_name']; |
1356 | 1356 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1369,9 +1369,9 @@ discard block |
||
1369 | 1369 | */ |
1370 | 1370 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
1371 | 1371 | { |
1372 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
1372 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
1373 | 1373 | |
1374 | - $query = "SELECT tracker_output.tracker_id |
|
1374 | + $query = "SELECT tracker_output.tracker_id |
|
1375 | 1375 | FROM tracker_output |
1376 | 1376 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
1377 | 1377 | |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | $sth = $this->db->prepare($query); |
1380 | 1380 | $sth->execute(); |
1381 | 1381 | |
1382 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1382 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1383 | 1383 | { |
1384 | 1384 | return $row['tracker_id']; |
1385 | 1385 | } |
@@ -1404,23 +1404,23 @@ discard block |
||
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | $current_date = date("Y-m-d H:i:s"); |
1407 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1407 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1408 | 1408 | |
1409 | 1409 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1410 | 1410 | |
1411 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1411 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1412 | 1412 | $years = $time_array['years']; |
1413 | 1413 | |
1414 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1414 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1415 | 1415 | $months = $time_array['months']; |
1416 | 1416 | |
1417 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1417 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1418 | 1418 | $days = $time_array['days']; |
1419 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1419 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1420 | 1420 | $hours = $time_array['hours']; |
1421 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1421 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1422 | 1422 | $minutes = $time_array['minutes']; |
1423 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1423 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1424 | 1424 | |
1425 | 1425 | return $time_array; |
1426 | 1426 | } |
@@ -1443,63 +1443,63 @@ discard block |
||
1443 | 1443 | $temp_array['direction_degree'] = $direction; |
1444 | 1444 | $temp_array['direction_shortname'] = "N"; |
1445 | 1445 | $temp_array['direction_fullname'] = "North"; |
1446 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1446 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1447 | 1447 | $temp_array['direction_degree'] = $direction; |
1448 | 1448 | $temp_array['direction_shortname'] = "NNE"; |
1449 | 1449 | $temp_array['direction_fullname'] = "North-Northeast"; |
1450 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1450 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1451 | 1451 | $temp_array['direction_degree'] = $direction; |
1452 | 1452 | $temp_array['direction_shortname'] = "NE"; |
1453 | 1453 | $temp_array['direction_fullname'] = "Northeast"; |
1454 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1454 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1455 | 1455 | $temp_array['direction_degree'] = $direction; |
1456 | 1456 | $temp_array['direction_shortname'] = "ENE"; |
1457 | 1457 | $temp_array['direction_fullname'] = "East-Northeast"; |
1458 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1458 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1459 | 1459 | $temp_array['direction_degree'] = $direction; |
1460 | 1460 | $temp_array['direction_shortname'] = "E"; |
1461 | 1461 | $temp_array['direction_fullname'] = "East"; |
1462 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1462 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1463 | 1463 | $temp_array['direction_degree'] = $direction; |
1464 | 1464 | $temp_array['direction_shortname'] = "ESE"; |
1465 | 1465 | $temp_array['direction_fullname'] = "East-Southeast"; |
1466 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1466 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1467 | 1467 | $temp_array['direction_degree'] = $direction; |
1468 | 1468 | $temp_array['direction_shortname'] = "SE"; |
1469 | 1469 | $temp_array['direction_fullname'] = "Southeast"; |
1470 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1470 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1471 | 1471 | $temp_array['direction_degree'] = $direction; |
1472 | 1472 | $temp_array['direction_shortname'] = "SSE"; |
1473 | 1473 | $temp_array['direction_fullname'] = "South-Southeast"; |
1474 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1474 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1475 | 1475 | $temp_array['direction_degree'] = $direction; |
1476 | 1476 | $temp_array['direction_shortname'] = "S"; |
1477 | 1477 | $temp_array['direction_fullname'] = "South"; |
1478 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1478 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1479 | 1479 | $temp_array['direction_degree'] = $direction; |
1480 | 1480 | $temp_array['direction_shortname'] = "SSW"; |
1481 | 1481 | $temp_array['direction_fullname'] = "South-Southwest"; |
1482 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1482 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1483 | 1483 | $temp_array['direction_degree'] = $direction; |
1484 | 1484 | $temp_array['direction_shortname'] = "SW"; |
1485 | 1485 | $temp_array['direction_fullname'] = "Southwest"; |
1486 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1486 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1487 | 1487 | $temp_array['direction_degree'] = $direction; |
1488 | 1488 | $temp_array['direction_shortname'] = "WSW"; |
1489 | 1489 | $temp_array['direction_fullname'] = "West-Southwest"; |
1490 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1490 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1491 | 1491 | $temp_array['direction_degree'] = $direction; |
1492 | 1492 | $temp_array['direction_shortname'] = "W"; |
1493 | 1493 | $temp_array['direction_fullname'] = "West"; |
1494 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1494 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1495 | 1495 | $temp_array['direction_degree'] = $direction; |
1496 | 1496 | $temp_array['direction_shortname'] = "WNW"; |
1497 | 1497 | $temp_array['direction_fullname'] = "West-Northwest"; |
1498 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1498 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1499 | 1499 | $temp_array['direction_degree'] = $direction; |
1500 | 1500 | $temp_array['direction_shortname'] = "NW"; |
1501 | 1501 | $temp_array['direction_fullname'] = "Northwest"; |
1502 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1502 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1503 | 1503 | $temp_array['direction_degree'] = $direction; |
1504 | 1504 | $temp_array['direction_shortname'] = "NNW"; |
1505 | 1505 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1516,11 +1516,11 @@ discard block |
||
1516 | 1516 | * @param Float $longitude longitute of the flight |
1517 | 1517 | * @return String the countrie |
1518 | 1518 | */ |
1519 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1519 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1520 | 1520 | { |
1521 | 1521 | global $globalDBdriver, $globalDebug; |
1522 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1523 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1522 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1523 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1524 | 1524 | |
1525 | 1525 | $Connection = new Connection($this->db); |
1526 | 1526 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1560,7 +1560,7 @@ discard block |
||
1560 | 1560 | public function getCountryFromISO2($iso2) |
1561 | 1561 | { |
1562 | 1562 | global $globalDBdriver, $globalDebug; |
1563 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1563 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1564 | 1564 | |
1565 | 1565 | $Connection = new Connection($this->db); |
1566 | 1566 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | |
1609 | 1609 | $bitly_data = json_decode($bitly_data); |
1610 | 1610 | $bitly_url = ''; |
1611 | - if ($bitly_data->status_txt = "OK"){ |
|
1611 | + if ($bitly_data->status_txt = "OK") { |
|
1612 | 1612 | $bitly_url = $bitly_data->data->url; |
1613 | 1613 | } |
1614 | 1614 | |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | |
1619 | 1619 | public function getOrderBy() |
1620 | 1620 | { |
1621 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_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")); |
|
1621 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_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")); |
|
1622 | 1622 | |
1623 | 1623 | return $orderby; |
1624 | 1624 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | |
10 | 10 | $from_archive = false; |
11 | 11 | if (isset($_GET['ident'])) { |
12 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
13 | 13 | if (isset($_GET['currenttime'])) { |
14 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
14 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | $currenttime = round($currenttime/1000); |
16 | - $spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident,$currenttime); |
|
16 | + $spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident, $currenttime); |
|
17 | 17 | /* |
18 | 18 | if (empty($spotter_array)) { |
19 | 19 | $from_archive = true; |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | if (isset($_GET['famtrackid'])) { |
34 | - $famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING); |
|
34 | + $famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING); |
|
35 | 35 | if (isset($_GET['currenttime'])) { |
36 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
36 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
37 | 37 | $currenttime = round($currenttime/1000); |
38 | - $spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid,$currenttime); |
|
38 | + $spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid, $currenttime); |
|
39 | 39 | /* |
40 | 40 | if (empty($spotter_array)) { |
41 | 41 | $from_archive = true; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
65 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
66 | 66 | } else $image = $spotter_item['image_thumbnail']; |
67 | 67 | |
68 | 68 | } |
@@ -131,5 +131,5 @@ |
||
131 | 131 | } else { |
132 | 132 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
133 | 133 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
134 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
134 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
135 | 135 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
3 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
3 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
4 | 4 | if ($date == '') $date = date('Y-m-d'); |
5 | 5 | header('Location: '.$globalURL.'/date/'.$date); |
6 | 6 | ?> |
7 | 7 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
3 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
3 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
4 | 4 | if ($date == '') $date = date('Y-m-d'); |
5 | 5 | header('Location: '.$globalURL.'/accident/'.$date); |
6 | 6 | ?> |
7 | 7 | \ No newline at end of file |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
21 | 21 | $year_data = ''; |
22 | 22 | $year_cnt = ''; |
23 | -foreach($date_array as $year_item) |
|
23 | +foreach ($date_array as $year_item) |
|
24 | 24 | { |
25 | 25 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
26 | 26 | $year_cnt .= $year_item['count'].','; |
27 | 27 | } |
28 | 28 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
29 | -$year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
29 | +$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
30 | 30 | print 'c3.generate({ |
31 | 31 | bindto: "#chart", |
32 | 32 | data: { x: "x", |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | |
37 | 37 | if (!empty($date_array)) |
38 | 38 | { |
39 | - foreach($date_array as $key => $row) { |
|
39 | + foreach ($date_array as $key => $row) { |
|
40 | 40 | $years[$key] = $row['year']; |
41 | 41 | $months[$key] = $row['month']; |
42 | 42 | $counts[$key] = $row['count']; |
43 | 43 | } |
44 | 44 | // array_multisort($years,SORT_DESC,$months,SORT_DESC,$date_array); |
45 | - array_multisort($counts,SORT_DESC,$date_array); |
|
45 | + array_multisort($counts, SORT_DESC, $date_array); |
|
46 | 46 | print '<div class="table-responsive">'; |
47 | 47 | print '<table class="common-date table-striped">'; |
48 | 48 | print '<thead>'; |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | print '</thead>'; |
53 | 53 | print '<tbody>'; |
54 | 54 | $i = 1; |
55 | - foreach($date_array as $date_item) |
|
55 | + foreach ($date_array as $date_item) |
|
56 | 56 | { |
57 | 57 | print '<tr>'; |
58 | 58 | print '<td><strong>'.$i.'</strong></td>'; |
59 | 59 | print '<td>'; |
60 | 60 | if ($date_item['month'] < 10) $month = '0'.$date_item['month']; |
61 | 61 | else $month = $date_item['month']; |
62 | - print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
|
62 | + print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
|
63 | 63 | print '</td>'; |
64 | 64 | print '<td>'; |
65 | 65 | print $date_item['count']; |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | -setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
13 | +setcookie('stats_airline_icao', $airline_icao, time() + 60*60*24, '/'); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | require_once('header.php'); |
17 | 17 | include('statistics-sub-menu.php'); |
18 | 18 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | </div> |
23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common pilot.").'</p>'; |
24 | 24 | |
25 | -$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
25 | +$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
26 | 26 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
27 | 27 | $pilot_data = ''; |
28 | -foreach($pilot_array as $pilot_item) |
|
28 | +foreach ($pilot_array as $pilot_item) |
|
29 | 29 | { |
30 | 30 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
31 | 31 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | print '</thead>'; |
51 | 51 | print '<tbody>'; |
52 | 52 | $i = 1; |
53 | - foreach($pilot_array as $pilot_item) |
|
53 | + foreach ($pilot_array as $pilot_item) |
|
54 | 54 | { |
55 | 55 | print '<tr>'; |
56 | 56 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | |
16 | 16 | require_once('header.php'); |
17 | 17 | include('statistics-sub-menu.php'); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | <p>'._("Below are the <strong>Top 10</strong> most common arrival airports.").'</p>'; |
26 | 26 | print '<div id="chartAirport" class="chart" width="100%"></div>'; |
27 | 27 | print '<script>'; |
28 | -$airport_airport_array = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
28 | +$airport_airport_array = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
29 | 29 | |
30 | 30 | print 'var series = ['; |
31 | 31 | $airport_data = ''; |
32 | -foreach($airport_airport_array as $airport_item) |
|
32 | +foreach ($airport_airport_array as $airport_item) |
|
33 | 33 | { |
34 | 34 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
35 | 35 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | print '</thead>'; |
84 | 84 | print '<tbody>'; |
85 | 85 | $i = 1; |
86 | -foreach($airport_airport_array as $airport_item) |
|
86 | +foreach ($airport_airport_array as $airport_item) |
|
87 | 87 | { |
88 | 88 | print '<tr>'; |
89 | 89 | print '<td><strong>'.$i.'</strong></td>'; |