Completed
Push — master ( a56c2a...1b7f0d )
by Yannick
47:35 queued 17:33
created
statistics-country.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 } else {
20 20
 	$title = _("Statistics").' - '._("Most common Country a flight was over");
21 21
 }
22
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
22
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
23 23
 if ($airline_icao == '' && isset($globalFilter)) {
24 24
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 25
 }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 if ($type == 'aircraft') {
51
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name);
51
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name);
52 52
 } elseif ($type == 'marine') {
53 53
 	$flightover_array = $Marine->countAllMarineOverCountries();
54 54
 } elseif ($type == 'tracker') {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 print '<div id="chart" class="chart" width="100%"></div><script>';
63 63
 print 'var series = [';
64 64
 $flightover_data = '';
65
-foreach($flightover_array as $flightover_item)
65
+foreach ($flightover_array as $flightover_item)
66 66
 {
67 67
 	if ($type == 'aircraft') $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
68 68
 	elseif ($type == 'marine') $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	print '</thead>';
114 114
 	print '<tbody>';
115 115
 	$i = 1;
116
-	array_splice($flightover_array,10);
117
-	foreach($flightover_array as $flightover_item)
116
+	array_splice($flightover_array, 10);
117
+	foreach ($flightover_array as $flightover_item)
118 118
 	{
119 119
 		print '<tr>';
120 120
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Stats = new Stats();
6 6
 
7
-if (!isset($filter_name)) $filter_name = '';
7
+if (!isset($filter_name)) {
8
+	$filter_name = '';
9
+}
8 10
 $type = 'aircraft';
9 11
 if (isset($_GET['marine'])) {
10 12
 	$type = 'marine';
@@ -21,8 +23,10 @@  discard block
 block discarded – undo
21 23
 }
22 24
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
23 25
 if ($airline_icao == '' && isset($globalFilter)) {
24
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25
-}
26
+    if (isset($globalFilter['airline'])) {
27
+    	$airline_icao = $globalFilter['airline'][0];
28
+    }
29
+    }
26 30
 
27 31
 require_once('header.php');
28 32
 include('statistics-sub-menu.php'); 
@@ -64,10 +68,14 @@  discard block
 block discarded – undo
64 68
 $flightover_data = '';
65 69
 foreach($flightover_array as $flightover_item)
66 70
 {
67
-	if ($type == 'aircraft') $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
68
-	elseif ($type == 'marine') $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
69
-	elseif ($type == 'tracker') $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
70
-}
71
+	if ($type == 'aircraft') {
72
+		$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
73
+	} elseif ($type == 'marine') {
74
+		$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
75
+	} elseif ($type == 'tracker') {
76
+		$flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
77
+	}
78
+	}
71 79
 $flightover_data = substr($flightover_data, 0, -1);
72 80
 print $flightover_data;
73 81
 print '];';
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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) {
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
 	* @return Array the SQL part
20 20
 	*/
21 21
 	
22
-	public function getFilter($filter = array(),$where = false,$and = false) {
22
+	public function getFilter($filter = array(), $where = false, $and = false) {
23 23
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
24 24
 		$filters = array();
25 25
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
26 26
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
27 27
 				$filters = $globalStatsFilters[$globalFilterName];
28 28
 			} else {
29
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
29
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
30 30
 			}
31 31
 		}
32 32
 		if (isset($filter[0]['source'])) {
33
-			$filters = array_merge($filters,$filter);
33
+			$filters = array_merge($filters, $filter);
34 34
 		}
35
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
36 36
 		$filter_query_join = '';
37 37
 		$filter_query_where = '';
38
-		foreach($filters as $flt) {
38
+		foreach ($filters as $flt) {
39 39
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
40 40
 				if (isset($flt['source'])) {
41
-					$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
+					$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";
42 42
 				} else {
43
-					$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
+					$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";
44 44
 				}
45 45
 			}
46 46
 		}
47 47
 		if (isset($filter['source']) && !empty($filter['source'])) {
48
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
48
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
49 49
 		}
50 50
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
51 51
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75 75
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76 76
 		if ($filter_query_where != '') {
77
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
77
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
78 78
 		}
79 79
 		$filter_query = $filter_query_join.$filter_query_where;
80 80
 		return $filter_query;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	* @return Array the spotter information
90 90
 	*
91 91
 	*/
92
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
93 93
 	{
94 94
 		date_default_timezone_set('UTC');
95 95
 		if (!is_string($query))
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 			$sth = $this->db->prepare($query.$limitQuery);
110 110
 			$sth->execute($params);
111 111
 		} catch (PDOException $e) {
112
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
112
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
113 113
 			exit();
114 114
 		}
115 115
 		
116 116
 		$num_rows = 0;
117 117
 		$spotter_array = array();
118
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
118
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
119 119
 		{
120 120
 			$num_rows++;
121 121
 			$temp_array = array();
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 				{
172 172
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
173 173
 				} else {
174
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
174
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
175 175
 				}
176 176
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
177
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
178
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
177
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
178
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
179 179
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
180 180
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
181 181
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
182 182
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
183
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
184
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
183
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
184
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
185 185
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
186 186
 					}
187 187
 				}
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 		{
219 219
 			$limit_array = explode(",", $limit);
220 220
 			
221
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
222
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
221
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
222
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
223 223
 			
224 224
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
225 225
 			{
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 			$orderby_query = " ORDER BY tracker_output.date DESC";
237 237
 		}
238 238
 
239
-		$query  = $global_query.$filter_query." ".$orderby_query;
239
+		$query = $global_query.$filter_query." ".$orderby_query;
240 240
 
241
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
241
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
242 242
 
243 243
 		return $spotter_array;
244 244
 	}
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		if ($id == '') return array();
258 258
 		$additional_query = "tracker_output.famtrackid = :id";
259 259
 		$query_values = array(':id' => $id);
260
-		$query  = $global_query." WHERE ".$additional_query." ";
261
-		$spotter_array = $this->getDataFromDB($query,$query_values);
260
+		$query = $global_query." WHERE ".$additional_query." ";
261
+		$spotter_array = $this->getDataFromDB($query, $query_values);
262 262
 		return $spotter_array;
263 263
 	}
264 264
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		$query_values = array();
278 278
 		$limit_query = '';
279 279
 		$additional_query = '';
280
-		$filter_query = $this->getFilter($filter,true,true);
280
+		$filter_query = $this->getFilter($filter, true, true);
281 281
 		if ($ident != "")
