Completed
Push — master ( 87b863...3be42e )
by Yannick
104:15 queued 75:58
created
statistics-manufacturer.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,15 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Manufacturer");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
-}
13
+    if (isset($globalFilter['airline'])) {
14
+    	$airline_icao = $globalFilter['airline'][0];
15
+    }
16
+    }
13 17
 
14 18
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 19
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Manufacturer");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 
17 17
 require_once('header.php');
18 18
 include('statistics-sub-menu.php'); 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 		 </div>
25 25
     	<p>'._("Below are the <strong>Top 10</strong> most common aircraft manufacturers.").'</p>';
26 26
  
27
-$manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline_icao,$filter_name,$year,$month);
27
+$manufacturers_array = $Stats->countAllAircraftManufacturers(true, $airline_icao, $filter_name, $year, $month);
28 28
 print '<div id="chart" class="chart" width="100%"></div><script>';
29 29
 $manufacturer_data = '';
30
-foreach($manufacturers_array as $manufacturer_item)
30
+foreach ($manufacturers_array as $manufacturer_item)
31 31
 {
32 32
 	$manufacturer_data .= '[ "'.$manufacturer_item['aircraft_manufacturer'].'",'.$manufacturer_item['aircraft_manufacturer_count'].'],';
33 33
 }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	print '</thead>';
53 53
 	print '<tbody>';
54 54
 	$i = 1;
55
-	foreach($manufacturers_array as $manufacturer_item)
55
+	foreach ($manufacturers_array as $manufacturer_item)
56 56
 	{
57 57
 		print '<tr>';
58 58
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-pilot.php 3 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,15 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Pilots");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
-}
13
+    if (isset($globalFilter['airline'])) {
14
+    	$airline_icao = $globalFilter['airline'][0];
15
+    }
16
+    }
13 17
 setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14 18
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 19
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Pilots");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13
-setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
13
+setcookie('stats_airline_icao', $airline_icao, time() + 60*60*24, '/');
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php');
18 18
 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	</div>
23 23
 	<p>'._("Below are the <strong>Top 10</strong> most common pilot.").'</p>';
24 24
 	  
25
-$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
25
+$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
26 26
 print '<div id="chart" class="chart" width="100%"></div><script>';
27 27
 $pilot_data = '';
28
-foreach($pilot_array as $pilot_item)
28
+foreach ($pilot_array as $pilot_item)
29 29
 {
30 30
 	$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
31 31
 }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	print '</thead>';
51 51
 	print '<tbody>';
52 52
 	$i = 1;
53
-	foreach($pilot_array as $pilot_item)
53
+	foreach ($pilot_array as $pilot_item)
54 54
 	{
55 55
 		print '<tr>';
56 56
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-time.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,11 +16,15 @@  discard block
 block discarded – undo
16 16
 	$Tracker = new Tracker();
17 17
 }
18 18
 
19
-if (!isset($filter_name)) $filter_name = '';
19
+if (!isset($filter_name)) {
20
+	$filter_name = '';
21
+}
20 22
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
21 23
 if ($airline_icao == '' && isset($globalFilter)) {
22
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
23
-}
24
+    if (isset($globalFilter['airline'])) {
25
+    	$airline_icao = $globalFilter['airline'][0];
26
+    }
27
+    }
24 28
 
25 29
 require_once('header.php');
26 30
 include('statistics-sub-menu.php');
@@ -33,9 +37,13 @@  discard block
 block discarded – undo
33 37
 	</div>
34 38
 	<p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>';
35 39
 
36
-if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
37
-elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true);
38
-elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true);
40
+if ($type == 'aircraft') {
41
+	$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
42
+} elseif ($type == 'marine') {
43
+	$hour_array = $Marine->countAllHours('hour',true);
44
+} elseif ($type == 'tracker') {
45
+	$hour_array = $Tracker->countAllHours('hour',true);
46
+}
39 47
 print '<div id="chartHour" class="chart" width="100%"></div><script>';
40 48
 $hour_data = '';
41 49
 $hour_cnt = '';
@@ -53,9 +61,13 @@  discard block
 block discarded – undo
53 61
     axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});';
54 62
 print '</script>';
55 63
 
56
-if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name);
57
-elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true);
58
-elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true);
64
+if ($type == 'aircraft') {
65
+	$hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name);
66
+} elseif ($type == 'marine') {
67
+	$hour_array = $Marine->countAllHours('count',true);
68
+} elseif ($type == 'tracker') {
69
+	$hour_array = $Tracker->countAllHours('count',true);
70
+}
59 71
 if (!empty($hour_array))
60 72
 {
61 73
 	print '<div class="table-responsive">';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 }
18 18
 
19 19
 if (!isset($filter_name)) $filter_name = '';
20
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
20
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
21 21
 if ($airline_icao == '' && isset($globalFilter)) {
22 22
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
23 23
 }
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	</div>
34 34
 	<p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>';
35 35
 
36
-if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
37
-elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true);
38
-elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true);
36
+if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
37
+elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour', true);
38
+elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour', true);
39 39
 print '<div id="chartHour" class="chart" width="100%"></div><script>';
40 40
 $hour_data = '';
41 41
 $hour_cnt = '';
42 42
 $last = 0;
43
-foreach($hour_array as $hour_item)
43
+foreach ($hour_array as $hour_item)
44 44
 {
45
-	while($last != $hour_item['hour_name']) {
45
+	while ($last != $hour_item['hour_name']) {
46 46
 		$hour_data .= '"'.$last.':00",';
47 47
 		$hour_cnt .= '0,';
48 48
 		$last++;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	$hour_cnt .= $hour_item['hour_count'].',';
53 53
 }
54 54
 $hour_data = "[".substr($hour_data, 0, -1)."]";
55
-$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
55
+$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
56 56
 print 'c3.generate({
57 57
     bindto: "#chartHour",
58 58
     data: {
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
     axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});';
61 61
 print '</script>';
62 62
 
63
-if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name);
64
-elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true);
65
-elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true);
63
+if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count', true, $airline_icao, $filter_name);
64
+elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count', true);
65
+elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count', true);
66 66
 if (!empty($hour_array))
67 67
 {
68 68
 	print '<div class="table-responsive">';
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	print '</thead>';
75 75
 	print '<tbody>';
76 76
 	$i = 1;
77
-	foreach($hour_array as $hour_item)
77
+	foreach ($hour_array as $hour_item)
78 78
 	{
79 79
 		print '<tr>';
80 80
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-date.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 }
18 18
 
19 19
 if (!isset($filter_name)) $filter_name = '';
20
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
20
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
21 21
 if ($airline_icao == '' && isset($globalFilter)) {
22 22
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
23 23
 }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	  </div>
34 34
       <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>';
35 35
 
36
-if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
36
+if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
37 37
 elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days();
38 38
 elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days();
39 39
 if (count($date_array) == 0) {
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 print '<div id="chart" class="chart" width="100%"></div><script>';
43 43
 $date_data = '';
44 44
 $date_cnt = '';
45
-foreach($date_array as $date_item)
45
+foreach ($date_array as $date_item)
46 46
 {
47 47
 	$date_data .= '"'.$date_item['date_name'].'",';
48 48
 	$date_cnt .= $date_item['date_count'].',';
49 49
 }
50 50
 $date_data = "['x',".substr($date_data, 0, -1)."]";
51
-$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
51
+$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
52 52
 print 'c3.generate({
53 53
     bindto: "#chart",
54 54
     data: { x: "x",
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 print '</script>';
58 58
 }
59 59
 if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) {
60
-	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>';
60
+	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>';
61 61
 } else {
62 62
 	print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>';
63 63
 }
64
-if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name);
64
+if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao, $filter_name);
65 65
 elseif ($type == 'marine') $date_array = $Marine->countAllDates();