282 282
 		{
283 283
 			if (!is_string($ident))
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 		{
294 294
 			$limit_array = explode(",", $limit);
295 295
 			
296
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
297
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
296
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
297
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
298 298
 			
299 299
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
300 300
 			{
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		return $spotter_array;
319 319
 	}
320 320
 	
321
-	public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array())
321
+	public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array())
322 322
 	{
323 323
 		global $global_query, $globalTimezone, $globalDBdriver;
324 324
 		
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		$limit_query = '';
327 327
 		$additional_query = '';
328 328
 
329
-		$filter_query = $this->getFilter($filter,true,true);
329
+		$filter_query = $this->getFilter($filter, true, true);
330 330
 		
331 331
 		if ($date != "")
332 332
 		{
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 		{
353 353
 			$limit_array = explode(",", $limit);
354 354
 			
355
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
356
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
355
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
356
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
357 357
 			
358 358
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
359 359
 			{
@@ -384,11 +384,11 @@  discard block
 block discarded – undo
384 384
 	* @return Array list of source name
385 385
 	*
386 386
 	*/
387
-	public function getAllSourceName($type = '',$filters = array())
387
+	public function getAllSourceName($type = '', $filters = array())
388 388
 	{
389
-		$filter_query = $this->getFilter($filters,true,true);
389
+		$filter_query = $this->getFilter($filters, true, true);
390 390
 		$query_values = array();
391
-		$query  = "SELECT DISTINCT tracker_output.source_name 
391
+		$query = "SELECT DISTINCT tracker_output.source_name 
392 392
 				FROM tracker_output".$filter_query." tracker_output.source_name <> ''";
393 393
 		if ($type != '') {
394 394
 			$query_values = array(':type' => $type);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$source_array = array();
404 404
 		$temp_array = array();
405 405
 		
406
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
406
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
407 407
 		{
408 408
 			$temp_array['source_name'] = $row['source_name'];
409 409
 			$source_array[] = $temp_array;
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	*/
421 421
 	public function getAllIdents($filters = array())
422 422
 	{
423
-		$filter_query = $this->getFilter($filters,true,true);
424
-		$query  = "SELECT DISTINCT tracker_output.ident
423
+		$filter_query = $this->getFilter($filters, true, true);
424
+		$query = "SELECT DISTINCT tracker_output.ident
425 425
 								FROM tracker_output".$filter_query." tracker_output.ident <> '' 
426 426
 								ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0";
427 427
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$ident_array = array();
432 432
 		$temp_array = array();
433 433
 		
434
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
434
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
435 435
 		{
436 436
 			$temp_array['ident'] = $row['ident'];
437 437
 			$ident_array[] = $temp_array;
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
 		} else $offset = '+00:00';
457 457
 
458 458
 		if ($globalDBdriver == 'mysql') {
459
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
459
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
460 460
 								FROM tracker_output
461 461
 								WHERE tracker_output.date <> '' 
462 462
 								ORDER BY tracker_output.date ASC LIMIT 0,100";
463 463
 		} else {
464
-			$query  = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
464
+			$query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
465 465
 								FROM tracker_output
466 466
 								WHERE tracker_output.date <> '' 
467 467
 								ORDER BY tracker_output.date ASC LIMIT 0,100";
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 		$date_array = array();
474 474
 		$temp_array = array();
475 475
 		
476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
477 477
 		{
478 478
 			$temp_array['date'] = $row['date'];
479 479
 
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	* @return String success or false
493 493
 	*
494 494
 	*/	
495
-	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495
+	public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL)
496 496
 	{
497 497
 
498 498
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
499
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident);
500 500
 
501 501
 		try {
502 502
 			$sth = $this->db->prepare($query);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
521 521
 	{
522 522
 		$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';
523
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523
+                $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident);
524 524
 
525 525
 		try {
526 526
 			$sth = $this->db->prepare($query);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	* @param String $verticalrate vertival rate of flight
561 561
 	* @return String success or false
562 562
 	*/
563
-	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563
+	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '')
564 564
 	{
565 565
 		global $globalURL;
566 566
 		
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
 		}
629 629
 
630 630
     
631
-		if ($date == "" || strtotime($date) < time()-20*60)
631
+		if ($date == "" || strtotime($date) < time() - 20*60)
632 632
 		{
633 633
 			$date = date("Y-m-d H:i:s", time());
634 634
 		}
635 635
 
636
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
637
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
638
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
639
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
640
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
641
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
642
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
643
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
644
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
645
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
636
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
637
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
638
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
639
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
640
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
641
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
642
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
643
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
644
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
645
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
646 646
 	
647 647
                 if ($latitude == '' && $longitude == '') {
648 648
             		$latitude = 0;
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
             	}
651 651
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652 652
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653
+                $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 654
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 655
 
656
-                $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
+                $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);
657 657
 
658 658
 		try {
659 659
 		        
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
681 681
 		if ($globalDBdriver == 'mysql') {
682
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
682
+			$query = "SELECT tracker_output.ident FROM tracker_output 
683 683
 								WHERE tracker_output.ident = :ident 
684 684
 								AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
685 685
 								AND tracker_output.date < UTC_TIMESTAMP()";
686 686
 			$query_data = array(':ident' => $ident);
687 687
 		} else {
688
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
688
+			$query = "SELECT tracker_output.ident FROM tracker_output 
689 689
 								WHERE tracker_output.ident = :ident 
690 690
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
691 691
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 		
695 695
 		$sth = $this->db->prepare($query);
696 696
 		$sth->execute($query_data);
697
-    		$ident_result='';
698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
697
+    		$ident_result = '';
698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
699 699
 		{
700 700
 			$ident_result = $row['ident'];
701 701
 		}
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 				return false;
722 722
 			} else {
723 723
 				$q_array = explode(" ", $q);
724
-				foreach ($q_array as $q_item){
725
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
724
+				foreach ($q_array as $q_item) {
725
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
726 726
 					$additional_query .= " AND (";
727 727
 					$additional_query .= "(tracker_output.ident like '%".$q_item."%')";
728 728
 					$additional_query .= ")";
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 			}
731 731
 		}
732 732
 		if ($globalDBdriver == 'mysql') {
733
-			$query  = "SELECT tracker_output.* FROM tracker_output 
733
+			$query = "SELECT tracker_output.* FROM tracker_output 
734 734
 				WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
735 735
 				AND tracker_output.date < UTC_TIMESTAMP()";
736 736
 		} else {
737
-			$query  = "SELECT tracker_output.* FROM tracker_output 
737
+			$query = "SELECT tracker_output.* FROM tracker_output 
738 738
 				WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
739 739
 				AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
740 740
 		}
@@ -753,16 +753,16 @@  discard block
 block discarded – undo
753 753
 	*
754 754
 	*/
755 755
 
756
-	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756
+	public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
757 757
 	{
758 758
 		global $globalDBdriver, $globalArchive;
759 759
 		//$filter_query = $this->getFilter($filters,true,true);
760
-		$Connection= new Connection($this->db);
760
+		$Connection = new Connection($this->db);
761 761
 		if (!$Connection->tableExists('countries')) return array();
762 762
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
763 763
 			require_once('class.TrackerLive.php');
764 764
 			$TrackerLive = new TrackerLive($this->db);
765
-			$filter_query = $TrackerLive->getFilter($filters,true,true);
765
+			$filter_query = $TrackerLive->getFilter($filters, true, true);
766 766
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
767 767
 			if ($olderthanmonths > 0) {
768 768
 				if ($globalDBdriver == 'mysql') {
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 		} else {
783 783
 			require_once('class.TrackerArchive.php');
784 784
 			$TrackerArchive = new TrackerArchive($this->db);
785
-			$filter_query = $TrackerArchive->getFilter($filters,true,true);
785
+			$filter_query = $TrackerArchive->getFilter($filters, true, true);
786 786
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
787 787
 			if ($olderthanmonths > 0) {
788 788
 				if ($globalDBdriver == 'mysql') {
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 		$flight_array = array();
811 811
 		$temp_array = array();
812 812
         
813
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
813
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
814 814
 		{
815 815
 			$temp_array['tracker_count'] = $row['nb'];
816 816
 			$temp_array['tracker_country'] = $row['name'];
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 	* @return Array the callsign list
828 828
 	*
829 829
 	*/
830
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
830
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
831 831
 	{
832 832
 		global $globalDBdriver;
833
-		$filter_query = $this->getFilter($filters,true,true);
834
-		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
833
+		$filter_query = $this->getFilter($filters, true, true);
834
+		$query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
835 835
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
836 836
 		 if ($olderthanmonths > 0) {
837 837
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -845,28 +845,28 @@  discard block
 block discarded – undo
845 845
 		if ($year != '') {
846 846
 			if ($globalDBdriver == 'mysql') {
847 847
 				$query .= " AND YEAR(tracker_output.date) = :year";
848
-				$query_values = array_merge($query_values,array(':year' => $year));
848
+				$query_values = array_merge($query_values, array(':year' => $year));
849 849
 			} else {
850 850
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
851
-				$query_values = array_merge($query_values,array(':year' => $year));
851
+				$query_values = array_merge($query_values, array(':year' => $year));
852 852
 			}
853 853
 		}
854 854
 		if ($month != '') {
855 855
 			if ($globalDBdriver == 'mysql') {
856 856
 				$query .= " AND MONTH(tracker_output.date) = :month";
857
-				$query_values = array_merge($query_values,array(':month' => $month));
857
+				$query_values = array_merge($query_values, array(':month' => $month));
858 858
 			} else {
859 859
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
860
-				$query_values = array_merge($query_values,array(':month' => $month));
860
+				$query_values = array_merge($query_values, array(':month' => $month));
861 861
 			}
862 862
 		}
863 863
 		if ($day != '') {
864 864
 			if ($globalDBdriver == 'mysql') {
865 865
 				$query .= " AND DAY(tracker_output.date) = :day";
866
-				$query_values = array_merge($query_values,array(':day' => $day));
866
+				$query_values = array_merge($query_values, array(':day' => $day));
867 867
 			} else {
868 868
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
869
-				$query_values = array_merge($query_values,array(':day' => $day));
869
+				$query_values = array_merge($query_values, array(':day' => $day));
870 870
 			}
871 871
 		}
872 872
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		$callsign_array = array();
879 879
 		$temp_array = array();
880 880
         
881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
882 882
 		{
883 883
 			$temp_array['callsign_icao'] = $row['ident'];
884 884
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 		$date_array = array();
931 931
 		$temp_array = array();
932 932
         
933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
934 934
 		{
935 935
 			$temp_array['date_name'] = $row['date_name'];
936 936
 			$temp_array['date_count'] = $row['date_count'];
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			$datetime = new DateTime();
957 957
 			$offset = $datetime->format('P');
958 958
 		} else $offset = '+00:00';
959
-		$filter_query = $this->getFilter($filters,true,true);
959
+		$filter_query = $this->getFilter($filters, true, true);
960 960
 		if ($globalDBdriver == 'mysql') {
961 961
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
962 962
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 		$date_array = array();
978 978
 		$temp_array = array();
979 979
         
980
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
980
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
981 981
 		{
982 982
 			$temp_array['date_name'] = $row['date_name'];
983 983
 			$temp_array['date_count'] = $row['date_count'];
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			$datetime = new DateTime();
1003 1003
 			$offset = $datetime->format('P');
1004 1004
 		} else $offset = '+00:00';
1005
-		$filter_query = $this->getFilter($filters,true,true);
1005
+		$filter_query = $this->getFilter($filters, true, true);
1006 1006
 		if ($globalDBdriver == 'mysql') {
1007 1007
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1008 1008
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 		$date_array = array();
1024 1024
 		$temp_array = array();
1025 1025
         
1026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1027 1027
 		{
1028 1028
 			$temp_array['date_name'] = $row['date_name'];
1029 1029
 			$temp_array['date_count'] = $row['date_count'];
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		$date_array = array();
1071 1071
 		$temp_array = array();
1072 1072
         
1073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1074 1074
 		{
1075 1075
 			$temp_array['month_name'] = $row['month_name'];
1076 1076
 			$temp_array['year_name'] = $row['year_name'];
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 			$datetime = new DateTime();
1100 1100
 			$offset = $datetime->format('P');
1101 1101
 		} else $offset = '+00:00';
1102
-		$filter_query = $this->getFilter($filters,true,true);
1102
+		$filter_query = $this->getFilter($filters, true, true);
1103 1103
 		if ($globalDBdriver == 'mysql') {
1104 1104
 			$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
1105 1105
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 		$date_array = array();
1121 1121
 		$temp_array = array();
1122 1122
         
1123
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1123
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1124 1124
 		{
1125 1125
 			$temp_array['year_name'] = $row['year_name'];
1126 1126
 			$temp_array['month_name'] = $row['month_name'];
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 	* @return Array the hour list
1141 1141
 	*
1142 1142
 	*/
1143
-	public function countAllHours($orderby,$filters = array())
1143
+	public function countAllHours($orderby, $filters = array())
1144 1144
 	{
1145 1145
 		global $globalTimezone, $globalDBdriver;
1146 1146
 		if ($globalTimezone != '') {
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 		$hour_array = array();
1189 1189
 		$temp_array = array();
1190 1190
         
1191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1192 1192
 		{
1193 1193
 			$temp_array['hour_name'] = $row['hour_name'];
1194 1194
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
 	public function countAllHoursByDate($date, $filters = array())
1211 1211
 	{
1212 1212
 		global $globalTimezone, $globalDBdriver;
1213
-		$filter_query = $this->getFilter($filters,true,true);
1214
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
1213
+		$filter_query = $this->getFilter($filters, true, true);
1214
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
1215 1215
 		if ($globalTimezone != '') {
1216 1216
 			date_default_timezone_set($globalTimezone);
1217 1217
 			$datetime = new DateTime($date);
@@ -1219,12 +1219,12 @@  discard block
 block discarded – undo
1219 1219
 		} else $offset = '+00:00';
1220 1220
 
1221 1221
 		if ($globalDBdriver == 'mysql') {
1222
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1222
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1223 1223
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date
1224 1224
 								GROUP BY hour_name 
1225 1225
 								ORDER BY hour_name ASC";
1226 1226
 		} else {
1227
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1227
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1228 1228
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
1229 1229
 								GROUP BY hour_name 
1230 1230
 								ORDER BY hour_name ASC";
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		$hour_array = array();
1237 1237
 		$temp_array = array();
1238 1238
         
1239
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1239
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1240 1240
 		{
1241 1241
 			$temp_array['hour_name'] = $row['hour_name'];
1242 1242
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 	public function countAllHoursByIdent($ident, $filters = array())
1259 1259
 	{
1260 1260
 		global $globalTimezone, $globalDBdriver;
1261
-		$filter_query = $this->getFilter($filters,true,true);
1262
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1261
+		$filter_query = $this->getFilter($filters, true, true);
1262
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1263 1263
 		if ($globalTimezone != '') {
1264 1264
 			date_default_timezone_set($globalTimezone);
1265 1265
 			$datetime = new DateTime();
@@ -1267,12 +1267,12 @@  discard block
 block discarded – undo
1267 1267
 		} else $offset = '+00:00';
1268 1268
 
1269 1269
 		if ($globalDBdriver == 'mysql') {
1270
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1270
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1271 1271
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1272 1272
 								GROUP BY hour_name 
1273 1273
 								ORDER BY hour_name ASC";
1274 1274
 		} else {
1275
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1275
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1276 1276
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1277 1277
 								GROUP BY hour_name 
1278 1278
 								ORDER BY hour_name ASC";
@@ -1280,12 +1280,12 @@  discard block
 block discarded – undo
1280 1280
       
1281 1281
 		
1282 1282
 		$sth = $this->db->prepare($query);
1283
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
1283
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
1284 1284
       
1285 1285
 		$hour_array = array();
1286 1286
 		$temp_array = array();
1287 1287
         
1288
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1288
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1289 1289
 		{
1290 1290
 			$temp_array['hour_name'] = $row['hour_name'];
1291 1291
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1304,33 +1304,33 @@  discard block
 block discarded – undo
1304 1304
 	* @return Integer the number of trackers
1305 1305
 	*
1306 1306
 	*/
1307
-	public function countOverallTracker($filters = array(),$year = '',$month = '')
1307
+	public function countOverallTracker($filters = array(), $year = '', $month = '')
1308 1308
 	{
1309 1309
 		global $globalDBdriver;
1310 1310
 		//$queryi  = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output";
1311
-		$queryi  = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output";
1311
+		$queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output";
1312 1312
 		$query_values = array();
1313 1313
 		$query = '';
1314 1314
 		if ($year != '') {
1315 1315
 			if ($globalDBdriver == 'mysql') {
1316 1316
 				$query .= " AND YEAR(tracker_output.date) = :year";
1317
-				$query_values = array_merge($query_values,array(':year' => $year));
1317
+				$query_values = array_merge($query_values, array(':year' => $year));
1318 1318
 			} else {
1319 1319
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1320
-				$query_values = array_merge($query_values,array(':year' => $year));
1320
+				$query_values = array_merge($query_values, array(':year' => $year));
1321 1321
 			}
1322 1322
 		}
1323 1323
 		if ($month != '') {
1324 1324
 			if ($globalDBdriver == 'mysql') {
1325 1325
 				$query .= " AND MONTH(tracker_output.date) = :month";
1326
-				$query_values = array_merge($query_values,array(':month' => $month));
1326
+				$query_values = array_merge($query_values, array(':month' => $month));
1327 1327
 			} else {
1328 1328
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1329
-				$query_values = array_merge($query_values,array(':month' => $month));
1329
+				$query_values = array_merge($query_values, array(':month' => $month));
1330 1330
 			}
1331 1331
 		}
1332 1332
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1333
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1333
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1334 1334
 		
1335 1335
 		$sth = $this->db->prepare($queryi);
1336 1336
 		$sth->execute($query_values);
@@ -1343,32 +1343,32 @@  discard block
 block discarded – undo
1343 1343
 	* @return Integer the number of flights
1344 1344
 	*
1345 1345
 	*/
1346
-	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1346
+	public function countOverallTrackerTypes($filters = array(), $year = '', $month = '')
1347 1347
 	{
1348 1348
 		global $globalDBdriver;
1349
-		$queryi  = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output";
1349
+		$queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output";
1350 1350
 		$query_values = array();
1351 1351
 		$query = '';
1352 1352
 		if ($year != '') {
1353 1353
 			if ($globalDBdriver == 'mysql') {
1354 1354
 				$query .= " AND YEAR(tracker_output.date) = :year";
1355
-				$query_values = array_merge($query_values,array(':year' => $year));
1355
+				$query_values = array_merge($query_values, array(':year' => $year));
1356 1356
 			} else {
1357 1357
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1358
-				$query_values = array_merge($query_values,array(':year' => $year));
1358
+				$query_values = array_merge($query_values, array(':year' => $year));
1359 1359
 			}
1360 1360
 		}
1361 1361
 		if ($month != '') {
1362 1362
 			if ($globalDBdriver == 'mysql') {
1363 1363
 				$query .= " AND MONTH(tracker_output.date) = :month";
1364
-				$query_values = array_merge($query_values,array(':month' => $month));
1364
+				$query_values = array_merge($query_values, array(':month' => $month));
1365 1365
 			} else {
1366 1366
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1367
-				$query_values = array_merge($query_values,array(':month' => $month));
1367
+				$query_values = array_merge($query_values, array(':month' => $month));
1368 1368
 			}
1369 1369
 		}
1370 1370
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1371
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1371
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1372 1372
 		
1373 1373
 		$sth = $this->db->prepare($queryi);
1374 1374
 		$sth->execute($query_values);
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 	public function countAllHoursFromToday($filters = array())
1386 1386
 	{
1387 1387
 		global $globalTimezone, $globalDBdriver;
1388
-		$filter_query = $this->getFilter($filters,true,true);
1388
+		$filter_query = $this->getFilter($filters, true, true);
1389 1389
 		if ($globalTimezone != '') {
1390 1390
 			date_default_timezone_set($globalTimezone);
1391 1391
 			$datetime = new DateTime();
@@ -1393,12 +1393,12 @@  discard block
 block discarded – undo
1393 1393
 		} else $offset = '+00:00';
1394 1394
 
1395 1395
 		if ($globalDBdriver == 'mysql') {
1396
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1396
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1397 1397
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE()
1398 1398
 								GROUP BY hour_name 
1399 1399
 								ORDER BY hour_name ASC";
1400 1400
 		} else {
1401
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1401
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1402 1402
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
1403 1403
 								GROUP BY hour_name 
1404 1404
 								ORDER BY hour_name ASC";
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 		$hour_array = array();
1411 1411
 		$temp_array = array();
1412 1412
         
1413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1414 1414
 		{
1415 1415
 			$temp_array['hour_name'] = $row['hour_name'];
1416 1416
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
 	*/
1430 1430
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1431 1431
 	{
1432
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
1432
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
1433 1433
 
1434
-		$query  = "SELECT tracker_output.tracker_id
1434
+		$query = "SELECT tracker_output.tracker_id
1435 1435
 				FROM tracker_output 
1436 1436
 				WHERE tracker_output.famtrackid = '".$famtrackid."'";
1437 1437
         
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 		$sth = $this->db->prepare($query);
1440 1440
 		$sth->execute();
1441 1441
 
1442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1443 1443
 		{
1444 1444
 			return $row['tracker_id'];
1445 1445
 		}
@@ -1464,23 +1464,23 @@  discard block
 block discarded – undo
1464 1464
 		}
1465 1465
 		
1466 1466
 		$current_date = date("Y-m-d H:i:s");
1467
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
1467
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
1468 1468
 		
1469 1469
 		$diff = abs(strtotime($current_date) - strtotime($date));
1470 1470
 
1471
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
1471
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
1472 1472
 		$years = $time_array['years'];
1473 1473
 		
1474
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
1474
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
1475 1475
 		$months = $time_array['months'];
1476 1476
 		
1477
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
1477
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
1478 1478
 		$days = $time_array['days'];
1479
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
1479
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
1480 1480
 		$hours = $time_array['hours'];
1481
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
1481
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
1482 1482
 		$minutes = $time_array['minutes'];
1483
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1483
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1484 1484
 		
1485 1485
 		return $time_array;
1486 1486
 	}
@@ -1503,63 +1503,63 @@  discard block
 block discarded – undo
1503 1503
 			$temp_array['direction_degree'] = $direction;
1504 1504
 			$temp_array['direction_shortname'] = "N";
1505 1505
 			$temp_array['direction_fullname'] = "North";
1506
-		} elseif ($direction >= 22.5 && $direction < 45){
1506
+		} elseif ($direction >= 22.5 && $direction < 45) {
1507 1507
 			$temp_array['direction_degree'] = $direction;
1508 1508
 			$temp_array['direction_shortname'] = "NNE";
1509 1509
 			$temp_array['direction_fullname'] = "North-Northeast";
1510
-		} elseif ($direction >= 45 && $direction < 67.5){
1510
+		} elseif ($direction >= 45 && $direction < 67.5) {
1511 1511
 			$temp_array['direction_degree'] = $direction;
1512 1512
 			$temp_array['direction_shortname'] = "NE";
1513 1513
 			$temp_array['direction_fullname'] = "Northeast";
1514
-		} elseif ($direction >= 67.5 && $direction < 90){
1514
+		} elseif ($direction >= 67.5 && $direction < 90) {
1515 1515
 			$temp_array['direction_degree'] = $direction;
1516 1516
 			$temp_array['direction_shortname'] = "ENE";
1517 1517
 			$temp_array['direction_fullname'] = "East-Northeast";
1518
-		} elseif ($direction >= 90 && $direction < 112.5){
1518
+		} elseif ($direction >= 90 && $direction < 112.5) {
1519 1519
 			$temp_array['direction_degree'] = $direction;
1520 1520
 			$temp_array['direction_shortname'] = "E";
1521 1521
 			$temp_array['direction_fullname'] = "East";
1522
-		} elseif ($direction >= 112.5 && $direction < 135){
1522
+		} elseif ($direction >= 112.5 && $direction < 135) {
1523 1523
 			$temp_array['direction_degree'] = $direction;
1524 1524
 			$temp_array['direction_shortname'] = "ESE";
1525 1525
 			$temp_array['direction_fullname'] = "East-Southeast";
1526
-		} elseif ($direction >= 135 && $direction < 157.5){
1526
+		} elseif ($direction >= 135 && $direction < 157.5) {
1527 1527
 			$temp_array['direction_degree'] = $direction;
1528 1528
 			$temp_array['direction_shortname'] = "SE";
1529 1529
 			$temp_array['direction_fullname'] = "Southeast";
1530
-		} elseif ($direction >= 157.5 && $direction < 180){
1530
+		} elseif ($direction >= 157.5 && $direction < 180) {
1531 1531
 			$temp_array['direction_degree'] = $direction;
1532 1532
 			$temp_array['direction_shortname'] = "SSE";
1533 1533
 			$temp_array['direction_fullname'] = "South-Southeast";
1534
-		} elseif ($direction >= 180 && $direction < 202.5){
1534
+		} elseif ($direction >= 180 && $direction < 202.5) {
1535 1535
 			$temp_array['direction_degree'] = $direction;
1536 1536
 			$temp_array['direction_shortname'] = "S";
1537 1537
 			$temp_array['direction_fullname'] = "South";
1538
-		} elseif ($direction >= 202.5 && $direction < 225){
1538
+		} elseif ($direction >= 202.5 && $direction < 225) {
1539 1539
 			$temp_array['direction_degree'] = $direction;
1540 1540
 			$temp_array['direction_shortname'] = "SSW";
1541 1541
 			$temp_array['direction_fullname'] = "South-Southwest";
1542
-		} elseif ($direction >= 225 && $direction < 247.5){
1542
+		} elseif ($direction >= 225 && $direction < 247.5) {
1543 1543
 			$temp_array['direction_degree'] = $direction;
1544 1544
 			$temp_array['direction_shortname'] = "SW";
1545 1545
 			$temp_array['direction_fullname'] = "Southwest";
1546
-		} elseif ($direction >= 247.5 && $direction < 270){
1546
+		} elseif ($direction >= 247.5 && $direction < 270) {
1547 1547
 			$temp_array['direction_degree'] = $direction;
1548 1548
 			$temp_array['direction_shortname'] = "WSW";
1549 1549
 			$temp_array['direction_fullname'] = "West-Southwest";
1550
-		} elseif ($direction >= 270 && $direction < 292.5){
1550
+		} elseif ($direction >= 270 && $direction < 292.5) {
1551 1551
 			$temp_array['direction_degree'] = $direction;
1552 1552
 			$temp_array['direction_shortname'] = "W";
1553 1553
 			$temp_array['direction_fullname'] = "West";
1554
-		} elseif ($direction >= 292.5 && $direction < 315){
1554
+		} elseif ($direction >= 292.5 && $direction < 315) {
1555 1555
 			$temp_array['direction_degree'] = $direction;
1556 1556
 			$temp_array['direction_shortname'] = "WNW";
1557 1557
 			$temp_array['direction_fullname'] = "West-Northwest";
1558
-		} elseif ($direction >= 315 && $direction < 337.5){
1558
+		} elseif ($direction >= 315 && $direction < 337.5) {
1559 1559
 			$temp_array['direction_degree'] = $direction;
1560 1560
 			$temp_array['direction_shortname'] = "NW";
1561 1561
 			$temp_array['direction_fullname'] = "Northwest";
1562
-		} elseif ($direction >= 337.5 && $direction < 360){
1562
+		} elseif ($direction >= 337.5 && $direction < 360) {
1563 1563
 			$temp_array['direction_degree'] = $direction;
1564 1564
 			$temp_array['direction_shortname'] = "NNW";
1565 1565
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -1576,11 +1576,11 @@  discard block
 block discarded – undo
1576 1576
 	* @param Float $longitude longitute of the flight
1577 1577
 	* @return String the countrie
1578 1578
 	*/
1579
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1579
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
1580 1580
 	{
1581 1581
 		global $globalDBdriver, $globalDebug;
1582
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1583
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1582
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1583
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1584 1584
 	
1585 1585
 		$Connection = new Connection($this->db);
1586 1586
 		if (!$Connection->tableExists('countries')) return '';
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 	public function getCountryFromISO2($iso2)
1621 1621
 	{
1622 1622
 		global $globalDBdriver, $globalDebug;
1623
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1623
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
1624 1624
 	
1625 1625
 		$Connection = new Connection($this->db);
1626 1626
 		if (!$Connection->tableExists('countries')) return '';
@@ -1649,11 +1649,11 @@  discard block
 block discarded – undo
1649 1649
 	* @return Array the vessel type list
1650 1650
 	*
1651 1651
 	*/
1652
-	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1652
+	public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
1653 1653
 	{
1654 1654
 		global $globalDBdriver;
1655
-		$filter_query = $this->getFilter($filters,true,true);
1656
-		$query  = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count 
1655
+		$filter_query = $this->getFilter($filters, true, true);
1656
+		$query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count 
1657 1657
 		    FROM tracker_output ".$filter_query." tracker_output.type  <> ''";
1658 1658
 		if ($olderthanmonths > 0) {
1659 1659
 			if ($globalDBdriver == 'mysql') {
@@ -1673,28 +1673,28 @@  discard block
 block discarded – undo
1673 1673
 		if ($year != '') {
1674 1674
 			if ($globalDBdriver == 'mysql') {
1675 1675
 				$query .= " AND YEAR(tracker_output.date) = :year";
1676
-				$query_values = array_merge($query_values,array(':year' => $year));
1676
+				$query_values = array_merge($query_values, array(':year' => $year));
1677 1677
 			} else {
1678 1678
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1679
-				$query_values = array_merge($query_values,array(':year' => $year));
1679
+				$query_values = array_merge($query_values, array(':year' => $year));
1680 1680
 			}
1681 1681
 		}
1682 1682
 		if ($month != '') {
1683 1683
 			if ($globalDBdriver == 'mysql') {
1684 1684
 				$query .= " AND MONTH(tracker_output.date) = :month";
1685
-				$query_values = array_merge($query_values,array(':month' => $month));
1685
+				$query_values = array_merge($query_values, array(':month' => $month));
1686 1686
 			} else {
1687 1687
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1688
-				$query_values = array_merge($query_values,array(':month' => $month));
1688
+				$query_values = array_merge($query_values, array(':month' => $month));
1689 1689
 			}
1690 1690
 		}
1691 1691
 		if ($day != '') {
1692 1692
 			if ($globalDBdriver == 'mysql') {
1693 1693
 				$query .= " AND DAY(tracker_output.date) = :day";
1694
-				$query_values = array_merge($query_values,array(':day' => $day));
1694
+				$query_values = array_merge($query_values, array(':day' => $day));
1695 1695
 			} else {
1696 1696
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
1697
-				$query_values = array_merge($query_values,array(':day' => $day));
1697
+				$query_values = array_merge($query_values, array(':day' => $day));
1698 1698
 			}
1699 1699
 		}
1700 1700
 		$query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC";
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		$sth->execute($query_values);
1704 1704
 		$tracker_array = array();
1705 1705
 		$temp_array = array();
1706
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1706
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1707 1707
 		{
1708 1708
 			$temp_array['tracker_type'] = $row['tracker_type'];
1709 1709
 			$temp_array['tracker_type_count'] = $row['tracker_type_count'];
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 		
1739 1739
 		$bitly_data = json_decode($bitly_data);
1740 1740
 		$bitly_url = '';
1741
-		if ($bitly_data->status_txt = "OK"){
1741
+		if ($bitly_data->status_txt = "OK") {
1742 1742
 			$bitly_url = $bitly_data->data->url;
1743 1743
 		}
1744 1744
 
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 
1749 1749
 	public function getOrderBy()
1750 1750
 	{
1751
-		$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"));
1751
+		$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"));
1752 1752
 		
1753 1753
 		return $orderby;
1754 1754
 		
Please login to merge, or discard this patch.
statistics.php 1 patch
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (!isset($filter_name)) $filter_name = '';
26
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
26
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
27 27
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28 28
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29 29
 }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
33 33
 	if (isset($airline_info[0]['name'])) {
34 34
 		$airline_name = $airline_info[0]['name'];
35
-	} elseif (strpos($airline_icao,'alliance_') !== FALSE) {
35
+	} elseif (strpos($airline_icao, 'alliance_') !== FALSE) {
36 36
 		$alliance_name = $airline_icao;
37 37
 	}
38 38
 }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	$title = _("Statistics");
43 43
 }
44 44
 
45
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
45
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 
48 48
 require_once('header.php');
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		date_default_timezone_set('UTC');
71 71
 		$lastupdate = strtotime($last_update[0]['value']);
72 72
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
73
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
73
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
74 74
 	}
75 75
 }
76 76
 ?>
@@ -82,31 +82,31 @@  discard block
 block discarded – undo
82 82
 <?php
83 83
 if ($type == 'aircraft') {
84 84
 ?>
85
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
86
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
87
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
88
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
85
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
86
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
87
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
88
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
89 89
 <?php
90 90
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
91 91
 ?>
92
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
93
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
92
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
93
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
94 94
 <?php
95 95
 	}
96 96
 	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
97 97
 ?>
98
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
99
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
98
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
99
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
100 100
 <?php
101 101
 	}
102 102
 ?>
103
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
104
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
103
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
104
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
105 105
 <?php
106 106
 	if ($airline_icao == '') {
107 107
 ?>
108
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
109
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
108
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
109
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
110 110
 <?php
111 111
 	}
112 112
 ?>
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
115 115
 		if ($airline_icao == '' || $airline_icao == 'all') {
116 116
 ?>
117
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
118
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
117
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
118
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
119 119
 <?php
120 120
 		}
121 121
 	}
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 <?php
124 124
 } elseif ($type == 'marine') {
125 125
 ?>
126
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
127
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
128
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
129
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
126
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
127
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
128
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
129
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
130 130
 <?php
131 131
 } elseif ($type == 'tracker') {
132 132
 ?>
133
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
134
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
135
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
136
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
133
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
134
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
135
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
136
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
137 137
 <?php
138 138
 }
139 139
 ?>
140 140
     </p>
141
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
141
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
142 142
     <div class="specific-stats">
143 143
 <?php
144 144
 if ($type == 'aircraft') {
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
             <div class="col-md-6">
148 148
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
149 149
 <?php
150
-	$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
150
+	$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
151 151
 	if (count($aircraft_array) == 0) {
152 152
 		print _("No data available");
153 153
 	} else {
154 154
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
155 155
 		$aircraft_data = '';
156
-		foreach($aircraft_array as $aircraft_item) {
156
+		foreach ($aircraft_array as $aircraft_item) {
157 157
 			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
158 158
 			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
159 159
 		}
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 ?>
183 183
                 </div>
184 184
             </div>
185
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
185
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
186 186
 <?php
187 187
 	if ($airline_icao == '' || $airline_icao == 'all') {
188
-		$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
188
+		$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
189 189
 		if (count($airline_array) > 0) {
190 190
 			print '<div class="col-md-6">';
191 191
 			print '<h2>'._("Top 10 Most Common Airline").'</h2>';
192 192
 			print '<div id="chart2" class="chart" width="100%"></div><script>';
193 193
 			$airline_data = '';
194
-			foreach($airline_array as $airline_item) {
194
+			foreach ($airline_array as $airline_item) {
195 195
 				$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
196 196
 			}
197 197
 			$airline_data = substr($airline_data, 0, -1);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		}
217 217
 ?>
218 218
         </div>
219
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
219
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
220 220
 <?php
221 221
 	}
222 222
 }
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
             <div class="col-md-6">
229 229
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
230 230
 <?php
231
-	$marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
231
+	$marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month);
232 232
 	if (count($marine_array) == 0) print _("No data available");
233 233
 	else {
234 234
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
235 235
 		$marine_data = '';
236
-		foreach($marine_array as $marine_item) {
236
+		foreach ($marine_array as $marine_item) {
237 237
 			$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
238 238
 		}
239 239
 		$marine_data = substr($marine_data, 0, -1);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             	    ?>
264 264
                 </div>
265 265
             </div>
266
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
266
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
267 267
 <!--	</div>-->
268 268
 <?php
269 269
 }
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
             <div class="col-md-6">
274 274
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
275 275
 <?php
276
-	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
276
+	$tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month);
277 277
 	if (count($tracker_array) == 0) print _("No data available");
278 278
 	else {
279 279
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
280 280
 		$tracker_data = '';
281
-		foreach($tracker_array as $tracker_item) {
281
+		foreach ($tracker_array as $tracker_item) {
282 282
 			$tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
283 283
 		}
284 284
 		$tracker_data = substr($tracker_data, 0, -1);
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             	    ?>
309 309
                 </div>
310 310
             </div>
311
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
311
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
312 312
 <!--	</div>-->
313 313
 <?php
314 314
 }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		else {
324 324
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
325 325
 			$owner_data = '';
326
-			foreach($owner_array as $owner_item) {
326
+			foreach ($owner_array as $owner_item) {
327 327
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
328 328
 			}
329 329
 			$owner_data = substr($owner_data, 0, -1);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                 </div>
344 344
                 -->
345 345
             </div>
346
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
346
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
347 347
             <div class="col-md-6">
348 348
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
349 349
 <?php
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		else {
353 353
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
354 354
 			$owner_data = '';
355
-			foreach($countries_array as $owner_item) {
355
+			foreach ($countries_array as $owner_item) {
356 356
 				$owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],';
357 357
 			}
358 358
 			$owner_data = substr($owner_data, 0, -1);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 -->
374 374
             </div>
375 375
             
376
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
376
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
377 377
 ²	</div>
378 378
         <div class="row column">
379 379
             <div class="col-md-6">
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		else {
385 385
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
386 386
 			$launch_site_data = '';
387
-			foreach($launch_site_array as $launch_site_item) {
387
+			foreach ($launch_site_array as $launch_site_item) {
388 388
 				$launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],';
389 389
 			}
390 390
 			$launch_site_data = substr($launch_site_data, 0, -1);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 ?>
412 412
         <div class="row column">
413 413
 <?php
414
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
414
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
415 415
 	//if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
416 416
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
417 417
 		if (empty($flightover_array)) {
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 ?>
423 423
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
424 424
 <?php
425
-		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
425
+		$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
426 426
 		if (count($pilot_array) == 0) print _("No data available");
427 427
 		else {
428 428
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
429 429
 			$pilot_data = '';
430
-			foreach($pilot_array as $pilot_item) {
430
+			foreach ($pilot_array as $pilot_item) {
431 431
 				$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
432 432
 			}
433 433
 			$pilot_data = substr($pilot_data, 0, -1);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 ?>
449 449
             </div>
450 450
 
451
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
451
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
452 452
 <?php
453 453
 	}
454 454
 	// else {
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
             <div class="col-md-6">
458 458
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
459 459
 <?php
460
-		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
460
+		$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
461 461
 		if (count($owner_array) == 0) print _("No data available");
462 462
 		else {
463 463
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
464 464
 			$owner_data = '';
465
-			foreach($owner_array as $owner_item) {
465
+			foreach ($owner_array as $owner_item) {
466 466
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
467 467
 			}
468 468
 			$owner_data = substr($owner_data, 0, -1);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 </div>
482 482
             </div>
483 483
         
484
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
484
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
485 485
 <?php
486 486
 	}
487 487
 	if (!empty($flightover_array)) {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
496 496
 			print 'var series = [';
497 497
 			$flightover_data = '';
498
-			foreach($flightover_array as $flightover_item) {
498
+			foreach ($flightover_array as $flightover_item) {
499 499
 				$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
500 500
 			}
501 501
 			$flightover_data = substr($flightover_data, 0, -1);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	}
541 541
 ?>
542 542
         </div>
543
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
543
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
544 544
         </div>
545 545
 <?php
546 546
 }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
557 557
 		print 'var series = [';
558 558
 		$flightover_data = '';
559
-		foreach($flightover_array as $flightover_item) {
559
+		foreach ($flightover_array as $flightover_item) {
560 560
 			$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
561 561
 		}
562 562
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
614 614
 		print 'var series = [';
615 615
 		$flightover_data = '';
616
-		foreach($flightover_array as $flightover_item) {
616
+		foreach ($flightover_array as $flightover_item) {
617 617
 			$flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
618 618
 		}
619 619
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
         <div class="row column">
664 664
             <div class="col-md-6">
665 665
 <?php
666
-	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
666
+	$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
667 667
 	if (count($airport_airport_array) > 0) {
668 668
 		print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
669 669
 		print '<div id="chart3" class="chart" width="100%"></div><script>';
670 670
 		print "\n";
671 671
 		print 'var series = [';
672 672
 		$airport_data = '';
673
-		foreach($airport_airport_array as $airport_item) {
673
+		foreach ($airport_airport_array as $airport_item) {
674 674
 			$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
675 675
 		}
676 676
 		$airport_data = substr($airport_data, 0, -1);
@@ -720,18 +720,18 @@  discard block
 block discarded – undo
720 720
 	}
721 721
 ?>
722 722
             </div>
723
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
723
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
724 724
 
725 725
             <div class="col-md-6">
726 726
 <?php
727
-	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
727
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
728 728
 	if (count($airport_airport_array2) > 0) {
729 729
 		print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
730 730
 		print '<div id="chart4" class="chart" width="100%"></div><script>';
731 731
 		print "\n";
732 732
 		print 'var series = [';
733 733
 		$airport_data = '';
734
-		foreach($airport_airport_array2 as $airport_item)
734
+		foreach ($airport_airport_array2 as $airport_item)
735 735
 		{
736 736
 			$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
737 737
 		}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 ?>
784 784
             </div>
785 785
         </div>
786
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
786
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
787 787
 <?php 
788 788
 }
789 789
 if ($type == 'aircraft') {
@@ -795,18 +795,18 @@  discard block
 block discarded – undo
795 795
             <div class="col-md-6">
796 796
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
797 797
 <?php
798
-		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
798
+		$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
799 799
 		if (count($year_array) == 0) print _("No data available");
800 800
 		else {
801 801
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
802 802
 			$year_data = '';
803 803
 			$year_cnt = '';
804
-			foreach($year_array as $year_item) {
804
+			foreach ($year_array as $year_item) {
805 805
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
806 806
 				$year_cnt .= $year_item['date_count'].',';
807 807
 			}
808 808
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
809
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
809
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
810 810
 			print 'c3.generate({
811 811
 			    bindto: "#chart8",
812 812
 			    data: { x: "x",
@@ -819,22 +819,22 @@  discard block
 block discarded – undo
819 819
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
820 820
                 </div>
821 821
             </div>
822
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
822
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
823 823
             <div class="col-md-6">
824 824
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
825 825
 <?php
826
-		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
826
+		$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
827 827
 		if (count($month_array) == 0) print _("No data available");
828 828
 		else {
829 829
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
830 830
 			$month_data = '';
831 831
 			$month_cnt = '';
832
-			foreach($month_array as $month_item) {
832
+			foreach ($month_array as $month_item) {
833 833
 				$month_data .= '"'.$month_item['date_name'].'",';
834 834
 				$month_cnt .= $month_item['date_count'].',';
835 835
 			}
836 836
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
837
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
837
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
838 838
 			print 'c3.generate({
839 839
 			    bindto: "#chart9",
840 840
 			    data: { x: "x",
@@ -847,23 +847,23 @@  discard block
 block discarded – undo
847 847
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
848 848
                 </div>
849 849
             </div>
850
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
850
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
851 851
 
852 852
             <div class="col-md-6">
853 853
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
854 854
 <?php
855
-		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
855
+		$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
856 856
 		if (empty($date_array)) print _("No data available");
857 857
 		else {
858 858
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
859 859
 			$date_data = '';
860 860
 			$date_cnt = '';
861
-			foreach($date_array as $date_item) {
861
+			foreach ($date_array as $date_item) {
862 862
 				$date_data .= '"'.$date_item['date_name'].'",';
863 863
 				$date_cnt .= $date_item['date_count'].',';
864 864
 			}
865 865
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
866
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
866
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
867 867
 			print 'c3.generate({
868 868
 			    bindto: "#chart5",
869 869
 			    data: { x: "x",
@@ -876,22 +876,22 @@  discard block
 block discarded – undo
876 876
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
877 877
                 </div>
878 878
             </div>
879
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
879
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
880 880
             <div class="col-md-6">
881 881
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
882 882
 <?php
883
-		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
883
+		$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
884 884
 		if (empty($hour_array)) print _("No data available");
885 885
 		else {
886 886
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
887 887
 			$hour_data = '';
888 888
 			$hour_cnt = '';
889
-			foreach($hour_array as $hour_item) {
889
+			foreach ($hour_array as $hour_item) {
890 890
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
891 891
 				$hour_cnt .= $hour_item['hour_count'].',';
892 892
 			}
893 893
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
894
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
894
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
895 895
 			print 'c3.generate({
896 896
 			    bindto: "#chart6",
897 897
 			    data: {
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
905 905
                 </div>
906 906
             </div>
907
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
907
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
908 908
         </div>
909 909
 <?php
910 910
 	}
@@ -920,18 +920,18 @@  discard block
 block discarded – undo
920 920
             <div class="col-md-6">
921 921
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
922 922
 <?php
923
-		$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
923
+		$year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name);
924 924
 		if (count($year_array) == 0) print _("No data available");
925 925
 		else {
926 926
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
927 927
 			$year_data = '';
928 928
 			$year_cnt = '';
929
-			foreach($year_array as $year_item) {
929
+			foreach ($year_array as $year_item) {
930 930
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
931 931
 				$year_cnt .= $year_item['date_count'].',';
932 932
 			}
933 933
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
934
-			$year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
934
+			$year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]";
935 935
 			print 'c3.generate({
936 936
 			    bindto: "#chart8",
937 937
 			    data: { x: "x",
@@ -945,22 +945,22 @@  discard block
 block discarded – undo
945 945
                 </div>
946 946
             </div>
947 947
             
948
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
948
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
949 949
             <div class="col-md-6">
950 950
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
951 951
 <?php
952
-		$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
952
+		$month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name);
953 953
 		if (count($month_array) == 0) print _("No data available");
954 954
 		else {
955 955
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
956 956
 			$month_data = '';
957 957
 			$month_cnt = '';
958
-			foreach($month_array as $month_item) {
958
+			foreach ($month_array as $month_item) {
959 959
 				$month_data .= '"'.$month_item['date_name'].'",';
960 960
 				$month_cnt .= $month_item['date_count'].',';
961 961
 			}
962 962
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
963
-			$month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
963
+			$month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]";
964 964
 			print 'c3.generate({
965 965
 			    bindto: "#chart9",
966 966
 			    data: { x: "x",
@@ -973,23 +973,23 @@  discard block
 block discarded – undo
973 973
                     <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
974 974
                 </div>
975 975
             </div>
976
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
976
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
977 977
 
978 978
             <div class="col-md-6">
979 979
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
980 980
 <?php
981
-		$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
981
+		$date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name);
982 982
 		if (empty($date_array)) print _("No data available");
983 983
 		else {
984 984
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
985 985
 			$date_data = '';
986 986
 			$date_cnt = '';
987
-			foreach($date_array as $date_item) {
987
+			foreach ($date_array as $date_item) {
988 988
 				$date_data .= '"'.$date_item['date_name'].'",';
989 989
 				$date_cnt .= $date_item['date_count'].',';
990 990
 			}
991 991
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
992
-			$date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
992
+			$date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]";
993 993
 			print 'c3.generate({
994 994
 			    bindto: "#chart5",
995 995
 			    data: { x: "x",
@@ -1002,22 +1002,22 @@  discard block
 block discarded – undo
1002 1002
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1003 1003
                 </div>
1004 1004
             </div>
1005
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1005
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1006 1006
             <div class="col-md-6">
1007 1007
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1008 1008
 <?php
1009
-		$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
1009
+		$hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name);
1010 1010
 		if (empty($hour_array)) print _("No data available");
1011 1011
 		else {
1012 1012
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1013 1013
 			$hour_data = '';
1014 1014
 			$hour_cnt = '';
1015
-			foreach($hour_array as $hour_item) {
1015
+			foreach ($hour_array as $hour_item) {
1016 1016
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1017 1017
 				$hour_cnt .= $hour_item['hour_count'].',';
1018 1018
 			}
1019 1019
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1020
-			$hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
1020
+			$hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]";
1021 1021
 			print 'c3.generate({
1022 1022
 			    bindto: "#chart6",
1023 1023
 			    data: {
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
                     <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1031 1031
                 </div>
1032 1032
             </div>
1033
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1033
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1034 1034
         </div>
1035 1035
 <?php
1036 1036
 	}
@@ -1052,12 +1052,12 @@  discard block
 block discarded – undo
1052 1052
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1053 1053
 			$year_data = '';
1054 1054
 			$year_cnt = '';
1055
-			foreach($year_array as $year_item) {
1055
+			foreach ($year_array as $year_item) {
1056 1056
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1057 1057
 				$year_cnt .= $year_item['date_count'].',';
1058 1058
 			}
1059 1059
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1060
-			$year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
1060
+			$year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]";
1061 1061
 			print 'c3.generate({
1062 1062
 			    bindto: "#chart8",
1063 1063
 			    data: { x: "x",
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
                 </div>
1072 1072
             </div>
1073 1073
             
1074
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1074
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1075 1075
             <div class="col-md-6">
1076 1076
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1077 1077
 <?php
@@ -1081,12 +1081,12 @@  discard block
 block discarded – undo
1081 1081
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1082 1082
 			$month_data = '';
1083 1083
 			$month_cnt = '';
1084
-			foreach($month_array as $month_item) {
1084
+			foreach ($month_array as $month_item) {
1085 1085
 				$month_data .= '"'.$month_item['date_name'].'",';
1086 1086
 				$month_cnt .= $month_item['date_count'].',';
1087 1087
 			}
1088 1088
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
1089
-			$month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1089
+			$month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]";
1090 1090
 			print 'c3.generate({
1091 1091
 			    bindto: "#chart9",
1092 1092
 			    data: { x: "x",
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                     <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1100 1100
                 </div>
1101 1101
             </div>
1102
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1102
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1103 1103
 
1104 1104
             <div class="col-md-6">
1105 1105
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1110,12 +1110,12 @@  discard block
 block discarded – undo
1110 1110
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1111 1111
 			$date_data = '';
1112 1112
 			$date_cnt = '';
1113
-			foreach($date_array as $date_item) {
1113
+			foreach ($date_array as $date_item) {
1114 1114
 				$date_data .= '"'.$date_item['date_name'].'",';
1115 1115
 				$date_cnt .= $date_item['date_count'].',';
1116 1116
 			}
1117 1117
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
1118
-			$date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1118
+			$date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]";
1119 1119
 			print 'c3.generate({
1120 1120
 			    bindto: "#chart5",
1121 1121
 			    data: { x: "x",
@@ -1128,22 +1128,22 @@  discard block
 block discarded – undo
1128 1128
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1129 1129
                 </div>
1130 1130
             </div>
1131
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1131
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1132 1132
             <div class="col-md-6">
1133 1133
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1134 1134
 <?php
1135
-		$hour_array = $Tracker->countAllHours('hour',true);
1135
+		$hour_array = $Tracker->countAllHours('hour', true);
1136 1136
 		if (empty($hour_array)) print _("No data available");
1137 1137
 		else {
1138 1138
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1139 1139
 			$hour_data = '';
1140 1140
 			$hour_cnt = '';
1141
-			foreach($hour_array as $hour_item) {
1141
+			foreach ($hour_array as $hour_item) {
1142 1142
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1143 1143
 				$hour_cnt .= $hour_item['hour_count'].',';
1144 1144
 			}
1145 1145
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1146
-			$hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1146
+			$hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]";
1147 1147
 			print 'c3.generate({
1148 1148
 			    bindto: "#chart6",
1149 1149
 			    data: {
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
                     <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1157 1157
                 </div>
1158 1158
             </div>
1159
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1159
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1160 1160
         </div>
1161 1161
 <?php
1162 1162
 	}
@@ -1178,12 +1178,12 @@  discard block
 block discarded – undo
1178 1178
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1179 1179
 			$year_data = '';
1180 1180
 			$year_cnt = '';
1181
-			foreach($year_array as $year_item) {
1181
+			foreach ($year_array as $year_item) {
1182 1182
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1183 1183
 				$year_cnt .= $year_item['date_count'].',';
1184 1184
 			}
1185 1185
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1186
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1186
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1187 1187
 			print 'c3.generate({
1188 1188
 			    bindto: "#chart21",
1189 1189
 			    data: { x: "x",
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
             -->
1200 1200
             </div>
1201 1201
             
1202
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1202
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1203 1203
             <div class="col-md-6">
1204 1204
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1205 1205
 <?php
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1210 1210
 			$year_data = '';
1211 1211
 			$year_cnt = '';
1212
-			foreach($year_array as $year_item) {
1212
+			foreach ($year_array as $year_item) {
1213 1213
 				$year_data .= '"'.$year_item['year_name'].'-01-01'.'",';
1214 1214
 				$year_cnt .= $year_item['date_count'].',';
1215 1215
 			}
1216 1216
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1217
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1217
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1218 1218
 			print 'c3.generate({
1219 1219
 			    bindto: "#chart22",
1220 1220
 			    data: { x: "x",
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
             -->
1231 1231
             </div>
1232 1232
             
1233
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1233
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1234 1234
         </div>
1235 1235
 <?php
1236 1236
 	}
@@ -1252,12 +1252,12 @@  discard block
 block discarded – undo
1252 1252
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1253 1253
 			$year_data = '';
1254 1254
 			$year_cnt = '';
1255
-			foreach($year_array as $year_item) {
1255
+			foreach ($year_array as $year_item) {
1256 1256
 				$year_data .= '"'.$year_item['year'].'-01-01",';
1257 1257
 				$year_cnt .= $year_item['count'].',';
1258 1258
 			}
1259 1259
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1260
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1260
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1261 1261
 			print 'c3.generate({
1262 1262
 			    bindto: "#chart32",
1263 1263
 			    data: { x: "x",
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1271 1271
                 </div>
1272 1272
             </div>
1273
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1273
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1274 1274
 
1275 1275
         <div class="row column">
1276 1276
             <div class="col-md-6">
@@ -1282,12 +1282,12 @@  discard block
 block discarded – undo
1282 1282
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1283 1283
 			$year_data = '';
1284 1284
 			$year_cnt = '';
1285
-			foreach($year_array as $year_item) {
1285
+			foreach ($year_array as $year_item) {
1286 1286
 				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1287 1287
 				$year_cnt .= $year_item['count'].',';
1288 1288
 			}
1289 1289
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1290
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1290
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1291 1291
 			print 'c3.generate({
1292 1292
 			    bindto: "#chart33",
1293 1293
 			    data: { x: "x",
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1301 1301
                 </div>
1302 1302
             </div>
1303
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1303
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1304 1304
 <br/>
1305 1305
 <?php
1306 1306
 	}
@@ -1314,19 +1314,19 @@  discard block
 block discarded – undo
1314 1314
 	//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1315 1315
 	if ($year == '' && $month == '') {
1316 1316
 		if ($type == 'aircraft') {
1317
-			$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1317
+			$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
1318 1318
 		} elseif ($type == 'marine') {
1319
-			$polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1319
+			$polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d'));
1320 1320
 		} elseif ($type == 'tracker') {
1321
-			$polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1321
+			$polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d'));
1322 1322
 		}
1323 1323
 	} else {
1324 1324
 		if ($type == 'aircraft') {
1325
-			$polar = $Stats->getStatsSource('polar',$year,$month);
1325
+			$polar = $Stats->getStatsSource('polar', $year, $month);
1326 1326
 		} elseif ($type == 'marine') {
1327
-			$polar = $Stats->getStatsSource('polar_marine',$year,$month);
1327
+			$polar = $Stats->getStatsSource('polar_marine', $year, $month);
1328 1328
 		} elseif ($type == 'tracker') {
1329
-			$polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1329
+			$polar = $Stats->getStatsSource('polar_tracker', $year, $month);
1330 1330
 		}
1331 1331
 	}
1332 1332
 	if (!empty($polar)) {
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 			unset($polar_data);
1336 1336
 			$Spotter = new Spotter();
1337 1337
 			$data = json_decode($eachpolar['source_data']);
1338
-			foreach($data as $value => $key) {
1338
+			foreach ($data as $value => $key) {
1339 1339
 				$direction = $Spotter->parseDirection(($value*22.5));
1340 1340
 				$distance = $key;
1341 1341
 				$unit = 'km';
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 ?>
1356 1356
             <div class="col-md-6">
1357 1357
                 <h4><?php print $eachpolar['source_name']; ?></h4>
1358
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1358
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1359 1359
         	<script>
1360 1360
         	    (function() {
1361 1361
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		      color: color,
1380 1380
 		      unit: '<?php echo $unit; ?>'
1381 1381
 		    };
1382
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1382
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1383 1383
 		    })();
1384 1384
 		</script>
1385 1385
             </div>
@@ -1394,19 +1394,19 @@  discard block
 block discarded – undo
1394 1394
 	//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1395 1395
 	if ($year == '' && $month == '') {
1396 1396
 		if ($type == 'aircraft') {
1397
-			$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1397
+			$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
1398 1398
 		} elseif ($type == 'marine') {
1399
-			$msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1399
+			$msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d'));
1400 1400
 		} elseif ($type == 'tracker') {
1401
-			$msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1401
+			$msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d'));
1402 1402
 		}
1403 1403
 	} else {
1404 1404
 		if ($type == 'aircraft') {
1405
-			$msg = $Stats->getStatsSource('msg',$year,$month);
1405
+			$msg = $Stats->getStatsSource('msg', $year, $month);
1406 1406
 		} elseif ($type == 'marine') {
1407
-			$msg = $Stats->getStatsSource('msg_marine',$year,$month);
1407
+			$msg = $Stats->getStatsSource('msg_marine', $year, $month);
1408 1408
 		} elseif ($type == 'tracker') {
1409
-			$msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1409
+			$msg = $Stats->getStatsSource('msg_tracker', $year, $month);
1410 1410
 		}
1411 1411
 	}
1412 1412
 	if (!empty($msg)) {
@@ -1414,13 +1414,13 @@  discard block
 block discarded – undo
1414 1414
 		foreach ($msg as $eachmsg) {
1415 1415
 			//$eachmsg = $msg[0];
1416 1416
 			$data = $eachmsg['source_data'];
1417
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1417
+			if ($data > 500) $max = (round(($data + 100)/100))*100;
1418 1418
 			else $max = 500;
1419 1419
 ?>
1420
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1420
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1421 1421
         	<script>
1422 1422
 		      var g = new JustGage({
1423
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1423
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
1424 1424
 			    value: <?php echo $data; ?>,
1425 1425
 			    min: 0,
1426 1426
 			    max: <?php print $max; ?>,
@@ -1442,19 +1442,19 @@  discard block
 block discarded – undo
1442 1442
 	//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1443 1443
 	if ($year == '' && $month == '') {
1444 1444
 		if ($type == 'aircraft') {
1445
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1445
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
1446 1446
 		} elseif ($type == 'marine') {
1447
-			$hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1447
+			$hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d'));
1448 1448
 		} elseif ($type == 'tracker') {
1449
-			$hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1449
+			$hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d'));
1450 1450
 		}
1451 1451
 	} else {
1452 1452
 		if ($type == 'aircraft') {
1453
-			$hist = $Stats->getStatsSource('hist',$year,$month);
1453
+			$hist = $Stats->getStatsSource('hist', $year, $month);
1454 1454
 		} elseif ($type == 'marine') {
1455
-			$hist = $Stats->getStatsSource('hist_marine',$year,$month);
1455
+			$hist = $Stats->getStatsSource('hist_marine', $year, $month);
1456 1456
 		} elseif ($type == 'tracker') {
1457
-			$hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1457
+			$hist = $Stats->getStatsSource('hist_tracker', $year, $month);
1458 1458
 		}
1459 1459
 	}
1460 1460
 	foreach ($hist as $hists) {
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
 		$source = $hists['source_name'];
1465 1465
 		$hist_array = json_decode($hists['source_data']);
1466 1466
 		$unit = 'km';
1467
-		foreach($hist_array as $distance => $nb) {
1467
+		foreach ($hist_array as $distance => $nb) {
1468 1468
 			if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1469 1469
 				$distance = round($distance*0.539957);
1470 1470
 				$unit = 'nm';
@@ -1484,18 +1484,18 @@  discard block
 block discarded – undo
1484 1484
 		$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1485 1485
 ?>
1486 1486
             <div class="col-md-6">
1487
-                <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2>
1487
+                <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2>
1488 1488
 <?php
1489
-		print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1489
+		print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
1490 1490
 		print 'c3.generate({
1491
-		    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1491
+		    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
1492 1492
 		    data: { x: "x",
1493 1493
 		    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1494 1494
 		    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1495 1495
 		print '</script>';
1496 1496
 ?>
1497 1497
     	    </div>
1498
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1498
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1499 1499
 <?php
1500 1500
 	}
1501 1501
 ?>
Please login to merge, or discard this patch.