66 66
 elseif ($type == 'tracker') $date_array = $Tracker->countAllDates();
67 67
 if (!empty($date_array))
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	print '</thead>';
76 76
 	print '<tbody>';
77 77
 	$i = 1;
78
-	foreach($date_array as $date_item)
78
+	foreach ($date_array as $date_item)
79 79
 	{
80 80
 		print '<tr>';
81 81
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,11 +16,15 @@  discard block
 block discarded – undo
16 16
 	$Tracker = new Tracker();
17 17
 }
18 18
 
19
-if (!isset($filter_name)) $filter_name = '';
19
+if (!isset($filter_name)) {
20
+	$filter_name = '';
21
+}
20 22
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
21 23
 if ($airline_icao == '' && isset($globalFilter)) {
22
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
23
-}
24
+    if (isset($globalFilter['airline'])) {
25
+    	$airline_icao = $globalFilter['airline'][0];
26
+    }
27
+    }
24 28
 
25 29
 require_once('header.php');
26 30
 include('statistics-sub-menu.php'); 
@@ -33,9 +37,13 @@  discard block
 block discarded – undo
33 37
 	  </div>
34 38
       <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>';
35 39
 
36
-if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
37
-elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days();
38
-elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days();
40
+if ($type == 'aircraft') {
41
+	$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
42
+} elseif ($type == 'marine') {
43
+	$date_array = $Marine->countAllDatesLast7Days();
44
+} elseif ($type == 'tracker') {
45
+	$date_array = $Tracker->countAllDatesLast7Days();
46
+}
39 47
 if (count($date_array) == 0) {
40 48
 	print _("No data available");
41 49
 } else {
@@ -61,9 +69,13 @@  discard block
 block discarded – undo
61 69
 } else {
62 70
 	print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>';
63 71
 }
64
-if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name);
65
-elseif ($type == 'marine') $date_array = $Marine->countAllDates();
66
-elseif ($type == 'tracker') $date_array = $Tracker->countAllDates();
72
+if ($type == 'aircraft') {
73
+	$date_array = $Stats->countAllDates($airline_icao,$filter_name);
74
+} elseif ($type == 'marine') {
75
+	$date_array = $Marine->countAllDates();
76
+} elseif ($type == 'tracker') {
77
+	$date_array = $Tracker->countAllDates();
78
+}
67 79
 if (!empty($date_array))
68 80
 {
69 81
 	print '<div class="table-responsive">';
Please login to merge, or discard this patch.
statistics-year.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
 if (!isset($filter_name)) $filter_name = '';
21
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
21
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
22 22
 if ($airline_icao == '' && isset($globalFilter)) {
23 23
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
24 24
 }
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 	</div>
34 34
       <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>';
35 35
 
36
-if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
36
+if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
37 37
 elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true);
38 38
 elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true);
39 39
 print '<div id="chart" class="chart" width="100%"></div><script>';
40 40
 $year_data = '';
41 41
 $year_cnt = '';
42
-foreach($date_array as $year_item)
42
+foreach ($date_array as $year_item)
43 43
 {
44 44
 	$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
45 45
 	$year_cnt .= $year_item['date_count'].',';
46 46
 }
47 47
 $year_data = "['x',".substr($year_data, 0, -1)."]";
48
-$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
48
+$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
49 49
 print 'c3.generate({
50 50
     bindto: "#chart",
51 51
     data: { x: "x",
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	print '</thead>';
69 69
 	print '<tbody>';
70 70
 	$i = 1;
71
-	foreach($date_array as $date_item)
71
+	foreach ($date_array as $date_item)
72 72
 	{
73 73
 		print '<tr>';
74 74
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,11 +17,15 @@  discard block
 block discarded – undo
17 17
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
18 18
 
19 19
 
20
-if (!isset($filter_name)) $filter_name = '';
20
+if (!isset($filter_name)) {
21
+	$filter_name = '';
22
+}
21 23
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
22 24
 if ($airline_icao == '' && isset($globalFilter)) {
23
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
24
-}
25
+    if (isset($globalFilter['airline'])) {
26
+    	$airline_icao = $globalFilter['airline'][0];
27
+    }
28
+    }
25 29
 
26 30
 require_once('header.php');
27 31
 include('statistics-sub-menu.php');
@@ -33,9 +37,13 @@  discard block
 block discarded – undo
33 37
 	</div>
34 38
       <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>';
35 39
 
36
-if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
37
-elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true);
38
-elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true);
40
+if ($type == 'aircraft') {
41
+	$date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
42
+} elseif ($type == 'marine') {
43
+	$date_array = $Marine->countAllMonthsLastYear(true);
44
+} elseif ($type == 'tracker') {
45
+	$date_array = $Tracker->countAllMonthsLastYear(true);
46
+}
39 47
 print '<div id="chart" class="chart" width="100%"></div><script>';
40 48
 $year_data = '';
41 49
 $year_cnt = '';
@@ -53,9 +61,13 @@  discard block
 block discarded – undo
53 61
     axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "#"}},legend: { show: false }});';
54 62
 print '</script>';
55 63
 
56
-if ($type == 'aircraft') $date_array = $Stats->countAllMonths($airline_icao);
57
-elseif ($type == 'marine') $date_array = $Marine->countAllMonths();
58
-elseif ($type == 'tracker') $date_array = $Tracker->countAllMonths();
64
+if ($type == 'aircraft') {
65
+	$date_array = $Stats->countAllMonths($airline_icao);
66
+} elseif ($type == 'marine') {
67
+	$date_array = $Marine->countAllMonths();
68
+} elseif ($type == 'tracker') {
69
+	$date_array = $Tracker->countAllMonths();
70
+}
59 71
 
60 72
 if (!empty($date_array))
61 73
 {
Please login to merge, or discard this patch.
owner-statistics-registration.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['owner'])) {
6
-        header('Location: '.$globalURL.'/owner');
7
-        die();
6
+		header('Location: '.$globalURL.'/owner');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Aircraft by Registration of %s"),$spotter_array[0]['aircraft_owner']);
21
+	$title = sprintf(_("Most Common Aircraft by Registration of %s"), $spotter_array[0]['aircraft_owner']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
33 33
 
34
-	$aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner,$filter);
34
+	$aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner, $filter);
35 35
 	
36 36
 	if (!empty($aircraft_array))
37 37
 	{
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		print '</thead>';
48 48
 		print '<tbody>';
49 49
 		$i = 1;
50
-		foreach($aircraft_array as $aircraft_item)
50
+		foreach ($aircraft_array as $aircraft_item)
51 51
 		{
52 52
 			print '<tr>';
53 53
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	}
137 137
 
138 138
 	/**
139
-	* Gets all the spotter information based on the latest data entry
140
-	*
141
-	* @return Array the spotter information
142
-	*
143
-	*/
139
+	 * Gets all the spotter information based on the latest data entry
140
+	 *
141
+	 * @return Array the spotter information
142
+	 *
143
+	 */
144 144
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
145 145
 	{
146 146
 		global $globalDBdriver, $globalLiveInterval;
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	}
184 184
 
185 185
 	/**
186
-	* Gets Minimal Live Spotter data
187
-	*
188
-	* @return Array the spotter information
189
-	*
190
-	*/
186
+	 * Gets Minimal Live Spotter data
187
+	 *
188
+	 * @return Array the spotter information
189
+	 *
190
+	 */
191 191
 	public function getMinLiveSpotterData($filter = array())
192 192
 	{
193 193
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	}
225 225
 
226 226
 	/**
227
-	* Gets Minimal Live Spotter data since xx seconds
228
-	*
229
-	* @return Array the spotter information
230
-	*
231
-	*/
227
+	 * Gets Minimal Live Spotter data since xx seconds
228
+	 *
229
+	 * @return Array the spotter information
230
+	 *
231
+	 */
232 232
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
233 233
 	{
234 234
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
 	}
321 321
 
322 322
 	/**
323
-	* Gets number of latest data entry
324
-	*
325
-	* @return String number of entry
326
-	*
327
-	*/
323
+	 * Gets number of latest data entry
324
+	 *
325
+	 * @return String number of entry
326
+	 *
327
+	 */
328 328
 	public function getLiveSpotterCount($filter = array())
329 329
 	{
330 330
 		global $globalDBdriver, $globalLiveInterval;
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 	}
352 352
 
353 353
 	/**
354
-	* Gets all the spotter information based on the latest data entry and coord
355
-	*
356
-	* @return Array the spotter information
357
-	*
358
-	*/
354
+	 * Gets all the spotter information based on the latest data entry and coord
355
+	 *
356
+	 * @return Array the spotter information
357
+	 *
358
+	 */
359 359
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
360 360
 	{
361 361
 		global $globalDBdriver, $globalLiveInterval;
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
 	}
381 381
 
382 382
 	/**
383
-	* Gets all the spotter information based on the latest data entry and coord
384
-	*
385
-	* @return Array the spotter information
386
-	*
387
-	*/
383
+	 * Gets all the spotter information based on the latest data entry and coord
384
+	 *
385
+	 * @return Array the spotter information
386
+	 *
387
+	 */
388 388
 	public function getMinLiveSpotterDatabyCoord($coord, $filter = array())
389 389
 	{
390 390
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 	}
450 450
 
451 451
 	/**
452
-	* Gets all the spotter information based on a user's latitude and longitude
453
-	*
454
-	* @return Array the spotter information
455
-	*
456
-	*/
452
+	 * Gets all the spotter information based on a user's latitude and longitude
453
+	 *
454
+	 * @return Array the spotter information
455
+	 *
456
+	 */
457 457
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
458 458
 	{
459 459
 		$Spotter = new Spotter($this->db);
@@ -463,98 +463,98 @@  discard block
 block discarded – undo
463 463
 				return false;
464 464
 			}
465 465
 		}
466
-        if ($lng != '')
467
-                {
468
-                        if (!is_numeric($lng))
469
-                        {
470
-                                return false;
471
-                        }
472
-                }
473
-
474
-                if ($radius != '')
475
-                {
476
-                        if (!is_numeric($radius))
477
-                        {
478
-                                return false;
479
-                        }
480
-                }
466
+		if ($lng != '')
467
+				{
468
+						if (!is_numeric($lng))
469
+						{
470
+								return false;
471
+						}
472
+				}
473
+
474
+				if ($radius != '')
475
+				{
476
+						if (!is_numeric($radius))
477
+						{
478
+								return false;
479
+						}
480
+				}
481 481
 		$additional_query = '';
482
-        if ($interval != '')
483
-                {
484
-                        if (!is_string($interval))
485
-                        {
486
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
487
-			        return false;
488
-                        } else {
489
-                if ($interval == '1m')
490
-                {
491
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
492
-                } else if ($interval == '15m'){
493
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
494
-                } 
495
-            }
496
-                } else {
497
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
498
-        }
499
-
500
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
482
+		if ($interval != '')
483
+				{
484
+						if (!is_string($interval))
485
+						{
486
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
487
+					return false;
488
+						} else {
489
+				if ($interval == '1m')
490
+				{
491
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
492
+				} else if ($interval == '15m'){
493
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
494
+				} 
495
+			}
496
+				} else {
497
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
498
+		}
499
+
500
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
501 501
                    WHERE spotter_live.latitude <> '' 
502 502
                                    AND spotter_live.longitude <> '' 
503 503
                    ".$additional_query."
504 504
                    HAVING distance < :radius  
505 505
                                    ORDER BY distance";
506 506
 
507
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
507
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
508 508
 
509
-                return $spotter_array;
510
-        }
509
+				return $spotter_array;
510
+		}
511 511
 
512 512
     
513
-        /**
514
-	* Gets all the spotter information based on a particular callsign
515
-	*
516
-	* @return Array the spotter information
517
-	*
518
-	*/
513
+		/**
514
+		 * Gets all the spotter information based on a particular callsign
515
+		 *
516
+		 * @return Array the spotter information
517
+		 *
518
+		 */
519 519
 	public function getLastLiveSpotterDataByIdent($ident)
520 520
 	{
521 521
 		$Spotter = new Spotter($this->db);
522 522
 		date_default_timezone_set('UTC');
523 523
 
524 524
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
525
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
525
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526 526
 
527 527
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
528 528
 
529 529
 		return $spotter_array;
530 530
 	}
531 531
 
532
-        /**
533
-	* Gets all the spotter information based on a particular callsign
534
-	*
535
-	* @return Array the spotter information
536
-	*
537
-	*/
532
+		/**
533
+		 * Gets all the spotter information based on a particular callsign
534
+		 *
535
+		 * @return Array the spotter information
536
+		 *
537
+		 */
538 538
 	public function getDateLiveSpotterDataByIdent($ident,$date)
539 539
 	{
540 540
 		$Spotter = new Spotter($this->db);
541 541
 		date_default_timezone_set('UTC');
542 542
 
543 543
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
544
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
544
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
545 545
 
546
-                $date = date('c',$date);
546
+				$date = date('c',$date);
547 547
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
548 548
 
549 549
 		return $spotter_array;
550 550
 	}
551 551
 
552
-        /**
553
-	* Gets last spotter information based on a particular callsign
554
-	*
555
-	* @return Array the spotter information
556
-	*
557
-	*/
552
+		/**
553
+		 * Gets last spotter information based on a particular callsign
554
+		 *
555
+		 * @return Array the spotter information
556
+		 *
557
+		 */
558 558
 	public function getLastLiveSpotterDataById($id)
559 559
 	{
560 560
 		$Spotter = new Spotter($this->db);
@@ -565,12 +565,12 @@  discard block
 block discarded – undo
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
568
-        /**
569
-	* Gets last spotter information based on a particular callsign
570
-	*
571
-	* @return Array the spotter information
572
-	*
573
-	*/
568
+		/**
569
+		 * Gets last spotter information based on a particular callsign
570
+		 *
571
+		 * @return Array the spotter information
572
+		 *
573
+		 */
574 574
 	public function getDateLiveSpotterDataById($id,$date)
575 575
 	{
576 576
 		$Spotter = new Spotter($this->db);
@@ -583,21 +583,21 @@  discard block
 block discarded – undo
583 583
 		return $spotter_array;
584 584
 	}
585 585
 
586
-        /**
587
-	* Gets altitude information based on a particular callsign
588
-	*
589
-	* @return Array the spotter information
590
-	*
591
-	*/
586
+		/**
587
+		 * Gets altitude information based on a particular callsign
588
+		 *
589
+		 * @return Array the spotter information
590
+		 *
591
+		 */
592 592
 	public function getAltitudeLiveSpotterDataByIdent($ident)
593 593
 	{
594 594
 
595 595
 		date_default_timezone_set('UTC');
596 596
 
597 597
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
598
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
598
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
599 599
 
600
-    		try {
600
+			try {
601 601
 			
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':ident' => $ident));
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
 		return $spotter_array;
611 611
 	}
612 612
 
613
-        /**
614
-	* Gets all the spotter information based on a particular id
615
-	*
616
-	* @return Array the spotter information
617
-	*
618
-	*/
613
+		/**
614
+		 * Gets all the spotter information based on a particular id
615
+		 *
616
+		 * @return Array the spotter information
617
+		 *
618
+		 */
619 619
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
620 620
 	{
621 621
 		global $globalDBdriver, $globalLiveInterval;
@@ -643,18 +643,18 @@  discard block
 block discarded – undo
643 643
 		return $spotter_array;
644 644
 	}
645 645
 
646
-        /**
647
-	* Gets all the spotter information based on a particular ident
648
-	*
649
-	* @return Array the spotter information
650
-	*
651
-	*/
646
+		/**
647
+		 * Gets all the spotter information based on a particular ident
648
+		 *
649
+		 * @return Array the spotter information
650
+		 *
651
+		 */
652 652
 	public function getAllLiveSpotterDataByIdent($ident)
653 653
 	{
654 654
 		date_default_timezone_set('UTC');
655 655
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
656 656
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
657
-    		try {
657
+			try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
@@ -668,23 +668,23 @@  discard block
 block discarded – undo
668 668
 
669 669
 
670 670
 	/**
671
-	* Deletes all info in the table
672
-	*
673
-	* @return String success or false
674
-	*
675
-	*/
671
+	 * Deletes all info in the table
672
+	 *
673
+	 * @return String success or false
674
+	 *
675
+	 */
676 676
 	public function deleteLiveSpotterData()
677 677
 	{
678 678
 		global $globalDBdriver;
679 679
 		if ($globalDBdriver == 'mysql') {
680 680
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
681 681
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
682
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
682
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
683 683
 		} else {
684 684
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
685 685
 		}
686 686
         
687
-    		try {
687
+			try {
688 688
 			
689 689
 			$sth = $this->db->prepare($query);
690 690
 			$sth->execute();
@@ -696,18 +696,18 @@  discard block
 block discarded – undo
696 696
 	}
697 697
 
698 698
 	/**
699
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
700
-	*
701
-	* @return String success or false
702
-	*
703
-	*/
699
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
700
+	 *
701
+	 * @return String success or false
702
+	 *
703
+	 */
704 704
 	public function deleteLiveSpotterDataNotUpdated()
705 705
 	{
706 706
 		global $globalDBdriver, $globalDebug;
707 707
 		if ($globalDBdriver == 'mysql') {
708 708
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
709
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
710
-    			try {
709
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
710
+				try {
711 711
 				
712 712
 				$sth = $this->db->prepare($query);
713 713
 				$sth->execute();
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 				return "error";
716 716
 			}
717 717
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
718
-                        $i = 0;
719
-                        $j =0;
718
+						$i = 0;
719
+						$j =0;
720 720
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
721 721
 			foreach($all as $row)
722 722
 			{
@@ -724,20 +724,20 @@  discard block
 block discarded – undo
724 724
 				$j++;
725 725
 				if ($j == 30) {
726 726
 					if ($globalDebug) echo ".";
727
-				    	try {
727
+						try {
728 728
 						
729 729
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
730 730
 						$sth->execute();
731 731
 					} catch(PDOException $e) {
732 732
 						return "error";
733 733
 					}
734
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
735
-                                	$j = 0;
734
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
735
+									$j = 0;
736 736
 				}
737 737
 				$query_delete .= "'".$row['flightaware_id']."',";
738 738
 			}
739 739
 			if ($i > 0) {
740
-    				try {
740
+					try {
741 741
 					
742 742
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
743 743
 					$sth->execute();
@@ -748,9 +748,9 @@  discard block
 block discarded – undo
748 748
 			return "success";
749 749
 		} elseif ($globalDBdriver == 'pgsql') {
750 750
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
751
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
752
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
753
-    			try {
751
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
752
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
753
+				try {
754 754
 				
755 755
 				$sth = $this->db->prepare($query);
756 756
 				$sth->execute();
@@ -794,17 +794,17 @@  discard block
 block discarded – undo
794 794
 	}
795 795
 
796 796
 	/**
797
-	* Deletes all info in the table for an ident
798
-	*
799
-	* @return String success or false
800
-	*
801
-	*/
797
+	 * Deletes all info in the table for an ident
798
+	 *
799
+	 * @return String success or false
800
+	 *
801
+	 */
802 802
 	public function deleteLiveSpotterDataByIdent($ident)
803 803
 	{
804 804
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
805 805
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
806 806
         
807
-    		try {
807
+			try {
808 808
 			
809 809
 			$sth = $this->db->prepare($query);
810 810
 			$sth->execute(array(':ident' => $ident));
@@ -816,17 +816,17 @@  discard block
 block discarded – undo
816 816
 	}
817 817
 
818 818
 	/**
819
-	* Deletes all info in the table for an id
820
-	*
821
-	* @return String success or false
822
-	*
823
-	*/
819
+	 * Deletes all info in the table for an id
820
+	 *
821
+	 * @return String success or false
822
+	 *
823
+	 */
824 824
 	public function deleteLiveSpotterDataById($id)
825 825
 	{
826 826
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
827 827
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
828 828
         
829
-    		try {
829
+			try {
830 830
 			
831 831
 			$sth = $this->db->prepare($query);
832 832
 			$sth->execute(array(':id' => $id));
@@ -839,11 +839,11 @@  discard block
 block discarded – undo
839 839
 
840 840
 
841 841
 	/**
842
-	* Gets the aircraft ident within the last hour
843
-	*
844
-	* @return String the ident
845
-	*
846
-	*/
842
+	 * Gets the aircraft ident within the last hour
843
+	 *
844
+	 * @return String the ident
845
+	 *
846
+	 */
847 847
 	public function getIdentFromLastHour($ident)
848 848
 	{
849 849
 		global $globalDBdriver, $globalTimezone;
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 			$ident_result = $row['ident'];
870 870
 		}
871 871
 		return $ident_result;
872
-        }
872
+		}
873 873
 
874 874
 	/**
875
-	* Check recent aircraft
876
-	*
877
-	* @return String the ident
878
-	*
879
-	*/
875
+	 * Check recent aircraft
876
+	 *
877
+	 * @return String the ident
878
+	 *
879
+	 */
880 880
 	public function checkIdentRecent($ident)
881 881
 	{
882 882
 		global $globalDBdriver, $globalTimezone;
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
 			$ident_result = $row['flightaware_id'];
903 903
 		}
904 904
 		return $ident_result;
905
-        }
905
+		}
906 906
 
907 907
 	/**
908
-	* Check recent aircraft by id
909
-	*
910
-	* @return String the ident
911
-	*
912
-	*/
908
+	 * Check recent aircraft by id
909
+	 *
910
+	 * @return String the ident
911
+	 *
912
+	 */
913 913
 	public function checkIdRecent($id)
914 914
 	{
915 915
 		global $globalDBdriver, $globalTimezone;
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 			$ident_result = $row['flightaware_id'];
936 936
 		}
937 937
 		return $ident_result;
938
-        }
938
+		}
939 939
 
940 940
 	/**
941
-	* Check recent aircraft by ModeS
942
-	*
943
-	* @return String the ModeS
944
-	*
945
-	*/
941
+	 * Check recent aircraft by ModeS
942
+	 *
943
+	 * @return String the ModeS
944
+	 *
945
+	 */
946 946
 	public function checkModeSRecent($modes)
947 947
 	{
948 948
 		global $globalDBdriver, $globalTimezone;
@@ -972,11 +972,11 @@  discard block
 block discarded – undo
972 972
 	}
973 973
 
974 974
 	/**
975
-	* Gets the aircraft data from the last 20 seconds
976
-	*
977
-	* @return Array the spotter data
978
-	*
979
-	*/
975
+	 * Gets the aircraft data from the last 20 seconds
976
+	 *
977
+	 * @return Array the spotter data
978
+	 *
979
+	 */
980 980
 	public function getRealTimeData($q = '')
981 981
 	{
982 982
 		global $globalDBdriver;
@@ -1018,16 +1018,16 @@  discard block
 block discarded – undo
1018 1018
 	}
1019 1019
 
1020 1020
 	/**
1021
-	* Adds a new spotter data
1022
-	*
1023
-	* @param String $flightaware_id the ID from flightaware
1024
-	* @param String $ident the flight ident
1025
-	* @param String $aircraft_icao the aircraft type
1026
-	* @param String $departure_airport_icao the departure airport
1027
-	* @param String $arrival_airport_icao the arrival airport
1028
-	* @return String success or false
1029
-	*
1030
-	*/
1021
+	 * Adds a new spotter data
1022
+	 *
1023
+	 * @param String $flightaware_id the ID from flightaware
1024
+	 * @param String $ident the flight ident
1025
+	 * @param String $aircraft_icao the aircraft type
1026
+	 * @param String $departure_airport_icao the departure airport
1027
+	 * @param String $arrival_airport_icao the arrival airport
1028
+	 * @return String success or false
1029
+	 *
1030
+	 */
1031 1031
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1032 1032
 	{
1033 1033
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 		$arrival_airport_country = '';
1171 1171
 		
1172 1172
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1173
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1177 1177
 		
1178 1178
 		$query = '';
1179 1179
 		if ($globalArchive) {
@@ -1194,10 +1194,10 @@  discard block
 block discarded – undo
1194 1194
 			return "error : ".$e->getMessage();
1195 1195
 		}
1196 1196
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1198
-		    $SpotterArchive = new SpotterArchive($this->db);
1199
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1200
-		    if ($globalDebug) echo $result.')';
1197
+			if ($globalDebug) echo '(Add to SBS archive : ';
1198
+			$SpotterArchive = new SpotterArchive($this->db);
1199
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1200
+			if ($globalDebug) echo $result.')';
1201 1201
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1202
 			echo '(Not adding to archive)';
1203 1203
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41 41
 					} else {
42
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56 56
 				} else {
57
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63 63
 				} else {
64
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
65 65
 				}
66 66
 			}
67 67
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
86 86
 		}
87 87
 		if (isset($filter['source']) && !empty($filter['source'])) {
88 88
 			if (count($filter['source']) == 1) {
89 89
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
90 90
 			} else {
91
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
91
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
92 92
 			}
93 93
 		}
94 94
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
122 122
 				}
123 123
 			}
124
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
124
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
125 125
 		}
126 126
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
127
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
128 128
 		}
129 129
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130 130
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
131 131
 		if ($filter_query_where != '') {
132
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
132
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
133 133
 		}
134 134
 		$filter_query = $filter_query_join.$filter_query_where;
135 135
 		return $filter_query;
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		if ($limit != '')
153 153
 		{
154 154
 			$limit_array = explode(',', $limit);
155
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
156
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
155
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
156
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
157 157
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
158 158
 			{
159 159
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		} else {
178 178
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
179 179
 		}
180
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
180
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
181 181
 
182 182
 		return $spotter_array;
183 183
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	{
193 193
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 194
 		date_default_timezone_set('UTC');
195
-		$filter_query = $this->getFilter($filter,true,true);
195
+		$filter_query = $this->getFilter($filter, true, true);
196 196
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197 197
 		if ($globalDBdriver == 'mysql') {
198 198
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		try {
216 216
 			$sth = $this->db->prepare($query);
217 217
 			$sth->execute();
218
-		} catch(PDOException $e) {
218
+		} catch (PDOException $e) {
219 219
 			echo $e->getMessage();
220 220
 			die;
221 221
 		}
@@ -229,20 +229,20 @@  discard block
 block discarded – undo
229 229
 	* @return Array the spotter information
230 230
 	*
231 231
 	*/
232
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
232
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '')
233 233
 	{
234 234
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
235 235
 		date_default_timezone_set('UTC');
236 236
 		$usecoord = false;
237 237
 		if (is_array($coord) && !empty($coord)) {
238
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
239
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
240
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
241
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
238
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
239
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
240
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
241
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
242 242
 			$usecoord = true;
243 243
 		}
244
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
245
-		$filter_query = $this->getFilter($filter,true,true);
244
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
245
+		$filter_query = $this->getFilter($filter, true, true);
246 246
 
247 247
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248 248
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
255 255
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
256 256
 				*/
257
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
257
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
258 258
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259 259
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260 260
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				ORDER BY flightaware_id, date";
269 269
 				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
270 270
 			} else {
271
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
271
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
272 272
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273 273
 				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274 274
 				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
285 285
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
286 286
                                */
287
-				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
287
+				$query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
288 288
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289 289
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290 290
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		try {
312 312
 			$sth = $this->db->prepare($query);
313 313
 			$sth->execute($query_values);
314
-		} catch(PDOException $e) {
314
+		} catch (PDOException $e) {
315 315
 			echo $e->getMessage();
316 316
 			die;
317 317
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	public function getLiveSpotterCount($filter = array())
329 329
 	{
330 330
 		global $globalDBdriver, $globalLiveInterval;
331
-		$filter_query = $this->getFilter($filter,true,true);
331
+		$filter_query = $this->getFilter($filter, true, true);
332 332
 
333 333
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
334 334
 		if ($globalDBdriver == 'mysql') {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 		try {
342 342
 			$sth = $this->db->prepare($query);
343 343
 			$sth->execute();
344
-		} catch(PDOException $e) {
344
+		} catch (PDOException $e) {
345 345
 			echo $e->getMessage();
346 346
 			die;
347 347
 		}
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 		$filter_query = $this->getFilter($filter);
365 365
 
366 366
 		if (is_array($coord)) {
367
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
368
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
367
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
368
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
369
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
370
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
371 371
 		} else return array();
372 372
 		if ($globalDBdriver == 'mysql') {
373 373
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -390,23 +390,23 @@  discard block
 block discarded – undo
390 390
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 391
 		$Spotter = new Spotter($this->db);
392 392
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
393
-		$filter_query = $this->getFilter($filter,true,true);
393
+		$filter_query = $this->getFilter($filter, true, true);
394 394
 
395 395
 		if (is_array($coord)) {
396
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
397
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
396
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
397
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
398
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
399
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
400 400
 		} else return array();
401 401
 		if ($globalDBdriver == 'mysql') {
402 402
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
403
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
404 404
 				FROM spotter_live 
405 405
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
406 406
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
407 407
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0';
408 408
 			} else {
409
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
409
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
410 410
 				FROM spotter_live 
411 411
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
412 412
 				    FROM spotter_live l 
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 			}
419 419
 		} else {
420 420
 			if (isset($globalArchive) && $globalArchive === TRUE) {
421
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
421
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
422 422
 				FROM spotter_live 
423 423
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
424 424
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
425 425
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
426 426
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
427 427
 			} else {
428
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
428
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
429 429
 				FROM spotter_live 
430 430
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
431 431
 				    FROM spotter_live l 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		try {
441 441
 			$sth = $this->db->prepare($query);
442 442
 			$sth->execute();
443
-		} catch(PDOException $e) {
443
+		} catch (PDOException $e) {
444 444
 			echo $e->getMessage();
445 445
 			die;
446 446
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 if ($interval == '1m')
490 490
                 {
491 491
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
492
-                } else if ($interval == '15m'){
492
+                } else if ($interval == '15m') {
493 493
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
494 494
                 } 
495 495
             }
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
498 498
         }
499 499
 
500
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
500
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
501 501
                    WHERE spotter_live.latitude <> '' 
502 502
                                    AND spotter_live.longitude <> '' 
503 503
                    ".$additional_query."
504 504
                    HAVING distance < :radius  
505 505
                                    ORDER BY distance";
506 506
 
507
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
507
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
508 508
 
509 509
                 return $spotter_array;
510 510
         }
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 		date_default_timezone_set('UTC');
523 523
 
524 524
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
525
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
525
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526 526
 
527
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
527
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
528 528
 
529 529
 		return $spotter_array;
530 530
 	}
@@ -535,16 +535,16 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getDateLiveSpotterDataByIdent($ident,$date)
538
+	public function getDateLiveSpotterDataByIdent($ident, $date)
539 539
 	{
540 540
 		$Spotter = new Spotter($this->db);
541 541
 		date_default_timezone_set('UTC');
542 542
 
543 543
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
544
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
544
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
545 545
 
546
-                $date = date('c',$date);
547
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
546
+                $date = date('c', $date);
547
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
548 548
 
549 549
 		return $spotter_array;
550 550
 	}
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 		$Spotter = new Spotter($this->db);
561 561
 		date_default_timezone_set('UTC');
562 562
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
563
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
564
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
563
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
564
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 	* @return Array the spotter information
572 572
 	*
573 573
 	*/
574
-	public function getDateLiveSpotterDataById($id,$date)
574
+	public function getDateLiveSpotterDataById($id, $date)
575 575
 	{
576 576
 		$Spotter = new Spotter($this->db);
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
580
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
581
-		$date = date('c',$date);
582
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
580
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
581
+		$date = date('c', $date);
582
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
583 583
 		return $spotter_array;
584 584
 	}
585 585
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 		date_default_timezone_set('UTC');
596 596
 
597 597
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
598
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
598
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
599 599
 
600 600
     		try {
601 601
 			
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':ident' => $ident));
604
-		} catch(PDOException $e) {
604
+		} catch (PDOException $e) {
605 605
 			echo $e->getMessage();
606 606
 			die;
607 607
 		}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	* @return Array the spotter information
617 617
 	*
618 618
 	*/
619
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
619
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
620 620
 	{
621 621
 		global $globalDBdriver, $globalLiveInterval;
622 622
 		date_default_timezone_set('UTC');
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		try {
636 636
 			$sth = $this->db->prepare($query);
637 637
 			$sth->execute(array(':id' => $id));
638
-		} catch(PDOException $e) {
638
+		} catch (PDOException $e) {
639 639
 			echo $e->getMessage();
640 640
 			die;
641 641
 		}
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 	{
654 654
 		date_default_timezone_set('UTC');
655 655
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
656
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
656
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
657 657
     		try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
661
-		} catch(PDOException $e) {
661
+		} catch (PDOException $e) {
662 662
 			echo $e->getMessage();
663 663
 			die;
664 664
 		}
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 			
689 689
 			$sth = $this->db->prepare($query);
690 690
 			$sth->execute();
691
-		} catch(PDOException $e) {
691
+		} catch (PDOException $e) {
692 692
 			return "error";
693 693
 		}
694 694
 
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 				
712 712
 				$sth = $this->db->prepare($query);
713 713
 				$sth->execute();
714
-			} catch(PDOException $e) {
714
+			} catch (PDOException $e) {
715 715
 				return "error";
716 716
 			}
717 717
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
718 718
                         $i = 0;
719
-                        $j =0;
719
+                        $j = 0;
720 720
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
721
-			foreach($all as $row)
721
+			foreach ($all as $row)
722 722
 			{
723 723
 				$i++;
724 724
 				$j++;
@@ -726,9 +726,9 @@  discard block
 block discarded – undo
726 726
 					if ($globalDebug) echo ".";
727 727
 				    	try {
728 728
 						
729
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
729
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
730 730
 						$sth->execute();
731
-					} catch(PDOException $e) {
731
+					} catch (PDOException $e) {
732 732
 						return "error";
733 733
 					}
734 734
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 			if ($i > 0) {
740 740
     				try {
741 741
 					
742
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
742
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
743 743
 					$sth->execute();
744
-				} catch(PDOException $e) {
744
+				} catch (PDOException $e) {
745 745
 					return "error";
746 746
 				}
747 747
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 				
755 755
 				$sth = $this->db->prepare($query);
756 756
 				$sth->execute();
757
-			} catch(PDOException $e) {
757
+			} catch (PDOException $e) {
758 758
 				return "error";
759 759
 			}
760 760
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 	public function deleteLiveSpotterDataByIdent($ident)
803 803
 	{
804 804
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
805
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
805
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
806 806
         
807 807
     		try {
808 808
 			
809 809
 			$sth = $this->db->prepare($query);
810 810
 			$sth->execute(array(':ident' => $ident));
811
-		} catch(PDOException $e) {
811
+		} catch (PDOException $e) {
812 812
 			return "error";
813 813
 		}
814 814
 
@@ -824,13 +824,13 @@  discard block
 block discarded – undo
824 824
 	public function deleteLiveSpotterDataById($id)
825 825
 	{
826 826
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
827
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
827
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
828 828
         
829 829
     		try {
830 830
 			
831 831
 			$sth = $this->db->prepare($query);
832 832
 			$sth->execute(array(':id' => $id));
833
-		} catch(PDOException $e) {
833
+		} catch (PDOException $e) {
834 834
 			return "error";
835 835
 		}
836 836
 
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 	{
849 849
 		global $globalDBdriver, $globalTimezone;
850 850
 		if ($globalDBdriver == 'mysql') {
851
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
851
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
852 852
 				WHERE spotter_live.ident = :ident 
853 853
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
854 854
 				AND spotter_live.date < UTC_TIMESTAMP()';
855 855
 			$query_data = array(':ident' => $ident);
856 856
 		} else {
857
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
857
+			$query = "SELECT spotter_live.ident FROM spotter_live 
858 858
 				WHERE spotter_live.ident = :ident 
859 859
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
860 860
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 		
864 864
 		$sth = $this->db->prepare($query);
865 865
 		$sth->execute($query_data);
866
-		$ident_result='';
867
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
866
+		$ident_result = '';
867
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
868 868
 		{
869 869
 			$ident_result = $row['ident'];
870 870
 		}
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 	{
882 882
 		global $globalDBdriver, $globalTimezone;
883 883
 		if ($globalDBdriver == 'mysql') {
884
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
884
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
885 885
 				WHERE spotter_live.ident = :ident 
886 886
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
887 887
 //				AND spotter_live.date < UTC_TIMESTAMP()";
888 888
 			$query_data = array(':ident' => $ident);
889 889
 		} else {
890
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
890
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
891 891
 				WHERE spotter_live.ident = :ident 
892 892
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
893 893
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
 		
897 897
 		$sth = $this->db->prepare($query);
898 898
 		$sth->execute($query_data);
899
-		$ident_result='';
900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
899
+		$ident_result = '';
900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
901 901
 		{
902 902
 			$ident_result = $row['flightaware_id'];
903 903
 		}
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 	{
915 915
 		global $globalDBdriver, $globalTimezone;
916 916
 		if ($globalDBdriver == 'mysql') {
917
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
917
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
918 918
 				WHERE spotter_live.flightaware_id = :id 
919 919
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
920 920
 //				AND spotter_live.date < UTC_TIMESTAMP()";
921 921
 			$query_data = array(':id' => $id);
922 922
 		} else {
923
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
923
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
924 924
 				WHERE spotter_live.flightaware_id = :id 
925 925
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
926 926
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 		
930 930
 		$sth = $this->db->prepare($query);
931 931
 		$sth->execute($query_data);
932
-		$ident_result='';
933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
932
+		$ident_result = '';
933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
934 934
 		{
935 935
 			$ident_result = $row['flightaware_id'];
936 936
 		}
@@ -947,13 +947,13 @@  discard block
 block discarded – undo
947 947
 	{
948 948
 		global $globalDBdriver, $globalTimezone;
949 949
 		if ($globalDBdriver == 'mysql') {
950
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
950
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
951 951
 				WHERE spotter_live.ModeS = :modes 
952 952
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
953 953
 //				AND spotter_live.date < UTC_TIMESTAMP()";
954 954
 			$query_data = array(':modes' => $modes);
955 955
 		} else {
956
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
956
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
957 957
 				WHERE spotter_live.ModeS = :modes 
958 958
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
959 959
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 		
963 963
 		$sth = $this->db->prepare($query);
964 964
 		$sth->execute($query_data);
965
-		$ident_result='';
966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
965
+		$ident_result = '';
966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
967 967
 		{
968 968
 			//$ident_result = $row['spotter_live_id'];
969 969
 			$ident_result = $row['flightaware_id'];
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 				return array();
989 989
 			} else {
990 990
 				$q_array = explode(" ", $q);
991
-				foreach ($q_array as $q_item){
992
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
991
+				foreach ($q_array as $q_item) {
992
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
993 993
 					$additional_query .= " AND (";
994 994
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
995 995
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 			}
1005 1005
 		}
1006 1006
 		if ($globalDBdriver == 'mysql') {
1007
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1007
+			$query = "SELECT spotter_live.* FROM spotter_live 
1008 1008
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
1009 1009
 			    AND spotter_live.date < UTC_TIMESTAMP()";
1010 1010
 		} else {
1011
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1011
+			$query = "SELECT spotter_live.* FROM spotter_live 
1012 1012
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1013 1013
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1014 1014
 		}
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 	* @return String success or false
1029 1029
 	*
1030 1030
 	*/
1031
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1031
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
1032 1032
 	{
1033 1033
 		global $globalURL, $globalArchive, $globalDebug;
1034 1034
 		$Common = new Common();
@@ -1128,27 +1128,27 @@  discard block
 block discarded – undo
1128 1128
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1129 1129
 
1130 1130
         
1131
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1132
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1133
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1134
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1135
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1136
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1137
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1138
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1139
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1140
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1141
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1142
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1143
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1144
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1145
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1146
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1147
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1148
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1149
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1150
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1151
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1131
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1132
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1133
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1134
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1135
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1136
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1137
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1138
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1139
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1140
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1141
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1142
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1143
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1144
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1145
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1146
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1147
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1148
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1149
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1150
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1151
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1152 1152
 
1153 1153
 		$airline_name = '';
1154 1154
 		$airline_icao = '';
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 		$arrival_airport_country = '';
1171 1171
 		
1172 1172
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1173
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1174
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1175
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1176
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1177 1177
 		
1178 1178
 		$query = '';
1179 1179
 		if ($globalArchive) {
@@ -1184,19 +1184,19 @@  discard block
 block discarded – undo
1184 1184
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1185 1185
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1186 1186
 
1187
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1187
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1188 1188
 		try {
1189 1189
 			
1190 1190
 			$sth = $this->db->prepare($query);
1191 1191
 			$sth->execute($query_values);
1192 1192
 			$sth->closeCursor();
1193
-		} catch(PDOException $e) {
1193
+		} catch (PDOException $e) {
1194 1194
 			return "error : ".$e->getMessage();
1195 1195
 		}
1196 1196
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197 1197
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1198 1198
 		    $SpotterArchive = new SpotterArchive($this->db);
1199
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1199
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1200 1200
 		    if ($globalDebug) echo $result.')';
1201 1201
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1202
 			echo '(Not adding to archive)';
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 	public function getOrderBy()
1211 1211
 	{
1212
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1212
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1213 1213
 		return $orderby;
1214 1214
 	}
1215 1215
 
Please login to merge, or discard this patch.
Braces   +143 added lines, -48 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (SpotterLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (SpotterLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -126,8 +130,11 @@  discard block
 block discarded – undo
126 130
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127 131
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
128 132
 		}
129
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
133
+		if ($filter_query_where == '' && $where) {
134
+			$filter_query_where = ' WHERE';
135
+		} elseif ($filter_query_where != '' && $and) {
136
+			$filter_query_where .= ' AND';
137
+		}
131 138
 		if ($filter_query_where != '') {
132 139
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
133 140
 		}
@@ -168,9 +175,13 @@  discard block
 block discarded – undo
168 175
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
169 176
 			}
170 177
 		}
171
-		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
178
+		if ($orderby_query == '') {
179
+			$orderby_query = ' ORDER BY date DESC';
180
+		}
172 181
 
173
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
182
+		if (!isset($globalLiveInterval)) {
183
+			$globalLiveInterval = '200';
184
+		}
174 185
 		if ($globalDBdriver == 'mysql') {
175 186
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
176 187
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -193,7 +204,9 @@  discard block
 block discarded – undo
193 204
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 205
 		date_default_timezone_set('UTC');
195 206
 		$filter_query = $this->getFilter($filter,true,true);
196
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
207
+		if (!isset($globalLiveInterval)) {
208
+			$globalLiveInterval = '200';
209
+		}
197 210
 		if ($globalDBdriver == 'mysql') {
198 211
 			if (isset($globalArchive) && $globalArchive === TRUE) {
199 212
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -244,8 +257,12 @@  discard block
 block discarded – undo
244 257
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
245 258
 		$filter_query = $this->getFilter($filter,true,true);
246 259
 
247
-		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248
-		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
260
+		if (!isset($globalLiveInterval) || $globalLiveInterval == '') {
261
+			$globalLiveInterval = '200';
262
+		}
263
+		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') {
264
+			$globalMap3DAircraftsLimit = '300';
265
+		}
249 266
 		if ($globalDBdriver == 'mysql') {
250 267
 			if (isset($globalArchive) && $globalArchive === TRUE) {
251 268
 				/*
@@ -256,25 +273,41 @@  discard block
 block discarded – undo
256 273
 				*/
257 274
 				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
258 275
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
276
+				if ($usecoord) {
277
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
278
+				}
279
+				if ($id != '') {
280
+					$query .= "OR spotter_archive.flightaware_id = :id ";
281
+				}
261 282
 				$query .= "UNION
262 283
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
263 284
 				FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date";
264
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
265
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
285
+				if ($usecoord) {
286
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
287
+				}
288
+				if ($id != '') {
289
+					$query .= " OR spotter_live.flightaware_id = :id";
290
+				}
266 291
 				$query .= ") AS spotter 
267 292
 				WHERE latitude <> '0' AND longitude <> '0' 
268 293
 				ORDER BY flightaware_id, date";
269
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
294
+				if ($limit) {
295
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
296
+				}
270 297
 			} else {
271 298
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
272 299
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
300
+				if ($usecoord) {
301
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
302
+				}
303
+				if ($id != '') {
304
+					$query .= "OR spotter_live.flightaware_id = :id ";
305
+				}
275 306
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
276 307
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
277
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
308
+				if ($limit) {
309
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
310
+				}
278 311
 			}
279 312
 		} else {
280 313
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -286,28 +319,46 @@  discard block
 block discarded – undo
286 319
                                */
287 320
 				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
288 321
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
322
+				if ($usecoord) {
323
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
324
+				}
325
+				if ($id != '') {
326
+					$query .= "OR spotter_archive.flightaware_id = :id ";
327
+				}
291 328
 				$query .= "UNION
292 329
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
293 330
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
294
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
295
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
331
+				if ($usecoord) {
332
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
333
+				}
334
+				if ($id != '') {
335
+					$query .= " OR spotter_live.flightaware_id = :id";
336
+				}
296 337
 				$query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' ";
297 338
 				$query .= "ORDER BY flightaware_id, date";
298
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
339
+				if ($limit) {
340
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
341
+				}
299 342
 			} else {
300 343
 				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
301 344
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date ";
302
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
303
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
345
+				if ($usecoord) {
346
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
347
+				}
348
+				if ($id != '') {
349
+					$query .= "OR spotter_live.flightaware_id = :id ";
350
+				}
304 351
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
305 352
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
306
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
353
+				if ($limit) {
354
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
355
+				}
307 356
 			}
308 357
 		}
309 358
 		$query_values = array();
310
-		if ($id != '') $query_values = array(':id' => $id);
359
+		if ($id != '') {
360
+			$query_values = array(':id' => $id);
361
+		}
311 362
 		try {
312 363
 			$sth = $this->db->prepare($query);
313 364
 			$sth->execute($query_values);
@@ -330,7 +381,9 @@  discard block
 block discarded – undo
330 381
 		global $globalDBdriver, $globalLiveInterval;
331 382
 		$filter_query = $this->getFilter($filter,true,true);
332 383
 
333
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
384
+		if (!isset($globalLiveInterval)) {
385
+			$globalLiveInterval = '200';
386
+		}
334 387
 		if ($globalDBdriver == 'mysql') {
335 388
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
336 389
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -360,7 +413,9 @@  discard block
 block discarded – undo
360 413
 	{
361 414
 		global $globalDBdriver, $globalLiveInterval;
362 415
 		$Spotter = new Spotter($this->db);
363
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
416
+		if (!isset($globalLiveInterval)) {
417
+			$globalLiveInterval = '200';
418
+		}
364 419
 		$filter_query = $this->getFilter($filter);
365 420
 
366 421
 		if (is_array($coord)) {
@@ -368,7 +423,9 @@  discard block
 block discarded – undo
368 423
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369 424
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370 425
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
371
-		} else return array();
426
+		} else {
427
+			return array();
428
+		}
372 429
 		if ($globalDBdriver == 'mysql') {
373 430
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
374 431
 		} else {
@@ -389,7 +446,9 @@  discard block
 block discarded – undo
389 446
 	{
390 447
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 448
 		$Spotter = new Spotter($this->db);
392
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
449
+		if (!isset($globalLiveInterval)) {
450
+			$globalLiveInterval = '200';
451
+		}
393 452
 		$filter_query = $this->getFilter($filter,true,true);
394 453
 
395 454
 		if (is_array($coord)) {
@@ -397,7 +456,9 @@  discard block
 block discarded – undo
397 456
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398 457
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399 458
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
400
-		} else return array();
459
+		} else {
460
+			return array();
461
+		}
401 462
 		if ($globalDBdriver == 'mysql') {
402 463
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403 464
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -624,11 +685,15 @@  discard block
 block discarded – undo
624 685
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
625 686
 		if ($globalDBdriver == 'mysql') {
626 687
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
627
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
688
+			if ($liveinterval) {
689
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
690
+			}
628 691
 			$query .= ' ORDER BY date';
629 692
 		} else {
630 693
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
631
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
694
+			if ($liveinterval) {
695
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
696
+			}
632 697
 			$query .= ' ORDER BY date';
633 698
 		}
634 699
 
@@ -723,7 +788,9 @@  discard block
 block discarded – undo
723 788
 				$i++;
724 789
 				$j++;
725 790
 				if ($j == 30) {
726
-					if ($globalDebug) echo ".";
791
+					if ($globalDebug) {
792
+						echo ".";
793
+					}
727 794
 				    	try {
728 795
 						
729 796
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1076,7 +1143,9 @@  discard block
 block discarded – undo
1076 1143
 			{
1077 1144
 				return false;
1078 1145
 			}
1079
-		} else return '';
1146
+		} else {
1147
+			return '';
1148
+		}
1080 1149
 
1081 1150
 		if ($longitude != '')
1082 1151
 		{
@@ -1084,7 +1153,9 @@  discard block
 block discarded – undo
1084 1153
 			{
1085 1154
 				return false;
1086 1155
 			}
1087
-		} else return '';
1156
+		} else {
1157
+			return '';
1158
+		}
1088 1159
 
1089 1160
 		if ($waypoints != '')
1090 1161
 		{
@@ -1100,14 +1171,18 @@  discard block
 block discarded – undo
1100 1171
 			{
1101 1172
 				return false;
1102 1173
 			}
1103
-		} else $altitude = 0;
1174
+		} else {
1175
+			$altitude = 0;
1176
+		}
1104 1177
 		if ($altitude_real != '')
1105 1178
 		{
1106 1179
 			if (!is_numeric($altitude_real))
1107 1180
 			{
1108 1181
 				return false;
1109 1182
 			}
1110
-		} else $altitude_real = 0;
1183
+		} else {
1184
+			$altitude_real = 0;
1185
+		}
1111 1186
 
1112 1187
 		if ($heading != '')
1113 1188
 		{
@@ -1115,7 +1190,9 @@  discard block
 block discarded – undo
1115 1190
 			{
1116 1191
 				return false;
1117 1192
 			}
1118
-		} else $heading = 0;
1193
+		} else {
1194
+			$heading = 0;
1195
+		}
1119 1196
 
1120 1197
 		if ($groundspeed != '')
1121 1198
 		{
@@ -1123,9 +1200,13 @@  discard block
 block discarded – undo
1123 1200
 			{
1124 1201
 				return false;
1125 1202
 			}
1126
-		} else $groundspeed = 0;
1203
+		} else {
1204
+			$groundspeed = 0;
1205
+		}
1127 1206
 		date_default_timezone_set('UTC');
1128
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1207
+		if ($date == '') {
1208
+			$date = date("Y-m-d H:i:s", time());
1209
+		}
1129 1210
 
1130 1211
         
1131 1212
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1170,14 +1251,24 @@  discard block
 block discarded – undo
1170 1251
 		$arrival_airport_country = '';
1171 1252
 		
1172 1253
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1254
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1255
+            		$squawk = NULL;
1256
+            	}
1257
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1258
+            		$verticalrate = NULL;
1259
+            	}
1260
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1261
+            		$groundspeed = 0;
1262
+            	}
1263
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1264
+            		$heading = 0;
1265
+            	}
1177 1266
 		
1178 1267
 		$query = '';
1179 1268
 		if ($globalArchive) {
1180
-			if ($globalDebug) echo '-- Delete previous data -- ';
1269
+			if ($globalDebug) {
1270
+				echo '-- Delete previous data -- ';
1271
+			}
1181 1272
 			$query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;';
1182 1273
 		}
1183 1274
 
@@ -1194,10 +1285,14 @@  discard block
 block discarded – undo
1194 1285
 			return "error : ".$e->getMessage();
1195 1286
 		}
1196 1287
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1288
+		    if ($globalDebug) {
1289
+		    	echo '(Add to SBS archive : ';
1290
+		    }
1198 1291
 		    $SpotterArchive = new SpotterArchive($this->db);
1199 1292
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1200
-		    if ($globalDebug) echo $result.')';
1293
+		    if ($globalDebug) {
1294
+		    	echo $result.')';
1295
+		    }
1201 1296
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1297
 			echo '(Not adding to archive)';
1203 1298
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
flightid-sub-menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 		<?php if ($globalFlightAware) { ?>
8 8
 		<li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>" target="_blank"><?php echo _("Flight Status"); ?>&raquo;</a></li>
9 9
 		<li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>/tracklog" target="_blank"><?php echo _("Flight Log"); ?>&raquo;</a></li>
Please login to merge, or discard this patch.
aircraft-sub-menu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration"){ print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration") { print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li>
8 8
 		<li class="dropdown">
9
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
10 10
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
11 11
 		    </a>
12 12
 		    <ul class="dropdown-menu" role="menu">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		    </ul>
16 16
 		</li>
17 17
 		<li class="dropdown">
18
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
18
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
19 19
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 20
 		    </a>
21 21
 		    <ul class="dropdown-menu" role="menu">
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			  <li><a href="<?php print $globalURL; ?>/aircraft/statistics/arrival-airport-country/<?php print $aircraft_type; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 26
 		    </ul>
27 27
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time"){ print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li>
28
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time") { print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li>
30 30
 	</ul>
31 31
 </div>
32 32
\ No newline at end of file
Please login to merge, or discard this patch.