Completed
Push — master ( 416413...2c5ccc )
by Yannick
16:48 queued 08:22
created
statistics-year.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
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
 }
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	</div>
20 20
       <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>';
21 21
 
22
-$date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
22
+$date_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
23 23
 print '<div id="chart" class="chart" width="100%"></div>
24 24
       	<script> 
25 25
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             	["'._("Month").'", "'._("# of Flights").'"], ';
30 30
 
31 31
 $date_data = '';
32
-foreach($date_array as $date_item)
32
+foreach ($date_array as $date_item)
33 33
 {
34 34
 	$date_data .= '[ "'.date("F, Y", strtotime($date_item['year_name'].'-'.$date_item['month_name'].'-01')).'",'.$date_item['date_count'].'],';
35 35
 }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	print '</thead>';
67 67
 	print '<tbody>';
68 68
 	$i = 1;
69
-	foreach($date_array as $date_item)
69
+	foreach ($date_array as $date_item)
70 70
 	{
71 71
 		print '<tr>';
72 72
 		print '<td><strong>'.$i.'</strong></td>';
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").' - '._("Busiest Month of Last Year");
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
 require_once('header.php');
15 19
 include('statistics-sub-menu.php');
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
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
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.
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'); 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		 </div>
24 24
     	<p>'._("Below are the <strong>Top 10</strong> most common aircraft manufacturers.").'</p>';
25 25
  
26
-$manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline_icao,$filter_name,$year,$month);
26
+$manufacturers_array = $Stats->countAllAircraftManufacturers(true, $airline_icao, $filter_name, $year, $month);
27 27
 print '<div id="chart" class="chart" width="100%"></div>
28 28
       	<script> 
29 29
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             var data = google.visualization.arrayToDataTable([
33 33
             	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
34 34
 $manufacturer_data = '';
35
-foreach($manufacturers_array as $manufacturer_item)
35
+foreach ($manufacturers_array as $manufacturer_item)
36 36
 {
37 37
 	$manufacturer_data .= '[ "'.$manufacturer_item['aircraft_manufacturer'].'",'.$manufacturer_item['aircraft_manufacturer_count'].'],';
38 38
 }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	print '</thead>';
66 66
 	print '<tbody>';
67 67
 	$i = 1;
68
-	foreach($manufacturers_array as $manufacturer_item)
68
+	foreach ($manufacturers_array as $manufacturer_item)
69 69
 	{
70 70
 		print '<tr>';
71 71
 		print '<td><strong>'.$i.'</strong></td>';
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.
statistics-time.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Busiest Time of the Day");
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
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	</div>
21 21
 	<p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>';
22 22
 
23
-$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
23
+$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
24 24
 print '<div id="chartHour" class="chart" width="100%"></div>
25 25
       	<script> 
26 26
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	date_default_timezone_set('UTC');
37 37
 }
38 38
 //print_r($hour_array);
39
-foreach($hour_array as $hour_item)
39
+foreach ($hour_array as $hour_item)
40 40
 {
41 41
 	$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
42 42
 }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     			});
62 62
       </script>';
63 63
 
64
-$hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name);
64
+$hour_array = $Stats->countAllHours('count', true, $airline_icao, $filter_name);
65 65
 if (!empty($hour_array))
66 66
 {
67 67
 	print '<div class="table-responsive">';
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	print '</thead>';
74 74
 	print '<tbody>';
75 75
 	$i = 1;
76
-	foreach($hour_array as $hour_item)
76
+	foreach ($hour_array as $hour_item)
77 77
 	{
78 78
 		print '<tr>';
79 79
 		print '<td><strong>'.$i.'</strong></td>';
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").' - '._("Busiest Time of the Day");
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
 require_once('header.php');
15 19
 include('statistics-sub-menu.php');
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
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-sub-menu.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		</form>
33 33
 	</div>
34 34
 <?php 
35
-    if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) {
35
+	if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) {
36 36
 ?>
37 37
 <div class="sub-menu sub-menu-container">
38 38
 	<ul class="nav">
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		    </ul>
88 88
 		</li>
89 89
 		<?php
90
-		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
90
+			if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
91 91
 		?>
92 92
 		<li class="dropdown">
93 93
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 		    </ul>
100 100
 		</li>
101 101
 		<?php
102
-		    }
102
+			}
103 103
 		?>
104 104
 	</ul>
105 105
 </div>
106 106
 <?php
107
-    } else {
107
+	} else {
108 108
 ?>
109 109
 <div class="sub-menu sub-menu-container">
110 110
 	<ul class="nav">
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		</li>
164 164
 		-->
165 165
 		<?php
166
-		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
166
+			if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
167 167
 		?>
168 168
 		<!--
169 169
 		<li class="dropdown">
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 		</li>
178 178
 		-->
179 179
 		<?php
180
-		    }
180
+			}
181 181
 		?>
182 182
 	</ul>
183 183
 </div>
184 184
 <?php
185
-    }
185
+	}
186 186
 ?>
187 187
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 					} else {
21 21
 						print '<option value="all">All</option>';
22 22
 					}
23
-					foreach($airlines as $airline) {
23
+					foreach ($airlines as $airline) {
24 24
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
25 25
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
26 26
 						} else {
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 <div class="sub-menu sub-menu-container">
38 38
 	<ul class="nav">
39 39
 		<li class="dropdown">
40
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
40
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
41 41
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
42 42
 		    </a>
43 43
 		    <ul class="dropdown-menu">
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		    </ul>
49 49
 		</li>
50 50
 		<li class="dropdown">
51
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
51
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
52 52
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
53 53
 		    </a>
54 54
 		    <ul class="dropdown-menu" role="menu">
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		    </ul>
59 59
 		</li>
60 60
 		<li class="dropdown">
61
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
61
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
62 62
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
63 63
 		    </a>
64 64
 		    <ul class="dropdown-menu" role="menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Route"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		    </ul>
79 79
 		</li>
80 80
 		<li class="dropdown">
81
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
81
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
82 82
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
83 83
 		    </a>
84 84
 		    <ul class="dropdown-menu" role="menu">
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
91 91
 		?>
92 92
 		<li class="dropdown">
93
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
93
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
94 94
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
95 95
 		    </a>
96 96
 		    <ul class="dropdown-menu" role="menu">
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 <div class="sub-menu sub-menu-container">
110 110
 	<ul class="nav">
111 111
 		<li class="dropdown">
112
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
112
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
113 113
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
114 114
 		    </a>
115 115
 		    <ul class="dropdown-menu">
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		    </ul>
121 121
 		</li>
122 122
 		<li class="dropdown">
123
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
123
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
124 124
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
125 125
 		    </a>
126 126
 		    <ul class="dropdown-menu" role="menu">
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		    </ul>
131 131
 		</li>
132 132
 		<li class="dropdown">
133
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
133
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
134 134
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
135 135
 		    </a>
136 136
 		    <ul class="dropdown-menu" role="menu">
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		</li>
143 143
 		<!--
144 144
 		<li class="dropdown">
145
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
145
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
146 146
 		      <?php echo _("Route"); ?> <span class="caret"></span>
147 147
 		    </a>
148 148
 		    <ul class="dropdown-menu" role="menu">
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		-->
154 154
 		<!--
155 155
 		<li class="dropdown">
156
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
156
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
157 157
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
158 158
 		    </a>
159 159
 		    <ul class="dropdown-menu" role="menu">
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		?>
168 168
 		<!--
169 169
 		<li class="dropdown">
170
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
170
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
171 171
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
172 172
 		    </a>
173 173
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
Braces   +110 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,7 +4,13 @@  discard block
 block discarded – undo
4 4
 	<div class="stats_airline">
5 5
 	
6 6
 		<form id="changedate" method="post">
7
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
7
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
8
+	echo $year.'-';
9
+}
10
+?><?php if (isset($month) && $month != '') {
11
+	echo $month;
12
+}
13
+?>" />
8 14
 		</form>
9 15
 	
10 16
 		<form id="changeairline" method="post">
@@ -13,7 +19,9 @@  discard block
 block discarded – undo
13 19
 				<?php
14 20
 					require_once('require/class.Stats.php');
15 21
 					$Stats = new Stats();
16
-					if (!isset($filter_name)) $filter_name = '';
22
+					if (!isset($filter_name)) {
23
+						$filter_name = '';
24
+					}
17 25
 					$airlines = $Stats->getAllAirlineNames($filter_name);
18 26
 					if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) {
19 27
 						print '<option value="all" selected>All</option>';
@@ -41,10 +49,22 @@  discard block
 block discarded – undo
41 49
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
42 50
 		    </a>
43 51
 		    <ul class="dropdown-menu">
44
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li>
45
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li>
46
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li>
47
-			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li>
52
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
53
+	echo '/'.$airline_icao;
54
+}
55
+?>"><?php echo _("Aircraft"); ?></a></li>
56
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
57
+	echo '/'.$airline_icao;
58
+}
59
+?>"><?php echo _("Registration"); ?></a></li>
60
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
61
+	echo '/'.$airline_icao;
62
+}
63
+?>"><?php echo _("Manufacturer"); ?></a></li>
64
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
65
+	echo '/'.$airline_icao;
66
+}
67
+?>"><?php echo _("Country"); ?></a></li>
48 68
 		    </ul>
49 69
 		</li>
50 70
 		<li class="dropdown">
@@ -52,9 +72,18 @@  discard block
 block discarded – undo
52 72
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
53 73
 		    </a>
54 74
 		    <ul class="dropdown-menu" role="menu">
55
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li>
56
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li>
57
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li>
75
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
76
+	echo '/'.$airline_icao;
77
+}
78
+?>"><?php echo _("Airline"); ?></a></li>
79
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
80
+	echo '/'.$airline_icao;
81
+}
82
+?>"><?php echo _("Airline by Country"); ?></a></li>
83
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
84
+	echo '/'.$airline_icao;
85
+}
86
+?>"><?php echo _("Callsign"); ?></a></li>
58 87
 		    </ul>
59 88
 		</li>
60 89
 		<li class="dropdown">
@@ -62,10 +91,22 @@  discard block
 block discarded – undo
62 91
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
63 92
 		    </a>
64 93
 		    <ul class="dropdown-menu" role="menu">
65
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li>
66
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
67
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li>
68
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
94
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
95
+	echo '/'.$airline_icao;
96
+}
97
+?>"><?php echo _("Departure Airport"); ?></a></li>
98
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
99
+	echo '/'.$airline_icao;
100
+}
101
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
102
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
103
+	echo '/'.$airline_icao;
104
+}
105
+?>"><?php echo _("Arrival Airport"); ?></a></li>
106
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
107
+	echo '/'.$airline_icao;
108
+}
109
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
69 110
 		    </ul>
70 111
 		</li>
71 112
 		<li class="dropdown">
@@ -73,8 +114,14 @@  discard block
 block discarded – undo
73 114
 		      <?php echo _("Route"); ?> <span class="caret"></span>
74 115
 		    </a>
75 116
 		    <ul class="dropdown-menu" role="menu">
76
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li>
77
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li>
117
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
118
+	echo '/'.$airline_icao;
119
+}
120
+?>"><?php echo _("Route by Airport"); ?></a></li>
121
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
122
+	echo '/'.$airline_icao;
123
+}
124
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
78 125
 		    </ul>
79 126
 		</li>
80 127
 		<li class="dropdown">
@@ -82,8 +129,14 @@  discard block
 block discarded – undo
82 129
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
83 130
 		    </a>
84 131
 		    <ul class="dropdown-menu" role="menu">
85
-		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li>
86
-			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li>
132
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
133
+	echo '/'.$airline_icao;
134
+}
135
+?>"><?php echo _("Date"); ?></a></li>
136
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
137
+	echo '/'.$airline_icao;
138
+}
139
+?>"><?php echo _("Time"); ?></a></li>
87 140
 		    </ul>
88 141
 		</li>
89 142
 		<?php
@@ -113,9 +166,18 @@  discard block
 block discarded – undo
113 166
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
114 167
 		    </a>
115 168
 		    <ul class="dropdown-menu">
116
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
117
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
118
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
169
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
170
+	echo '/'.$airline_icao;
171
+}
172
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
173
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
174
+	echo '/'.$airline_icao;
175
+}
176
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
177
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
178
+	echo '/'.$airline_icao;
179
+}
180
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
119 181
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
120 182
 		    </ul>
121 183
 		</li>
@@ -124,9 +186,18 @@  discard block
 block discarded – undo
124 186
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
125 187
 		    </a>
126 188
 		    <ul class="dropdown-menu" role="menu">
127
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
128
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
129
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
189
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
190
+	echo '/'.$airline_icao;
191
+}
192
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
193
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
194
+	echo '/'.$airline_icao;
195
+}
196
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
197
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
198
+	echo '/'.$airline_icao;
199
+}
200
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
130 201
 		    </ul>
131 202
 		</li>
132 203
 		<li class="dropdown">
@@ -134,10 +205,22 @@  discard block
 block discarded – undo
134 205
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
135 206
 		    </a>
136 207
 		    <ul class="dropdown-menu" role="menu">
137
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
138
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
139
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
140
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
208
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
209
+	echo '/'.$airline_icao;
210
+}
211
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
212
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
213
+	echo '/'.$airline_icao;
214
+}
215
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
216
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
217
+	echo '/'.$airline_icao;
218
+}
219
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
220
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
221
+	echo '/'.$airline_icao;
222
+}
223
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
141 224
 		    </ul>
142 225
 		</li>
143 226
 		<!--
Please login to merge, or discard this patch.
statistics-pilot.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 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);
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
           function drawChart() {
31 31
             var data = google.visualization.arrayToDataTable([
32 32
             	["'._("Pilot").'", "'._("# of times").'"], ';
33
-            	$pilot_data = '';
33
+				$pilot_data = '';
34 34
 		foreach($pilot_array as $pilot_item)
35 35
 		{
36 36
 			$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
37 37
 		}
38 38
 		$pilot_data = substr($pilot_data, 0, -1);
39 39
 		print $pilot_data;
40
-            print ']);
40
+			print ']);
41 41
     
42 42
             var options = {
43 43
             	chartArea: {"width": "80%", "height": "60%"},
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
 
@@ -22,7 +22,7 @@  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>
27 27
       	<script> 
28 28
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             var data = google.visualization.arrayToDataTable([
32 32
             	["'._("Pilot").'", "'._("# of times").'"], ';
33 33
             	$pilot_data = '';
34
-		foreach($pilot_array as $pilot_item)
34
+		foreach ($pilot_array as $pilot_item)
35 35
 		{
36 36
 			$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
37 37
 		}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	print '</thead>';
65 65
 	print '<tbody>';
66 66
 	$i = 1;
67
-	foreach($pilot_array as $pilot_item)
67
+	foreach ($pilot_array as $pilot_item)
68 68
 	{
69 69
 		print '<tr>';
70 70
 		print '<td><strong>'.$i.'</strong></td>';
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 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.
require/class.METAR.php 3 patches
Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -7,109 +7,109 @@  discard block
 block discarded – undo
7 7
 	public $db;
8 8
 	
9 9
 	protected $texts = Array(
10
-	    'MI' => 'Shallow',
11
-	    'PR' => 'Partial',
12
-	    'BC' => 'Low drifting',
13
-	    'BL' => 'Blowing',
14
-	    'SH' => 'Showers',
15
-	    'TS' => 'Thunderstorm',
16
-	    'FZ' => 'Freezing',
17
-	    'DZ' => 'Drizzle',
18
-	    'RA' => 'Rain',
19
-	    'SN' => 'Snow',
20
-	    'SG' => 'Snow Grains',
21
-	    'IC' => 'Ice crystals',
22
-	    'PL' => 'Ice pellets',
23
-	    'GR' => 'Hail',
24
-	    'GS' => 'Small hail',
25
-	    'UP' => 'Unknown',
26
-	    'BR' => 'Mist',
27
-	    'FG' => 'Fog',
28
-	    'FU' => 'Smoke',
29
-	    'VA' => 'Volcanic ash',
30
-	    'DU' => 'Widespread dust',
31
-	    'SA' => 'Sand',
32
-	    'HZ' => 'Haze',
33
-	    'PY' => 'Spray',
34
-	    'PO' => 'Well developed dust / sand whirls',
35
-	    'SQ' => 'Squalls',
36
-	    'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
-	    'SS' => 'Sandstorm',
38
-	    'DS' => 'Duststorm'
10
+		'MI' => 'Shallow',
11
+		'PR' => 'Partial',
12
+		'BC' => 'Low drifting',
13
+		'BL' => 'Blowing',
14
+		'SH' => 'Showers',
15
+		'TS' => 'Thunderstorm',
16
+		'FZ' => 'Freezing',
17
+		'DZ' => 'Drizzle',
18
+		'RA' => 'Rain',
19
+		'SN' => 'Snow',
20
+		'SG' => 'Snow Grains',
21
+		'IC' => 'Ice crystals',
22
+		'PL' => 'Ice pellets',
23
+		'GR' => 'Hail',
24
+		'GS' => 'Small hail',
25
+		'UP' => 'Unknown',
26
+		'BR' => 'Mist',
27
+		'FG' => 'Fog',
28
+		'FU' => 'Smoke',
29
+		'VA' => 'Volcanic ash',
30
+		'DU' => 'Widespread dust',
31
+		'SA' => 'Sand',
32
+		'HZ' => 'Haze',
33
+		'PY' => 'Spray',
34
+		'PO' => 'Well developed dust / sand whirls',
35
+		'SQ' => 'Squalls',
36
+		'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
+		'SS' => 'Sandstorm',
38
+		'DS' => 'Duststorm'
39 39
 	);
40 40
 	
41 41
 	public function __construct($dbc = null) {
42
-                $Connection = new Connection($dbc);
43
-                $this->db = $Connection->db;
44
-        }
42
+				$Connection = new Connection($dbc);
43
+				$this->db = $Connection->db;
44
+		}
45 45
 
46
-       public static function check_last_update() {
47
-    		global $globalDBdriver;
48
-    		if ($globalDBdriver == 'mysql') {
46
+	   public static function check_last_update() {
47
+			global $globalDBdriver;
48
+			if ($globalDBdriver == 'mysql') {
49 49
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)";
50 50
 		} else {
51 51
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'";
52 52
 		}
53
-                try {
54
-                        $Connection = new Connection();
55
-                        $sth = $Connection->db->prepare($query);
56
-                        $sth->execute();
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
61
-                $sth->closeCursor();
62
-                if ($row['nb'] > 0) return false;
63
-                else return true;
64
-        }
53
+				try {
54
+						$Connection = new Connection();
55
+						$sth = $Connection->db->prepare($query);
56
+						$sth->execute();
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
61
+				$sth->closeCursor();
62
+				if ($row['nb'] > 0) return false;
63
+				else return true;
64
+		}
65 65
 
66
-        public static function insert_last_update() {
67
-                $query = "DELETE FROM config WHERE name = 'last_update_metar';
66
+		public static function insert_last_update() {
67
+				$query = "DELETE FROM config WHERE name = 'last_update_metar';
68 68
                         INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());";
69
-                try {
70
-                        $Connection = new Connection();
71
-                        $sth = $Connection->db->prepare($query);
72
-                        $sth->execute();
73
-                } catch(PDOException $e) {
74
-                        return "error : ".$e->getMessage();
75
-                }
76
-        }
69
+				try {
70
+						$Connection = new Connection();
71
+						$sth = $Connection->db->prepare($query);
72
+						$sth->execute();
73
+				} catch(PDOException $e) {
74
+						return "error : ".$e->getMessage();
75
+				}
76
+		}
77 77
 
78 78
 
79 79
         
80
-        public function parse($data) {
81
-    		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
-    		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
-    		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
86
-    		$pos = 0;
87
-    		if ($pieces[0] == 'METAR') $pos++;
88
-    		elseif ($pieces[0] == 'SPECI') $pos++;
89
-    		if (strlen($pieces[$pos]) != 4) $pos++;
90
-    		$result = array();
91
-    		$result['location'] = $pieces[$pos];
92
-    		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
95
-    		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
97
-    			$piece = $pieces[$pos];
98
-    			if ($piece == 'RMK') break;
99
-    			if ($piece == 'AUTO') $result['auto'] = true;
100
-    			if ($piece == 'COR') $result['correction'] = true;
101
-    			// Wind Speed
102
-    			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
80
+		public function parse($data) {
81
+			//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
+			$codes = implode('|', array_keys($this->texts));
83
+			$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
+			//$pieces = explode(' ',$data);
85
+			$pieces = preg_split('/\s/',$data);
86
+			$pos = 0;
87
+			if ($pieces[0] == 'METAR') $pos++;
88
+			elseif ($pieces[0] == 'SPECI') $pos++;
89
+			if (strlen($pieces[$pos]) != 4) $pos++;
90
+			$result = array();
91
+			$result['location'] = $pieces[$pos];
92
+			$pos++;
93
+			$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
+			$result['time'] = substr($pieces[$pos],2,4);
95
+			$c = count($pieces);
96
+			for($pos++; $pos < $c; $pos++) {
97
+				$piece = $pieces[$pos];
98
+				if ($piece == 'RMK') break;
99
+				if ($piece == 'AUTO') $result['auto'] = true;
100
+				if ($piece == 'COR') $result['correction'] = true;
101
+				// Wind Speed
102
+				if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
+					$result['wind']['direction'] = (float)$matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
105
+					if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
+					elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
+					elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108 108
 				$result['wind']['gust'] = (float)$matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110 110
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111 111
 				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
112
-    			}
112
+				}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
115 115
     				$result['wind_direction'] = (float)$matches[1];
@@ -126,35 +126,35 @@  discard block
 block discarded – undo
126 126
     				}
127 127
     			}
128 128
     			*/
129
-    			// Temperature
130
-    			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
129
+				// Temperature
130
+				if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
+					$temp = (float)$matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133 133
 					$temp = ((float)substr($matches[1], 1)) * -1;
134 134
 				}
135
-    				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
135
+					$result['temperature'] = $temp;
136
+					$dew = (float)$matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138 138
 					$dew = ((float)substr($matches[2], 1)) * -1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141
-    			}
142
-    			// QNH
143
-    			if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
-    			// #^(Q|A)(////|[0-9]{4})( )#
145
-    				if ($matches[1] == 'Q') {
146
-    					// hPa
147
-    					$result['QNH'] = $matches[2];
148
-    				} else {
149
-    					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151 141
 				}
152
-    				/*
142
+				// QNH
143
+				if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
+				// #^(Q|A)(////|[0-9]{4})( )#
145
+					if ($matches[1] == 'Q') {
146
+						// hPa
147
+						$result['QNH'] = $matches[2];
148
+					} else {
149
+						// inHg
150
+						$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151
+				}
152
+					/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
154 154
     				$result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg';
155 155
     				*/
156
-    			}
157
-                     /*
156
+				}
157
+					 /*
158 158
     			// Wind Direction
159 159
     			if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) {
160 160
     				$result['wind_direction'] = $matches[1];
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     				$result['speed_variable'] = $matches[1];
166 166
     			}
167 167
     			*/
168
-    			// Visibility
169
-    			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
-    				if (isset($matches[3]) && strlen($matches[3]) > 0) {
168
+				// Visibility
169
+				if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
+					if (isset($matches[3]) && strlen($matches[3]) > 0) {
171 171
 					$result['visibility'] = (float)$matches[3] * 1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
@@ -180,28 +180,28 @@  discard block
 block discarded – undo
180 180
 					$result['visibility'] = '> 10000';
181 181
 					$result['weather'] = "CAVOK";
182 182
 				}
183
-    			}
184
-    			// Cloud Coverage
185
-    			if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
-    				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
-    				$type = $matches[1];
188
-    				$cloud = array();
189
-    				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
-    				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
-    				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
-    				elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
-    				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
-    				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
-    				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
-    				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
-    				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
-    				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
-    				$result['cloud'][] = $cloud;
201
-    			}
202
-    			// RVR
203
-    			 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
-    				$rvr = array();
183
+				}
184
+				// Cloud Coverage
185
+				if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
+					//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
+					$type = $matches[1];
188
+					$cloud = array();
189
+					if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
+					elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
+					elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
+					elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
+					elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
+					elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
+					elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
+					elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
+					$cloud['type_code'] = $type;
198
+					$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
+					$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
+					$result['cloud'][] = $cloud;
201
+				}
202
+				// RVR
203
+				 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
+					$rvr = array();
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
@@ -210,33 +210,33 @@  discard block
 block discarded – undo
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
213
-    			//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
-    			if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
-    				//print_r($matches);
216
-    				// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
-    				$result['RVR']['runway'] = $matches[1];
218
-        			$result['RVR']['deposits'] = $matches[2];
219
-        			$result['RVR']['extent'] = $matches[3];
220
-        			$result['RVR']['depth'] = $matches[4];
221
-        			$result['RVR']['friction'] = $matches[5];
222
-    			}
223
-    			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
-    				//echo $piece;
225
-    				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
213
+				//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
+				if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
+					//print_r($matches);
216
+					// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
+					$result['RVR']['runway'] = $matches[1];
218
+					$result['RVR']['deposits'] = $matches[2];
219
+					$result['RVR']['extent'] = $matches[3];
220
+					$result['RVR']['depth'] = $matches[4];
221
+					$result['RVR']['friction'] = $matches[5];
222
+				}
223
+				if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
+					//echo $piece;
225
+					//print_r($matches);
226
+					if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+					else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
232
-					    'unit' => $matches[5] ? 'FT' : 'M'
230
+						'from' => (float)$matches[2],
231
+						'to'   => (float)$matches[4],
232
+						'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
235 235
 				$result['RVR'] = $matches[1];
236 236
 				$result['RVR_range'] = $range;
237
-    			}
238
-    			// Weather
239
-    			if (preg_match($regWeather, $piece, $matches)) {
237
+				}
238
+				// Weather
239
+				if (preg_match($regWeather, $piece, $matches)) {
240 240
 				$text = Array();
241 241
 				switch ($matches[1]) {
242 242
 					case '+':
@@ -259,35 +259,35 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
261 261
 				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
262
-    			}
263
-    		}
264
-    		return $result;
262
+				}
263
+			}
264
+			return $result;
265 265
         
266
-        }
266
+		}
267 267
         
268 268
 	public function getMETAR($icao) {
269
-    		global $globalMETARcycle, $globalDBdriver;
270
-    		if (isset($globalMETARcycle) && $globalMETARcycle) {
271
-            		$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
-                } else {
273
-            		if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
-            		else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
-                }
276
-                $query_values = array(':icao' => $icao);
277
-                 try {
278
-                        $sth = $this->db->prepare($query);
279
-                        $sth->execute($query_values);
280
-                } catch(PDOException $e) {
281
-                        return "error : ".$e->getMessage();
282
-                }
283
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
-                if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
-            		$all = $this->downloadMETAR($icao);
286
-                }
287
-                return $all;
288
-        }
269
+			global $globalMETARcycle, $globalDBdriver;
270
+			if (isset($globalMETARcycle) && $globalMETARcycle) {
271
+					$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
+				} else {
273
+					if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
+					else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
+				}
276
+				$query_values = array(':icao' => $icao);
277
+				 try {
278
+						$sth = $this->db->prepare($query);
279
+						$sth->execute($query_values);
280
+				} catch(PDOException $e) {
281
+						return "error : ".$e->getMessage();
282
+				}
283
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
+				if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
+					$all = $this->downloadMETAR($icao);
286
+				}
287
+				return $all;
288
+		}
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+	   public function addMETAR($location,$metar,$date) {
291 291
 		global $globalDBdriver;
292 292
 		$date = date('Y-m-d H:i:s',strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
@@ -295,106 +295,106 @@  discard block
 block discarded – undo
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
-                 try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute($query_values);
302
-                } catch(PDOException $e) {
303
-                        return "error : ".$e->getMessage();
304
-                }
305
-        }
298
+				$query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
+				 try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute($query_values);
302
+				} catch(PDOException $e) {
303
+						return "error : ".$e->getMessage();
304
+				}
305
+		}
306 306
 
307
-       public function deleteMETAR($id) {
308
-                $query = "DELETE FROM metar WHERE id = :id";
309
-                $query_values = array(':id' => $id);
310
-                 try {
311
-                        $sth = $this->db->prepare($query);
312
-                        $sth->execute($query_values);
313
-                } catch(PDOException $e) {
314
-                        return "error : ".$e->getMessage();
315
-                }
316
-        }
317
-       public function deleteAllMETARLocation() {
318
-                $query = "DELETE FROM metar";
319
-                 try {
320
-                        $sth = $this->db->prepare($query);
321
-                        $sth->execute();
322
-                } catch(PDOException $e) {
323
-                        return "error : ".$e->getMessage();
324
-                }
325
-        }
307
+	   public function deleteMETAR($id) {
308
+				$query = "DELETE FROM metar WHERE id = :id";
309
+				$query_values = array(':id' => $id);
310
+				 try {
311
+						$sth = $this->db->prepare($query);
312
+						$sth->execute($query_values);
313
+				} catch(PDOException $e) {
314
+						return "error : ".$e->getMessage();
315
+				}
316
+		}
317
+	   public function deleteAllMETARLocation() {
318
+				$query = "DELETE FROM metar";
319
+				 try {
320
+						$sth = $this->db->prepare($query);
321
+						$sth->execute();
322
+				} catch(PDOException $e) {
323
+						return "error : ".$e->getMessage();
324
+				}
325
+		}
326 326
         
327
-        public function addMETARCycle() {
328
-    		global $globalDebug, $globalIVAO, $globalTransaction;
329
-    		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
-    		date_default_timezone_set("UTC");
331
-    		$Common = new Common();
332
-    		if (isset($globalIVAO) && $globalIVAO) {
333
-        		//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
327
+		public function addMETARCycle() {
328
+			global $globalDebug, $globalIVAO, $globalTransaction;
329
+			if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
+			date_default_timezone_set("UTC");
331
+			$Common = new Common();
332
+			if (isset($globalIVAO) && $globalIVAO) {
333
+				//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334 334
 			$Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
336
-    		} else {
335
+				$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
336
+			} else {
337 337
 			//$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT');
338 338
 			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340
-    		}
341
-    		if ($handle) {
339
+				$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340
+			}
341
+			if ($handle) {
342 342
 			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
343 343
 			$date = '';
344
-    			//foreach(explode("\n",$cycle) as $line) {
345
-    			if ($globalTransaction) $this->db->beginTransaction();
346
-	    		while(($line = fgets($handle,4096)) !== false) {
344
+				//foreach(explode("\n",$cycle) as $line) {
345
+				if ($globalTransaction) $this->db->beginTransaction();
346
+				while(($line = fgets($handle,4096)) !== false) {
347 347
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
348 348
 					$date = $line;
349
-    				} elseif ($line != '') {
350
-    				    //$this->parse($line);
351
-    				    if ($date == '') $date = date('Y/m/d H:m');
352
-        			    $pos = 0;
353
-        			    $pieces = preg_split('/\s/',$line);
354
-        			    if ($pieces[0] == 'METAR') $pos++;
355
-        			    if (strlen($pieces[$pos]) != 4) $pos++;
356
-		        	    $location = $pieces[$pos];
357
-        	        	    echo $this->addMETAR($location,$line,$date);
358
-    				}
359
-    			}
360
-    			fclose($handle);
361
-    			if ($globalTransaction) $this->db->commit();
362
-    		}
363
-    		if (isset($globalDebug) && $globalDebug) echo "Done\n";
349
+					} elseif ($line != '') {
350
+						//$this->parse($line);
351
+						if ($date == '') $date = date('Y/m/d H:m');
352
+						$pos = 0;
353
+						$pieces = preg_split('/\s/',$line);
354
+						if ($pieces[0] == 'METAR') $pos++;
355
+						if (strlen($pieces[$pos]) != 4) $pos++;
356
+						$location = $pieces[$pos];
357
+							echo $this->addMETAR($location,$line,$date);
358
+					}
359
+				}
360
+				fclose($handle);
361
+				if ($globalTransaction) $this->db->commit();
362
+			}
363
+			if (isset($globalDebug) && $globalDebug) echo "Done\n";
364 364
         
365
-        }
366
-        public function downloadMETAR($icao) {
367
-    		global $globalMETARurl;
368
-    		if ($globalMETARurl == '') return array();
369
-    		date_default_timezone_set("UTC");
370
-    		$Common = new Common();
371
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
372
-    		$cycle = $Common->getData($url);
373
-    		$date = '';
374
-    		foreach(explode("\n",$cycle) as $line) {
375
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
376
-    				//echo "date : ".$line."\n";
377
-    				$date = $line;
378
-    			} 
379
-    			if ($line != '') {
380
-    			    //$this->parse($line);
381
-    			    //echo $line;
382
-    			    if ($date == '') $date = date('Y/m/d H:m');
383
-    			    $pos = 0;
384
-    			    $pieces = preg_split('/\s/',$line);
385
-    			    if ($pieces[0] == 'METAR') $pos++;
386
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
387
-	        	    $location = $pieces[$pos];
388
-	        	    if (strlen($location == 4)) {
389
-	        		$this->addMETAR($location,$line,$date);
390
-	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
-	        	    } else return array();
392
-    			}
393
-    			//echo $line."\n";
394
-    		}
395
-    		return array();
365
+		}
366
+		public function downloadMETAR($icao) {
367
+			global $globalMETARurl;
368
+			if ($globalMETARurl == '') return array();
369
+			date_default_timezone_set("UTC");
370
+			$Common = new Common();
371
+			$url = str_replace('{icao}',$icao,$globalMETARurl);
372
+			$cycle = $Common->getData($url);
373
+			$date = '';
374
+			foreach(explode("\n",$cycle) as $line) {
375
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
376
+					//echo "date : ".$line."\n";
377
+					$date = $line;
378
+				} 
379
+				if ($line != '') {
380
+					//$this->parse($line);
381
+					//echo $line;
382
+					if ($date == '') $date = date('Y/m/d H:m');
383
+					$pos = 0;
384
+					$pieces = preg_split('/\s/',$line);
385
+					if ($pieces[0] == 'METAR') $pos++;
386
+					if (strlen($pieces[$pos]) != 4) $pos++;
387
+					$location = $pieces[$pos];
388
+					if (strlen($location == 4)) {
389
+					$this->addMETAR($location,$line,$date);
390
+					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
+					} else return array();
392
+				}
393
+				//echo $line."\n";
394
+			}
395
+			return array();
396 396
         
397
-        }
397
+		}
398 398
 }
399 399
 /*
400 400
 $METAR = new METAR();
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                         $Connection = new Connection();
55 55
                         $sth = $Connection->db->prepare($query);
56 56
                         $sth->execute();
57
-                } catch(PDOException $e) {
57
+                } catch (PDOException $e) {
58 58
                         return "error : ".$e->getMessage();
59 59
                 }
60 60
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $Connection = new Connection();
71 71
                         $sth = $Connection->db->prepare($query);
72 72
                         $sth->execute();
73
-                } catch(PDOException $e) {
73
+                } catch (PDOException $e) {
74 74
                         return "error : ".$e->getMessage();
75 75
                 }
76 76
         }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
         public function parse($data) {
81 81
     		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82 82
     		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
83
+    		$regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#';
84 84
     		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
85
+    		$pieces = preg_split('/\s/', $data);
86 86
     		$pos = 0;
87 87
     		if ($pieces[0] == 'METAR') $pos++;
88 88
     		elseif ($pieces[0] == 'SPECI') $pos++;
@@ -90,25 +90,25 @@  discard block
 block discarded – undo
90 90
     		$result = array();
91 91
     		$result['location'] = $pieces[$pos];
92 92
     		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
93
+    		$result['dayofmonth'] = substr($pieces[$pos], 0, 2);
94
+    		$result['time'] = substr($pieces[$pos], 2, 4);
95 95
     		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
96
+    		for ($pos++; $pos < $c; $pos++) {
97 97
     			$piece = $pieces[$pos];
98 98
     			if ($piece == 'RMK') break;
99 99
     			if ($piece == 'AUTO') $result['auto'] = true;
100 100
     			if ($piece == 'COR') $result['correction'] = true;
101 101
     			// Wind Speed
102 102
     			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
103
+    				$result['wind']['direction'] = (float) $matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108
-				$result['wind']['gust'] = (float)$matches[3];
105
+    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2);
106
+    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2);
107
+    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2);
108
+				$result['wind']['gust'] = (float) $matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110
-				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111
-				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
110
+				$result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0;
111
+				$result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0;
112 112
     			}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
     			*/
129 129
     			// Temperature
130 130
     			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
131
+    				$temp = (float) $matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133
-					$temp = ((float)substr($matches[1], 1)) * -1;
133
+					$temp = ((float) substr($matches[1], 1))*-1;
134 134
 				}
135 135
     				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
136
+    				$dew = (float) $matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138
-					$dew = ((float)substr($matches[2], 1)) * -1;
138
+					$dew = ((float) substr($matches[2], 1))*-1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141 141
     			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     					$result['QNH'] = $matches[2];
148 148
     				} else {
149 149
     					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
150
+    					$result['QNH'] = round(($matches[2]/100)*33.86389, 2);
151 151
 				}
152 152
     				/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
     			// Visibility
169 169
     			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170 170
     				if (isset($matches[3]) && strlen($matches[3]) > 0) {
171
-					$result['visibility'] = (float)$matches[3] * 1609.34;
171
+					$result['visibility'] = (float) $matches[3]*1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
174 174
 						$result['visibility'] = '> 10000';
175 175
 					} else {
176
-						$result['visibility'] = (float)$matches[1];
176
+						$result['visibility'] = (float) $matches[1];
177 177
 					}
178 178
 				}
179 179
 				if (preg_match('#^CAVOK$#', $piece, $matches)) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196 196
     				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197 197
     				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
198
+    				$cloud['level'] = round(((float) $matches[2])*100*0.3048);
199 199
     				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200 200
     				$result['cloud'][] = $cloud;
201 201
     			}
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
208
-				$rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0;
209
-				$rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : '';
208
+				$rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0;
209
+				$rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : '';
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
     			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224 224
     				//echo $piece;
225 225
     				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
226
+    				if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+    				else $range = array('exact' => (float) $matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
230
+					    'from' => (float) $matches[2],
231
+					    'to'   => (float) $matches[4],
232 232
 					    'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                  try {
278 278
                         $sth = $this->db->prepare($query);
279 279
                         $sth->execute($query_values);
280
-                } catch(PDOException $e) {
280
+                } catch (PDOException $e) {
281 281
                         return "error : ".$e->getMessage();
282 282
                 }
283 283
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -287,19 +287,19 @@  discard block
 block discarded – undo
287 287
                 return $all;
288 288
         }
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+       public function addMETAR($location, $metar, $date) {
291 291
 		global $globalDBdriver;
292
-		$date = date('Y-m-d H:i:s',strtotime($date));
292
+		$date = date('Y-m-d H:i:s', strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
294 294
 			$query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar";
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
298
+                $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar));
299 299
                  try {
300 300
                         $sth = $this->db->prepare($query);
301 301
                         $sth->execute($query_values);
302
-                } catch(PDOException $e) {
302
+                } catch (PDOException $e) {
303 303
                         return "error : ".$e->getMessage();
304 304
                 }
305 305
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                  try {
311 311
                         $sth = $this->db->prepare($query);
312 312
                         $sth->execute($query_values);
313
-                } catch(PDOException $e) {
313
+                } catch (PDOException $e) {
314 314
                         return "error : ".$e->getMessage();
315 315
                 }
316 316
         }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                  try {
320 320
                         $sth = $this->db->prepare($query);
321 321
                         $sth->execute();
322
-                } catch(PDOException $e) {
322
+                } catch (PDOException $e) {
323 323
                         return "error : ".$e->getMessage();
324 324
                 }
325 325
         }
@@ -331,30 +331,30 @@  discard block
 block discarded – undo
331 331
     		$Common = new Common();
332 332
     		if (isset($globalIVAO) && $globalIVAO) {
333 333
         		//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334
-			$Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
334
+			$Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
+    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r");
336 336
     		} else {
337 337
 			//$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT');
338
-			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
338
+			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
+    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r");
340 340
     		}
341 341
     		if ($handle) {
342 342
 			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
343 343
 			$date = '';
344 344
     			//foreach(explode("\n",$cycle) as $line) {
345 345
     			if ($globalTransaction) $this->db->beginTransaction();
346
-	    		while(($line = fgets($handle,4096)) !== false) {
347
-				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
346
+	    		while (($line = fgets($handle, 4096)) !== false) {
347
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
348 348
 					$date = $line;
349 349
     				} elseif ($line != '') {
350 350
     				    //$this->parse($line);
351 351
     				    if ($date == '') $date = date('Y/m/d H:m');
352 352
         			    $pos = 0;
353
-        			    $pieces = preg_split('/\s/',$line);
353
+        			    $pieces = preg_split('/\s/', $line);
354 354
         			    if ($pieces[0] == 'METAR') $pos++;
355 355
         			    if (strlen($pieces[$pos]) != 4) $pos++;
356 356
 		        	    $location = $pieces[$pos];
357
-        	        	    echo $this->addMETAR($location,$line,$date);
357
+        	        	    echo $this->addMETAR($location, $line, $date);
358 358
     				}
359 359
     			}
360 360
     			fclose($handle);
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
     		if ($globalMETARurl == '') return array();
369 369
     		date_default_timezone_set("UTC");
370 370
     		$Common = new Common();
371
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
371
+    		$url = str_replace('{icao}', $icao, $globalMETARurl);
372 372
     		$cycle = $Common->getData($url);
373 373
     		$date = '';
374
-    		foreach(explode("\n",$cycle) as $line) {
375
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
374
+    		foreach (explode("\n", $cycle) as $line) {
375
+    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
376 376
     				//echo "date : ".$line."\n";
377 377
     				$date = $line;
378 378
     			} 
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
     			    //echo $line;
382 382
     			    if ($date == '') $date = date('Y/m/d H:m');
383 383
     			    $pos = 0;
384
-    			    $pieces = preg_split('/\s/',$line);
384
+    			    $pieces = preg_split('/\s/', $line);
385 385
     			    if ($pieces[0] == 'METAR') $pos++;
386 386
     			    if (strlen($pieces[$pos]) != 4) $pos++;
387 387
 	        	    $location = $pieces[$pos];
388 388
 	        	    if (strlen($location == 4)) {
389
-	        		$this->addMETAR($location,$line,$date);
389
+	        		$this->addMETAR($location, $line, $date);
390 390
 	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391 391
 	        	    } else return array();
392 392
     			}
Please login to merge, or discard this patch.
Braces   +100 added lines, -38 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
                 }
60 60
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
61 61
                 $sth->closeCursor();
62
-                if ($row['nb'] > 0) return false;
63
-                else return true;
62
+                if ($row['nb'] > 0) {
63
+                	return false;
64
+                } else {
65
+                	return true;
66
+                }
64 67
         }
65 68
 
66 69
         public static function insert_last_update() {
@@ -84,9 +87,14 @@  discard block
 block discarded – undo
84 87
     		//$pieces = explode(' ',$data);
85 88
     		$pieces = preg_split('/\s/',$data);
86 89
     		$pos = 0;
87
-    		if ($pieces[0] == 'METAR') $pos++;
88
-    		elseif ($pieces[0] == 'SPECI') $pos++;
89
-    		if (strlen($pieces[$pos]) != 4) $pos++;
90
+    		if ($pieces[0] == 'METAR') {
91
+    			$pos++;
92
+    		} elseif ($pieces[0] == 'SPECI') {
93
+    			$pos++;
94
+    		}
95
+    		if (strlen($pieces[$pos]) != 4) {
96
+    			$pos++;
97
+    		}
90 98
     		$result = array();
91 99
     		$result['location'] = $pieces[$pos];
92 100
     		$pos++;
@@ -95,16 +103,26 @@  discard block
 block discarded – undo
95 103
     		$c = count($pieces);
96 104
     		for($pos++; $pos < $c; $pos++) {
97 105
     			$piece = $pieces[$pos];
98
-    			if ($piece == 'RMK') break;
99
-    			if ($piece == 'AUTO') $result['auto'] = true;
100
-    			if ($piece == 'COR') $result['correction'] = true;
106
+    			if ($piece == 'RMK') {
107
+    				break;
108
+    			}
109
+    			if ($piece == 'AUTO') {
110
+    				$result['auto'] = true;
111
+    			}
112
+    			if ($piece == 'COR') {
113
+    				$result['correction'] = true;
114
+    			}
101 115
     			// Wind Speed
102 116
     			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103 117
     				$result['wind']['direction'] = (float)$matches[1];
104 118
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
119
+    				if ($result['wind']['unit'] == 'KT') {
120
+    					$result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
121
+    				} elseif ($result['wind']['unit'] == 'KPH') {
122
+    					$result['wind']['speed'] = round(((float)$matches[2])*1000,2);
123
+    				} elseif ($result['wind']['unit'] == 'MPS') {
124
+    					$result['wind']['speed'] = round(((float)$matches[2]),2);
125
+    				}
108 126
 				$result['wind']['gust'] = (float)$matches[3];
109 127
 				$result['wind']['unit'] = $matches[4];
110 128
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
@@ -186,14 +204,23 @@  discard block
 block discarded – undo
186 204
     				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187 205
     				$type = $matches[1];
188 206
     				$cloud = array();
189
-    				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
-    				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
-    				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
-    				elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
-    				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
-    				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
-    				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
-    				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
207
+    				if ($type == 'SKC') {
208
+    					$cloud['type'] = 'No cloud/Sky clear';
209
+    				} elseif ($type == 'CLR') {
210
+    					$cloud['type'] = 'No cloud below 12,000ft (3700m)';
211
+    				} elseif ($type == 'NSC') {
212
+    					$cloud['type'] = 'No significant cloud';
213
+    				} elseif ($type == 'FEW') {
214
+    					$cloud['type'] = 'Few';
215
+    				} elseif ($type == 'SCT') {
216
+    					$cloud['type'] = 'Scattered';
217
+    				} elseif ($type == 'BKN') {
218
+    					$cloud['type'] = 'Broken';
219
+    				} elseif ($type == 'OVC') {
220
+    					$cloud['type'] = 'Overcast/Full cloud coverage';
221
+    				} elseif ($type == 'VV') {
222
+    					$cloud['type'] = 'Vertical visibility';
223
+    				}
197 224
     				$cloud['type_code'] = $type;
198 225
     				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199 226
     				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
@@ -223,8 +250,11 @@  discard block
 block discarded – undo
223 250
     			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224 251
     				//echo $piece;
225 252
     				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
253
+    				if (isset($matches[5])) {
254
+    					$range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
255
+    				} else {
256
+    					$range = array('exact' => (float)$matches[2], 'unit' => 'M');
257
+    				}
228 258
 				if (isset($matches[3])) {
229 259
 					$range = Array(
230 260
 					    'from' => (float)$matches[2],
@@ -257,8 +287,11 @@  discard block
 block discarded – undo
257 287
 				if (isset($matches[3])) {
258 288
 					$text[] = $this->texts[$matches[3]];
259 289
 				}
260
-				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
261
-				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
290
+				if (!isset($result['weather'])) {
291
+					$result['weather'] = implode(' ', $text);
292
+				} else {
293
+					$result['weather'] = $result['weather'].' / '.implode(' ', $text);
294
+				}
262 295
     			}
263 296
     		}
264 297
     		return $result;
@@ -270,8 +303,11 @@  discard block
 block discarded – undo
270 303
     		if (isset($globalMETARcycle) && $globalMETARcycle) {
271 304
             		$query = "SELECT * FROM metar WHERE metar_location = :icao";
272 305
                 } else {
273
-            		if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
-            		else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
306
+            		if ($globalDBdriver == 'mysql') {
307
+            			$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
308
+            		} else {
309
+            			$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
310
+            		}
275 311
                 }
276 312
                 $query_values = array(':icao' => $icao);
277 313
                  try {
@@ -326,7 +362,9 @@  discard block
 block discarded – undo
326 362
         
327 363
         public function addMETARCycle() {
328 364
     		global $globalDebug, $globalIVAO, $globalTransaction;
329
-    		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
365
+    		if (isset($globalDebug) && $globalDebug) {
366
+    			echo "Downloading METAR cycle...";
367
+    		}
330 368
     		date_default_timezone_set("UTC");
331 369
     		$Common = new Common();
332 370
     		if (isset($globalIVAO) && $globalIVAO) {
@@ -339,33 +377,49 @@  discard block
 block discarded – undo
339 377
     			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340 378
     		}
341 379
     		if ($handle) {
342
-			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
380
+			if (isset($globalDebug) && $globalDebug) {
381
+				echo "Done - Updating DB...";
382
+			}
343 383
 			$date = '';
344 384
     			//foreach(explode("\n",$cycle) as $line) {
345
-    			if ($globalTransaction) $this->db->beginTransaction();
385
+    			if ($globalTransaction) {
386
+    				$this->db->beginTransaction();
387
+    			}
346 388
 	    		while(($line = fgets($handle,4096)) !== false) {
347 389
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
348 390
 					$date = $line;
349 391
     				} elseif ($line != '') {
350 392
     				    //$this->parse($line);
351
-    				    if ($date == '') $date = date('Y/m/d H:m');
393
+    				    if ($date == '') {
394
+    				    	$date = date('Y/m/d H:m');
395
+    				    }
352 396
         			    $pos = 0;
353 397
         			    $pieces = preg_split('/\s/',$line);
354
-        			    if ($pieces[0] == 'METAR') $pos++;
355
-        			    if (strlen($pieces[$pos]) != 4) $pos++;
398
+        			    if ($pieces[0] == 'METAR') {
399
+        			    	$pos++;
400
+        			    }
401
+        			    if (strlen($pieces[$pos]) != 4) {
402
+        			    	$pos++;
403
+        			    }
356 404
 		        	    $location = $pieces[$pos];
357 405
         	        	    echo $this->addMETAR($location,$line,$date);
358 406
     				}
359 407
     			}
360 408
     			fclose($handle);
361
-    			if ($globalTransaction) $this->db->commit();
409
+    			if ($globalTransaction) {
410
+    				$this->db->commit();
411
+    			}
412
+    		}
413
+    		if (isset($globalDebug) && $globalDebug) {
414
+    			echo "Done\n";
362 415
     		}
363
-    		if (isset($globalDebug) && $globalDebug) echo "Done\n";
364 416
         
365 417
         }
366 418
         public function downloadMETAR($icao) {
367 419
     		global $globalMETARurl;
368
-    		if ($globalMETARurl == '') return array();
420
+    		if ($globalMETARurl == '') {
421
+    			return array();
422
+    		}
369 423
     		date_default_timezone_set("UTC");
370 424
     		$Common = new Common();
371 425
     		$url = str_replace('{icao}',$icao,$globalMETARurl);
@@ -379,16 +433,24 @@  discard block
 block discarded – undo
379 433
     			if ($line != '') {
380 434
     			    //$this->parse($line);
381 435
     			    //echo $line;
382
-    			    if ($date == '') $date = date('Y/m/d H:m');
436
+    			    if ($date == '') {
437
+    			    	$date = date('Y/m/d H:m');
438
+    			    }
383 439
     			    $pos = 0;
384 440
     			    $pieces = preg_split('/\s/',$line);
385
-    			    if ($pieces[0] == 'METAR') $pos++;
386
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
441
+    			    if ($pieces[0] == 'METAR') {
442
+    			    	$pos++;
443
+    			    }
444
+    			    if (strlen($pieces[$pos]) != 4) {
445
+    			    	$pos++;
446
+    			    }
387 447
 	        	    $location = $pieces[$pos];
388 448
 	        	    if (strlen($location == 4)) {
389 449
 	        		$this->addMETAR($location,$line,$date);
390 450
 	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
-	        	    } else return array();
451
+	        	    } else {
452
+	        	    	return array();
453
+	        	    }
392 454
     			}
393 455
     			//echo $line."\n";
394 456
     		}
Please login to merge, or discard this patch.
statistics.php 3 patches
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $Stats = new Stats();
8 8
 
9 9
 if (!isset($filter_name)) $filter_name = '';
10
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == '' && isset($globalFilter)) {
12 12
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	$title = _("Statistics");
23 23
 }
24 24
 
25
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
26
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
25
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
26
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
27 27
 
28 28
 require_once('header.php');
29 29
 
@@ -44,36 +44,36 @@  discard block
 block discarded – undo
44 44
 		date_default_timezone_set('UTC');
45 45
 		$lastupdate = strtotime($last_update[0]['value']);
46 46
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
47
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
47
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
48 48
 	}
49 49
     ?>
50 50
     </div>
51 51
     <?php include('statistics-sub-menu.php'); ?>
52 52
     <p class="global-stats">
53
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
54
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
55
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
56
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
53
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
54
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
55
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
56
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
57 57
 	<?php
58 58
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
59 59
 	?>
60
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
61
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
60
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
61
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
62 62
         <?php
63 63
     	    } else {
64 64
     	?>
65
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
66
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
65
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
66
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
67 67
     	<?php
68 68
     	    }
69 69
     	?>
70
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
71
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
70
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
71
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
72 72
         <?php
73 73
     		if ($airline_icao == '') {
74 74
     	?>
75
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
76
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
75
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
76
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
77 77
 	<?php
78 78
 		}
79 79
 	?>
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
82 82
 			if ($airline_icao == '' || $airline_icao == 'all') {
83 83
 	?>
84
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
85
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
84
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
85
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
86 86
 	<?php
87 87
 			}
88 88
 		}
89 89
 	?>
90 90
     </p>
91
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
91
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
92 92
     <div class="specific-stats">
93 93
         <div class="row column">
94 94
             <div class="col-md-6">
95 95
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
96 96
                  <?php
97
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
97
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
98 98
 		    if (count($aircraft_array) == 0) print _("No data available");
99 99
 		    else {
100 100
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                         var data = google.visualization.arrayToDataTable([
107 107
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
108 108
                             $aircraft_data = '';
109
-                          foreach($aircraft_array as $aircraft_item)
109
+                          foreach ($aircraft_array as $aircraft_item)
110 110
                                     {
111 111
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
112 112
                                     }
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
             	    ?>
144 144
                 </div>
145 145
             </div>
146
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
146
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
147 147
 <?php
148 148
 //    echo $airline_icao;
149 149
     if ($airline_icao == '' || $airline_icao == 'all') {
150
-	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
150
+	$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
151 151
 	if (count($airline_array) > 0) {
152 152
             print '<div class="col-md-6">';
153 153
 	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                         var data = google.visualization.arrayToDataTable([
160 160
                             ["'._("Airline").'", "'._("# of times").'"], ';
161 161
 	    $airline_data = '';
162
-	    foreach($airline_array as $airline_item)
162
+	    foreach ($airline_array as $airline_item)
163 163
 	    {
164 164
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
165 165
 	    }
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 	}
194 194
 ?>
195 195
         </div>
196
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
196
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
197 197
 <?php
198 198
     }
199 199
 ?>
200 200
         <div class="row column">
201 201
 <?php
202
-    $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
202
+    $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
203 203
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
204 204
 	if (empty($flightover_array)) {
205 205
 	    print '<div class="col-md-12">';
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 ?>
210 210
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
211 211
 <?php
212
-	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
212
+	$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
213 213
 	if (count($pilot_array) == 0) print _("No data available");
214 214
 	else {
215 215
 	    print '<div id="chart7" class="chart" width="100%"></div>
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                         var data = google.visualization.arrayToDataTable([
221 221
                             ["'._("Pilots").'", "'._("# of times").'"], ';
222 222
 	    $pilot_data = '';
223
-	    foreach($pilot_array as $pilot_item)
223
+	    foreach ($pilot_array as $pilot_item)
224 224
 	    {
225 225
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
226 226
 	    }
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 ?>
251 251
             </div>
252 252
         
253
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
253
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
254 254
 <?php
255 255
     } else {
256 256
 ?>
257 257
             <div class="col-md-6">
258 258
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
259 259
 <?php
260
-	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
260
+	$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
261 261
 	if (count($owner_array) == 0) print _("No data available");
262 262
 	else {
263 263
 	    print '<div id="chart7" class="chart" width="100%"></div>
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                         var data = google.visualization.arrayToDataTable([
269 269
                             ["'._("Owner").'", "'._("# of times").'"], ';
270 270
                             $owner_data = '';
271
-	    foreach($owner_array as $owner_item)
271
+	    foreach ($owner_array as $owner_item)
272 272
 	    {
273 273
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
274 274
 	    }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                 </div>
297 297
             </div>
298 298
         
299
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
299
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
300 300
 <?php
301 301
     }
302 302
     if (!empty($flightover_array)) {
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         var data = google.visualization.arrayToDataTable([
316 316
                             ["'._("Country").'", "'._("# of times").'"], ';
317 317
                             $flightover_data = '';
318
-	    foreach($flightover_array as $flightover_item)
318
+	    foreach ($flightover_array as $flightover_item)
319 319
 	    {
320 320
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
321 321
 	    }
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
     }
349 349
 ?>
350 350
         </div>
351
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
351
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
352 352
 
353 353
     	
354 354
         </div>
355 355
         <div class="row column">
356 356
             <div class="col-md-6">
357 357
 <?php
358
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
358
+    $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
359 359
     if (count($airport_airport_array) > 0) {
360 360
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
361 361
 	print '<div id="chart3" class="chart" width="100%"></div>
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 var data = google.visualization.arrayToDataTable([ 
371 371
                     ["'._("Airport").'", "'._("# of times").'"],';
372 372
                     $airport_data = '';
373
-	foreach($airport_airport_array as $airport_item)
373
+	foreach ($airport_airport_array as $airport_item)
374 374
 	{
375 375
 	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
376 376
 	    $name = str_replace("'", "", $name);
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
     }
400 400
 ?>
401 401
             </div>
402
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
402
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
403 403
 
404 404
             <div class="col-md-6">
405 405
 <?php
406
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
406
+    $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
407 407
     if (count($airport_airport_array2) > 0) {
408 408
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
409 409
 	print '<div id="chart4" class="chart" width="100%"></div>
@@ -418,10 +418,10 @@  discard block
 block discarded – undo
418 418
                 var data = google.visualization.arrayToDataTable([ 
419 419
                     ["'._("Airport").'", "'._("# of times").'"],';
420 420
 	$airport_data2 = '';
421
-	foreach($airport_airport_array2 as $airport_item2)
421
+	foreach ($airport_airport_array2 as $airport_item2)
422 422
 	{
423 423
 	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
424
-	    $name2 = str_replace(array("'",'"'), '', $name2);
424
+	    $name2 = str_replace(array("'", '"'), '', $name2);
425 425
 	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
426 426
 	}
427 427
 	$airport_data2 = substr($airport_data2, 0, -1);
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 ?>
448 448
             </div>
449 449
         </div>
450
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
450
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
451 451
 <?php
452 452
     if ($year == '' && $month == '') {
453 453
 ?>
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             <div class="col-md-6">
456 456
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
457 457
                 <?php
458
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
458
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
459 459
 		    if (count($year_array) == 0) print _("No data available");
460 460
 		    else {
461 461
                   print '<div id="chart8" class="chart" width="100%"></div>
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
                         var data = google.visualization.arrayToDataTable([
467 467
                             ["'._("Month").'", "'._("# of Flights").'"], ';
468 468
                             $year_data = '';
469
-                          foreach($year_array as $year_item)
469
+                          foreach ($year_array as $year_item)
470 470
                                     {
471
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
471
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
472 472
                                     }
473 473
                                     $year_data = substr($year_data, 0, -1);
474 474
                                     print $year_data;
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
497 497
                 </div>
498 498
             </div>
499
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
499
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
500 500
             <div class="col-md-6">
501 501
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
502 502
                 <?php
503
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
503
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
504 504
 		    if (count($month_array) == 0) print _("No data available");
505 505
 		    else {
506 506
                   print '<div id="chart9" class="chart" width="100%"></div>
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
                         var data = google.visualization.arrayToDataTable([
512 512
                             ["'._("Day").'", "'._("# of Flights").'"], ';
513 513
                             $month_data = '';
514
-                          foreach($month_array as $month_item)
514
+                          foreach ($month_array as $month_item)
515 515
                                     {
516
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
516
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
517 517
                                     }
518 518
                                     $month_data = substr($month_data, 0, -1);
519 519
                                     print $month_data;
@@ -541,12 +541,12 @@  discard block
 block discarded – undo
541 541
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
542 542
                 </div>
543 543
             </div>
544
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
544
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
545 545
 
546 546
             <div class="col-md-6">
547 547
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
548 548
                 <?php
549
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
549
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
550 550
 		    if (empty($date_array)) print _("No data available");
551 551
 		    else {
552 552
                   print '<div id="chart5" class="chart" width="100%"></div>
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
                             ["'._("Date").'", "'._("# of Flights").'"], ';
559 559
                             $date_data = '';
560 560
                         
561
-                          foreach($date_array as $date_item)
561
+                          foreach ($date_array as $date_item)
562 562
                                     {
563 563
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
564 564
                                     }
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
589 589
                 </div>
590 590
             </div>
591
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
591
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
592 592
             <div class="col-md-6">
593 593
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
594 594
                 <?php
595
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
595
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
596 596
 		    if (empty($hour_array)) print _("No data available");
597 597
 		    else {
598 598
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                         var data = google.visualization.arrayToDataTable([
605 605
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
606 606
                             $hour_data = '';
607
-                          foreach($hour_array as $hour_item)
607
+                          foreach ($hour_array as $hour_item)
608 608
                                     {
609 609
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
610 610
                                     }
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
635 635
                 </div>
636 636
             </div>
637
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
637
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
638 638
         </div>
639 639
 <?php
640 640
     }
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
                         var data = google.visualization.arrayToDataTable([
661 661
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
662 662
                             $year_data = '';
663
-                          foreach($year_array as $year_item)
663
+                          foreach ($year_array as $year_item)
664 664
                                     {
665 665
                                         $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
666 666
                                     }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
691 691
                 </div>
692 692
             </div>
693
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
693
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
694 694
 
695 695
         <div class="row column">
696 696
             <div class="col-md-6">
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
                         var data = google.visualization.arrayToDataTable([
710 710
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
711 711
                             $year_data = '';
712
-                          foreach($year_array as $year_item)
712
+                          foreach ($year_array as $year_item)
713 713
                                     {
714
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
714
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
715 715
                                     }
716 716
                                     $year_data = substr($year_data, 0, -1);
717 717
                                     print $year_data;
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
740 740
                 </div>
741 741
             </div>
742
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
742
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
743 743
 <br/>
744 744
 <?php
745 745
     }
@@ -752,9 +752,9 @@  discard block
 block discarded – undo
752 752
         	<?php
753 753
         	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
754 754
         	    if ($year == '' && $month == '') {
755
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
755
+		        $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
756 756
 		    } else {
757
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
757
+        		$polar = $Stats->getStatsSource('polar', $year, $month);
758 758
         	    }
759 759
         	    if (!empty($polar)) {
760 760
             		print '<h2>'._("Coverage pattern").'</h2>';
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         		    unset($polar_data);
763 763
 	        	    $Spotter = new Spotter();
764 764
         		    $data = json_decode($eachpolar['source_data']);
765
-        		    foreach($data as $value => $key) {
765
+        		    foreach ($data as $value => $key) {
766 766
         			$direction = $Spotter->parseDirection(($value*22.5));
767 767
         			$distance = $key;
768 768
         			$unit = 'km';
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         	?>
783 783
             <div class="col-md-6">
784 784
                 <h4><?php print $eachpolar['source_name']; ?></h4>
785
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
785
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
786 786
         	<script>
787 787
         	    (function() {
788 788
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 		      color: color,
807 807
 		      unit: '<?php echo $unit; ?>'
808 808
 		    };
809
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
809
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
810 810
 		    })();
811 811
 		</script>
812 812
             </div>
@@ -820,22 +820,22 @@  discard block
 block discarded – undo
820 820
         	<?php
821 821
         	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
822 822
         	    if ($year == '' && $month == '') {
823
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
823
+        		$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
824 824
         	    } else {
825
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
825
+        		$msg = $Stats->getStatsSource('msg', $year, $month);
826 826
         	    }
827 827
         	    if (!empty($msg)) {
828 828
             		print '<h2>'._("Messages received").'</h2>';
829 829
         		foreach ($msg as $eachmsg) {
830 830
         		    //$eachmsg = $msg[0];
831 831
         		    $data = $eachmsg['source_data'];
832
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
832
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
833 833
         		    else $max = 500;
834 834
         	?>
835
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
835
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
836 836
         	<script>
837 837
 		      var g = new JustGage({
838
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
838
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
839 839
 			    value: <?php echo $data; ?>,
840 840
 			    min: 0,
841 841
 			    max: <?php print $max; ?>,
@@ -857,15 +857,15 @@  discard block
 block discarded – undo
857 857
             <?php
858 858
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
859 859
 		if ($year == '' && $month == '') {
860
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
860
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
861 861
 		} else {
862
-			$hist = $Stats->getStatsSource('hist',$year,$month);
862
+			$hist = $Stats->getStatsSource('hist', $year, $month);
863 863
 		}
864 864
 		foreach ($hist as $hists) {
865 865
 			$hist_data = '';
866 866
 			$source = $hists['source_name'];
867 867
 			$hist_array = json_decode($hists['source_data']);
868
-			foreach($hist_array as $distance => $nb)
868
+			foreach ($hist_array as $distance => $nb)
869 869
 			{
870 870
 				$unit = 'km';
871 871
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -883,13 +883,13 @@  discard block
 block discarded – undo
883 883
 			$hist_data = substr($hist_data, 0, -1);
884 884
             ?>
885 885
             <div class="col-md-6">
886
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
886
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
887 887
                 <?php
888
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
888
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
889 889
                     <script> 
890 890
                         google.load("visualization", "1", {packages:["corechart"]});
891
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
892
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
891
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
892
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
893 893
                         var data = google.visualization.arrayToDataTable([
894 894
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
895 895
                             print $hist_data;
@@ -904,16 +904,16 @@  discard block
 block discarded – undo
904 904
                             colors: ["#1a3151"]
905 905
                         };
906 906
 
907
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
907
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
908 908
                         chart.draw(data, options);
909 909
                       }
910 910
                       $(window).resize(function(){
911
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
911
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
912 912
                             });
913 913
                   </script>';
914 914
         	?>
915 915
     	    </div>
916
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
916
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
917 917
         	<?php
918 918
                   }
919 919
                 ?>
Please login to merge, or discard this patch.
Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
47 47
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
48 48
 	}
49
-    ?>
49
+	?>
50 50
     </div>
51 51
     <?php include('statistics-sub-menu.php'); ?>
52 52
     <p class="global-stats">
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
56 56
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
57 57
 	<?php
58
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
58
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
59 59
 	?>
60 60
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
61 61
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
62 62
         <?php
63
-    	    } else {
64
-    	?>
63
+			} else {
64
+		?>
65 65
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
66 66
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
67 67
     	<?php
68
-    	    }
69
-    	?>
68
+			}
69
+		?>
70 70
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
71 71
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
72 72
         <?php
73
-    		if ($airline_icao == '') {
74
-    	?>
73
+			if ($airline_icao == '') {
74
+		?>
75 75
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
76 76
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
77 77
 	<?php
@@ -94,25 +94,25 @@  discard block
 block discarded – undo
94 94
             <div class="col-md-6">
95 95
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
96 96
                  <?php
97
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
98
-		    if (count($aircraft_array) == 0) print _("No data available");
99
-		    else {
97
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
98
+			if (count($aircraft_array) == 0) print _("No data available");
99
+			else {
100 100
 
101
-                    print '<div id="chart1" class="chart" width="100%"></div>
101
+					print '<div id="chart1" class="chart" width="100%"></div>
102 102
                     <script> 
103 103
                         google.load("visualization", "1", {packages:["corechart"]});
104 104
                       google.setOnLoadCallback(drawChart1);
105 105
                       function drawChart1() {
106 106
                         var data = google.visualization.arrayToDataTable([
107 107
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
108
-                            $aircraft_data = '';
109
-                          foreach($aircraft_array as $aircraft_item)
110
-                                    {
111
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
112
-                                    }
113
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
114
-                                    print $aircraft_data;
115
-                        print ']);
108
+							$aircraft_data = '';
109
+						  foreach($aircraft_array as $aircraft_item)
110
+									{
111
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
112
+									}
113
+									$aircraft_data = substr($aircraft_data, 0, -1);
114
+									print $aircraft_data;
115
+						print ']);
116 116
 
117 117
                         var options = {
118 118
                             chartArea: {"width": "80%", "height": "60%"},
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
                               drawChart1();
128 128
                             });
129 129
                   </script>';
130
-                  }
131
-                  ?>
130
+				  }
131
+				  ?>
132 132
                 <div class="more">
133 133
             	    <?php
134
-            		if ($year != '' && $month != '') {
135
-            	    ?>
134
+					if ($year != '' && $month != '') {
135
+					?>
136 136
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
137 137
             	    <?php
138
-            		} else {
139
-            	    ?>
138
+					} else {
139
+					?>
140 140
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
141 141
             	    <?php
142
-            		}
143
-            	    ?>
142
+					}
143
+					?>
144 144
                 </div>
145 145
             </div>
146 146
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
147 147
 <?php
148 148
 //    echo $airline_icao;
149
-    if ($airline_icao == '' || $airline_icao == 'all') {
149
+	if ($airline_icao == '' || $airline_icao == 'all') {
150 150
 	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
151 151
 	if (count($airline_array) > 0) {
152
-            print '<div class="col-md-6">';
153
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
154
-	    print '<div id="chart2" class="chart" width="100%"></div>
152
+			print '<div class="col-md-6">';
153
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
154
+		print '<div id="chart2" class="chart" width="100%"></div>
155 155
                     <script> 
156 156
                         google.load("visualization", "1", {packages:["corechart"]});
157 157
                       google.setOnLoadCallback(drawChart2);
158 158
                       function drawChart2() {
159 159
                         var data = google.visualization.arrayToDataTable([
160 160
                             ["'._("Airline").'", "'._("# of times").'"], ';
161
-	    $airline_data = '';
162
-	    foreach($airline_array as $airline_item)
163
-	    {
161
+		$airline_data = '';
162
+		foreach($airline_array as $airline_item)
163
+		{
164 164
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
165
-	    }
166
-	    $airline_data = substr($airline_data, 0, -1);
167
-	    print $airline_data;
168
-	    print ']);
165
+		}
166
+		$airline_data = substr($airline_data, 0, -1);
167
+		print $airline_data;
168
+		print ']);
169 169
 
170 170
                         var options = {
171 171
                             chartArea: {"width": "80%", "height": "60%"},
@@ -180,31 +180,31 @@  discard block
 block discarded – undo
180 180
                               drawChart2();
181 181
                             });
182 182
                   </script>';
183
-	    if ($year != '' && $month != '') {
183
+		if ($year != '' && $month != '') {
184 184
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
185 185
 		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
186 186
 		print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
187
-	    } else {
187
+		} else {
188 188
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
189 189
 		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
190 190
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
191
-	    }
192
-    	    print '</div>';
191
+		}
192
+			print '</div>';
193 193
 	}
194 194
 ?>
195 195
         </div>
196 196
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
197 197
 <?php
198
-    }
198
+	}
199 199
 ?>
200 200
         <div class="row column">
201 201
 <?php
202
-    $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
203
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
202
+	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
203
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
204 204
 	if (empty($flightover_array)) {
205
-	    print '<div class="col-md-12">';
205
+		print '<div class="col-md-12">';
206 206
 	} else {
207
-            print '<div class="col-md-6">';
207
+			print '<div class="col-md-6">';
208 208
 	}
209 209
 ?>
210 210
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -212,21 +212,21 @@  discard block
 block discarded – undo
212 212
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
213 213
 	if (count($pilot_array) == 0) print _("No data available");
214 214
 	else {
215
-	    print '<div id="chart7" class="chart" width="100%"></div>
215
+		print '<div id="chart7" class="chart" width="100%"></div>
216 216
                     <script> 
217 217
                         google.load("visualization", "1", {packages:["corechart"]});
218 218
                       google.setOnLoadCallback(drawChart7);
219 219
                       function drawChart7() {
220 220
                         var data = google.visualization.arrayToDataTable([
221 221
                             ["'._("Pilots").'", "'._("# of times").'"], ';
222
-	    $pilot_data = '';
223
-	    foreach($pilot_array as $pilot_item)
224
-	    {
222
+		$pilot_data = '';
223
+		foreach($pilot_array as $pilot_item)
224
+		{
225 225
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
226
-	    }
227
-	    $pilot_data = substr($pilot_data, 0, -1);
228
-	    print $pilot_data;
229
-	    print ']);
226
+		}
227
+		$pilot_data = substr($pilot_data, 0, -1);
228
+		print $pilot_data;
229
+		print ']);
230 230
 
231 231
                         var options = {
232 232
                             chartArea: {"width": "80%", "height": "60%"},
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
                               drawChart7();
242 242
                             });
243 243
                   </script>';
244
-        }
245
-        print '<div class="more">';
244
+		}
245
+		print '<div class="more">';
246 246
 	print '<a href="'.$globalURL.'/statistics/pilot'; 
247 247
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
248 248
 	print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         
253 253
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
254 254
 <?php
255
-    } else {
255
+	} else {
256 256
 ?>
257 257
             <div class="col-md-6">
258 258
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -260,21 +260,21 @@  discard block
 block discarded – undo
260 260
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
261 261
 	if (count($owner_array) == 0) print _("No data available");
262 262
 	else {
263
-	    print '<div id="chart7" class="chart" width="100%"></div>
263
+		print '<div id="chart7" class="chart" width="100%"></div>
264 264
                     <script> 
265 265
                         google.load("visualization", "1", {packages:["corechart"]});
266 266
                       google.setOnLoadCallback(drawChart7);
267 267
                       function drawChart7() {
268 268
                         var data = google.visualization.arrayToDataTable([
269 269
                             ["'._("Owner").'", "'._("# of times").'"], ';
270
-                            $owner_data = '';
271
-	    foreach($owner_array as $owner_item)
272
-	    {
270
+							$owner_data = '';
271
+		foreach($owner_array as $owner_item)
272
+		{
273 273
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
274
-	    }
275
-	    $owner_data = substr($owner_data, 0, -1);
276
-	    print $owner_data;
277
-	    print ']);
274
+		}
275
+		$owner_data = substr($owner_data, 0, -1);
276
+		print $owner_data;
277
+		print ']);
278 278
 
279 279
                         var options = {
280 280
                             chartArea: {"width": "80%", "height": "60%"},
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
         
299 299
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
300 300
 <?php
301
-    }
302
-    if (!empty($flightover_array)) {
301
+	}
302
+	if (!empty($flightover_array)) {
303 303
 ?>
304 304
             <div class="col-md-6">
305 305
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
308 308
 	if (count($flightover_array) == 0) print _("No data available");
309 309
 	else {
310
-	    print '<div id="chart10" class="chart" width="100%"></div>
310
+		print '<div id="chart10" class="chart" width="100%"></div>
311 311
                     <script> 
312 312
                         google.load("visualization", "1", {packages:["corechart"]});
313 313
                       google.setOnLoadCallback(drawChart10);
314 314
                       function drawChart10() {
315 315
                         var data = google.visualization.arrayToDataTable([
316 316
                             ["'._("Country").'", "'._("# of times").'"], ';
317
-                            $flightover_data = '';
318
-	    foreach($flightover_array as $flightover_item)
319
-	    {
317
+							$flightover_data = '';
318
+		foreach($flightover_array as $flightover_item)
319
+		{
320 320
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
321
-	    }
322
-	    $flightover_data = substr($flightover_data, 0, -1);
323
-	    print $flightover_data;
324
-	    print ']);
321
+		}
322
+		$flightover_data = substr($flightover_data, 0, -1);
323
+		print $flightover_data;
324
+		print ']);
325 325
 
326 326
                         var options = {
327 327
                             chartArea: {"width": "80%", "height": "60%"},
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
                 </div>
346 346
             </div>
347 347
 <?php
348
-    }
348
+	}
349 349
 ?>
350 350
         </div>
351 351
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
         <div class="row column">
356 356
             <div class="col-md-6">
357 357
 <?php
358
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
359
-    if (count($airport_airport_array) > 0) {
358
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
359
+	if (count($airport_airport_array) > 0) {
360 360
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
361 361
 	print '<div id="chart3" class="chart" width="100%"></div>
362 362
                 <script>
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
 
370 370
                 var data = google.visualization.arrayToDataTable([ 
371 371
                     ["'._("Airport").'", "'._("# of times").'"],';
372
-                    $airport_data = '';
372
+					$airport_data = '';
373 373
 	foreach($airport_airport_array as $airport_item)
374 374
 	{
375
-	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
376
-	    $name = str_replace("'", "", $name);
377
-	    $name = str_replace('"', "", $name);
378
-	    $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
375
+		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
376
+		$name = str_replace("'", "", $name);
377
+		$name = str_replace('"', "", $name);
378
+		$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
379 379
 	}
380 380
 	$airport_data = substr($airport_data, 0, -1);
381 381
 	print $airport_data;
@@ -396,15 +396,15 @@  discard block
 block discarded – undo
396 396
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
397 397
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
398 398
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
399
-    }
399
+	}
400 400
 ?>
401 401
             </div>
402 402
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
403 403
 
404 404
             <div class="col-md-6">
405 405
 <?php
406
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
407
-    if (count($airport_airport_array2) > 0) {
406
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
407
+	if (count($airport_airport_array2) > 0) {
408 408
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
409 409
 	print '<div id="chart4" class="chart" width="100%"></div>
410 410
                 <script>
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 	$airport_data2 = '';
421 421
 	foreach($airport_airport_array2 as $airport_item2)
422 422
 	{
423
-	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
424
-	    $name2 = str_replace(array("'",'"'), '', $name2);
425
-	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
423
+		$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
424
+		$name2 = str_replace(array("'",'"'), '', $name2);
425
+		$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
426 426
 	}
427 427
 	$airport_data2 = substr($airport_data2, 0, -1);
428 428
 	print $airport_data2;
@@ -443,36 +443,36 @@  discard block
 block discarded – undo
443 443
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
444 444
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
445 445
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
446
-    }
446
+	}
447 447
 ?>
448 448
             </div>
449 449
         </div>
450 450
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
451 451
 <?php
452
-    if ($year == '' && $month == '') {
452
+	if ($year == '' && $month == '') {
453 453
 ?>
454 454
         <div class="row column">
455 455
             <div class="col-md-6">
456 456
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
457 457
                 <?php
458
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
459
-		    if (count($year_array) == 0) print _("No data available");
460
-		    else {
461
-                  print '<div id="chart8" class="chart" width="100%"></div>
458
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
459
+			if (count($year_array) == 0) print _("No data available");
460
+			else {
461
+				  print '<div id="chart8" class="chart" width="100%"></div>
462 462
                     <script> 
463 463
                         google.load("visualization", "1", {packages:["corechart"]});
464 464
                       google.setOnLoadCallback(drawChart8);
465 465
                       function drawChart8() {
466 466
                         var data = google.visualization.arrayToDataTable([
467 467
                             ["'._("Month").'", "'._("# of Flights").'"], ';
468
-                            $year_data = '';
469
-                          foreach($year_array as $year_item)
470
-                                    {
471
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
472
-                                    }
473
-                                    $year_data = substr($year_data, 0, -1);
474
-                                    print $year_data;
475
-                        print ']);
468
+							$year_data = '';
469
+						  foreach($year_array as $year_item)
470
+									{
471
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
472
+									}
473
+									$year_data = substr($year_data, 0, -1);
474
+									print $year_data;
475
+						print ']);
476 476
 
477 477
                         var options = {
478 478
                             legend: {position: "none"},
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
                               drawChart8();
491 491
                             });
492 492
                   </script>';
493
-                  }
494
-                  ?>
493
+				  }
494
+				  ?>
495 495
                 <div class="more">
496 496
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
497 497
                 </div>
@@ -500,24 +500,24 @@  discard block
 block discarded – undo
500 500
             <div class="col-md-6">
501 501
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
502 502
                 <?php
503
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
504
-		    if (count($month_array) == 0) print _("No data available");
505
-		    else {
506
-                  print '<div id="chart9" class="chart" width="100%"></div>
503
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
504
+			if (count($month_array) == 0) print _("No data available");
505
+			else {
506
+				  print '<div id="chart9" class="chart" width="100%"></div>
507 507
                     <script> 
508 508
                         google.load("visualization", "1", {packages:["corechart"]});
509 509
                       google.setOnLoadCallback(drawChart9);
510 510
                       function drawChart9() {
511 511
                         var data = google.visualization.arrayToDataTable([
512 512
                             ["'._("Day").'", "'._("# of Flights").'"], ';
513
-                            $month_data = '';
514
-                          foreach($month_array as $month_item)
515
-                                    {
516
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
517
-                                    }
518
-                                    $month_data = substr($month_data, 0, -1);
519
-                                    print $month_data;
520
-                        print ']);
513
+							$month_data = '';
514
+						  foreach($month_array as $month_item)
515
+									{
516
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
517
+									}
518
+									$month_data = substr($month_data, 0, -1);
519
+									print $month_data;
520
+						print ']);
521 521
 
522 522
                         var options = {
523 523
                             legend: {position: "none"},
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
                               drawChart9();
536 536
                             });
537 537
                   </script>';
538
-                  }
539
-                  ?>
538
+				  }
539
+				  ?>
540 540
                 <div class="more">
541 541
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
542 542
                 </div>
@@ -546,25 +546,25 @@  discard block
 block discarded – undo
546 546
             <div class="col-md-6">
547 547
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
548 548
                 <?php
549
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
550
-		    if (empty($date_array)) print _("No data available");
551
-		    else {
552
-                  print '<div id="chart5" class="chart" width="100%"></div>
549
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
550
+			if (empty($date_array)) print _("No data available");
551
+			else {
552
+				  print '<div id="chart5" class="chart" width="100%"></div>
553 553
                     <script> 
554 554
                         google.load("visualization", "1", {packages:["corechart"]});
555 555
                       google.setOnLoadCallback(drawChart5);
556 556
                       function drawChart5() {
557 557
                         var data = google.visualization.arrayToDataTable([
558 558
                             ["'._("Date").'", "'._("# of Flights").'"], ';
559
-                            $date_data = '';
559
+							$date_data = '';
560 560
                         
561
-                          foreach($date_array as $date_item)
562
-                                    {
563
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
564
-                                    }
565
-                                    $date_data = substr($date_data, 0, -1);
566
-                                    print $date_data;
567
-                        print ']);
561
+						  foreach($date_array as $date_item)
562
+									{
563
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
564
+									}
565
+									$date_data = substr($date_data, 0, -1);
566
+									print $date_data;
567
+						print ']);
568 568
 
569 569
                         var options = {
570 570
                             legend: {position: "none"},
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
                               drawChart5();
583 583
                             });
584 584
                   </script>';
585
-                  }
586
-                  ?>
585
+				  }
586
+				  ?>
587 587
                 <div class="more">
588 588
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
589 589
                 </div>
@@ -592,25 +592,25 @@  discard block
 block discarded – undo
592 592
             <div class="col-md-6">
593 593
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
594 594
                 <?php
595
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
596
-		    if (empty($hour_array)) print _("No data available");
597
-		    else {
595
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
596
+			if (empty($hour_array)) print _("No data available");
597
+			else {
598 598
 
599
-                  print '<div id="chart6" class="chart" width="100%"></div>
599
+				  print '<div id="chart6" class="chart" width="100%"></div>
600 600
                     <script> 
601 601
                         google.load("visualization", "1", {packages:["corechart"]});
602 602
                       google.setOnLoadCallback(drawChart6);
603 603
                       function drawChart6() {
604 604
                         var data = google.visualization.arrayToDataTable([
605 605
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
606
-                            $hour_data = '';
607
-                          foreach($hour_array as $hour_item)
608
-                                    {
609
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
610
-                                    }
611
-                                    $hour_data = substr($hour_data, 0, -1);
612
-                                    print $hour_data;
613
-                        print ']);
606
+							$hour_data = '';
607
+						  foreach($hour_array as $hour_item)
608
+									{
609
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
610
+									}
611
+									$hour_data = substr($hour_data, 0, -1);
612
+									print $hour_data;
613
+						print ']);
614 614
 
615 615
                         var options = {
616 616
                             legend: {position: "none"},
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
                               drawChart6();
629 629
                             });
630 630
                   </script>';
631
-                  }
632
-                ?>
631
+				  }
632
+				?>
633 633
                 <div class="more">
634 634
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
635 635
                 </div>
@@ -637,34 +637,34 @@  discard block
 block discarded – undo
637 637
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
638 638
         </div>
639 639
 <?php
640
-    }
640
+	}
641 641
 ?>
642 642
 
643 643
 <?php
644
-    if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
644
+	if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
645 645
 ?>
646 646
         <div class="row column">
647 647
             <div class="col-md-6">
648 648
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
649 649
                 <?php
650
-                  $year_array = $Stats->countFatalitiesByYear();
651
-		    if (count($year_array) == 0) print _("No data available");
652
-		    else {
653
-                  print '<div id="chart32" class="chart" width="100%"></div>
650
+				  $year_array = $Stats->countFatalitiesByYear();
651
+			if (count($year_array) == 0) print _("No data available");
652
+			else {
653
+				  print '<div id="chart32" class="chart" width="100%"></div>
654 654
                     <script> 
655 655
                         google.load("visualization", "1", {packages:["corechart"]});
656 656
                       google.setOnLoadCallback(drawChart32);
657 657
                       function drawChart32() {
658 658
                         var data = google.visualization.arrayToDataTable([
659 659
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
660
-                            $year_data = '';
661
-                          foreach($year_array as $year_item)
662
-                                    {
663
-                                        $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
664
-                                    }
665
-                                    $year_data = substr($year_data, 0, -1);
666
-                                    print $year_data;
667
-                        print ']);
660
+							$year_data = '';
661
+						  foreach($year_array as $year_item)
662
+									{
663
+										$year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
664
+									}
665
+									$year_data = substr($year_data, 0, -1);
666
+									print $year_data;
667
+						print ']);
668 668
 
669 669
                         var options = {
670 670
                             legend: {position: "none"},
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
                               drawChart32();
683 683
                             });
684 684
                   </script>';
685
-                  }
686
-                  ?>
685
+				  }
686
+				  ?>
687 687
                 <div class="more">
688 688
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
689 689
                 </div>
@@ -694,24 +694,24 @@  discard block
 block discarded – undo
694 694
             <div class="col-md-6">
695 695
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
696 696
                 <?php
697
-                  $year_array = $Stats->countFatalitiesLast12Months();
698
-		    if (count($year_array) == 0) print _("No data available");
699
-		    else {
700
-                  print '<div id="chart33" class="chart" width="100%"></div>
697
+				  $year_array = $Stats->countFatalitiesLast12Months();
698
+			if (count($year_array) == 0) print _("No data available");
699
+			else {
700
+				  print '<div id="chart33" class="chart" width="100%"></div>
701 701
                     <script> 
702 702
                         google.load("visualization", "1", {packages:["corechart"]});
703 703
                       google.setOnLoadCallback(drawChart33);
704 704
                       function drawChart33() {
705 705
                         var data = google.visualization.arrayToDataTable([
706 706
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
707
-                            $year_data = '';
708
-                          foreach($year_array as $year_item)
709
-                                    {
710
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
711
-                                    }
712
-                                    $year_data = substr($year_data, 0, -1);
713
-                                    print $year_data;
714
-                        print ']);
707
+							$year_data = '';
708
+						  foreach($year_array as $year_item)
709
+									{
710
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
711
+									}
712
+									$year_data = substr($year_data, 0, -1);
713
+									print $year_data;
714
+						print ']);
715 715
 
716 716
                         var options = {
717 717
                             legend: {position: "none"},
@@ -729,8 +729,8 @@  discard block
 block discarded – undo
729 729
                               drawChart33();
730 730
                             });
731 731
                   </script>';
732
-                  }
733
-                  ?>
732
+				  }
733
+				  ?>
734 734
                 <div class="more">
735 735
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
736 736
                 </div>
@@ -738,30 +738,30 @@  discard block
 block discarded – undo
738 738
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
739 739
 <br/>
740 740
 <?php
741
-    }
741
+	}
742 742
 ?>
743 743
 
744 744
 <?php
745
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
745
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
746 746
 ?>
747 747
         <div class="row column">
748 748
         	<?php
749
-        	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
750
-        	    if ($year == '' && $month == '') {
751
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
752
-		    } else {
753
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
754
-        	    }
755
-        	    if (!empty($polar)) {
756
-            		print '<h2>'._("Coverage pattern").'</h2>';
757
-        		foreach ($polar as $eachpolar) {
758
-        		    unset($polar_data);
759
-	        	    $Spotter = new Spotter();
760
-        		    $data = json_decode($eachpolar['source_data']);
761
-        		    foreach($data as $value => $key) {
762
-        			$direction = $Spotter->parseDirection(($value*22.5));
763
-        			$distance = $key;
764
-        			$unit = 'km';
749
+				//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
750
+				if ($year == '' && $month == '') {
751
+				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
752
+			} else {
753
+				$polar = $Stats->getStatsSource('polar',$year,$month);
754
+				}
755
+				if (!empty($polar)) {
756
+					print '<h2>'._("Coverage pattern").'</h2>';
757
+				foreach ($polar as $eachpolar) {
758
+					unset($polar_data);
759
+					$Spotter = new Spotter();
760
+					$data = json_decode($eachpolar['source_data']);
761
+					foreach($data as $value => $key) {
762
+					$direction = $Spotter->parseDirection(($value*22.5));
763
+					$distance = $key;
764
+					$unit = 'km';
765 765
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
766 766
 					$distance = round($distance*0.539957);
767 767
 					$unit = 'nm';
@@ -772,10 +772,10 @@  discard block
 block discarded – undo
772 772
 					$distance = $distance;
773 773
 					$unit = 'km';
774 774
 				}
775
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
776
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
777
-        		    }
778
-        	?>
775
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
776
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
777
+					}
778
+			?>
779 779
             <div class="col-md-6">
780 780
                 <h4><?php print $eachpolar['source_name']; ?></h4>
781 781
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -807,27 +807,27 @@  discard block
 block discarded – undo
807 807
 		</script>
808 808
             </div>
809 809
             <?php
810
-        	    }
811
-        	}
812
-            ?>
810
+				}
811
+			}
812
+			?>
813 813
         </div>
814 814
         <div class="row column">
815 815
             <div class="col-md-6">
816 816
         	<?php
817
-        	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
818
-        	    if ($year == '' && $month == '') {
819
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
820
-        	    } else {
821
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
822
-        	    }
823
-        	    if (!empty($msg)) {
824
-            		print '<h2>'._("Messages received").'</h2>';
825
-        		foreach ($msg as $eachmsg) {
826
-        		    //$eachmsg = $msg[0];
827
-        		    $data = $eachmsg['source_data'];
828
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
829
-        		    else $max = 500;
830
-        	?>
817
+				//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
818
+				if ($year == '' && $month == '') {
819
+				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
820
+				} else {
821
+				$msg = $Stats->getStatsSource('msg',$year,$month);
822
+				}
823
+				if (!empty($msg)) {
824
+					print '<h2>'._("Messages received").'</h2>';
825
+				foreach ($msg as $eachmsg) {
826
+					//$eachmsg = $msg[0];
827
+					$data = $eachmsg['source_data'];
828
+					if ($data > 500) $max = (round(($data+100)/100))*100;
829
+					else $max = 500;
830
+			?>
831 831
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
832 832
         	<script>
833 833
 		      var g = new JustGage({
@@ -843,9 +843,9 @@  discard block
 block discarded – undo
843 843
 			  });
844 844
 		</script>
845 845
             <?php
846
-        	   }
847
-        	}
848
-            ?>
846
+			   }
847
+			}
848
+			?>
849 849
             </div>
850 850
         </div>
851 851
         <div class="row column">
@@ -877,19 +877,19 @@  discard block
 block discarded – undo
877 877
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
878 878
 			}
879 879
 			$hist_data = substr($hist_data, 0, -1);
880
-            ?>
880
+			?>
881 881
             <div class="col-md-6">
882 882
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
883 883
                 <?php
884
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
884
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
885 885
                     <script> 
886 886
                         google.load("visualization", "1", {packages:["corechart"]});
887 887
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
888 888
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
889 889
                         var data = google.visualization.arrayToDataTable([
890 890
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
891
-                            print $hist_data;
892
-                        print ']);
891
+							print $hist_data;
892
+						print ']);
893 893
 
894 894
                         var options = {
895 895
                             legend: {position: "none"},
@@ -907,15 +907,15 @@  discard block
 block discarded – undo
907 907
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
908 908
                             });
909 909
                   </script>';
910
-        	?>
910
+			?>
911 911
     	    </div>
912 912
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
913 913
         	<?php
914
-                  }
915
-                ?>
914
+				  }
915
+				?>
916 916
         </div>
917 917
 <?php
918
-    }
918
+	}
919 919
 ?>
920 920
     </div>
921 921
 </div>  
Please login to merge, or discard this patch.
Braces   +103 added lines, -42 removed lines patch added patch discarded remove patch
@@ -6,11 +6,15 @@  discard block
 block discarded – undo
6 6
 $beginpage = microtime(true);
7 7
 $Stats = new Stats();
8 8
 
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 13
 if ($airline_icao == '' && isset($globalFilter)) {
12
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
14
+	if (isset($globalFilter['airline'])) {
15
+		$airline_icao = $globalFilter['airline'][0];
16
+	}
17
+	}
14 18
 if ($airline_icao != '' && $airline_icao != 'all') {
15 19
 	$Spotter = new Spotter();
16 20
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
@@ -36,14 +40,21 @@  discard block
 block discarded – undo
36 40
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/justgage.js"></script>
37 41
 <div class="column">
38 42
     <div class="info">
39
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
43
+            <h1><?php if (isset($airline_name)) {
44
+	echo _("Statistics for ").$airline_name;
45
+} else {
46
+	echo _("Statistics");
47
+}
48
+?></h1>
40 49
     <?php 
41 50
 	$last_update = $Stats->getLastStatsUpdate();
42 51
 	//if (isset($last_update[0]['value'])) print '<!-- Last update : '.$last_update[0]['value'].' -->';
43 52
 	if (isset($last_update[0]['value'])) {
44 53
 		date_default_timezone_set('UTC');
45 54
 		$lastupdate = strtotime($last_update[0]['value']);
46
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
55
+		if (isset($globalTimezone) && $globalTimezone != '') {
56
+			date_default_timezone_set($globalTimezone);
57
+		}
47 58
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
48 59
 	}
49 60
     ?>
@@ -95,8 +106,9 @@  discard block
 block discarded – undo
95 106
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
96 107
                  <?php
97 108
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
98
-		    if (count($aircraft_array) == 0) print _("No data available");
99
-		    else {
109
+		    if (count($aircraft_array) == 0) {
110
+		    	print _("No data available");
111
+		    } else {
100 112
 
101 113
                     print '<div id="chart1" class="chart" width="100%"></div>
102 114
                     <script> 
@@ -133,11 +145,17 @@  discard block
 block discarded – undo
133 145
             	    <?php
134 146
             		if ($year != '' && $month != '') {
135 147
             	    ?>
136
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
148
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
149
+	echo '/'.$airline_icao;
150
+}
151
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
137 152
             	    <?php
138 153
             		} else {
139 154
             	    ?>
140
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
155
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
156
+	echo '/'.$airline_icao;
157
+}
158
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
141 159
             	    <?php
142 160
             		}
143 161
             	    ?>
@@ -182,11 +200,15 @@  discard block
 block discarded – undo
182 200
                   </script>';
183 201
 	    if ($year != '' && $month != '') {
184 202
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
185
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
203
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
204
+			echo '/'.$airline_icao;
205
+		}
186 206
 		print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
187 207
 	    } else {
188 208
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
189
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
209
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
210
+			echo '/'.$airline_icao;
211
+		}
190 212
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
191 213
 	    }
192 214
     	    print '</div>';
@@ -210,8 +232,9 @@  discard block
 block discarded – undo
210 232
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
211 233
 <?php
212 234
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
213
-	if (count($pilot_array) == 0) print _("No data available");
214
-	else {
235
+	if (count($pilot_array) == 0) {
236
+		print _("No data available");
237
+	} else {
215 238
 	    print '<div id="chart7" class="chart" width="100%"></div>
216 239
                     <script> 
217 240
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -244,7 +267,9 @@  discard block
 block discarded – undo
244 267
         }
245 268
         print '<div class="more">';
246 269
 	print '<a href="'.$globalURL.'/statistics/pilot'; 
247
-	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
270
+	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
271
+		echo '/'.$airline_icao;
272
+	}
248 273
 	print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
249 274
 	print '</div>';
250 275
 ?>
@@ -258,8 +283,9 @@  discard block
 block discarded – undo
258 283
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
259 284
 <?php
260 285
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
261
-	if (count($owner_array) == 0) print _("No data available");
262
-	else {
286
+	if (count($owner_array) == 0) {
287
+		print _("No data available");
288
+	} else {
263 289
 	    print '<div id="chart7" class="chart" width="100%"></div>
264 290
                     <script> 
265 291
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -292,7 +318,10 @@  discard block
 block discarded – undo
292 318
 	}
293 319
 ?>
294 320
                 <div class="more">
295
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
321
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
322
+	echo '/'.$airline_icao;
323
+}
324
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
296 325
                 </div>
297 326
             </div>
298 327
         
@@ -305,8 +334,9 @@  discard block
 block discarded – undo
305 334
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
306 335
 <?php
307 336
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
308
-	if (count($flightover_array) == 0) print _("No data available");
309
-	else {
337
+	if (count($flightover_array) == 0) {
338
+		print _("No data available");
339
+	} else {
310 340
 	    print '<div id="chart10" class="chart" width="100%"></div>
311 341
                     <script> 
312 342
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -341,7 +371,10 @@  discard block
 block discarded – undo
341 371
 	}
342 372
 ?>
343 373
                 <div class="more">
344
-                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
374
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
375
+	echo '/'.$airline_icao;
376
+}
377
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
345 378
                 </div>
346 379
             </div>
347 380
 <?php
@@ -394,7 +427,9 @@  discard block
 block discarded – undo
394 427
               }
395 428
                 </script>';
396 429
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
397
-	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
430
+	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
431
+		echo '/'.$airline_icao;
432
+	}
398 433
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
399 434
     }
400 435
 ?>
@@ -441,7 +476,9 @@  discard block
 block discarded – undo
441 476
               }
442 477
                 </script>';
443 478
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
444
-	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
479
+	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
480
+		echo '/'.$airline_icao;
481
+	}
445 482
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
446 483
     }
447 484
 ?>
@@ -456,8 +493,9 @@  discard block
 block discarded – undo
456 493
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
457 494
                 <?php
458 495
                   $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
459
-		    if (count($year_array) == 0) print _("No data available");
460
-		    else {
496
+		    if (count($year_array) == 0) {
497
+		    	print _("No data available");
498
+		    } else {
461 499
                   print '<div id="chart8" class="chart" width="100%"></div>
462 500
                     <script> 
463 501
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -493,7 +531,10 @@  discard block
 block discarded – undo
493 531
                   }
494 532
                   ?>
495 533
                 <div class="more">
496
-                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
534
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
535
+	echo '/'.$airline_icao;
536
+}
537
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
497 538
                 </div>
498 539
             </div>
499 540
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -501,8 +542,9 @@  discard block
 block discarded – undo
501 542
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
502 543
                 <?php
503 544
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
504
-		    if (count($month_array) == 0) print _("No data available");
505
-		    else {
545
+		    if (count($month_array) == 0) {
546
+		    	print _("No data available");
547
+		    } else {
506 548
                   print '<div id="chart9" class="chart" width="100%"></div>
507 549
                     <script> 
508 550
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -538,7 +580,10 @@  discard block
 block discarded – undo
538 580
                   }
539 581
                   ?>
540 582
                 <div class="more">
541
-                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
583
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
584
+	echo '/'.$airline_icao;
585
+}
586
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
542 587
                 </div>
543 588
             </div>
544 589
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -547,8 +592,9 @@  discard block
 block discarded – undo
547 592
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
548 593
                 <?php
549 594
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
550
-		    if (empty($date_array)) print _("No data available");
551
-		    else {
595
+		    if (empty($date_array)) {
596
+		    	print _("No data available");
597
+		    } else {
552 598
                   print '<div id="chart5" class="chart" width="100%"></div>
553 599
                     <script> 
554 600
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -585,7 +631,10 @@  discard block
 block discarded – undo
585 631
                   }
586 632
                   ?>
587 633
                 <div class="more">
588
-                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
634
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
635
+	echo '/'.$airline_icao;
636
+}
637
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
589 638
                 </div>
590 639
             </div>
591 640
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -593,8 +642,9 @@  discard block
 block discarded – undo
593 642
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
594 643
                 <?php
595 644
                   $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
596
-		    if (empty($hour_array)) print _("No data available");
597
-		    else {
645
+		    if (empty($hour_array)) {
646
+		    	print _("No data available");
647
+		    } else {
598 648
 
599 649
                   print '<div id="chart6" class="chart" width="100%"></div>
600 650
                     <script> 
@@ -631,7 +681,10 @@  discard block
 block discarded – undo
631 681
                   }
632 682
                 ?>
633 683
                 <div class="more">
634
-                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
684
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
685
+	echo '/'.$airline_icao;
686
+}
687
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
635 688
                 </div>
636 689
             </div>
637 690
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -648,8 +701,9 @@  discard block
 block discarded – undo
648 701
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
649 702
                 <?php
650 703
                   $year_array = $Stats->countFatalitiesByYear();
651
-		    if (count($year_array) == 0) print _("No data available");
652
-		    else {
704
+		    if (count($year_array) == 0) {
705
+		    	print _("No data available");
706
+		    } else {
653 707
                   print '<div id="chart32" class="chart" width="100%"></div>
654 708
                     <script> 
655 709
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -695,8 +749,9 @@  discard block
 block discarded – undo
695 749
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
696 750
                 <?php
697 751
                   $year_array = $Stats->countFatalitiesLast12Months();
698
-		    if (count($year_array) == 0) print _("No data available");
699
-		    else {
752
+		    if (count($year_array) == 0) {
753
+		    	print _("No data available");
754
+		    } else {
700 755
                   print '<div id="chart33" class="chart" width="100%"></div>
701 756
                     <script> 
702 757
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -772,8 +827,11 @@  discard block
 block discarded – undo
772 827
 					$distance = $distance;
773 828
 					$unit = 'km';
774 829
 				}
775
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
776
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
830
+        			if (!isset($polar_data)) {
831
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
832
+        			} else {
833
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
834
+        	    		}
777 835
         		    }
778 836
         	?>
779 837
             <div class="col-md-6">
@@ -825,8 +883,11 @@  discard block
 block discarded – undo
825 883
         		foreach ($msg as $eachmsg) {
826 884
         		    //$eachmsg = $msg[0];
827 885
         		    $data = $eachmsg['source_data'];
828
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
829
-        		    else $max = 500;
886
+        		    if ($data > 500) {
887
+        		    	$max = (round(($data+100)/100))*100;
888
+        		    } else {
889
+        		    	$max = 500;
890
+        		    }
830 891
         	?>
831 892
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
832 893
         	<script>
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	* Get SQL query part for filter used
59 59
 	* @param Array $filter the filter
60
-	* @return Array the SQL part
60
+	* @return string the SQL part
61 61
 	*/
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -10171,6 +10171,7 @@  discard block
 block discarded – undo
10171 10171
 	/**
10172 10172
 	* Counts all hours
10173 10173
 	*
10174
+	* @param string $orderby
10174 10175
 	* @return Array the hour list
10175 10176
 	*
10176 10177
 	*/
@@ -10236,6 +10237,7 @@  discard block
 block discarded – undo
10236 10237
 	/**
10237 10238
 	* Counts all hours
10238 10239
 	*
10240
+	* @param string $orderby
10239 10241
 	* @return Array the hour list
10240 10242
 	*
10241 10243
 	*/
@@ -11288,7 +11290,7 @@  discard block
 block discarded – undo
11288 11290
 	/**
11289 11291
 	* Parses the direction degrees to working
11290 11292
 	*
11291
-	* @param Float $direction the direction in degrees
11293
+	* @param integer $direction the direction in degrees
11292 11294
 	* @return Array the direction information
11293 11295
 	*
11294 11296
 	*/
Please login to merge, or discard this patch.
Braces   +735 added lines, -257 removed lines patch added patch discarded remove patch
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
 		if (isset($filter[0]['source'])) {
73 73
 			$filters = array_merge($filters,$filter);
74 74
 		}
75
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
75
+		if (is_array($globalFilter)) {
76
+			$filter = array_merge($filter,$globalFilter);
77
+		}
76 78
 		$filter_query_join = '';
77 79
 		$filter_query_where = '';
78 80
 		foreach($filters as $flt) {
@@ -156,8 +158,11 @@  discard block
 block discarded – undo
156 158
 				$filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
157 159
 			}
158 160
 		}
159
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
160
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
161
+		if ($filter_query_where == '' && $where) {
162
+			$filter_query_where = ' WHERE';
163
+		} elseif ($filter_query_where != '' && $and) {
164
+			$filter_query_where .= ' AND';
165
+		}
161 166
 		if ($filter_query_where != '') {
162 167
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
163 168
 		}
@@ -180,10 +185,18 @@  discard block
 block discarded – undo
180 185
 		$Image = new Image($this->db);
181 186
 		$Schedule = new Schedule($this->db);
182 187
 		$ACARS = new ACARS($this->db);
183
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
184
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
185
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
186
-		if (!isset($globalVAM)) $globalVAM = FALSE;
188
+		if (!isset($globalIVAO)) {
189
+			$globalIVAO = FALSE;
190
+		}
191
+		if (!isset($globalVATSIM)) {
192
+			$globalVATSIM = FALSE;
193
+		}
194
+		if (!isset($globalphpVMS)) {
195
+			$globalphpVMS = FALSE;
196
+		}
197
+		if (!isset($globalVAM)) {
198
+			$globalVAM = FALSE;
199
+		}
187 200
 		date_default_timezone_set('UTC');
188 201
 		
189 202
 		if (!is_string($query))
@@ -230,21 +243,35 @@  discard block
 block discarded – undo
230 243
 			} else {
231 244
 				$temp_array['spotter_id'] = '';
232 245
 			}
233
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
234
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
246
+			if (isset($row['flightaware_id'])) {
247
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
248
+			}
249
+			if (isset($row['modes'])) {
250
+				$temp_array['modes'] = $row['modes'];
251
+			}
235 252
 			$temp_array['ident'] = $row['ident'];
236 253
 			if (isset($row['registration']) && $row['registration'] != '') {
237 254
 				$temp_array['registration'] = $row['registration'];
238 255
 			} elseif (isset($temp_array['modes'])) {
239 256
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
240
-			} else $temp_array['registration'] = '';
241
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
257
+			} else {
258
+				$temp_array['registration'] = '';
259
+			}
260
+			if (isset($row['aircraft_icao'])) {
261
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
262
+			}
242 263
 			
243 264
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
244 265
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
245
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
246
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
247
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
266
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
267
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
268
+			}
269
+			if (isset($row['latitude'])) {
270
+				$temp_array['latitude'] = $row['latitude'];
271
+			}
272
+			if (isset($row['longitude'])) {
273
+				$temp_array['longitude'] = $row['longitude'];
274
+			}
248 275
 			/*
249 276
 			if (Connection->tableExists('countries')) {
250 277
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -254,8 +281,12 @@  discard block
 block discarded – undo
254 281
 				}
255 282
 			}
256 283
 			*/
257
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
258
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
284
+			if (isset($row['waypoints'])) {
285
+				$temp_array['waypoints'] = $row['waypoints'];
286
+			}
287
+			if (isset($row['format_source'])) {
288
+				$temp_array['format_source'] = $row['format_source'];
289
+			}
259 290
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
260 291
 				$temp_array['route_stop'] = $row['route_stop'];
261 292
 				$allroute = explode(' ',$row['route_stop']);
@@ -271,13 +302,19 @@  discard block
 block discarded – undo
271 302
 					}
272 303
 				}
273 304
 			}
274
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
305
+			if (isset($row['altitude'])) {
306
+				$temp_array['altitude'] = $row['altitude'];
307
+			}
275 308
 			if (isset($row['heading'])) {
276 309
 				$temp_array['heading'] = $row['heading'];
277 310
 				$heading_direction = $this->parseDirection($row['heading']);
278
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
311
+				if (isset($heading_direction[0]['direction_fullname'])) {
312
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
313
+				}
314
+			}
315
+			if (isset($row['ground_speed'])) {
316
+				$temp_array['ground_speed'] = $row['ground_speed'];
279 317
 			}
280
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
281 318
 			$temp_array['image'] = "";
282 319
 			$temp_array['image_thumbnail'] = "";
283 320
 			$temp_array['image_source'] = "";
@@ -285,7 +322,9 @@  discard block
 block discarded – undo
285 322
  
286 323
 			if (isset($row['highlight'])) {
287 324
 				$temp_array['highlight'] = $row['highlight'];
288
-			} else $temp_array['highlight'] = '';
325
+			} else {
326
+				$temp_array['highlight'] = '';
327
+			}
289 328
 			
290 329
 			if (isset($row['date'])) {
291 330
 				$dateArray = $this->parseDateString($row['date']);
@@ -341,7 +380,9 @@  discard block
 block discarded – undo
341 380
 				
342 381
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 382
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344
-					} else $temp_array['aircraft_shadow'] = 'default.png';
383
+					} else {
384
+						$temp_array['aircraft_shadow'] = 'default.png';
385
+					}
345 386
                                 } else {
346 387
                             		$temp_array['aircraft_shadow'] = 'default.png';
347 388
 					$temp_array['aircraft_name'] = 'N/A';
@@ -349,11 +390,17 @@  discard block
 block discarded – undo
349 390
                             	}
350 391
 			}
351 392
 			$fromsource = NULL;
352
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
353
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
354
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
355
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
356
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
393
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
394
+				$fromsource = $globalAirlinesSource;
395
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
396
+				$fromsource = 'vatsim';
397
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
398
+				$fromsource = 'ivao';
399
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
400
+				$fromsource = 'vatsim';
401
+			} elseif (isset($globalIVAO) && $globalIVAO) {
402
+				$fromsource = 'ivao';
403
+			}
357 404
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
358 405
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
359 406
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -376,12 +423,18 @@  discard block
 block discarded – undo
376 423
 				}
377 424
 			} else {
378 425
 				$temp_array['airline_icao'] = $row['airline_icao'];
379
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
380
-				else $temp_array['airline_iata'] = 'N/A';
426
+				if (isset($row['airline_iata'])) {
427
+					$temp_array['airline_iata'] = $row['airline_iata'];
428
+				} else {
429
+					$temp_array['airline_iata'] = 'N/A';
430
+				}
381 431
 				$temp_array['airline_name'] = $row['airline_name'];
382 432
 				$temp_array['airline_country'] = $row['airline_country'];
383
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
384
-				else $temp_array['airline_callsign'] = 'N/A';
433
+				if (isset($row['airline_callsign'])) {
434
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
435
+				} else {
436
+					$temp_array['airline_callsign'] = 'N/A';
437
+				}
385 438
 				$temp_array['airline_type'] = $row['airline_type'];
386 439
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
387 440
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -408,7 +461,9 @@  discard block
 block discarded – undo
408 461
 			}
409 462
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
410 463
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
411
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
464
+				if ($owner_info['owner'] != '') {
465
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
466
+				}
412 467
 				$temp_array['aircraft_base'] = $owner_info['base'];
413 468
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
414 469
 			}
@@ -416,9 +471,14 @@  discard block
 block discarded – undo
416 471
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
417 472
 			{
418 473
 				if ($globalIVAO) {
419
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
420
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
421
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
474
+					if (isset($temp_array['airline_icao'])) {
475
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
476
+					} else {
477
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
478
+					}
479
+				} else {
480
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
481
+				}
422 482
 				if (count($image_array) > 0) {
423 483
 					$temp_array['image'] = $image_array[0]['image'];
424 484
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -470,7 +530,9 @@  discard block
 block discarded – undo
470 530
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
471 531
 			if ($row['departure_airport_icao'] != '') {
472 532
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
473
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
533
+				if (!isset($departure_airport_array[0]['name'])) {
534
+					$departure_airport_array = $this->getAllAirportInfo('NA');
535
+				}
474 536
 			/*
475 537
 			} elseif ($row['departure_airport_name'] != '') {
476 538
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -478,7 +540,9 @@  discard block
 block discarded – undo
478 540
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
479 541
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
480 542
 			*/
481
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
543
+			} else {
544
+				$departure_airport_array = $this->getAllAirportInfo('NA');
545
+			}
482 546
 			if (isset($departure_airport_array[0]['name'])) {
483 547
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
484 548
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -498,8 +562,12 @@  discard block
 block discarded – undo
498 562
 			
499 563
 			if ($row['arrival_airport_icao'] != '') {
500 564
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
501
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
502
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
565
+				if (count($arrival_airport_array) == 0) {
566
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
567
+				}
568
+			} else {
569
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
570
+			}
503 571
 			if (isset($arrival_airport_array[0]['name'])) {
504 572
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
505 573
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -515,27 +583,45 @@  discard block
 block discarded – undo
515 583
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
516 584
 			}
517 585
 			*/
518
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
519
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
520
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
521
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
522
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
586
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
587
+				$temp_array['pilot_id'] = $row['pilot_id'];
588
+			}
589
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
590
+				$temp_array['pilot_name'] = $row['pilot_name'];
591
+			}
592
+			if (isset($row['source_name']) && $row['source_name'] != '') {
593
+				$temp_array['source_name'] = $row['source_name'];
594
+			}
595
+			if (isset($row['over_country']) && $row['over_country'] != '') {
596
+				$temp_array['over_country'] = $row['over_country'];
597
+			}
598
+			if (isset($row['distance']) && $row['distance'] != '') {
599
+				$temp_array['distance'] = $row['distance'];
600
+			}
523 601
 			if (isset($row['squawk'])) {
524 602
 				$temp_array['squawk'] = $row['squawk'];
525 603
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
526 604
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
527
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
605
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
606
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
607
+					}
528 608
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
529 609
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
530
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
531
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
610
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
611
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
612
+					}
613
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
614
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
615
+				}
532 616
 			}
533 617
     			
534 618
 			$temp_array['query_number_rows'] = $num_rows;
535 619
 			
536 620
 			$spotter_array[] = $temp_array;
537 621
 		}
538
-		if ($num_rows == 0) return array();
622
+		if ($num_rows == 0) {
623
+			return array();
624
+		}
539 625
 		$spotter_array[0]['query_number_rows'] = $num_rows;
540 626
 		return $spotter_array;
541 627
 	}	
@@ -568,7 +654,9 @@  discard block
 block discarded – undo
568 654
 				foreach ($q_array as $q_item){
569 655
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
570 656
 					$additional_query .= " AND (";
571
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
657
+					if (is_int($q_item)) {
658
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
659
+					}
572 660
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
573 661
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
574 662
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -589,7 +677,9 @@  discard block
 block discarded – undo
589 677
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
590 678
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
591 679
 					$translate = $Translation->ident2icao($q_item);
592
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
680
+					if ($translate != $q_item) {
681
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
682
+					}
593 683
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
594 684
 					$additional_query .= ")";
595 685
 				}
@@ -816,7 +906,9 @@  discard block
 block discarded – undo
816 906
 				date_default_timezone_set($globalTimezone);
817 907
 				$datetime = new DateTime();
818 908
 				$offset = $datetime->format('P');
819
-			} else $offset = '+00:00';
909
+			} else {
910
+				$offset = '+00:00';
911
+			}
820 912
 
821 913
 			if ($date_array[1] != "")
822 914
 			{
@@ -848,8 +940,12 @@  discard block
 block discarded – undo
848 940
 			{
849 941
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
850 942
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
851
-			} else $limit_query = "";
852
-		} else $limit_query = "";
943
+			} else {
944
+				$limit_query = "";
945
+			}
946
+		} else {
947
+			$limit_query = "";
948
+		}
853 949
 
854 950
 
855 951
 		if ($sort != "")
@@ -917,8 +1013,12 @@  discard block
 block discarded – undo
917 1013
 			{
918 1014
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
919 1015
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
920
-			} else $limit_query = "";
921
-		} else $limit_query = "";
1016
+			} else {
1017
+				$limit_query = "";
1018
+			}
1019
+		} else {
1020
+			$limit_query = "";
1021
+		}
922 1022
 		
923 1023
 		if ($sort != "")
924 1024
 		{
@@ -1242,7 +1342,9 @@  discard block
 block discarded – undo
1242 1342
 		global $global_query;
1243 1343
 		
1244 1344
 		date_default_timezone_set('UTC');
1245
-		if ($id == '') return array();
1345
+		if ($id == '') {
1346
+			return array();
1347
+		}
1246 1348
 		$additional_query = "spotter_output.spotter_id = :id";
1247 1349
 		$query_values = array(':id' => $id);
1248 1350
 
@@ -1357,8 +1459,11 @@  discard block
 block discarded – undo
1357 1459
 		if ($sort != "")
1358 1460
 		{
1359 1461
 			$search_orderby_array = $this->getOrderBy();
1360
-			if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql'];
1361
-			else $orderby_query = " ORDER BY spotter_output.date DESC";
1462
+			if (isset($search_orderby_array[$sort]['sql'])) {
1463
+				$orderby_query = $search_orderby_array[$sort]['sql'];
1464
+			} else {
1465
+				$orderby_query = " ORDER BY spotter_output.date DESC";
1466
+			}
1362 1467
 		} else {
1363 1468
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1364 1469
 		}
@@ -1983,7 +2088,9 @@  discard block
 block discarded – undo
1983 2088
 		{
1984 2089
 			$highlight = $row['highlight'];
1985 2090
 		}
1986
-		if (isset($highlight)) return $highlight;
2091
+		if (isset($highlight)) {
2092
+			return $highlight;
2093
+		}
1987 2094
 	}
1988 2095
 
1989 2096
 	
@@ -2011,7 +2118,9 @@  discard block
 block discarded – undo
2011 2118
 		$sth->closeCursor();
2012 2119
 		if (count($row) > 0) {
2013 2120
 			return $row['usage'];
2014
-		} else return '';
2121
+		} else {
2122
+			return '';
2123
+		}
2015 2124
 	}
2016 2125
 
2017 2126
 	/**
@@ -2036,7 +2145,9 @@  discard block
 block discarded – undo
2036 2145
 		$sth->closeCursor();
2037 2146
 		if (count($row) > 0) {
2038 2147
 			return $row['icao'];
2039
-		} else return '';
2148
+		} else {
2149
+			return '';
2150
+		}
2040 2151
 	}
2041 2152
 
2042 2153
 	/**
@@ -2064,7 +2175,9 @@  discard block
 block discarded – undo
2064 2175
 			$airport_longitude = $row['longitude'];
2065 2176
 			$Common = new Common();
2066 2177
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2067
-		} else return '';
2178
+		} else {
2179
+			return '';
2180
+		}
2068 2181
 	}
2069 2182
 	
2070 2183
 	/**
@@ -2176,7 +2289,9 @@  discard block
 block discarded – undo
2176 2289
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2177 2290
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2178 2291
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2179
-		} else return array();
2292
+		} else {
2293
+			return array();
2294
+		}
2180 2295
 		if ($globalDBdriver == 'mysql') {
2181 2296
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2182 2297
 		} else {
@@ -2211,7 +2326,9 @@  discard block
 block discarded – undo
2211 2326
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2212 2327
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2213 2328
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2214
-		} else return array();
2329
+		} else {
2330
+			return array();
2331
+		}
2215 2332
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2216 2333
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2217 2334
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2246,7 +2363,9 @@  discard block
 block discarded – undo
2246 2363
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2247 2364
 	{
2248 2365
 		global $globalUseRealAirlines;
2249
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2366
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2367
+			$fromsource = NULL;
2368
+		}
2250 2369
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2251 2370
 		if ($airline_icao == 'NA') {
2252 2371
 			$airline_array = array();
@@ -2315,7 +2434,9 @@  discard block
 block discarded – undo
2315 2434
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2316 2435
 	{
2317 2436
 		global $globalUseRealAirlines;
2318
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2437
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2438
+			$fromsource = NULL;
2439
+		}
2319 2440
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2320 2441
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2321 2442
 		$sth = $this->db->prepare($query);
@@ -2331,7 +2452,9 @@  discard block
 block discarded – undo
2331 2452
 			$sth->execute(array(':fromsource' => $fromsource));
2332 2453
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2333 2454
 			$sth->closeCursor();
2334
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2455
+			if ($row['nb'] == 0) {
2456
+				$result = $this->getAllAirlineInfoByName($airline_name);
2457
+			}
2335 2458
 		}
2336 2459
 		return $result;
2337 2460
 	}
@@ -2394,15 +2517,20 @@  discard block
 block discarded – undo
2394 2517
 				'A320-211' => 'A320',
2395 2518
 				'747-8i' => 'B748',
2396 2519
 				'A380' => 'A388');
2397
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2520
+		if (isset($all_aircraft[$aircraft_type])) {
2521
+			return $all_aircraft[$aircraft_type];
2522
+		}
2398 2523
 
2399 2524
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2400 2525
 		$aircraft_type = strtoupper($aircraft_type);
2401 2526
 		$sth = $this->db->prepare($query);
2402 2527
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2403 2528
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2404
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2405
-		else return '';
2529
+		if (isset($result[0]['icao'])) {
2530
+			return $result[0]['icao'];
2531
+		} else {
2532
+			return '';
2533
+		}
2406 2534
 	}
2407 2535
 	
2408 2536
 	/**
@@ -2430,11 +2558,15 @@  discard block
 block discarded – undo
2430 2558
 		$sth->closeCursor();
2431 2559
 		if (isset($row['icaotypecode'])) {
2432 2560
 			$icao = $row['icaotypecode'];
2433
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2561
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2562
+				$icao = $this->aircraft_correct_icaotype[$icao];
2563
+			}
2434 2564
 			return $icao;
2435 2565
 		} elseif ($source_type == 'flarm') {
2436 2566
 			return $this->getAllAircraftType($aircraft_modes);
2437
-		} else  return '';
2567
+		} else {
2568
+			return '';
2569
+		}
2438 2570
 	}
2439 2571
 
2440 2572
 	/**
@@ -2457,7 +2589,9 @@  discard block
 block discarded – undo
2457 2589
 		$sth->closeCursor();
2458 2590
 		if (isset($row['icaotypecode'])) {
2459 2591
 			return $row['icaotypecode'];
2460
-		} else return '';
2592
+		} else {
2593
+			return '';
2594
+		}
2461 2595
 	}
2462 2596
 
2463 2597
 	/**
@@ -2503,7 +2637,9 @@  discard block
 block discarded – undo
2503 2637
 		$sth->closeCursor();
2504 2638
 		if (isset($row['operator_correct'])) {
2505 2639
 			return $row['operator_correct'];
2506
-		} else return $operator;
2640
+		} else {
2641
+			return $operator;
2642
+		}
2507 2643
 	}
2508 2644
 
2509 2645
 	/**
@@ -2516,7 +2652,9 @@  discard block
 block discarded – undo
2516 2652
 	public function getRouteInfo($callsign)
2517 2653
 	{
2518 2654
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
-                if ($callsign == '') return array();
2655
+                if ($callsign == '') {
2656
+                	return array();
2657
+                }
2520 2658
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2521 2659
 		
2522 2660
 		$sth = $this->db->prepare($query);
@@ -2526,7 +2664,9 @@  discard block
 block discarded – undo
2526 2664
 		$sth->closeCursor();
2527 2665
 		if (count($row) > 0) {
2528 2666
 			return $row;
2529
-		} else return array();
2667
+		} else {
2668
+			return array();
2669
+		}
2530 2670
 	}
2531 2671
 	
2532 2672
 	/**
@@ -2579,7 +2719,9 @@  discard block
 block discarded – undo
2579 2719
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2580 2720
 			$sth->closeCursor();
2581 2721
 			return $result;
2582
-		} else return array();
2722
+		} else {
2723
+			return array();
2724
+		}
2583 2725
 	}
2584 2726
 	
2585 2727
   
@@ -2738,8 +2880,11 @@  discard block
 block discarded – undo
2738 2880
 		$query .= " ORDER BY spotter_output.source_name ASC";
2739 2881
 
2740 2882
 		$sth = $this->db->prepare($query);
2741
-		if (!empty($query_values)) $sth->execute($query_values);
2742
-		else $sth->execute();
2883
+		if (!empty($query_values)) {
2884
+			$sth->execute($query_values);
2885
+		} else {
2886
+			$sth->execute();
2887
+		}
2743 2888
 
2744 2889
 		$source_array = array();
2745 2890
 		$temp_array = array();
@@ -2772,9 +2917,13 @@  discard block
 block discarded – undo
2772 2917
 								WHERE spotter_output.airline_icao <> '' 
2773 2918
 								ORDER BY spotter_output.airline_name ASC";
2774 2919
 			*/
2775
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2776
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2777
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2920
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2921
+				$forsource = $globalAirlinesSource;
2922
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2923
+				$forsource = 'vatsim';
2924
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2925
+				$forsource = 'ivao';
2926
+			}
2778 2927
 			if ($forsource === NULL) {
2779 2928
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2780 2929
 				$query_data = array();
@@ -2817,9 +2966,13 @@  discard block
 block discarded – undo
2817 2966
 	{
2818 2967
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2819 2968
 		$filter_query = $this->getFilter($filters,true,true);
2820
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2821
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2822
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2969
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2970
+			$forsource = $globalAirlinesSource;
2971
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2972
+			$forsource = 'vatsim';
2973
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2974
+			$forsource = 'ivao';
2975
+		}
2823 2976
 		if ($forsource === NULL) {
2824 2977
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2825 2978
 			$query_data = array();
@@ -3130,7 +3283,9 @@  discard block
 block discarded – undo
3130 3283
 			date_default_timezone_set($globalTimezone);
3131 3284
 			$datetime = new DateTime();
3132 3285
 			$offset = $datetime->format('P');
3133
-		} else $offset = '+00:00';
3286
+		} else {
3287
+			$offset = '+00:00';
3288
+		}
3134 3289
 		if ($airport_icao == '') {
3135 3290
 			if ($globalDBdriver == 'mysql') {
3136 3291
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3162,7 +3317,9 @@  discard block
 block discarded – undo
3162 3317
 			date_default_timezone_set($globalTimezone);
3163 3318
 			$datetime = new DateTime();
3164 3319
 			$offset = $datetime->format('P');
3165
-		} else $offset = '+00:00';
3320
+		} else {
3321
+			$offset = '+00:00';
3322
+		}
3166 3323
 		if ($airport_icao == '') {
3167 3324
 			if ($globalDBdriver == 'mysql') {
3168 3325
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3195,7 +3352,9 @@  discard block
 block discarded – undo
3195 3352
 			date_default_timezone_set($globalTimezone);
3196 3353
 			$datetime = new DateTime();
3197 3354
 			$offset = $datetime->format('P');
3198
-		} else $offset = '+00:00';
3355
+		} else {
3356
+			$offset = '+00:00';
3357
+		}
3199 3358
 		if ($airport_icao == '') {
3200 3359
 			if ($globalDBdriver == 'mysql') {
3201 3360
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3234,7 +3393,9 @@  discard block
 block discarded – undo
3234 3393
 			date_default_timezone_set($globalTimezone);
3235 3394
 			$datetime = new DateTime();
3236 3395
 			$offset = $datetime->format('P');
3237
-		} else $offset = '+00:00';
3396
+		} else {
3397
+			$offset = '+00:00';
3398
+		}
3238 3399
 		if ($airport_icao == '') {
3239 3400
 			if ($globalDBdriver == 'mysql') {
3240 3401
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3279,7 +3440,9 @@  discard block
 block discarded – undo
3279 3440
 			date_default_timezone_set($globalTimezone);
3280 3441
 			$datetime = new DateTime();
3281 3442
 			$offset = $datetime->format('P');
3282
-		} else $offset = '+00:00';
3443
+		} else {
3444
+			$offset = '+00:00';
3445
+		}
3283 3446
 		if ($airport_icao == '') {
3284 3447
 			if ($globalDBdriver == 'mysql') {
3285 3448
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3314,7 +3477,9 @@  discard block
 block discarded – undo
3314 3477
 			date_default_timezone_set($globalTimezone);
3315 3478
 			$datetime = new DateTime();
3316 3479
 			$offset = $datetime->format('P');
3317
-		} else $offset = '+00:00';
3480
+		} else {
3481
+			$offset = '+00:00';
3482
+		}
3318 3483
 		if ($airport_icao == '') {
3319 3484
 			if ($globalDBdriver == 'mysql') {
3320 3485
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3356,7 +3521,9 @@  discard block
 block discarded – undo
3356 3521
 			date_default_timezone_set($globalTimezone);
3357 3522
 			$datetime = new DateTime();
3358 3523
 			$offset = $datetime->format('P');
3359
-		} else $offset = '+00:00';
3524
+		} else {
3525
+			$offset = '+00:00';
3526
+		}
3360 3527
 		if ($airport_icao == '') {
3361 3528
 			if ($globalDBdriver == 'mysql') {
3362 3529
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3390,7 +3557,9 @@  discard block
 block discarded – undo
3390 3557
 			date_default_timezone_set($globalTimezone);
3391 3558
 			$datetime = new DateTime();
3392 3559
 			$offset = $datetime->format('P');
3393
-		} else $offset = '+00:00';
3560
+		} else {
3561
+			$offset = '+00:00';
3562
+		}
3394 3563
 		if ($airport_icao == '') {
3395 3564
 			if ($globalDBdriver == 'mysql') {
3396 3565
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3438,7 +3607,9 @@  discard block
 block discarded – undo
3438 3607
 			date_default_timezone_set($globalTimezone);
3439 3608
 			$datetime = new DateTime();
3440 3609
 			$offset = $datetime->format('P');
3441
-		} else $offset = '+00:00';
3610
+		} else {
3611
+			$offset = '+00:00';
3612
+		}
3442 3613
 
3443 3614
 		if ($globalDBdriver == 'mysql') {
3444 3615
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3558,7 +3729,9 @@  discard block
 block discarded – undo
3558 3729
 	*/	
3559 3730
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560 3731
 	{
3561
-		if ($groundspeed == '') $groundspeed = NULL;
3732
+		if ($groundspeed == '') {
3733
+			$groundspeed = NULL;
3734
+		}
3562 3735
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3563 3736
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3564 3737
 
@@ -3608,10 +3781,18 @@  discard block
 block discarded – undo
3608 3781
 		$Image = new Image($this->db);
3609 3782
 		$Common = new Common();
3610 3783
 		
3611
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3612
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3613
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3614
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3784
+		if (!isset($globalIVAO)) {
3785
+			$globalIVAO = FALSE;
3786
+		}
3787
+		if (!isset($globalVATSIM)) {
3788
+			$globalVATSIM = FALSE;
3789
+		}
3790
+		if (!isset($globalphpVMS)) {
3791
+			$globalphpVMS = FALSE;
3792
+		}
3793
+		if (!isset($globalVAM)) {
3794
+			$globalVAM = FALSE;
3795
+		}
3615 3796
 		date_default_timezone_set('UTC');
3616 3797
 		
3617 3798
 		//getting the registration
@@ -3624,23 +3805,33 @@  discard block
 block discarded – undo
3624 3805
 				if ($ModeS != '') {
3625 3806
 					$timeelapsed = microtime(true);
3626 3807
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type);
3627
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3808
+					if ($globalDebugTimeElapsed) {
3809
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3810
+					}
3628 3811
 				} else {
3629 3812
 					$myhex = explode('-',$flightaware_id);
3630 3813
 					if (count($myhex) > 0) {
3631 3814
 						$timeelapsed = microtime(true);
3632 3815
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type);
3633
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3816
+						if ($globalDebugTimeElapsed) {
3817
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3818
+						}
3634 3819
 					}
3635 3820
 				}
3636 3821
 			}
3637 3822
 		}
3638 3823
 		$fromsource = NULL;
3639
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3640
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3641
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3642
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3643
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3824
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3825
+			$fromsource = $globalAirlinesSource;
3826
+		} elseif ($format_source == 'vatsimtxt') {
3827
+			$fromsource = 'vatsim';
3828
+		} elseif ($format_source == 'whazzup') {
3829
+			$fromsource = 'ivao';
3830
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3831
+			$fromsource = 'vatsim';
3832
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3833
+			$fromsource = 'ivao';
3834
+		}
3644 3835
 		//getting the airline information
3645 3836
 		if ($ident != "")
3646 3837
 		{
@@ -3664,15 +3855,21 @@  discard block
 block discarded – undo
3664 3855
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3665 3856
 						$airline_array = $this->getAllAirlineInfo("NA");
3666 3857
 					}
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858
+					if ($globalDebugTimeElapsed) {
3859
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					}
3668 3861
 
3669 3862
 				} else {
3670 3863
 					$timeelapsed = microtime(true);
3671 3864
 					$airline_array = $this->getAllAirlineInfo("NA");
3672
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3865
+					if ($globalDebugTimeElapsed) {
3866
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3867
+					}
3673 3868
 				}
3674 3869
 			}
3675
-		} else $airline_array = array();
3870
+		} else {
3871
+			$airline_array = array();
3872
+		}
3676 3873
 		
3677 3874
 		//getting the aircraft information
3678 3875
 		$aircraft_array = array();
@@ -3686,27 +3883,37 @@  discard block
 block discarded – undo
3686 3883
 				{
3687 3884
 					$timeelapsed = microtime(true);
3688 3885
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3689
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3886
+					if ($globalDebugTimeElapsed) {
3887
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3888
+					}
3690 3889
 				} else {
3691 3890
 					$timeelapsed = microtime(true);
3692 3891
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3693
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3892
+					if ($globalDebugTimeElapsed) {
3893
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3894
+					}
3694 3895
 				}
3695 3896
 			}
3696 3897
 		} else {
3697 3898
 			if ($ModeS != '') {
3698 3899
 				$timeelapsed = microtime(true);
3699 3900
 				$aircraft_icao = $this->getAllAircraftType($ModeS,$source_type);
3700
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3901
+				if ($globalDebugTimeElapsed) {
3902
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3903
+				}
3701 3904
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3702 3905
 				{
3703 3906
 					$timeelapsed = microtime(true);
3704 3907
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3705
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3908
+					if ($globalDebugTimeElapsed) {
3909
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3910
+					}
3706 3911
 				} else {
3707 3912
 					$timeelapsed = microtime(true);
3708 3913
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3709
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3914
+					if ($globalDebugTimeElapsed) {
3915
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3916
+					}
3710 3917
 				}
3711 3918
 			}
3712 3919
 		}
@@ -3722,7 +3929,9 @@  discard block
 block discarded – undo
3722 3929
 			} else {
3723 3930
 				$timeelapsed = microtime(true);
3724 3931
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3725
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3932
+				if ($globalDebugTimeElapsed) {
3933
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3934
+				}
3726 3935
 			}
3727 3936
 		}
3728 3937
 		
@@ -3737,7 +3946,9 @@  discard block
 block discarded – undo
3737 3946
 			} else {
3738 3947
 				$timeelapsed = microtime(true);
3739 3948
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3740
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3949
+				if ($globalDebugTimeElapsed) {
3950
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3951
+				}
3741 3952
 			}
3742 3953
 		}
3743 3954
 
@@ -3771,7 +3982,9 @@  discard block
 block discarded – undo
3771 3982
 			{
3772 3983
 				return false;
3773 3984
 			}
3774
-		} else $altitude = 0;
3985
+		} else {
3986
+			$altitude = 0;
3987
+		}
3775 3988
 		
3776 3989
 		if ($heading != "")
3777 3990
 		{
@@ -3800,7 +4013,9 @@  discard block
 block discarded – undo
3800 4013
 		{
3801 4014
 			$timeelapsed = microtime(true);
3802 4015
 			$image_array = $Image->getSpotterImage($registration);
3803
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4016
+			if ($globalDebugTimeElapsed) {
4017
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4018
+			}
3804 4019
 			if (!isset($image_array[0]['registration']))
3805 4020
 			{
3806 4021
 				//echo "Add image !!!! \n";
@@ -3808,14 +4023,21 @@  discard block
 block discarded – undo
3808 4023
 			}
3809 4024
 			$timeelapsed = microtime(true);
3810 4025
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3811
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3812
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
4026
+			if ($globalDebugTimeElapsed) {
4027
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4028
+			}
4029
+			if ($owner_info['owner'] != '') {
4030
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
4031
+			}
3813 4032
 		}
3814 4033
     
3815 4034
 		if ($globalIVAO && $aircraft_icao != '')
3816 4035
 		{
3817
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
-            		else $airline_icao = '';
4036
+            		if (isset($airline_array[0]['icao'])) {
4037
+            			$airline_icao = $airline_array[0]['icao'];
4038
+            		} else {
4039
+            			$airline_icao = '';
4040
+            		}
3819 4041
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820 4042
 			if (!isset($image_array[0]['registration']))
3821 4043
 			{
@@ -3860,16 +4082,28 @@  discard block
 block discarded – undo
3860 4082
                 {
3861 4083
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3862 4084
                 }
3863
-                if ($registration == '') $registration = 'NA';
4085
+                if ($registration == '') {
4086
+                	$registration = 'NA';
4087
+                }
3864 4088
                 if ($latitude == '' && $longitude == '') {
3865 4089
             		$latitude = 0;
3866 4090
             		$longitude = 0;
3867 4091
             	}
3868
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4092
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4093
+                	$squawk = NULL;
4094
+                }
4095
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4096
+                	$verticalrate = NULL;
4097
+                }
4098
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4099
+                	$heading = 0;
4100
+                }
4101
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4102
+                	$groundspeed = 0;
4103
+                }
4104
+                if (!isset($aircraft_owner)) {
4105
+                	$aircraft_owner = NULL;
4106
+                }
3873 4107
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3874 4108
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3875 4109
 
@@ -3880,9 +4114,13 @@  discard block
 block discarded – undo
3880 4114
 		if ($airline_type == '') {
3881 4115
 			$timeelapsed = microtime(true);
3882 4116
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4117
+			if ($globalDebugTimeElapsed) {
4118
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4119
+			}
4120
+		}
4121
+		if ($airline_type == null) {
4122
+			$airline_type = '';
3884 4123
 		}
3885
-		if ($airline_type == null) $airline_type = '';
3886 4124
                 $aircraft_type = $aircraft_array[0]['type'];
3887 4125
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888 4126
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -4046,7 +4284,9 @@  discard block
 block discarded – undo
4046 4284
 			}
4047 4285
 		}
4048 4286
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
4049
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4287
+		if ($limit) {
4288
+			$query .= " LIMIT 10 OFFSET 0";
4289
+		}
4050 4290
 
4051 4291
 		$sth = $this->db->prepare($query);
4052 4292
 		$sth->execute($query_values);
@@ -4119,7 +4359,9 @@  discard block
 block discarded – undo
4119 4359
 		}
4120 4360
 		
4121 4361
 		$query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4122
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4362
+		if ($limit) {
4363
+			$query .= " LIMIT 10 OFFSET 0";
4364
+		}
4123 4365
       
4124 4366
 		
4125 4367
 		$sth = $this->db->prepare($query);
@@ -4163,7 +4405,9 @@  discard block
 block discarded – undo
4163 4405
 			}
4164 4406
 		}
4165 4407
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4166
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4408
+		if ($limit) {
4409
+			$query .= " LIMIT 10 OFFSET 0";
4410
+		}
4167 4411
       
4168 4412
 		
4169 4413
 		$sth = $this->db->prepare($query);
@@ -4239,7 +4483,9 @@  discard block
 block discarded – undo
4239 4483
 			}
4240 4484
 		}
4241 4485
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4242
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4486
+		if ($limit) {
4487
+			$query .= " LIMIT 10 OFFSET 0";
4488
+		}
4243 4489
 		
4244 4490
 		$sth = $this->db->prepare($query);
4245 4491
 		$sth->execute($query_values);
@@ -4281,7 +4527,9 @@  discard block
 block discarded – undo
4281 4527
 			}
4282 4528
 		}
4283 4529
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4284
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4530
+		if ($limit) {
4531
+			$query .= " LIMIT 10 OFFSET 0";
4532
+		}
4285 4533
       
4286 4534
 		
4287 4535
 		$sth = $this->db->prepare($query);
@@ -4524,7 +4772,9 @@  discard block
 block discarded – undo
4524 4772
 			date_default_timezone_set($globalTimezone);
4525 4773
 			$datetime = new DateTime($date);
4526 4774
 			$offset = $datetime->format('P');
4527
-		} else $offset = '+00:00';
4775
+		} else {
4776
+			$offset = '+00:00';
4777
+		}
4528 4778
 
4529 4779
 		if ($globalDBdriver == 'mysql') {
4530 4780
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4572,7 +4822,9 @@  discard block
 block discarded – undo
4572 4822
 			date_default_timezone_set($globalTimezone);
4573 4823
 			$datetime = new DateTime($date);
4574 4824
 			$offset = $datetime->format('P');
4575
-		} else $offset = '+00:00';
4825
+		} else {
4826
+			$offset = '+00:00';
4827
+		}
4576 4828
 		
4577 4829
 		if ($globalDBdriver == 'mysql') {
4578 4830
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4692,9 +4944,13 @@  discard block
 block discarded – undo
4692 4944
 		$sth = $this->db->prepare($query);
4693 4945
 		$sth->execute($query_values);
4694 4946
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4695
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4696
-		elseif ($result[0]['duration'] == '') return 0;
4697
-		else return $result[0]['duration'];
4947
+		if (is_numeric($result[0]['duration'])) {
4948
+			return gmdate('H:i:s',$result[0]['duration']);
4949
+		} elseif ($result[0]['duration'] == '') {
4950
+			return 0;
4951
+		} else {
4952
+			return $result[0]['duration'];
4953
+		}
4698 4954
 	}
4699 4955
 
4700 4956
 	/**
@@ -4783,8 +5039,11 @@  discard block
 block discarded – undo
4783 5039
 		$sth = $this->db->prepare($query);
4784 5040
 		$sth->execute($query_values);
4785 5041
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4786
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4787
-		else return $result[0]['duration'];
5042
+		if (is_int($result[0]['duration'])) {
5043
+			return gmdate('H:i:s',$result[0]['duration']);
5044
+		} else {
5045
+			return $result[0]['duration'];
5046
+		}
4788 5047
 	}
4789 5048
 
4790 5049
 	/**
@@ -4989,7 +5248,9 @@  discard block
 block discarded – undo
4989 5248
 		}
4990 5249
 		$query .= " GROUP BY spotter_output.airline_country
4991 5250
 					ORDER BY airline_country_count DESC";
4992
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5251
+		if ($limit) {
5252
+			$query .= " LIMIT 10 OFFSET 0";
5253
+		}
4993 5254
       
4994 5255
 		$sth = $this->db->prepare($query);
4995 5256
 		$sth->execute($query_values);
@@ -5017,7 +5278,9 @@  discard block
 block discarded – undo
5017 5278
 		global $globalDBdriver;
5018 5279
 		//$filter_query = $this->getFilter($filters,true,true);
5019 5280
 		$Connection= new Connection($this->db);
5020
-		if (!$Connection->tableExists('countries')) return array();
5281
+		if (!$Connection->tableExists('countries')) {
5282
+			return array();
5283
+		}
5021 5284
 		/*
5022 5285
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
5023 5286
 					FROM countries c, spotter_output s
@@ -5049,7 +5312,9 @@  discard block
 block discarded – undo
5049 5312
 		}
5050 5313
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
5051 5314
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
5052
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5315
+		if ($limit) {
5316
+			$query .= " LIMIT 10 OFFSET 0";
5317
+		}
5053 5318
       
5054 5319
 		
5055 5320
 		$sth = $this->db->prepare($query);
@@ -5126,7 +5391,9 @@  discard block
 block discarded – undo
5126 5391
 		}
5127 5392
 
5128 5393
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5129
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5394
+		if ($limit) {
5395
+			$query .= " LIMIT 10 OFFSET 0";
5396
+		}
5130 5397
  
5131 5398
 		$sth = $this->db->prepare($query);
5132 5399
 		$sth->execute($query_values);
@@ -5200,7 +5467,9 @@  discard block
 block discarded – undo
5200 5467
 		}
5201 5468
 
5202 5469
 		$query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5203
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5470
+		if ($limit) {
5471
+			$query .= " LIMIT 10 OFFSET 0";
5472
+		}
5204 5473
  
5205 5474
 		$sth = $this->db->prepare($query);
5206 5475
 		$sth->execute($query_values);
@@ -5247,7 +5516,9 @@  discard block
 block discarded – undo
5247 5516
 		}
5248 5517
 
5249 5518
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5250
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5519
+		if ($limit) {
5520
+			$query .= " LIMIT 10 OFFSET 0";
5521
+		}
5251 5522
  
5252 5523
 		$sth = $this->db->prepare($query);
5253 5524
 		$sth->execute();
@@ -5300,7 +5571,9 @@  discard block
 block discarded – undo
5300 5571
 			if($row['registration'] != "")
5301 5572
 			{
5302 5573
 				$image_array = $Image->getSpotterImage($row['registration']);
5303
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5574
+				if (isset($image_array[0]['image_thumbnail'])) {
5575
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5576
+				}
5304 5577
 			}
5305 5578
 			$temp_array['registration_count'] = $row['registration_count'];
5306 5579
 
@@ -5375,7 +5648,9 @@  discard block
 block discarded – undo
5375 5648
 			if($row['registration'] != "")
5376 5649
 			{
5377 5650
 				$image_array = $Image->getSpotterImage($row['registration']);
5378
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5651
+				if (isset($image_array[0]['image_thumbnail'])) {
5652
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5653
+				}
5379 5654
 			}
5380 5655
 			$temp_array['registration_count'] = $row['registration_count'];
5381 5656
 
@@ -5482,7 +5757,9 @@  discard block
 block discarded – undo
5482 5757
 			if($row['registration'] != "")
5483 5758
 			{
5484 5759
 				$image_array = $Image->getSpotterImage($row['registration']);
5485
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5760
+				if (isset($image_array[0]['image_thumbnail'])) {
5761
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5762
+				}
5486 5763
 			}
5487 5764
 			$temp_array['registration_count'] = $row['registration_count'];
5488 5765
 			$aircraft_array[] = $temp_array;
@@ -5607,7 +5884,9 @@  discard block
 block discarded – undo
5607 5884
 			date_default_timezone_set($globalTimezone);
5608 5885
 			$datetime = new DateTime($date);
5609 5886
 			$offset = $datetime->format('P');
5610
-		} else $offset = '+00:00';
5887
+		} else {
5888
+			$offset = '+00:00';
5889
+		}
5611 5890
 
5612 5891
 		if ($globalDBdriver == 'mysql') {
5613 5892
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5654,7 +5933,9 @@  discard block
 block discarded – undo
5654 5933
 			date_default_timezone_set($globalTimezone);
5655 5934
 			$datetime = new DateTime($date);
5656 5935
 			$offset = $datetime->format('P');
5657
-		} else $offset = '+00:00';
5936
+		} else {
5937
+			$offset = '+00:00';
5938
+		}
5658 5939
 
5659 5940
 		if ($globalDBdriver == 'mysql') {
5660 5941
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -5683,7 +5964,9 @@  discard block
 block discarded – undo
5683 5964
 			if($row['registration'] != "")
5684 5965
 			{
5685 5966
 				$image_array = $Image->getSpotterImage($row['registration']);
5686
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5967
+				if (isset($image_array[0]['image_thumbnail'])) {
5968
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5969
+				}
5687 5970
 			}
5688 5971
 			$temp_array['registration_count'] = $row['registration_count'];
5689 5972
  
@@ -5708,7 +5991,9 @@  discard block
 block discarded – undo
5708 5991
 			date_default_timezone_set($globalTimezone);
5709 5992
 			$datetime = new DateTime($date);
5710 5993
 			$offset = $datetime->format('P');
5711
-		} else $offset = '+00:00';
5994
+		} else {
5995
+			$offset = '+00:00';
5996
+		}
5712 5997
 
5713 5998
 		if ($globalDBdriver == 'mysql') {
5714 5999
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5904,8 +6189,11 @@  discard block
 block discarded – undo
5904 6189
 			if($row['registration'] != "")
5905 6190
 			{
5906 6191
 				$image_array = $Image->getSpotterImage($row['registration']);
5907
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5908
-				else $temp_array['image_thumbnail'] = '';
6192
+				if (isset($image_array[0]['image_thumbnail'])) {
6193
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6194
+				} else {
6195
+					$temp_array['image_thumbnail'] = '';
6196
+				}
5909 6197
 			}
5910 6198
 			$temp_array['registration_count'] = $row['registration_count'];
5911 6199
 			$aircraft_array[] = $temp_array;
@@ -5979,8 +6267,11 @@  discard block
 block discarded – undo
5979 6267
 			if($row['registration'] != "")
5980 6268
 			{
5981 6269
 				$image_array = $Image->getSpotterImage($row['registration']);
5982
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5983
-				else $temp_array['image_thumbnail'] = '';
6270
+				if (isset($image_array[0]['image_thumbnail'])) {
6271
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6272
+				} else {
6273
+					$temp_array['image_thumbnail'] = '';
6274
+				}
5984 6275
 			}
5985 6276
 			$temp_array['registration_count'] = $row['registration_count'];
5986 6277
 			$aircraft_array[] = $temp_array;
@@ -6054,8 +6345,11 @@  discard block
 block discarded – undo
6054 6345
 			if($row['registration'] != "")
6055 6346
 			{
6056 6347
 				$image_array = $Image->getSpotterImage($row['registration']);
6057
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6058
-				else $temp_array['image_thumbnail'] = '';
6348
+				if (isset($image_array[0]['image_thumbnail'])) {
6349
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6350
+				} else {
6351
+					$temp_array['image_thumbnail'] = '';
6352
+				}
6059 6353
 			}
6060 6354
 			$temp_array['registration_count'] = $row['registration_count'];
6061 6355
 			$aircraft_array[] = $temp_array;
@@ -6266,7 +6560,9 @@  discard block
 block discarded – undo
6266 6560
 			if($row['registration'] != "")
6267 6561
 			{
6268 6562
 				$image_array = $Image->getSpotterImage($row['registration']);
6269
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6563
+				if (isset($image_array[0]['image_thumbnail'])) {
6564
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6565
+				}
6270 6566
 			}
6271 6567
 			$temp_array['registration_count'] = $row['registration_count'];
6272 6568
           
@@ -6383,7 +6679,9 @@  discard block
 block discarded – undo
6383 6679
 			if($row['registration'] != "")
6384 6680
 			{
6385 6681
 				$image_array = $Image->getSpotterImage($row['registration']);
6386
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6682
+				if (isset($image_array[0]['image_thumbnail'])) {
6683
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6684
+				}
6387 6685
 			}
6388 6686
 			$temp_array['registration_count'] = $row['registration_count'];
6389 6687
           
@@ -6549,7 +6847,9 @@  discard block
 block discarded – undo
6549 6847
 			}
6550 6848
 		}
6551 6849
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6552
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6850
+		if ($limit) {
6851
+			$query .= " LIMIT 10 OFFSET 0";
6852
+		}
6553 6853
 		
6554 6854
 		$sth = $this->db->prepare($query);
6555 6855
 		$sth->execute($query_values);
@@ -6568,7 +6868,9 @@  discard block
 block discarded – undo
6568 6868
 			if($row['registration'] != "")
6569 6869
 			{
6570 6870
 				$image_array = $Image->getSpotterImage($row['registration']);
6571
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6871
+				if (isset($image_array[0]['image_thumbnail'])) {
6872
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6873
+				}
6572 6874
 			}
6573 6875
           
6574 6876
 			$aircraft_array[] = $temp_array;
@@ -6609,7 +6911,9 @@  discard block
 block discarded – undo
6609 6911
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6610 6912
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6611 6913
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6612
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6914
+		if ($limit) {
6915
+			$query .= " LIMIT 10 OFFSET 0";
6916
+		}
6613 6917
 		
6614 6918
 		$sth = $this->db->prepare($query);
6615 6919
 		$sth->execute();
@@ -6629,7 +6933,9 @@  discard block
 block discarded – undo
6629 6933
 			if($row['registration'] != "")
6630 6934
 			{
6631 6935
 				$image_array = $Image->getSpotterImage($row['registration']);
6632
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6936
+				if (isset($image_array[0]['image_thumbnail'])) {
6937
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6938
+				}
6633 6939
 			}
6634 6940
           
6635 6941
 			$aircraft_array[] = $temp_array;
@@ -6695,7 +7001,9 @@  discard block
 block discarded – undo
6695 7001
 		}
6696 7002
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6697 7003
 				ORDER BY airport_departure_icao_count DESC";
6698
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7004
+		if ($limit) {
7005
+			$query .= " LIMIT 10 OFFSET 0";
7006
+		}
6699 7007
 
6700 7008
 		$sth = $this->db->prepare($query);
6701 7009
 		$sth->execute($query_values);
@@ -6746,7 +7054,9 @@  discard block
 block discarded – undo
6746 7054
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747 7055
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6748 7056
 				ORDER BY airport_departure_icao_count DESC";
6749
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7057
+		if ($limit) {
7058
+			$query .= " LIMIT 10 OFFSET 0";
7059
+		}
6750 7060
       
6751 7061
 		$sth = $this->db->prepare($query);
6752 7062
 		$sth->execute();
@@ -6824,7 +7134,9 @@  discard block
 block discarded – undo
6824 7134
 		}
6825 7135
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6826 7136
 				ORDER BY airport_departure_icao_count DESC";
6827
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7137
+		if ($limit) {
7138
+			$query .= " LIMIT 10 OFFSET 0";
7139
+		}
6828 7140
     		//echo $query;
6829 7141
 		$sth = $this->db->prepare($query);
6830 7142
 		$sth->execute($query_values);
@@ -6876,7 +7188,9 @@  discard block
 block discarded – undo
6876 7188
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877 7189
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6878 7190
 				ORDER BY airport_departure_icao_count DESC";
6879
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7191
+		if ($limit) {
7192
+			$query .= " LIMIT 10 OFFSET 0";
7193
+		}
6880 7194
       
6881 7195
 		$sth = $this->db->prepare($query);
6882 7196
 		$sth->execute();
@@ -7271,7 +7585,9 @@  discard block
 block discarded – undo
7271 7585
 			date_default_timezone_set($globalTimezone);
7272 7586
 			$datetime = new DateTime($date);
7273 7587
 			$offset = $datetime->format('P');
7274
-		} else $offset = '+00:00';
7588
+		} else {
7589
+			$offset = '+00:00';
7590
+		}
7275 7591
 
7276 7592
 		if ($globalDBdriver == 'mysql') {
7277 7593
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -7321,7 +7637,9 @@  discard block
 block discarded – undo
7321 7637
 			date_default_timezone_set($globalTimezone);
7322 7638
 			$datetime = new DateTime($date);
7323 7639
 			$offset = $datetime->format('P');
7324
-		} else $offset = '+00:00';
7640
+		} else {
7641
+			$offset = '+00:00';
7642
+		}
7325 7643
 
7326 7644
 		if ($globalDBdriver == 'mysql') {
7327 7645
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7670,7 +7988,9 @@  discard block
 block discarded – undo
7670 7988
 		}
7671 7989
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7672 7990
 					ORDER BY airport_arrival_icao_count DESC";
7673
-		if ($limit) $query .= " LIMIT 10";
7991
+		if ($limit) {
7992
+			$query .= " LIMIT 10";
7993
+		}
7674 7994
       
7675 7995
 		
7676 7996
 		$sth = $this->db->prepare($query);
@@ -7690,7 +8010,9 @@  discard block
 block discarded – undo
7690 8010
 			if ($icaoaskey) {
7691 8011
 				$icao = $row['arrival_airport_icao'];
7692 8012
 				$airport_array[$icao] = $temp_array;
7693
-			} else $airport_array[] = $temp_array;
8013
+			} else {
8014
+				$airport_array[] = $temp_array;
8015
+			}
7694 8016
 		}
7695 8017
 
7696 8018
 		return $airport_array;
@@ -7727,7 +8049,9 @@  discard block
 block discarded – undo
7727 8049
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728 8050
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7729 8051
 					ORDER BY airport_arrival_icao_count DESC";
7730
-		if ($limit) $query .= " LIMIT 10";
8052
+		if ($limit) {
8053
+			$query .= " LIMIT 10";
8054
+		}
7731 8055
       
7732 8056
 		
7733 8057
 		$sth = $this->db->prepare($query);
@@ -7748,7 +8072,9 @@  discard block
 block discarded – undo
7748 8072
 			if ($icaoaskey) {
7749 8073
 				$icao = $row['arrival_airport_icao'];
7750 8074
 				$airport_array[$icao] = $temp_array;
7751
-			} else $airport_array[] = $temp_array;
8075
+			} else {
8076
+				$airport_array[] = $temp_array;
8077
+			}
7752 8078
 		}
7753 8079
 
7754 8080
 		return $airport_array;
@@ -7811,7 +8137,9 @@  discard block
 block discarded – undo
7811 8137
 		}
7812 8138
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7813 8139
 					ORDER BY airport_arrival_icao_count DESC";
7814
-		if ($limit) $query .= " LIMIT 10";
8140
+		if ($limit) {
8141
+			$query .= " LIMIT 10";
8142
+		}
7815 8143
       
7816 8144
 		
7817 8145
 		$sth = $this->db->prepare($query);
@@ -7830,7 +8158,9 @@  discard block
 block discarded – undo
7830 8158
 			if ($icaoaskey) {
7831 8159
 				$icao = $row['arrival_airport_icao'];
7832 8160
 				$airport_array[$icao] = $temp_array;
7833
-			} else $airport_array[] = $temp_array;
8161
+			} else {
8162
+				$airport_array[] = $temp_array;
8163
+			}
7834 8164
 		}
7835 8165
 
7836 8166
 		return $airport_array;
@@ -7867,7 +8197,9 @@  discard block
 block discarded – undo
7867 8197
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868 8198
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7869 8199
 					ORDER BY airport_arrival_icao_count DESC";
7870
-		if ($limit) $query .= " LIMIT 10";
8200
+		if ($limit) {
8201
+			$query .= " LIMIT 10";
8202
+		}
7871 8203
       
7872 8204
 		
7873 8205
 		$sth = $this->db->prepare($query);
@@ -7888,7 +8220,9 @@  discard block
 block discarded – undo
7888 8220
 			if ($icaoaskey) {
7889 8221
 				$icao = $row['arrival_airport_icao'];
7890 8222
 				$airport_array[$icao] = $temp_array;
7891
-			} else $airport_array[] = $temp_array;
8223
+			} else {
8224
+				$airport_array[] = $temp_array;
8225
+			}
7892 8226
 		}
7893 8227
 
7894 8228
 		return $airport_array;
@@ -8269,7 +8603,9 @@  discard block
 block discarded – undo
8269 8603
 			date_default_timezone_set($globalTimezone);
8270 8604
 			$datetime = new DateTime($date);
8271 8605
 			$offset = $datetime->format('P');
8272
-		} else $offset = '+00:00';
8606
+		} else {
8607
+			$offset = '+00:00';
8608
+		}
8273 8609
 
8274 8610
 		if ($globalDBdriver == 'mysql') {
8275 8611
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -8319,7 +8655,9 @@  discard block
 block discarded – undo
8319 8655
 			date_default_timezone_set($globalTimezone);
8320 8656
 			$datetime = new DateTime($date);
8321 8657
 			$offset = $datetime->format('P');
8322
-		} else $offset = '+00:00';
8658
+		} else {
8659
+			$offset = '+00:00';
8660
+		}
8323 8661
 
8324 8662
 		if ($globalDBdriver == 'mysql') {
8325 8663
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8710,7 +9048,9 @@  discard block
 block discarded – undo
8710 9048
 		}
8711 9049
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8712 9050
 					ORDER BY airport_arrival_country_count DESC";
8713
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9051
+		if ($limit) {
9052
+			$query .= " LIMIT 10 OFFSET 0";
9053
+		}
8714 9054
       
8715 9055
 		
8716 9056
 		$sth = $this->db->prepare($query);
@@ -8997,7 +9337,9 @@  discard block
 block discarded – undo
8997 9337
 			date_default_timezone_set($globalTimezone);
8998 9338
 			$datetime = new DateTime($date);
8999 9339
 			$offset = $datetime->format('P');
9000
-		} else $offset = '+00:00';
9340
+		} else {
9341
+			$offset = '+00:00';
9342
+		}
9001 9343
 		
9002 9344
 		if ($globalDBdriver == 'mysql') {
9003 9345
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -9253,12 +9595,18 @@  discard block
 block discarded – undo
9253 9595
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9254 9596
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9255 9597
 		 if ($olderthanmonths > 0) {
9256
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9257
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9598
+			if ($globalDBdriver == 'mysql') {
9599
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9600
+			} else {
9601
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9602
+			}
9258 9603
 		}
9259 9604
 		if ($sincedate != '') {
9260
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
9261
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9605
+			if ($globalDBdriver == 'mysql') {
9606
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9607
+			} else {
9608
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9609
+			}
9262 9610
 		}
9263 9611
 		$query_values = array();
9264 9612
 		if ($year != '') {
@@ -9289,7 +9637,9 @@  discard block
 block discarded – undo
9289 9637
 			}
9290 9638
 		}
9291 9639
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9292
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9640
+		if ($limit) {
9641
+			$query .= " LIMIT 10 OFFSET 0";
9642
+		}
9293 9643
       		
9294 9644
 		$sth = $this->db->prepare($query);
9295 9645
 		$sth->execute($query_values);
@@ -9323,15 +9673,23 @@  discard block
 block discarded – undo
9323 9673
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9324 9674
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9325 9675
 		 if ($olderthanmonths > 0) {
9326
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9327
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9676
+			if ($globalDBdriver == 'mysql') {
9677
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9678
+			} else {
9679
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9680
+			}
9328 9681
 		}
9329 9682
 		if ($sincedate != '') {
9330
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
9331
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9683
+			if ($globalDBdriver == 'mysql') {
9684
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9685
+			} else {
9686
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9687
+			}
9332 9688
 		}
9333 9689
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9334
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9690
+		if ($limit) {
9691
+			$query .= " LIMIT 10 OFFSET 0";
9692
+		}
9335 9693
       		
9336 9694
 		$sth = $this->db->prepare($query);
9337 9695
 		$sth->execute();
@@ -9368,7 +9726,9 @@  discard block
 block discarded – undo
9368 9726
 			date_default_timezone_set($globalTimezone);
9369 9727
 			$datetime = new DateTime();
9370 9728
 			$offset = $datetime->format('P');
9371
-		} else $offset = '+00:00';
9729
+		} else {
9730
+			$offset = '+00:00';
9731
+		}
9372 9732
 
9373 9733
 		if ($globalDBdriver == 'mysql') {
9374 9734
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9417,7 +9777,9 @@  discard block
 block discarded – undo
9417 9777
 			date_default_timezone_set($globalTimezone);
9418 9778
 			$datetime = new DateTime();
9419 9779
 			$offset = $datetime->format('P');
9420
-		} else $offset = '+00:00';
9780
+		} else {
9781
+			$offset = '+00:00';
9782
+		}
9421 9783
 		$filter_query = $this->getFilter($filters,true,true);
9422 9784
 		if ($globalDBdriver == 'mysql') {
9423 9785
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9466,7 +9828,9 @@  discard block
 block discarded – undo
9466 9828
 			date_default_timezone_set($globalTimezone);
9467 9829
 			$datetime = new DateTime();
9468 9830
 			$offset = $datetime->format('P');
9469
-		} else $offset = '+00:00';
9831
+		} else {
9832
+			$offset = '+00:00';
9833
+		}
9470 9834
 		$filter_query = $this->getFilter($filters,true,true);
9471 9835
 		if ($globalDBdriver == 'mysql') {
9472 9836
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9512,7 +9876,9 @@  discard block
 block discarded – undo
9512 9876
 			date_default_timezone_set($globalTimezone);
9513 9877
 			$datetime = new DateTime();
9514 9878
 			$offset = $datetime->format('P');
9515
-		} else $offset = '+00:00';
9879
+		} else {
9880
+			$offset = '+00:00';
9881
+		}
9516 9882
 		$filter_query = $this->getFilter($filters,true,true);
9517 9883
 		if ($globalDBdriver == 'mysql') {
9518 9884
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9560,7 +9926,9 @@  discard block
 block discarded – undo
9560 9926
 			date_default_timezone_set($globalTimezone);
9561 9927
 			$datetime = new DateTime();
9562 9928
 			$offset = $datetime->format('P');
9563
-		} else $offset = '+00:00';
9929
+		} else {
9930
+			$offset = '+00:00';
9931
+		}
9564 9932
 		
9565 9933
 		if ($globalDBdriver == 'mysql') {
9566 9934
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9608,7 +9976,9 @@  discard block
 block discarded – undo
9608 9976
 			date_default_timezone_set($globalTimezone);
9609 9977
 			$datetime = new DateTime();
9610 9978
 			$offset = $datetime->format('P');
9611
-		} else $offset = '+00:00';
9979
+		} else {
9980
+			$offset = '+00:00';
9981
+		}
9612 9982
 
9613 9983
 		if ($globalDBdriver == 'mysql') {
9614 9984
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9655,7 +10025,9 @@  discard block
 block discarded – undo
9655 10025
 			date_default_timezone_set($globalTimezone);
9656 10026
 			$datetime = new DateTime();
9657 10027
 			$offset = $datetime->format('P');
9658
-		} else $offset = '+00:00';
10028
+		} else {
10029
+			$offset = '+00:00';
10030
+		}
9659 10031
 
9660 10032
 		if ($globalDBdriver == 'mysql') {
9661 10033
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9703,7 +10075,9 @@  discard block
 block discarded – undo
9703 10075
 			date_default_timezone_set($globalTimezone);
9704 10076
 			$datetime = new DateTime();
9705 10077
 			$offset = $datetime->format('P');
9706
-		} else $offset = '+00:00';
10078
+		} else {
10079
+			$offset = '+00:00';
10080
+		}
9707 10081
 		$filter_query = $this->getFilter($filters,true,true);
9708 10082
 		if ($globalDBdriver == 'mysql') {
9709 10083
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9748,7 +10122,9 @@  discard block
 block discarded – undo
9748 10122
 			date_default_timezone_set($globalTimezone);
9749 10123
 			$datetime = new DateTime();
9750 10124
 			$offset = $datetime->format('P');
9751
-		} else $offset = '+00:00';
10125
+		} else {
10126
+			$offset = '+00:00';
10127
+		}
9752 10128
 		$filter_query = $this->getFilter($filters,true,true);
9753 10129
 
9754 10130
 		if ($globalDBdriver == 'mysql') {
@@ -9795,7 +10171,9 @@  discard block
 block discarded – undo
9795 10171
 			date_default_timezone_set($globalTimezone);
9796 10172
 			$datetime = new DateTime();
9797 10173
 			$offset = $datetime->format('P');
9798
-		} else $offset = '+00:00';
10174
+		} else {
10175
+			$offset = '+00:00';
10176
+		}
9799 10177
 
9800 10178
 		if ($globalDBdriver == 'mysql') {
9801 10179
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -9841,7 +10219,9 @@  discard block
 block discarded – undo
9841 10219
 			date_default_timezone_set($globalTimezone);
9842 10220
 			$datetime = new DateTime();
9843 10221
 			$offset = $datetime->format('P');
9844
-		} else $offset = '+00:00';
10222
+		} else {
10223
+			$offset = '+00:00';
10224
+		}
9845 10225
 		$filter_query = $this->getFilter($filters,true,true);
9846 10226
 
9847 10227
 		if ($globalDBdriver == 'mysql') {
@@ -9888,7 +10268,9 @@  discard block
 block discarded – undo
9888 10268
 			date_default_timezone_set($globalTimezone);
9889 10269
 			$datetime = new DateTime();
9890 10270
 			$offset = $datetime->format('P');
9891
-		} else $offset = '+00:00';
10271
+		} else {
10272
+			$offset = '+00:00';
10273
+		}
9892 10274
 
9893 10275
 		if ($globalDBdriver == 'mysql') {
9894 10276
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -9935,7 +10317,9 @@  discard block
 block discarded – undo
9935 10317
 			date_default_timezone_set($globalTimezone);
9936 10318
 			$datetime = new DateTime();
9937 10319
 			$offset = $datetime->format('P');
9938
-		} else $offset = '+00:00';
10320
+		} else {
10321
+			$offset = '+00:00';
10322
+		}
9939 10323
 
9940 10324
 		if ($globalDBdriver == 'mysql') {
9941 10325
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -9980,7 +10364,9 @@  discard block
 block discarded – undo
9980 10364
 			date_default_timezone_set($globalTimezone);
9981 10365
 			$datetime = new DateTime();
9982 10366
 			$offset = $datetime->format('P');
9983
-		} else $offset = '+00:00';
10367
+		} else {
10368
+			$offset = '+00:00';
10369
+		}
9984 10370
 		$filter_query = $this->getFilter($filters,true,true);
9985 10371
 
9986 10372
 		if ($globalDBdriver == 'mysql') {
@@ -10028,7 +10414,9 @@  discard block
 block discarded – undo
10028 10414
 			date_default_timezone_set($globalTimezone);
10029 10415
 			$datetime = new DateTime();
10030 10416
 			$offset = $datetime->format('P');
10031
-		} else $offset = '+00:00';
10417
+		} else {
10418
+			$offset = '+00:00';
10419
+		}
10032 10420
 
10033 10421
 		if ($globalDBdriver == 'mysql') {
10034 10422
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -10074,7 +10462,9 @@  discard block
 block discarded – undo
10074 10462
 			date_default_timezone_set($globalTimezone);
10075 10463
 			$datetime = new DateTime();
10076 10464
 			$offset = $datetime->format('P');
10077
-		} else $offset = '+00:00';
10465
+		} else {
10466
+			$offset = '+00:00';
10467
+		}
10078 10468
 		$filter_query = $this->getFilter($filters,true,true);
10079 10469
 
10080 10470
 		if ($globalDBdriver == 'mysql') {
@@ -10122,7 +10512,9 @@  discard block
 block discarded – undo
10122 10512
 			date_default_timezone_set($globalTimezone);
10123 10513
 			$datetime = new DateTime();
10124 10514
 			$offset = $datetime->format('P');
10125
-		} else $offset = '+00:00';
10515
+		} else {
10516
+			$offset = '+00:00';
10517
+		}
10126 10518
 
10127 10519
 		if ($globalDBdriver == 'mysql') {
10128 10520
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -10169,7 +10561,9 @@  discard block
 block discarded – undo
10169 10561
 			date_default_timezone_set($globalTimezone);
10170 10562
 			$datetime = new DateTime();
10171 10563
 			$offset = $datetime->format('P');
10172
-		} else $offset = '+00:00';
10564
+		} else {
10565
+			$offset = '+00:00';
10566
+		}
10173 10567
 		$filter_query = $this->getFilter($filters,true,true);
10174 10568
 		if ($globalDBdriver == 'mysql') {
10175 10569
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -10218,7 +10612,9 @@  discard block
 block discarded – undo
10218 10612
 			date_default_timezone_set($globalTimezone);
10219 10613
 			$datetime = new DateTime();
10220 10614
 			$offset = $datetime->format('P');
10221
-		} else $offset = '+00:00';
10615
+		} else {
10616
+			$offset = '+00:00';
10617
+		}
10222 10618
 
10223 10619
 		$orderby_sql = '';
10224 10620
 		if ($orderby == "hour")
@@ -10284,7 +10680,9 @@  discard block
 block discarded – undo
10284 10680
 			date_default_timezone_set($globalTimezone);
10285 10681
 			$datetime = new DateTime();
10286 10682
 			$offset = $datetime->format('P');
10287
-		} else $offset = '+00:00';
10683
+		} else {
10684
+			$offset = '+00:00';
10685
+		}
10288 10686
 
10289 10687
 		$orderby_sql = '';
10290 10688
 		if ($orderby == "hour")
@@ -10351,7 +10749,9 @@  discard block
 block discarded – undo
10351 10749
 			date_default_timezone_set($globalTimezone);
10352 10750
 			$datetime = new DateTime();
10353 10751
 			$offset = $datetime->format('P');
10354
-		} else $offset = '+00:00';
10752
+		} else {
10753
+			$offset = '+00:00';
10754
+		}
10355 10755
 
10356 10756
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10357 10757
 
@@ -10402,7 +10802,9 @@  discard block
 block discarded – undo
10402 10802
 			date_default_timezone_set($globalTimezone);
10403 10803
 			$datetime = new DateTime();
10404 10804
 			$offset = $datetime->format('P');
10405
-		} else $offset = '+00:00';
10805
+		} else {
10806
+			$offset = '+00:00';
10807
+		}
10406 10808
 
10407 10809
 		if ($globalDBdriver == 'mysql') {
10408 10810
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10449,7 +10851,9 @@  discard block
 block discarded – undo
10449 10851
 			date_default_timezone_set($globalTimezone);
10450 10852
 			$datetime = new DateTime();
10451 10853
 			$offset = $datetime->format('P');
10452
-		} else $offset = '+00:00';
10854
+		} else {
10855
+			$offset = '+00:00';
10856
+		}
10453 10857
 
10454 10858
 		if ($globalDBdriver == 'mysql') {
10455 10859
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10496,7 +10900,9 @@  discard block
 block discarded – undo
10496 10900
 			date_default_timezone_set($globalTimezone);
10497 10901
 			$datetime = new DateTime();
10498 10902
 			$offset = $datetime->format('P');
10499
-		} else $offset = '+00:00';
10903
+		} else {
10904
+			$offset = '+00:00';
10905
+		}
10500 10906
 
10501 10907
 		if ($globalDBdriver == 'mysql') {
10502 10908
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10544,7 +10950,9 @@  discard block
 block discarded – undo
10544 10950
 			date_default_timezone_set($globalTimezone);
10545 10951
 			$datetime = new DateTime();
10546 10952
 			$offset = $datetime->format('P');
10547
-		} else $offset = '+00:00';
10953
+		} else {
10954
+			$offset = '+00:00';
10955
+		}
10548 10956
 
10549 10957
 		if ($globalDBdriver == 'mysql') {
10550 10958
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10592,7 +11000,9 @@  discard block
 block discarded – undo
10592 11000
 			date_default_timezone_set($globalTimezone);
10593 11001
 			$datetime = new DateTime($date);
10594 11002
 			$offset = $datetime->format('P');
10595
-		} else $offset = '+00:00';
11003
+		} else {
11004
+			$offset = '+00:00';
11005
+		}
10596 11006
 
10597 11007
 		if ($globalDBdriver == 'mysql') {
10598 11008
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10640,7 +11050,9 @@  discard block
 block discarded – undo
10640 11050
 			date_default_timezone_set($globalTimezone);
10641 11051
 			$datetime = new DateTime();
10642 11052
 			$offset = $datetime->format('P');
10643
-		} else $offset = '+00:00';
11053
+		} else {
11054
+			$offset = '+00:00';
11055
+		}
10644 11056
 
10645 11057
 		if ($globalDBdriver == 'mysql') {
10646 11058
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10687,7 +11099,9 @@  discard block
 block discarded – undo
10687 11099
 			date_default_timezone_set($globalTimezone);
10688 11100
 			$datetime = new DateTime();
10689 11101
 			$offset = $datetime->format('P');
10690
-		} else $offset = '+00:00';
11102
+		} else {
11103
+			$offset = '+00:00';
11104
+		}
10691 11105
 
10692 11106
 		if ($globalDBdriver == 'mysql') {
10693 11107
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10734,7 +11148,9 @@  discard block
 block discarded – undo
10734 11148
 			date_default_timezone_set($globalTimezone);
10735 11149
 			$datetime = new DateTime();
10736 11150
 			$offset = $datetime->format('P');
10737
-		} else $offset = '+00:00';
11151
+		} else {
11152
+			$offset = '+00:00';
11153
+		}
10738 11154
 
10739 11155
 		if ($globalDBdriver == 'mysql') {
10740 11156
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10784,7 +11200,9 @@  discard block
 block discarded – undo
10784 11200
 			date_default_timezone_set($globalTimezone);
10785 11201
 			$datetime = new DateTime();
10786 11202
 			$offset = $datetime->format('P');
10787
-		} else $offset = '+00:00';
11203
+		} else {
11204
+			$offset = '+00:00';
11205
+		}
10788 11206
 
10789 11207
 		if ($globalDBdriver == 'mysql') {
10790 11208
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10831,7 +11249,9 @@  discard block
 block discarded – undo
10831 11249
 			date_default_timezone_set($globalTimezone);
10832 11250
 			$datetime = new DateTime();
10833 11251
 			$offset = $datetime->format('P');
10834
-		} else $offset = '+00:00';
11252
+		} else {
11253
+			$offset = '+00:00';
11254
+		}
10835 11255
 
10836 11256
 		if ($globalDBdriver == 'mysql') {
10837 11257
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11042,8 +11462,11 @@  discard block
 block discarded – undo
11042 11462
 				$query_values = array_merge($query_values,array(':month' => $month));
11043 11463
 			}
11044 11464
 		}
11045
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11046
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11465
+		if (empty($query_values)) {
11466
+			$queryi .= $this->getFilter($filters);
11467
+		} else {
11468
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11469
+		}
11047 11470
 		
11048 11471
 		$sth = $this->db->prepare($queryi);
11049 11472
 		$sth->execute($query_values);
@@ -11121,8 +11544,11 @@  discard block
 block discarded – undo
11121 11544
 				$query_values = array_merge($query_values,array(':month' => $month));
11122 11545
 			}
11123 11546
 		}
11124
-                if ($query == '') $queryi .= $this->getFilter($filters);
11125
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11547
+                if ($query == '') {
11548
+                	$queryi .= $this->getFilter($filters);
11549
+                } else {
11550
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11551
+                }
11126 11552
 
11127 11553
 
11128 11554
 		$sth = $this->db->prepare($queryi);
@@ -11145,7 +11571,9 @@  discard block
 block discarded – undo
11145 11571
 			date_default_timezone_set($globalTimezone);
11146 11572
 			$datetime = new DateTime();
11147 11573
 			$offset = $datetime->format('P');
11148
-		} else $offset = '+00:00';
11574
+		} else {
11575
+			$offset = '+00:00';
11576
+		}
11149 11577
 
11150 11578
 		if ($globalDBdriver == 'mysql') {
11151 11579
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11331,7 +11759,9 @@  discard block
 block discarded – undo
11331 11759
 	*/
11332 11760
 	public function parseDirection($direction = 0)
11333 11761
 	{
11334
-		if ($direction == '') $direction = 0;
11762
+		if ($direction == '') {
11763
+			$direction = 0;
11764
+		}
11335 11765
 		$direction_array = array();
11336 11766
 		$temp_array = array();
11337 11767
 
@@ -11432,7 +11862,9 @@  discard block
 block discarded – undo
11432 11862
 		if (isset($result->AirlineFlightInfoResult))
11433 11863
 		{
11434 11864
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11435
-		} else return '';
11865
+		} else {
11866
+			return '';
11867
+		}
11436 11868
 		
11437 11869
 		$registration = $this->convertAircraftRegistration($registration);
11438 11870
 		
@@ -11466,7 +11898,9 @@  discard block
 block discarded – undo
11466 11898
 		    return $row['registration'];
11467 11899
 		} elseif ($source_type == 'flarm') {
11468 11900
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11469
-		} else return '';
11901
+		} else {
11902
+			return '';
11903
+		}
11470 11904
 	
11471 11905
 	}
11472 11906
 
@@ -11493,11 +11927,16 @@  discard block
 block discarded – undo
11493 11927
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11494 11928
 		$sth->closeCursor();
11495 11929
 		if (count($row) > 0) {
11496
-			if ($row['type_flight'] == null) return '';
11497
-			else return $row['type_flight'];
11930
+			if ($row['type_flight'] == null) {
11931
+				return '';
11932
+			} else {
11933
+				return $row['type_flight'];
11934
+			}
11498 11935
 		} elseif ($source_type == 'flarm') {
11499 11936
 			return $this->getAircraftTypeBymodeS($aircraft_modes);
11500
-		} else return '';
11937
+		} else {
11938
+			return '';
11939
+		}
11501 11940
 	
11502 11941
 	}
11503 11942
 
@@ -11515,7 +11954,9 @@  discard block
 block discarded – undo
11515 11954
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11516 11955
 	
11517 11956
 		$Connection = new Connection($this->db);
11518
-		if (!$Connection->tableExists('countries')) return '';
11957
+		if (!$Connection->tableExists('countries')) {
11958
+			return '';
11959
+		}
11519 11960
 	
11520 11961
 		try {
11521 11962
 			/*
@@ -11535,9 +11976,13 @@  discard block
 block discarded – undo
11535 11976
 			$sth->closeCursor();
11536 11977
 			if (count($row) > 0) {
11537 11978
 				return $row;
11538
-			} else return '';
11979
+			} else {
11980
+				return '';
11981
+			}
11539 11982
 		} catch (PDOException $e) {
11540
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11983
+			if (isset($globalDebug) && $globalDebug) {
11984
+				echo 'Error : '.$e->getMessage()."\n";
11985
+			}
11541 11986
 			return '';
11542 11987
 		}
11543 11988
 	
@@ -11555,7 +12000,9 @@  discard block
 block discarded – undo
11555 12000
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11556 12001
 	
11557 12002
 		$Connection = new Connection($this->db);
11558
-		if (!$Connection->tableExists('countries')) return '';
12003
+		if (!$Connection->tableExists('countries')) {
12004
+			return '';
12005
+		}
11559 12006
 	
11560 12007
 		try {
11561 12008
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11567,9 +12014,13 @@  discard block
 block discarded – undo
11567 12014
 			$sth->closeCursor();
11568 12015
 			if (count($row) > 0) {
11569 12016
 				return $row;
11570
-			} else return '';
12017
+			} else {
12018
+				return '';
12019
+			}
11571 12020
 		} catch (PDOException $e) {
11572
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
12021
+			if (isset($globalDebug) && $globalDebug) {
12022
+				echo 'Error : '.$e->getMessage()."\n";
12023
+			}
11573 12024
 			return '';
11574 12025
 		}
11575 12026
 	
@@ -11819,7 +12270,9 @@  discard block
 block discarded – undo
11819 12270
 	{
11820 12271
 		global $globalBitlyAccessToken;
11821 12272
 		
11822
-		if ($globalBitlyAccessToken == '') return $url;
12273
+		if ($globalBitlyAccessToken == '') {
12274
+			return $url;
12275
+		}
11823 12276
         
11824 12277
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11825 12278
 		
@@ -11968,7 +12421,9 @@  discard block
 block discarded – undo
11968 12421
 		
11969 12422
 
11970 12423
 		// routes
11971
-		if ($globalDebug) print "Routes...\n";
12424
+		if ($globalDebug) {
12425
+			print "Routes...\n";
12426
+		}
11972 12427
 		if ($globalDBdriver == 'mysql') {
11973 12428
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
11974 12429
 		} else {
@@ -11987,7 +12442,9 @@  discard block
 block discarded – undo
11987 12442
 			}
11988 12443
 		}
11989 12444
 		
11990
-		if ($globalDebug) print "Airlines...\n";
12445
+		if ($globalDebug) {
12446
+			print "Airlines...\n";
12447
+		}
11991 12448
 		//airlines
11992 12449
 		if ($globalDBdriver == 'mysql') {
11993 12450
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -12001,10 +12458,15 @@  discard block
 block discarded – undo
12001 12458
 			if (is_numeric(substr($row['ident'], -1, 1)))
12002 12459
 			{
12003 12460
 				$fromsource = NULL;
12004
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
12005
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
12006
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
12007
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12461
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12462
+					$fromsource = 'vatsim';
12463
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12464
+					$fromsource = 'ivao';
12465
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12466
+					$fromsource = 'vatsim';
12467
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12468
+					$fromsource = 'ivao';
12469
+				}
12008 12470
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
12009 12471
 				if (isset($airline_array[0]['name'])) {
12010 12472
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -12014,13 +12476,17 @@  discard block
 block discarded – undo
12014 12476
 			}
12015 12477
 		}
12016 12478
 
12017
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12479
+		if ($globalDebug) {
12480
+			print "Remove Duplicate in aircraft_modes...\n";
12481
+		}
12018 12482
 		//duplicate modes
12019 12483
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
12020 12484
 		$sth = $this->db->prepare($query);
12021 12485
 		$sth->execute();
12022 12486
 		
12023
-		if ($globalDebug) print "Aircraft...\n";
12487
+		if ($globalDebug) {
12488
+			print "Aircraft...\n";
12489
+		}
12024 12490
 		//aircraft
12025 12491
 		if ($globalDBdriver == 'mysql') {
12026 12492
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -12063,26 +12529,38 @@  discard block
 block discarded – undo
12063 12529
 				 if (isset($closestAirports[0])) {
12064 12530
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
12065 12531
 						$airport_icao = $closestAirports[0]['icao'];
12066
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12532
+						if ($globalDebug) {
12533
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12534
+						}
12067 12535
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
12068 12536
 						foreach ($closestAirports as $airport) {
12069 12537
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
12070 12538
 								$airport_icao = $airport['icao'];
12071
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12539
+								if ($globalDebug) {
12540
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12541
+								}
12072 12542
 								break;
12073 12543
 							}
12074 12544
 						}
12075 12545
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12076 12546
 						$airport_icao = $closestAirports[0]['icao'];
12077
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12547
+						if ($globalDebug) {
12548
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12549
+						}
12078 12550
 					} else {
12079
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12551
+						if ($globalDebug) {
12552
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12553
+						}
12080 12554
 					}
12081 12555
 				} else {
12082
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12556
+					if ($globalDebug) {
12557
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12558
+					}
12083 12559
 				}
12084 12560
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12085
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12561
+					if ($globalDebug) {
12562
+						echo "Updating airport to ".$airport_icao."...\n";
12563
+					}
12086 12564
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12087 12565
 					$sthu = $this->db->prepare($update_query);
12088 12566
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
Indentation   +1455 added lines, -1455 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	/**
169
-	* Executes the SQL statements to get the spotter information
170
-	*
171
-	* @param String $query the SQL query
172
-	* @param Array $params parameter of the query
173
-	* @param String $limitQuery the limit query
174
-	* @return Array the spotter information
175
-	*
176
-	*/
169
+	 * Executes the SQL statements to get the spotter information
170
+	 *
171
+	 * @param String $query the SQL query
172
+	 * @param Array $params parameter of the query
173
+	 * @param String $limitQuery the limit query
174
+	 * @return Array the spotter information
175
+	 *
176
+	 */
177 177
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 343
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344 344
 					} else $temp_array['aircraft_shadow'] = 'default.png';
345
-                                } else {
346
-                            		$temp_array['aircraft_shadow'] = 'default.png';
345
+								} else {
346
+									$temp_array['aircraft_shadow'] = 'default.png';
347 347
 					$temp_array['aircraft_name'] = 'N/A';
348 348
 					$temp_array['aircraft_manufacturer'] = 'N/A';
349
-                            	}
349
+								}
350 350
 			}
351 351
 			$fromsource = NULL;
352 352
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
 	
543 543
 	
544 544
 	/**
545
-	* Gets all the spotter information
546
-	*
547
-	* @return Array the spotter information
548
-	*
549
-	*/
545
+	 * Gets all the spotter information
546
+	 *
547
+	 * @return Array the spotter information
548
+	 *
549
+	 */
550 550
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
551 551
 	{
552 552
 		global $globalTimezone, $globalDBdriver;
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
 	
894 894
 	
895 895
 	/**
896
-	* Gets all the spotter information based on the latest data entry
897
-	*
898
-	* @return Array the spotter information
899
-	*
900
-	*/
896
+	 * Gets all the spotter information based on the latest data entry
897
+	 *
898
+	 * @return Array the spotter information
899
+	 *
900
+	 */
901 901
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
902 902
 	{
903 903
 		global $global_query;
@@ -936,12 +936,12 @@  discard block
 block discarded – undo
936 936
 	}
937 937
     
938 938
     
939
-    /**
940
-	* Gets all the spotter information based on a user's latitude and longitude
941
-	*
942
-	* @return Array the spotter information
943
-	*
944
-	*/
939
+	/**
940
+	 * Gets all the spotter information based on a user's latitude and longitude
941
+	 *
942
+	 * @return Array the spotter information
943
+	 *
944
+	 */
945 945
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
946 946
 	{
947 947
 		date_default_timezone_set('UTC');
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 				return false;
970 970
 			}
971 971
 		}
972
-    		$additional_query = '';
972
+			$additional_query = '';
973 973
 		if ($interval != "")
974 974
 		{
975 975
 			if (!is_string($interval))
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 	}
1010 1010
     
1011 1011
     
1012
-    /**
1013
-	* Gets all the spotter information sorted by the newest aircraft type
1014
-	*
1015
-	* @return Array the spotter information
1016
-	*
1017
-	*/
1012
+	/**
1013
+	 * Gets all the spotter information sorted by the newest aircraft type
1014
+	 *
1015
+	 * @return Array the spotter information
1016
+	 *
1017
+	 */
1018 1018
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1019 1019
 	{
1020 1020
 		global $global_query;
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
     
1056 1056
     
1057 1057
 	/**
1058
-	* Gets all the spotter information sorted by the newest aircraft registration
1059
-	*
1060
-	* @return Array the spotter information
1061
-	*
1062
-	*/
1058
+	 * Gets all the spotter information sorted by the newest aircraft registration
1059
+	 *
1060
+	 * @return Array the spotter information
1061
+	 *
1062
+	 */
1063 1063
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1064 1064
 	{
1065 1065
 		global $global_query;
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 
1101 1101
 	/**
1102
-	* Gets all the spotter information sorted by the newest airline
1103
-	*
1104
-	* @return Array the spotter information
1105
-	*
1106
-	*/
1102
+	 * Gets all the spotter information sorted by the newest airline
1103
+	 *
1104
+	 * @return Array the spotter information
1105
+	 *
1106
+	 */
1107 1107
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1108 1108
 	{
1109 1109
 		global $global_query;
@@ -1142,12 +1142,12 @@  discard block
 block discarded – undo
1142 1142
 	}
1143 1143
     
1144 1144
     
1145
-    /**
1146
-	* Gets all the spotter information sorted by the newest departure airport
1147
-	*
1148
-	* @return Array the spotter information
1149
-	*
1150
-	*/
1145
+	/**
1146
+	 * Gets all the spotter information sorted by the newest departure airport
1147
+	 *
1148
+	 * @return Array the spotter information
1149
+	 *
1150
+	 */
1151 1151
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1152 1152
 	{
1153 1153
 		global $global_query;
@@ -1189,11 +1189,11 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 
1191 1191
 	/**
1192
-	* Gets all the spotter information sorted by the newest arrival airport
1193
-	*
1194
-	* @return Array the spotter information
1195
-	*
1196
-	*/
1192
+	 * Gets all the spotter information sorted by the newest arrival airport
1193
+	 *
1194
+	 * @return Array the spotter information
1195
+	 *
1196
+	 */
1197 1197
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1198 1198
 	{
1199 1199
 		global $global_query;
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 
1234 1234
 	/**
1235
-	* Gets all the spotter information based on the spotter id
1236
-	*
1237
-	* @return Array the spotter information
1238
-	*
1239
-	*/
1235
+	 * Gets all the spotter information based on the spotter id
1236
+	 *
1237
+	 * @return Array the spotter information
1238
+	 *
1239
+	 */
1240 1240
 	public function getSpotterDataByID($id = '')
1241 1241
 	{
1242 1242
 		global $global_query;
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 	
1259 1259
 	
1260 1260
 	/**
1261
-	* Gets all the spotter information based on the callsign
1262
-	*
1263
-	* @return Array the spotter information
1264
-	*
1265
-	*/
1261
+	 * Gets all the spotter information based on the callsign
1262
+	 *
1263
+	 * @return Array the spotter information
1264
+	 *
1265
+	 */
1266 1266
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1267 1267
 	{
1268 1268
 		global $global_query;
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
 	}
1315 1315
 	
1316 1316
 	/**
1317
-	* Gets all the spotter information based on the owner
1318
-	*
1319
-	* @return Array the spotter information
1320
-	*
1321
-	*/
1317
+	 * Gets all the spotter information based on the owner
1318
+	 *
1319
+	 * @return Array the spotter information
1320
+	 *
1321
+	 */
1322 1322
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1323 1323
 	{
1324 1324
 		global $global_query;
@@ -1371,11 +1371,11 @@  discard block
 block discarded – undo
1371 1371
 	}
1372 1372
 	
1373 1373
 	/**
1374
-	* Gets all the spotter information based on the pilot
1375
-	*
1376
-	* @return Array the spotter information
1377
-	*
1378
-	*/
1374
+	 * Gets all the spotter information based on the pilot
1375
+	 *
1376
+	 * @return Array the spotter information
1377
+	 *
1378
+	 */
1379 1379
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1380 1380
 	{
1381 1381
 		global $global_query;
@@ -1424,11 +1424,11 @@  discard block
 block discarded – undo
1424 1424
 	
1425 1425
 	
1426 1426
 	/**
1427
-	* Gets all the spotter information based on the aircraft type
1428
-	*
1429
-	* @return Array the spotter information
1430
-	*
1431
-	*/
1427
+	 * Gets all the spotter information based on the aircraft type
1428
+	 *
1429
+	 * @return Array the spotter information
1430
+	 *
1431
+	 */
1432 1432
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1433 1433
 	{
1434 1434
 		global $global_query;
@@ -1482,11 +1482,11 @@  discard block
 block discarded – undo
1482 1482
 	
1483 1483
 	
1484 1484
 	/**
1485
-	* Gets all the spotter information based on the aircraft registration
1486
-	*
1487
-	* @return Array the spotter information
1488
-	*
1489
-	*/
1485
+	 * Gets all the spotter information based on the aircraft registration
1486
+	 *
1487
+	 * @return Array the spotter information
1488
+	 *
1489
+	 */
1490 1490
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1491 1491
 	{
1492 1492
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the airline
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the airline
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1600,11 +1600,11 @@  discard block
 block discarded – undo
1600 1600
 	
1601 1601
 	
1602 1602
 	/**
1603
-	* Gets all the spotter information based on the airport
1604
-	*
1605
-	* @return Array the spotter information
1606
-	*
1607
-	*/
1603
+	 * Gets all the spotter information based on the airport
1604
+	 *
1605
+	 * @return Array the spotter information
1606
+	 *
1607
+	 */
1608 1608
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1609 1609
 	{
1610 1610
 		global $global_query;
@@ -1658,11 +1658,11 @@  discard block
 block discarded – undo
1658 1658
 
1659 1659
 
1660 1660
 	/**
1661
-	* Gets all the spotter information based on the date
1662
-	*
1663
-	* @return Array the spotter information
1664
-	*
1665
-	*/
1661
+	 * Gets all the spotter information based on the date
1662
+	 *
1663
+	 * @return Array the spotter information
1664
+	 *
1665
+	 */
1666 1666
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1667 1667
 	{
1668 1668
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1726,11 +1726,11 @@  discard block
 block discarded – undo
1726 1726
 
1727 1727
 
1728 1728
 	/**
1729
-	* Gets all the spotter information based on the country name
1730
-	*
1731
-	* @return Array the spotter information
1732
-	*
1733
-	*/
1729
+	 * Gets all the spotter information based on the country name
1730
+	 *
1731
+	 * @return Array the spotter information
1732
+	 *
1733
+	 */
1734 1734
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1735 1735
 	{
1736 1736
 		global $global_query;
@@ -1784,11 +1784,11 @@  discard block
 block discarded – undo
1784 1784
 	
1785 1785
 	
1786 1786
 	/**
1787
-	* Gets all the spotter information based on the manufacturer name
1788
-	*
1789
-	* @return Array the spotter information
1790
-	*
1791
-	*/
1787
+	 * Gets all the spotter information based on the manufacturer name
1788
+	 *
1789
+	 * @return Array the spotter information
1790
+	 *
1791
+	 */
1792 1792
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1793 1793
 	{
1794 1794
 		global $global_query;
@@ -1844,13 +1844,13 @@  discard block
 block discarded – undo
1844 1844
   
1845 1845
   
1846 1846
 	/**
1847
-	* Gets a list of all aircraft that take a route
1848
-	*
1849
-	* @param String $departure_airport_icao ICAO code of departure airport
1850
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1851
-	* @return Array the spotter information
1852
-	*
1853
-	*/
1847
+	 * Gets a list of all aircraft that take a route
1848
+	 *
1849
+	 * @param String $departure_airport_icao ICAO code of departure airport
1850
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1851
+	 * @return Array the spotter information
1852
+	 *
1853
+	 */
1854 1854
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1855 1855
 	{
1856 1856
 		global $global_query;
@@ -1919,11 +1919,11 @@  discard block
 block discarded – undo
1919 1919
 	
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets all the spotter information based on the special column in the table
1923
-	*
1924
-	* @return Array the spotter information
1925
-	*
1926
-	*/
1922
+	 * Gets all the spotter information based on the special column in the table
1923
+	 *
1924
+	 * @return Array the spotter information
1925
+	 *
1926
+	 */
1927 1927
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1928 1928
 	{
1929 1929
 		global $global_query;
@@ -1962,11 +1962,11 @@  discard block
 block discarded – undo
1962 1962
 	}
1963 1963
 
1964 1964
 	/**
1965
-	* Gets all the highlight based on a aircraft registration
1966
-	*
1967
-	* @return String the highlight text
1968
-	*
1969
-	*/
1965
+	 * Gets all the highlight based on a aircraft registration
1966
+	 *
1967
+	 * @return String the highlight text
1968
+	 *
1969
+	 */
1970 1970
 	public function getHighlightByRegistration($registration,$filter = array())
1971 1971
 	{
1972 1972
 		global $global_query;
@@ -1988,13 +1988,13 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
 	
1990 1990
 	/**
1991
-	* Gets the squawk usage from squawk code
1992
-	*
1993
-	* @param String $squawk squawk code
1994
-	* @param String $country country
1995
-	* @return String usage
1996
-	*
1997
-	*/
1991
+	 * Gets the squawk usage from squawk code
1992
+	 *
1993
+	 * @param String $squawk squawk code
1994
+	 * @param String $country country
1995
+	 * @return String usage
1996
+	 *
1997
+	 */
1998 1998
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1999 1999
 	{
2000 2000
 		
@@ -2015,12 +2015,12 @@  discard block
 block discarded – undo
2015 2015
 	}
2016 2016
 
2017 2017
 	/**
2018
-	* Gets the airport icao from the iata
2019
-	*
2020
-	* @param String $airport_iata the iata code of the airport
2021
-	* @return String airport iata
2022
-	*
2023
-	*/
2018
+	 * Gets the airport icao from the iata
2019
+	 *
2020
+	 * @param String $airport_iata the iata code of the airport
2021
+	 * @return String airport iata
2022
+	 *
2023
+	 */
2024 2024
 	public function getAirportIcao($airport_iata = '')
2025 2025
 	{
2026 2026
 		
@@ -2040,14 +2040,14 @@  discard block
 block discarded – undo
2040 2040
 	}
2041 2041
 
2042 2042
 	/**
2043
-	* Gets the airport distance
2044
-	*
2045
-	* @param String $airport_icao the icao code of the airport
2046
-	* @param Float $latitude the latitude
2047
-	* @param Float $longitude the longitude
2048
-	* @return Float distance to the airport
2049
-	*
2050
-	*/
2043
+	 * Gets the airport distance
2044
+	 *
2045
+	 * @param String $airport_icao the icao code of the airport
2046
+	 * @param Float $latitude the latitude
2047
+	 * @param Float $longitude the longitude
2048
+	 * @return Float distance to the airport
2049
+	 *
2050
+	 */
2051 2051
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2052 2052
 	{
2053 2053
 		
@@ -2068,12 +2068,12 @@  discard block
 block discarded – undo
2068 2068
 	}
2069 2069
 	
2070 2070
 	/**
2071
-	* Gets the airport info based on the icao
2072
-	*
2073
-	* @param String $airport the icao code of the airport
2074
-	* @return Array airport information
2075
-	*
2076
-	*/
2071
+	 * Gets the airport info based on the icao
2072
+	 *
2073
+	 * @param String $airport the icao code of the airport
2074
+	 * @return Array airport information
2075
+	 *
2076
+	 */
2077 2077
 	public function getAllAirportInfo($airport = '')
2078 2078
 	{
2079 2079
 		
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
 	}
2120 2120
 	
2121 2121
 	/**
2122
-	* Gets the airport info based on the country
2123
-	*
2124
-	* @param Array $countries Airports countries
2125
-	* @return Array airport information
2126
-	*
2127
-	*/
2122
+	 * Gets the airport info based on the country
2123
+	 *
2124
+	 * @param Array $countries Airports countries
2125
+	 * @return Array airport information
2126
+	 *
2127
+	 */
2128 2128
 	public function getAllAirportInfobyCountry($countries)
2129 2129
 	{
2130 2130
 		$lst_countries = '';
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 	
2164 2164
 	/**
2165
-	* Gets airports info based on the coord
2166
-	*
2167
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
-	* @return Array airport information
2169
-	*
2170
-	*/
2165
+	 * Gets airports info based on the coord
2166
+	 *
2167
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
+	 * @return Array airport information
2169
+	 *
2170
+	 */
2171 2171
 	public function getAllAirportInfobyCoord($coord)
2172 2172
 	{
2173 2173
 		global $globalDBdriver;
@@ -2198,12 +2198,12 @@  discard block
 block discarded – undo
2198 2198
 	}
2199 2199
 
2200 2200
 	/**
2201
-	* Gets waypoints info based on the coord
2202
-	*
2203
-	* @param Array $coord waypoints coord
2204
-	* @return Array airport information
2205
-	*
2206
-	*/
2201
+	 * Gets waypoints info based on the coord
2202
+	 *
2203
+	 * @param Array $coord waypoints coord
2204
+	 * @return Array airport information
2205
+	 *
2206
+	 */
2207 2207
 	public function getAllWaypointsInfobyCoord($coord)
2208 2208
 	{
2209 2209
 		if (is_array($coord)) {
@@ -2237,12 +2237,12 @@  discard block
 block discarded – undo
2237 2237
 	
2238 2238
 	
2239 2239
 	/**
2240
-	* Gets the airline info based on the icao code or iata code
2241
-	*
2242
-	* @param String $airline_icao the iata code of the airport
2243
-	* @return Array airport information
2244
-	*
2245
-	*/
2240
+	 * Gets the airline info based on the icao code or iata code
2241
+	 *
2242
+	 * @param String $airline_icao the iata code of the airport
2243
+	 * @return Array airport information
2244
+	 *
2245
+	 */
2246 2246
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2247 2247
 	{
2248 2248
 		global $globalUseRealAirlines;
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 			} else {
2274 2274
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2275 2275
 			}
2276
-                        /*
2276
+						/*
2277 2277
 			$airline_array = array();
2278 2278
 			$temp_array = array();
2279 2279
 		
@@ -2306,12 +2306,12 @@  discard block
 block discarded – undo
2306 2306
 	}
2307 2307
 	
2308 2308
 	/**
2309
-	* Gets the airline info based on the airline name
2310
-	*
2311
-	* @param String $airline_name the name of the airline
2312
-	* @return Array airline information
2313
-	*
2314
-	*/
2309
+	 * Gets the airline info based on the airline name
2310
+	 *
2311
+	 * @param String $airline_name the name of the airline
2312
+	 * @return Array airline information
2313
+	 *
2314
+	 */
2315 2315
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2316 2316
 	{
2317 2317
 		global $globalUseRealAirlines;
@@ -2339,12 +2339,12 @@  discard block
 block discarded – undo
2339 2339
 	
2340 2340
 	
2341 2341
 	/**
2342
-	* Gets the aircraft info based on the aircraft type
2343
-	*
2344
-	* @param String $aircraft_type the aircraft type
2345
-	* @return Array aircraft information
2346
-	*
2347
-	*/
2342
+	 * Gets the aircraft info based on the aircraft type
2343
+	 *
2344
+	 * @param String $aircraft_type the aircraft type
2345
+	 * @return Array aircraft information
2346
+	 *
2347
+	 */
2348 2348
 	public function getAllAircraftInfo($aircraft_type)
2349 2349
 	{
2350 2350
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2376,12 +2376,12 @@  discard block
 block discarded – undo
2376 2376
 	}
2377 2377
 
2378 2378
 	/**
2379
-	* Gets the aircraft icao based on the aircraft name/type
2380
-	*
2381
-	* @param String $aircraft_type the aircraft type
2382
-	* @return String aircraft information
2383
-	*
2384
-	*/
2379
+	 * Gets the aircraft icao based on the aircraft name/type
2380
+	 *
2381
+	 * @param String $aircraft_type the aircraft type
2382
+	 * @return String aircraft information
2383
+	 *
2384
+	 */
2385 2385
 	public function getAircraftIcao($aircraft_type)
2386 2386
 	{
2387 2387
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2406,12 +2406,12 @@  discard block
 block discarded – undo
2406 2406
 	}
2407 2407
 	
2408 2408
 	/**
2409
-	* Gets the aircraft info based on the aircraft modes
2410
-	*
2411
-	* @param String $aircraft_modes the aircraft ident (hex)
2412
-	* @return String aircraft type
2413
-	*
2414
-	*/
2409
+	 * Gets the aircraft info based on the aircraft modes
2410
+	 *
2411
+	 * @param String $aircraft_modes the aircraft ident (hex)
2412
+	 * @return String aircraft type
2413
+	 *
2414
+	 */
2415 2415
 	public function getAllAircraftType($aircraft_modes,$source_type = '')
2416 2416
 	{
2417 2417
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
 	}
2439 2439
 
2440 2440
 	/**
2441
-	* Gets the aircraft info based on the aircraft registration
2442
-	*
2443
-	* @param String $registration the aircraft registration
2444
-	* @return String aircraft type
2445
-	*
2446
-	*/
2441
+	 * Gets the aircraft info based on the aircraft registration
2442
+	 *
2443
+	 * @param String $registration the aircraft registration
2444
+	 * @return String aircraft type
2445
+	 *
2446
+	 */
2447 2447
 	public function getAllAircraftTypeByRegistration($registration)
2448 2448
 	{
2449 2449
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2461,12 +2461,12 @@  discard block
 block discarded – undo
2461 2461
 	}
2462 2462
 
2463 2463
 	/**
2464
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2465
-	*
2466
-	* @param String $registration the aircraft registration
2467
-	* @return Array spotter_id and flightaware_id
2468
-	*
2469
-	*/
2464
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2465
+	 *
2466
+	 * @param String $registration the aircraft registration
2467
+	 * @return Array spotter_id and flightaware_id
2468
+	 *
2469
+	 */
2470 2470
 	public function getAllIDByRegistration($registration)
2471 2471
 	{
2472 2472
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2485,12 +2485,12 @@  discard block
 block discarded – undo
2485 2485
 	}
2486 2486
 
2487 2487
 	/**
2488
-	* Gets correct aircraft operator code
2489
-	*
2490
-	* @param String $operator the aircraft operator code (callsign)
2491
-	* @return String aircraft operator code
2492
-	*
2493
-	*/
2488
+	 * Gets correct aircraft operator code
2489
+	 *
2490
+	 * @param String $operator the aircraft operator code (callsign)
2491
+	 * @return String aircraft operator code
2492
+	 *
2493
+	 */
2494 2494
 	public function getOperator($operator)
2495 2495
 	{
2496 2496
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2507,16 +2507,16 @@  discard block
 block discarded – undo
2507 2507
 	}
2508 2508
 
2509 2509
 	/**
2510
-	* Gets the aircraft route based on the aircraft callsign
2511
-	*
2512
-	* @param String $callsign the aircraft callsign
2513
-	* @return Array aircraft type
2514
-	*
2515
-	*/
2510
+	 * Gets the aircraft route based on the aircraft callsign
2511
+	 *
2512
+	 * @param String $callsign the aircraft callsign
2513
+	 * @return Array aircraft type
2514
+	 *
2515
+	 */
2516 2516
 	public function getRouteInfo($callsign)
2517 2517
 	{
2518 2518
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
-                if ($callsign == '') return array();
2519
+				if ($callsign == '') return array();
2520 2520
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2521 2521
 		
2522 2522
 		$sth = $this->db->prepare($query);
@@ -2530,12 +2530,12 @@  discard block
 block discarded – undo
2530 2530
 	}
2531 2531
 	
2532 2532
 	/**
2533
-	* Gets the aircraft info based on the aircraft registration
2534
-	*
2535
-	* @param String $registration the aircraft registration
2536
-	* @return Array aircraft information
2537
-	*
2538
-	*/
2533
+	 * Gets the aircraft info based on the aircraft registration
2534
+	 *
2535
+	 * @param String $registration the aircraft registration
2536
+	 * @return Array aircraft information
2537
+	 *
2538
+	 */
2539 2539
 	public function getAircraftInfoByRegistration($registration)
2540 2540
 	{
2541 2541
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2562,12 +2562,12 @@  discard block
 block discarded – undo
2562 2562
 	}
2563 2563
 	
2564 2564
 	/**
2565
-	* Gets the aircraft owner & base based on the aircraft registration
2566
-	*
2567
-	* @param String $registration the aircraft registration
2568
-	* @return Array aircraft information
2569
-	*
2570
-	*/
2565
+	 * Gets the aircraft owner & base based on the aircraft registration
2566
+	 *
2567
+	 * @param String $registration the aircraft registration
2568
+	 * @return Array aircraft information
2569
+	 *
2570
+	 */
2571 2571
 	public function getAircraftOwnerByRegistration($registration)
2572 2572
 	{
2573 2573
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2584,11 +2584,11 @@  discard block
 block discarded – undo
2584 2584
 	
2585 2585
   
2586 2586
   /**
2587
-	* Gets all flights (but with only little info)
2588
-	*
2589
-	* @return Array basic flight information
2590
-	*
2591
-	*/
2587
+   * Gets all flights (but with only little info)
2588
+   *
2589
+   * @return Array basic flight information
2590
+   *
2591
+   */
2592 2592
 	public function getAllFlightsforSitemap()
2593 2593
 	{
2594 2594
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 		
2597 2597
 		$sth = $this->db->prepare($query);
2598 2598
 		$sth->execute();
2599
-                  /*
2599
+				  /*
2600 2600
 		$flight_array = array();
2601 2601
 		$temp_array = array();
2602 2602
 		
@@ -2618,11 +2618,11 @@  discard block
 block discarded – undo
2618 2618
 	}
2619 2619
   
2620 2620
 	/**
2621
-	* Gets a list of all aircraft manufacturers
2622
-	*
2623
-	* @return Array list of aircraft types
2624
-	*
2625
-	*/
2621
+	 * Gets a list of all aircraft manufacturers
2622
+	 *
2623
+	 * @return Array list of aircraft types
2624
+	 *
2625
+	 */
2626 2626
 	public function getAllManufacturers()
2627 2627
 	{
2628 2628
 		/*
@@ -2651,11 +2651,11 @@  discard block
 block discarded – undo
2651 2651
   
2652 2652
   
2653 2653
   /**
2654
-	* Gets a list of all aircraft types
2655
-	*
2656
-	* @return Array list of aircraft types
2657
-	*
2658
-	*/
2654
+   * Gets a list of all aircraft types
2655
+   *
2656
+   * @return Array list of aircraft types
2657
+   *
2658
+   */
2659 2659
 	public function getAllAircraftTypes($filters = array())
2660 2660
 	{
2661 2661
 		/*
@@ -2690,11 +2690,11 @@  discard block
 block discarded – undo
2690 2690
 	
2691 2691
 	
2692 2692
 	/**
2693
-	* Gets a list of all aircraft registrations
2694
-	*
2695
-	* @return Array list of aircraft registrations
2696
-	*
2697
-	*/
2693
+	 * Gets a list of all aircraft registrations
2694
+	 *
2695
+	 * @return Array list of aircraft registrations
2696
+	 *
2697
+	 */
2698 2698
 	public function getAllAircraftRegistrations($filters = array())
2699 2699
 	{
2700 2700
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2719,12 +2719,12 @@  discard block
 block discarded – undo
2719 2719
 	}
2720 2720
 
2721 2721
 	/**
2722
-	* Gets all source name
2723
-	*
2724
-	* @param String type format of source
2725
-	* @return Array list of source name
2726
-	*
2727
-	*/
2722
+	 * Gets all source name
2723
+	 *
2724
+	 * @param String type format of source
2725
+	 * @return Array list of source name
2726
+	 *
2727
+	 */
2728 2728
 	public function getAllSourceName($type = '',$filters = array())
2729 2729
 	{
2730 2730
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 
2756 2756
 
2757 2757
 	/**
2758
-	* Gets a list of all airline names
2759
-	*
2760
-	* @return Array list of airline names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all airline names
2759
+	 *
2760
+	 * @return Array list of airline names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2808,11 +2808,11 @@  discard block
 block discarded – undo
2808 2808
 	}
2809 2809
 	
2810 2810
 	/**
2811
-	* Gets a list of all alliance names
2812
-	*
2813
-	* @return Array list of alliance names
2814
-	*
2815
-	*/
2811
+	 * Gets a list of all alliance names
2812
+	 *
2813
+	 * @return Array list of alliance names
2814
+	 *
2815
+	 */
2816 2816
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2817 2817
 	{
2818 2818
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2837,11 +2837,11 @@  discard block
 block discarded – undo
2837 2837
 	}
2838 2838
 	
2839 2839
 	/**
2840
-	* Gets a list of all airline countries
2841
-	*
2842
-	* @return Array list of airline countries
2843
-	*
2844
-	*/
2840
+	 * Gets a list of all airline countries
2841
+	 *
2842
+	 * @return Array list of airline countries
2843
+	 *
2844
+	 */
2845 2845
 	public function getAllAirlineCountries($filters = array())
2846 2846
 	{
2847 2847
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2869,11 +2869,11 @@  discard block
 block discarded – undo
2869 2869
 	
2870 2870
 	
2871 2871
 	/**
2872
-	* Gets a list of all departure & arrival names
2873
-	*
2874
-	* @return Array list of airport names
2875
-	*
2876
-	*/
2872
+	 * Gets a list of all departure & arrival names
2873
+	 *
2874
+	 * @return Array list of airport names
2875
+	 *
2876
+	 */
2877 2877
 	public function getAllAirportNames($filters = array())
2878 2878
 	{
2879 2879
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2921,11 +2921,11 @@  discard block
 block discarded – undo
2921 2921
 	} 
2922 2922
 
2923 2923
 	/**
2924
-	* Gets a list of all owner names
2925
-	*
2926
-	* @return Array list of owner names
2927
-	*
2928
-	*/
2924
+	 * Gets a list of all owner names
2925
+	 *
2926
+	 * @return Array list of owner names
2927
+	 *
2928
+	 */
2929 2929
 	public function getAllOwnerNames($filters = array())
2930 2930
 	{
2931 2931
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2939,11 +2939,11 @@  discard block
 block discarded – undo
2939 2939
 	} 
2940 2940
 
2941 2941
 	/**
2942
-	* Gets a list of all pilot names and pilot ids
2943
-	*
2944
-	* @return Array list of pilot names and pilot ids
2945
-	*
2946
-	*/
2942
+	 * Gets a list of all pilot names and pilot ids
2943
+	 *
2944
+	 * @return Array list of pilot names and pilot ids
2945
+	 *
2946
+	 */
2947 2947
 	public function getAllPilotNames($filters = array())
2948 2948
 	{
2949 2949
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2958,11 +2958,11 @@  discard block
 block discarded – undo
2958 2958
 	
2959 2959
 	
2960 2960
 	/**
2961
-	* Gets a list of all departure & arrival airport countries
2962
-	*
2963
-	* @return Array list of airport countries
2964
-	*
2965
-	*/
2961
+	 * Gets a list of all departure & arrival airport countries
2962
+	 *
2963
+	 * @return Array list of airport countries
2964
+	 *
2965
+	 */
2966 2966
 	public function getAllAirportCountries($filters = array())
2967 2967
 	{
2968 2968
 		$airport_array = array();
@@ -3010,11 +3010,11 @@  discard block
 block discarded – undo
3010 3010
 	
3011 3011
 	
3012 3012
 	/**
3013
-	* Gets a list of all countries (airline, departure airport & arrival airport)
3014
-	*
3015
-	* @return Array list of countries
3016
-	*
3017
-	*/
3013
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
3014
+	 *
3015
+	 * @return Array list of countries
3016
+	 *
3017
+	 */
3018 3018
 	public function getAllCountries($filters = array())
3019 3019
 	{
3020 3020
 		$Connection= new Connection($this->db);
@@ -3091,11 +3091,11 @@  discard block
 block discarded – undo
3091 3091
 	
3092 3092
 	
3093 3093
 	/**
3094
-	* Gets a list of all idents/callsigns
3095
-	*
3096
-	* @return Array list of ident/callsign names
3097
-	*
3098
-	*/
3094
+	 * Gets a list of all idents/callsigns
3095
+	 *
3096
+	 * @return Array list of ident/callsign names
3097
+	 *
3098
+	 */
3099 3099
 	public function getAllIdents($filters = array())
3100 3100
 	{
3101 3101
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3119,9 +3119,9 @@  discard block
 block discarded – undo
3119 3119
 	}
3120 3120
 
3121 3121
 	/**
3122
-	* Get a list of flights from airport since 7 days
3123
-	* @return Array number, icao, name and city of airports
3124
-	*/
3122
+	 * Get a list of flights from airport since 7 days
3123
+	 * @return Array number, icao, name and city of airports
3124
+	 */
3125 3125
 
3126 3126
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3127 3127
 		global $globalTimezone, $globalDBdriver;
@@ -3152,9 +3152,9 @@  discard block
 block discarded – undo
3152 3152
 	}
3153 3153
 
3154 3154
 	/**
3155
-	* Get a list of flights from airport since 7 days
3156
-	* @return Array number, icao, name and city of airports
3157
-	*/
3155
+	 * Get a list of flights from airport since 7 days
3156
+	 * @return Array number, icao, name and city of airports
3157
+	 */
3158 3158
 
3159 3159
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3160 3160
 		global $globalTimezone, $globalDBdriver;
@@ -3184,9 +3184,9 @@  discard block
 block discarded – undo
3184 3184
 	}
3185 3185
 
3186 3186
 	/**
3187
-	* Get a list of flights from detected airport since 7 days
3188
-	* @return Array number, icao, name and city of airports
3189
-	*/
3187
+	 * Get a list of flights from detected airport since 7 days
3188
+	 * @return Array number, icao, name and city of airports
3189
+	 */
3190 3190
 
3191 3191
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3192 3192
 		global $globalTimezone, $globalDBdriver;
@@ -3224,9 +3224,9 @@  discard block
 block discarded – undo
3224 3224
 	}
3225 3225
 
3226 3226
 	/**
3227
-	* Get a list of flights from detected airport since 7 days
3228
-	* @return Array number, icao, name and city of airports
3229
-	*/
3227
+	 * Get a list of flights from detected airport since 7 days
3228
+	 * @return Array number, icao, name and city of airports
3229
+	 */
3230 3230
 
3231 3231
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3232 3232
 		global $globalTimezone, $globalDBdriver;
@@ -3268,9 +3268,9 @@  discard block
 block discarded – undo
3268 3268
 
3269 3269
 
3270 3270
 	/**
3271
-	* Get a list of flights to airport since 7 days
3272
-	* @return Array number, icao, name and city of airports
3273
-	*/
3271
+	 * Get a list of flights to airport since 7 days
3272
+	 * @return Array number, icao, name and city of airports
3273
+	 */
3274 3274
 
3275 3275
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3276 3276
 		global $globalTimezone, $globalDBdriver;
@@ -3303,9 +3303,9 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
 
3305 3305
 	/**
3306
-	* Get a list of flights detected to airport since 7 days
3307
-	* @return Array number, icao, name and city of airports
3308
-	*/
3306
+	 * Get a list of flights detected to airport since 7 days
3307
+	 * @return Array number, icao, name and city of airports
3308
+	 */
3309 3309
 
3310 3310
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3311 3311
 		global $globalTimezone, $globalDBdriver;
@@ -3346,9 +3346,9 @@  discard block
 block discarded – undo
3346 3346
 
3347 3347
 
3348 3348
 	/**
3349
-	* Get a list of flights to airport since 7 days
3350
-	* @return Array number, icao, name and city of airports
3351
-	*/
3349
+	 * Get a list of flights to airport since 7 days
3350
+	 * @return Array number, icao, name and city of airports
3351
+	 */
3352 3352
 
3353 3353
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3354 3354
 		global $globalTimezone, $globalDBdriver;
@@ -3380,9 +3380,9 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
 
3382 3382
 	/**
3383
-	* Get a list of flights detected to airport since 7 days
3384
-	* @return Array number, icao, name and city of airports
3385
-	*/
3383
+	 * Get a list of flights detected to airport since 7 days
3384
+	 * @return Array number, icao, name and city of airports
3385
+	 */
3386 3386
 
3387 3387
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3388 3388
 		global $globalTimezone, $globalDBdriver;
@@ -3426,11 +3426,11 @@  discard block
 block discarded – undo
3426 3426
 
3427 3427
 
3428 3428
 	/**
3429
-	* Gets a list of all dates
3430
-	*
3431
-	* @return Array list of date names
3432
-	*
3433
-	*/
3429
+	 * Gets a list of all dates
3430
+	 *
3431
+	 * @return Array list of date names
3432
+	 *
3433
+	 */
3434 3434
 	public function getAllDates()
3435 3435
 	{
3436 3436
 		global $globalTimezone, $globalDBdriver;
@@ -3471,11 +3471,11 @@  discard block
 block discarded – undo
3471 3471
 	
3472 3472
 	
3473 3473
 	/**
3474
-	* Gets all route combinations
3475
-	*
3476
-	* @return Array the route list
3477
-	*
3478
-	*/
3474
+	 * Gets all route combinations
3475
+	 *
3476
+	 * @return Array the route list
3477
+	 *
3478
+	 */
3479 3479
 	public function getAllRoutes()
3480 3480
 	{
3481 3481
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3501,13 +3501,13 @@  discard block
 block discarded – undo
3501 3501
 	}
3502 3502
 
3503 3503
 	/**
3504
-	* Update ident spotter data
3505
-	*
3506
-	* @param String $flightaware_id the ID from flightaware
3507
-	* @param String $ident the flight ident
3508
-	* @return String success or false
3509
-	*
3510
-	*/	
3504
+	 * Update ident spotter data
3505
+	 *
3506
+	 * @param String $flightaware_id the ID from flightaware
3507
+	 * @param String $ident the flight ident
3508
+	 * @return String success or false
3509
+	 *
3510
+	 */	
3511 3511
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3512 3512
 	{
3513 3513
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3528,14 +3528,14 @@  discard block
 block discarded – undo
3528 3528
 		} else {
3529 3529
 			$airline_array = $this->getAllAirlineInfo("NA");
3530 3530
 		}
3531
-                $airline_name = $airline_array[0]['name'];
3532
-                $airline_icao = $airline_array[0]['icao'];
3533
-                $airline_country = $airline_array[0]['country'];
3534
-                $airline_type = $airline_array[0]['type'];
3531
+				$airline_name = $airline_array[0]['name'];
3532
+				$airline_icao = $airline_array[0]['icao'];
3533
+				$airline_country = $airline_array[0]['country'];
3534
+				$airline_type = $airline_array[0]['type'];
3535 3535
 
3536 3536
 
3537 3537
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3538
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3538
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3539 3539
 
3540 3540
 		try {
3541 3541
 			$sth = $this->db->prepare($query);
@@ -3548,19 +3548,19 @@  discard block
 block discarded – undo
3548 3548
 
3549 3549
 	}
3550 3550
 	/**
3551
-	* Update latest spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $arrival_airport_icao the arrival airport
3556
-	* @return String success or false
3557
-	*
3558
-	*/	
3551
+	 * Update latest spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $arrival_airport_icao the arrival airport
3556
+	 * @return String success or false
3557
+	 *
3558
+	 */	
3559 3559
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560 3560
 	{
3561 3561
 		if ($groundspeed == '') $groundspeed = NULL;
3562 3562
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3563
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3563
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3564 3564
 
3565 3565
 		try {
3566 3566
 			$sth = $this->db->prepare($query);
@@ -3574,32 +3574,32 @@  discard block
 block discarded – undo
3574 3574
 	}
3575 3575
 
3576 3576
 	/**
3577
-	* Adds a new spotter data
3578
-	*
3579
-	* @param String $flightaware_id the ID from flightaware
3580
-	* @param String $ident the flight ident
3581
-	* @param String $aircraft_icao the aircraft type
3582
-	* @param String $departure_airport_icao the departure airport
3583
-	* @param String $arrival_airport_icao the arrival airport
3584
-	* @param String $latitude latitude of flight
3585
-	* @param String $longitude latitude of flight
3586
-	* @param String $waypoints waypoints of flight
3587
-	* @param String $altitude altitude of flight
3588
-	* @param String $heading heading of flight
3589
-	* @param String $groundspeed speed of flight
3590
-	* @param String $date date of flight
3591
-	* @param String $departure_airport_time departure time of flight
3592
-	* @param String $arrival_airport_time arrival time of flight
3593
-	* @param String $squawk squawk code of flight
3594
-	* @param String $route_stop route stop of flight
3595
-	* @param String $highlight highlight or not
3596
-	* @param String $ModeS ModesS code of flight
3597
-	* @param String $registration registration code of flight
3598
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3599
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3600
-	* @param String $verticalrate vertival rate of flight
3601
-	* @return String success or false
3602
-	*/
3577
+	 * Adds a new spotter data
3578
+	 *
3579
+	 * @param String $flightaware_id the ID from flightaware
3580
+	 * @param String $ident the flight ident
3581
+	 * @param String $aircraft_icao the aircraft type
3582
+	 * @param String $departure_airport_icao the departure airport
3583
+	 * @param String $arrival_airport_icao the arrival airport
3584
+	 * @param String $latitude latitude of flight
3585
+	 * @param String $longitude latitude of flight
3586
+	 * @param String $waypoints waypoints of flight
3587
+	 * @param String $altitude altitude of flight
3588
+	 * @param String $heading heading of flight
3589
+	 * @param String $groundspeed speed of flight
3590
+	 * @param String $date date of flight
3591
+	 * @param String $departure_airport_time departure time of flight
3592
+	 * @param String $arrival_airport_time arrival time of flight
3593
+	 * @param String $squawk squawk code of flight
3594
+	 * @param String $route_stop route stop of flight
3595
+	 * @param String $highlight highlight or not
3596
+	 * @param String $ModeS ModesS code of flight
3597
+	 * @param String $registration registration code of flight
3598
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3599
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3600
+	 * @param String $verticalrate vertival rate of flight
3601
+	 * @return String success or false
3602
+	 */
3603 3603
 	public function addSpotterData($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 = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '',$source_type = '')
3604 3604
 	{
3605 3605
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3814,8 +3814,8 @@  discard block
 block discarded – undo
3814 3814
     
3815 3815
 		if ($globalIVAO && $aircraft_icao != '')
3816 3816
 		{
3817
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
-            		else $airline_icao = '';
3817
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
+					else $airline_icao = '';
3819 3819
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820 3820
 			if (!isset($image_array[0]['registration']))
3821 3821
 			{
@@ -3846,53 +3846,53 @@  discard block
 block discarded – undo
3846 3846
 	
3847 3847
 		if (count($airline_array) == 0) 
3848 3848
 		{
3849
-                        $airline_array = $this->getAllAirlineInfo('NA');
3850
-                }
3851
-                if (count($aircraft_array) == 0) 
3852
-                {
3853
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3854
-                }
3855
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
-                {
3857
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3858
-                }
3859
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
-                {
3861
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3862
-                }
3863
-                if ($registration == '') $registration = 'NA';
3864
-                if ($latitude == '' && $longitude == '') {
3865
-            		$latitude = 0;
3866
-            		$longitude = 0;
3867
-            	}
3868
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3849
+						$airline_array = $this->getAllAirlineInfo('NA');
3850
+				}
3851
+				if (count($aircraft_array) == 0) 
3852
+				{
3853
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3854
+				}
3855
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
+				{
3857
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3858
+				}
3859
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
+				{
3861
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3862
+				}
3863
+				if ($registration == '') $registration = 'NA';
3864
+				if ($latitude == '' && $longitude == '') {
3865
+					$latitude = 0;
3866
+					$longitude = 0;
3867
+				}
3868
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3874 3874
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3875 3875
 
3876
-                $airline_name = $airline_array[0]['name'];
3877
-                $airline_icao = $airline_array[0]['icao'];
3878
-                $airline_country = $airline_array[0]['country'];
3879
-                $airline_type = $airline_array[0]['type'];
3876
+				$airline_name = $airline_array[0]['name'];
3877
+				$airline_icao = $airline_array[0]['icao'];
3878
+				$airline_country = $airline_array[0]['country'];
3879
+				$airline_type = $airline_array[0]['type'];
3880 3880
 		if ($airline_type == '') {
3881 3881
 			$timeelapsed = microtime(true);
3882 3882
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883 3883
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884 3884
 		}
3885 3885
 		if ($airline_type == null) $airline_type = '';
3886
-                $aircraft_type = $aircraft_array[0]['type'];
3887
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
-                $departure_airport_name = $departure_airport_array[0]['name'];
3889
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3890
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3886
+				$aircraft_type = $aircraft_array[0]['type'];
3887
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
+				$departure_airport_name = $departure_airport_array[0]['name'];
3889
+			$departure_airport_city = $departure_airport_array[0]['city'];
3890
+				$departure_airport_country = $departure_airport_array[0]['country'];
3891 3891
                 
3892
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3893
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3894
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3895
-                $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3892
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3893
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3894
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3895
+				$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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3896 3896
 
3897 3897
 		try {
3898 3898
 		        
@@ -3900,7 +3900,7 @@  discard block
 block discarded – undo
3900 3900
 			$sth->execute($query_values);
3901 3901
 			$this->db = null;
3902 3902
 		} catch (PDOException $e) {
3903
-		    return "error : ".$e->getMessage();
3903
+			return "error : ".$e->getMessage();
3904 3904
 		}
3905 3905
 		
3906 3906
 		return "success";
@@ -3909,11 +3909,11 @@  discard block
 block discarded – undo
3909 3909
 	
3910 3910
   
3911 3911
 	/**
3912
-	* Gets the aircraft ident within the last hour
3913
-	*
3914
-	* @return String the ident
3915
-	*
3916
-	*/
3912
+	 * Gets the aircraft ident within the last hour
3913
+	 *
3914
+	 * @return String the ident
3915
+	 *
3916
+	 */
3917 3917
 	public function getIdentFromLastHour($ident)
3918 3918
 	{
3919 3919
 		global $globalDBdriver, $globalTimezone;
@@ -3929,11 +3929,11 @@  discard block
 block discarded – undo
3929 3929
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3930 3930
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3931 3931
 			$query_data = array(':ident' => $ident);
3932
-    		}
3932
+			}
3933 3933
 		
3934 3934
 		$sth = $this->db->prepare($query);
3935 3935
 		$sth->execute($query_data);
3936
-    		$ident_result='';
3936
+			$ident_result='';
3937 3937
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3938 3938
 		{
3939 3939
 			$ident_result = $row['ident'];
@@ -3944,11 +3944,11 @@  discard block
 block discarded – undo
3944 3944
 	
3945 3945
 	
3946 3946
 	/**
3947
-	* Gets the aircraft data from the last 20 seconds
3948
-	*
3949
-	* @return Array the spotter data
3950
-	*
3951
-	*/
3947
+	 * Gets the aircraft data from the last 20 seconds
3948
+	 *
3949
+	 * @return Array the spotter data
3950
+	 *
3951
+	 */
3952 3952
 	public function getRealTimeData($q = '')
3953 3953
 	{
3954 3954
 		global $globalDBdriver;
@@ -3992,11 +3992,11 @@  discard block
 block discarded – undo
3992 3992
 	
3993 3993
 	
3994 3994
 	 /**
3995
-	* Gets all airlines that have flown over
3996
-	*
3997
-	* @return Array the airline list
3998
-	*
3999
-	*/
3995
+	  * Gets all airlines that have flown over
3996
+	  *
3997
+	  * @return Array the airline list
3998
+	  *
3999
+	  */
4000 4000
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4001 4001
 	{
4002 4002
 		global $globalDBdriver;
@@ -4010,7 +4010,7 @@  discard block
 block discarded – undo
4010 4010
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4011 4011
 			}
4012 4012
 		}
4013
-                if ($sincedate != '') {
4013
+				if ($sincedate != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4016 4016
 			} else {
@@ -4064,26 +4064,26 @@  discard block
 block discarded – undo
4064 4064
 	}
4065 4065
 
4066 4066
 	 /**
4067
-	* Gets all pilots that have flown over
4068
-	*
4069
-	* @return Array the pilots list
4070
-	*
4071
-	*/
4067
+	  * Gets all pilots that have flown over
4068
+	  *
4069
+	  * @return Array the pilots list
4070
+	  *
4071
+	  */
4072 4072
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4073 4073
 	{
4074 4074
 		global $globalDBdriver;
4075 4075
 		$filter_query = $this->getFilter($filters,true,true);
4076 4076
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4077 4077
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4078
-                if ($olderthanmonths > 0) {
4079
-            		if ($globalDBdriver == 'mysql') {
4078
+				if ($olderthanmonths > 0) {
4079
+					if ($globalDBdriver == 'mysql') {
4080 4080
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4081 4081
 			} else {
4082 4082
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4083 4083
 			}
4084 4084
 		}
4085
-                if ($sincedate != '') {
4086
-            		if ($globalDBdriver == 'mysql') {
4085
+				if ($sincedate != '') {
4086
+					if ($globalDBdriver == 'mysql') {
4087 4087
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4088 4088
 			} else {
4089 4089
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4138,25 +4138,25 @@  discard block
 block discarded – undo
4138 4138
 	}
4139 4139
 	
4140 4140
 	/**
4141
-	* Gets all pilots that have flown over
4142
-	*
4143
-	* @return Array the pilots list
4144
-	*
4145
-	*/
4141
+	 * Gets all pilots that have flown over
4142
+	 *
4143
+	 * @return Array the pilots list
4144
+	 *
4145
+	 */
4146 4146
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4147 4147
 	{
4148 4148
 		global $globalDBdriver;
4149 4149
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4150 4150
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4151
-                if ($olderthanmonths > 0) {
4152
-            		if ($globalDBdriver == 'mysql') {
4151
+				if ($olderthanmonths > 0) {
4152
+					if ($globalDBdriver == 'mysql') {
4153 4153
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4154 4154
 			} else {
4155 4155
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4156 4156
 			}
4157 4157
 		}
4158
-                if ($sincedate != '') {
4159
-            		if ($globalDBdriver == 'mysql') {
4158
+				if ($sincedate != '') {
4159
+					if ($globalDBdriver == 'mysql') {
4160 4160
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4161 4161
 			} else {
4162 4162
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4185,26 +4185,26 @@  discard block
 block discarded – undo
4185 4185
 	}
4186 4186
 	
4187 4187
 	 /**
4188
-	* Gets all owner that have flown over
4189
-	*
4190
-	* @return Array the pilots list
4191
-	*
4192
-	*/
4188
+	  * Gets all owner that have flown over
4189
+	  *
4190
+	  * @return Array the pilots list
4191
+	  *
4192
+	  */
4193 4193
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4194 4194
 	{
4195 4195
 		global $globalDBdriver;
4196 4196
 		$filter_query = $this->getFilter($filters,true,true);
4197 4197
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4198 4198
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4199
-                if ($olderthanmonths > 0) {
4200
-            		if ($globalDBdriver == 'mysql') {
4199
+				if ($olderthanmonths > 0) {
4200
+					if ($globalDBdriver == 'mysql') {
4201 4201
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4202 4202
 			} else {
4203 4203
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4204 4204
 			}
4205 4205
 		}
4206
-                if ($sincedate != '') {
4207
-            		if ($globalDBdriver == 'mysql') {
4206
+				if ($sincedate != '') {
4207
+					if ($globalDBdriver == 'mysql') {
4208 4208
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4209 4209
 			} else {
4210 4210
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4255,26 +4255,26 @@  discard block
 block discarded – undo
4255 4255
 	}
4256 4256
 	
4257 4257
 	 /**
4258
-	* Gets all owner that have flown over
4259
-	*
4260
-	* @return Array the pilots list
4261
-	*
4262
-	*/
4258
+	  * Gets all owner that have flown over
4259
+	  *
4260
+	  * @return Array the pilots list
4261
+	  *
4262
+	  */
4263 4263
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4264 4264
 	{
4265 4265
 		global $globalDBdriver;
4266 4266
 		$filter_query = $this->getFilter($filters,true,true);
4267 4267
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4268 4268
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4269
-                if ($olderthanmonths > 0) {
4270
-            		if ($globalDBdriver == 'mysql') {
4269
+				if ($olderthanmonths > 0) {
4270
+					if ($globalDBdriver == 'mysql') {
4271 4271
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4272 4272
 			} else {
4273 4273
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4274 4274
 			}
4275 4275
 		}
4276
-                if ($sincedate != '') {
4277
-            		if ($globalDBdriver == 'mysql') {
4276
+				if ($sincedate != '') {
4277
+					if ($globalDBdriver == 'mysql') {
4278 4278
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4279 4279
 			} else {
4280 4280
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4301,11 +4301,11 @@  discard block
 block discarded – undo
4301 4301
 	}
4302 4302
 
4303 4303
 	/**
4304
-	* Gets all airlines that have flown over by aircraft
4305
-	*
4306
-	* @return Array the airline list
4307
-	*
4308
-	*/
4304
+	 * Gets all airlines that have flown over by aircraft
4305
+	 *
4306
+	 * @return Array the airline list
4307
+	 *
4308
+	 */
4309 4309
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4310 4310
 	{
4311 4311
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4337,11 +4337,11 @@  discard block
 block discarded – undo
4337 4337
 
4338 4338
 
4339 4339
 	/**
4340
-	* Gets all airline countries that have flown over by aircraft
4341
-	*
4342
-	* @return Array the airline country list
4343
-	*
4344
-	*/
4340
+	 * Gets all airline countries that have flown over by aircraft
4341
+	 *
4342
+	 * @return Array the airline country list
4343
+	 *
4344
+	 */
4345 4345
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4346 4346
 	{
4347 4347
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4373,11 +4373,11 @@  discard block
 block discarded – undo
4373 4373
 	
4374 4374
 	
4375 4375
 	/**
4376
-	* Gets all airlines that have flown over by airport
4377
-	*
4378
-	* @return Array the airline list
4379
-	*
4380
-	*/
4376
+	 * Gets all airlines that have flown over by airport
4377
+	 *
4378
+	 * @return Array the airline list
4379
+	 *
4380
+	 */
4381 4381
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4382 4382
 	{
4383 4383
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4408,11 +4408,11 @@  discard block
 block discarded – undo
4408 4408
 
4409 4409
 
4410 4410
 	/**
4411
-	* Gets all airline countries that have flown over by airport icao
4412
-	*
4413
-	* @return Array the airline country list
4414
-	*
4415
-	*/
4411
+	 * Gets all airline countries that have flown over by airport icao
4412
+	 *
4413
+	 * @return Array the airline country list
4414
+	 *
4415
+	 */
4416 4416
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4417 4417
 	{
4418 4418
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4442,11 +4442,11 @@  discard block
 block discarded – undo
4442 4442
 
4443 4443
 
4444 4444
 	/**
4445
-	* Gets all airlines that have flown over by aircraft manufacturer
4446
-	*
4447
-	* @return Array the airline list
4448
-	*
4449
-	*/
4445
+	 * Gets all airlines that have flown over by aircraft manufacturer
4446
+	 *
4447
+	 * @return Array the airline list
4448
+	 *
4449
+	 */
4450 4450
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4451 4451
 	{
4452 4452
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4477,11 +4477,11 @@  discard block
 block discarded – undo
4477 4477
 
4478 4478
 
4479 4479
 	/**
4480
-	* Gets all airline countries that have flown over by aircraft manufacturer
4481
-	*
4482
-	* @return Array the airline country list
4483
-	*
4484
-	*/
4480
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4481
+	 *
4482
+	 * @return Array the airline country list
4483
+	 *
4484
+	 */
4485 4485
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4486 4486
 	{
4487 4487
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4510,11 +4510,11 @@  discard block
 block discarded – undo
4510 4510
 
4511 4511
 
4512 4512
 	/**
4513
-	* Gets all airlines that have flown over by date
4514
-	*
4515
-	* @return Array the airline list
4516
-	*
4517
-	*/
4513
+	 * Gets all airlines that have flown over by date
4514
+	 *
4515
+	 * @return Array the airline list
4516
+	 *
4517
+	 */
4518 4518
 	public function countAllAirlinesByDate($date,$filters = array())
4519 4519
 	{
4520 4520
 		global $globalTimezone, $globalDBdriver;
@@ -4558,11 +4558,11 @@  discard block
 block discarded – undo
4558 4558
 	
4559 4559
 	
4560 4560
 	/**
4561
-	* Gets all airline countries that have flown over by date
4562
-	*
4563
-	* @return Array the airline country list
4564
-	*
4565
-	*/
4561
+	 * Gets all airline countries that have flown over by date
4562
+	 *
4563
+	 * @return Array the airline country list
4564
+	 *
4565
+	 */
4566 4566
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4567 4567
 	{
4568 4568
 		global $globalTimezone, $globalDBdriver;
@@ -4605,11 +4605,11 @@  discard block
 block discarded – undo
4605 4605
 
4606 4606
 
4607 4607
 	/**
4608
-	* Gets all airlines that have flown over by ident/callsign
4609
-	*
4610
-	* @return Array the airline list
4611
-	*
4612
-	*/
4608
+	 * Gets all airlines that have flown over by ident/callsign
4609
+	 *
4610
+	 * @return Array the airline list
4611
+	 *
4612
+	 */
4613 4613
 	public function countAllAirlinesByIdent($ident,$filters = array())
4614 4614
 	{
4615 4615
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4626,11 +4626,11 @@  discard block
 block discarded – undo
4626 4626
 	}
4627 4627
 
4628 4628
 	/**
4629
-	* Gets all airlines by owner
4630
-	*
4631
-	* @return Array the airline list
4632
-	*
4633
-	*/
4629
+	 * Gets all airlines by owner
4630
+	 *
4631
+	 * @return Array the airline list
4632
+	 *
4633
+	 */
4634 4634
 	public function countAllAirlinesByOwner($owner,$filters = array())
4635 4635
 	{
4636 4636
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4647,11 +4647,11 @@  discard block
 block discarded – undo
4647 4647
 	}
4648 4648
 
4649 4649
 	/**
4650
-	* Gets flight duration by owner
4651
-	*
4652
-	* @return String Duration of all flights
4653
-	*
4654
-	*/
4650
+	 * Gets flight duration by owner
4651
+	 *
4652
+	 * @return String Duration of all flights
4653
+	 *
4654
+	 */
4655 4655
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4656 4656
 	{
4657 4657
 		global $globalDBdriver;
@@ -4698,11 +4698,11 @@  discard block
 block discarded – undo
4698 4698
 	}
4699 4699
 
4700 4700
 	/**
4701
-	* Count flights by owner
4702
-	*
4703
-	* @return String Duration of all flights
4704
-	*
4705
-	*/
4701
+	 * Count flights by owner
4702
+	 *
4703
+	 * @return String Duration of all flights
4704
+	 *
4705
+	 */
4706 4706
 	public function countFlightsByOwner($owner,$filters = array())
4707 4707
 	{
4708 4708
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 	}
4719 4719
 
4720 4720
 	/**
4721
-	* Count flights by pilot
4722
-	*
4723
-	* @return String Duration of all flights
4724
-	*
4725
-	*/
4721
+	 * Count flights by pilot
4722
+	 *
4723
+	 * @return String Duration of all flights
4724
+	 *
4725
+	 */
4726 4726
 	public function countFlightsByPilot($pilot,$filters = array())
4727 4727
 	{
4728 4728
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4738,11 +4738,11 @@  discard block
 block discarded – undo
4738 4738
 	}
4739 4739
 
4740 4740
 	/**
4741
-	* Gets flight duration by pilot
4742
-	*
4743
-	* @return String Duration of all flights
4744
-	*
4745
-	*/
4741
+	 * Gets flight duration by pilot
4742
+	 *
4743
+	 * @return String Duration of all flights
4744
+	 *
4745
+	 */
4746 4746
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4747 4747
 	{
4748 4748
 		global $globalDBdriver;
@@ -4788,11 +4788,11 @@  discard block
 block discarded – undo
4788 4788
 	}
4789 4789
 
4790 4790
 	/**
4791
-	* Gets all airlines used by pilot
4792
-	*
4793
-	* @return Array the airline list
4794
-	*
4795
-	*/
4791
+	 * Gets all airlines used by pilot
4792
+	 *
4793
+	 * @return Array the airline list
4794
+	 *
4795
+	 */
4796 4796
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4797 4797
 	{
4798 4798
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4809,11 +4809,11 @@  discard block
 block discarded – undo
4809 4809
 	}
4810 4810
 
4811 4811
 	/**
4812
-	* Gets all airlines that have flown over by route
4813
-	*
4814
-	* @return Array the airline list
4815
-	*
4816
-	*/
4812
+	 * Gets all airlines that have flown over by route
4813
+	 *
4814
+	 * @return Array the airline list
4815
+	 *
4816
+	 */
4817 4817
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4818 4818
 	{
4819 4819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4845,11 +4845,11 @@  discard block
 block discarded – undo
4845 4845
 	}
4846 4846
 
4847 4847
 	/**
4848
-	* Gets all airline countries that have flown over by route
4849
-	*
4850
-	* @return Array the airline country list
4851
-	*
4852
-	*/
4848
+	 * Gets all airline countries that have flown over by route
4849
+	 *
4850
+	 * @return Array the airline country list
4851
+	 *
4852
+	 */
4853 4853
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4854 4854
 	{
4855 4855
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4881,11 +4881,11 @@  discard block
 block discarded – undo
4881 4881
 
4882 4882
 
4883 4883
 	/**
4884
-	* Gets all airlines that have flown over by country
4885
-	*
4886
-	* @return Array the airline list
4887
-	*
4888
-	*/
4884
+	 * Gets all airlines that have flown over by country
4885
+	 *
4886
+	 * @return Array the airline list
4887
+	 *
4888
+	 */
4889 4889
 	public function countAllAirlinesByCountry($country,$filters = array())
4890 4890
 	{
4891 4891
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4915,11 +4915,11 @@  discard block
 block discarded – undo
4915 4915
 
4916 4916
 
4917 4917
 	/**
4918
-	* Gets all airline countries that have flown over by country
4919
-	*
4920
-	* @return Array the airline country list
4921
-	*
4922
-	*/
4918
+	 * Gets all airline countries that have flown over by country
4919
+	 *
4920
+	 * @return Array the airline country list
4921
+	 *
4922
+	 */
4923 4923
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4924 4924
 	{
4925 4925
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4948,11 +4948,11 @@  discard block
 block discarded – undo
4948 4948
 
4949 4949
 
4950 4950
 	/**
4951
-	* Gets all airlines countries
4952
-	*
4953
-	* @return Array the airline country list
4954
-	*
4955
-	*/
4951
+	 * Gets all airlines countries
4952
+	 *
4953
+	 * @return Array the airline country list
4954
+	 *
4955
+	 */
4956 4956
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4957 4957
 	{
4958 4958
 		global $globalDBdriver;
@@ -5007,11 +5007,11 @@  discard block
 block discarded – undo
5007 5007
 	}
5008 5008
 
5009 5009
 	/**
5010
-	* Gets all number of flight over countries
5011
-	*
5012
-	* @return Array the airline country list
5013
-	*
5014
-	*/
5010
+	 * Gets all number of flight over countries
5011
+	 *
5012
+	 * @return Array the airline country list
5013
+	 *
5014
+	 */
5015 5015
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5016 5016
 	{
5017 5017
 		global $globalDBdriver;
@@ -5033,15 +5033,15 @@  discard block
 block discarded – undo
5033 5033
 		$SpotterLive = new SpotterLive();
5034 5034
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5035 5035
 		$filter_query .= ' over_country IS NOT NULL';
5036
-                if ($olderthanmonths > 0) {
5036
+				if ($olderthanmonths > 0) {
5037 5037
 			if ($globalDBdriver == 'mysql') {
5038 5038
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5039 5039
 			} else {
5040 5040
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5041 5041
 			}
5042 5042
 		}
5043
-                if ($sincedate != '') {
5044
-            		if ($globalDBdriver == 'mysql') {
5043
+				if ($sincedate != '') {
5044
+					if ($globalDBdriver == 'mysql') {
5045 5045
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5046 5046
 			} else {
5047 5047
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5071,11 +5071,11 @@  discard block
 block discarded – undo
5071 5071
 	
5072 5072
 	
5073 5073
 	/**
5074
-	* Gets all aircraft types that have flown over
5075
-	*
5076
-	* @return Array the aircraft list
5077
-	*
5078
-	*/
5074
+	 * Gets all aircraft types that have flown over
5075
+	 *
5076
+	 * @return Array the aircraft list
5077
+	 *
5078
+	 */
5079 5079
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5080 5080
 	{
5081 5081
 		global $globalDBdriver;
@@ -5145,11 +5145,11 @@  discard block
 block discarded – undo
5145 5145
 	}
5146 5146
 
5147 5147
 	/**
5148
-	* Gets all aircraft types that have flown over by airline
5149
-	*
5150
-	* @return Array the aircraft list
5151
-	*
5152
-	*/
5148
+	 * Gets all aircraft types that have flown over by airline
5149
+	 *
5150
+	 * @return Array the aircraft list
5151
+	 *
5152
+	 */
5153 5153
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5154 5154
 	{
5155 5155
 		global $globalDBdriver;
@@ -5220,11 +5220,11 @@  discard block
 block discarded – undo
5220 5220
 	}
5221 5221
 
5222 5222
 	/**
5223
-	* Gets all aircraft types that have flown over by months
5224
-	*
5225
-	* @return Array the aircraft list
5226
-	*
5227
-	*/
5223
+	 * Gets all aircraft types that have flown over by months
5224
+	 *
5225
+	 * @return Array the aircraft list
5226
+	 *
5227
+	 */
5228 5228
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5229 5229
 	{
5230 5230
 		global $globalDBdriver;
@@ -5268,11 +5268,11 @@  discard block
 block discarded – undo
5268 5268
 
5269 5269
 
5270 5270
 	/**
5271
-	* Gets all aircraft registration that have flown over by aircaft icao
5272
-	*
5273
-	* @return Array the aircraft list
5274
-	*
5275
-	*/
5271
+	 * Gets all aircraft registration that have flown over by aircaft icao
5272
+	 *
5273
+	 * @return Array the aircraft list
5274
+	 *
5275
+	 */
5276 5276
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5277 5277
 	{
5278 5278
 		$Image = new Image($this->db);
@@ -5311,11 +5311,11 @@  discard block
 block discarded – undo
5311 5311
 
5312 5312
 
5313 5313
 	/**
5314
-	* Gets all aircraft types that have flown over by airline icao
5315
-	*
5316
-	* @return Array the aircraft list
5317
-	*
5318
-	*/
5314
+	 * Gets all aircraft types that have flown over by airline icao
5315
+	 *
5316
+	 * @return Array the aircraft list
5317
+	 *
5318
+	 */
5319 5319
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5320 5320
 	{
5321 5321
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5344,11 +5344,11 @@  discard block
 block discarded – undo
5344 5344
 
5345 5345
 
5346 5346
 	/**
5347
-	* Gets all aircraft registration that have flown over by airline icao
5348
-	*
5349
-	* @return Array the aircraft list
5350
-	*
5351
-	*/
5347
+	 * Gets all aircraft registration that have flown over by airline icao
5348
+	 *
5349
+	 * @return Array the aircraft list
5350
+	 *
5351
+	 */
5352 5352
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5353 5353
 	{
5354 5354
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5386,11 +5386,11 @@  discard block
 block discarded – undo
5386 5386
 
5387 5387
 
5388 5388
 	/**
5389
-	* Gets all aircraft manufacturer that have flown over by airline icao
5390
-	*
5391
-	* @return Array the aircraft list
5392
-	*
5393
-	*/
5389
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5390
+	 *
5391
+	 * @return Array the aircraft list
5392
+	 *
5393
+	 */
5394 5394
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5395 5395
 	{
5396 5396
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5418,11 +5418,11 @@  discard block
 block discarded – undo
5418 5418
 
5419 5419
 
5420 5420
 	/**
5421
-	* Gets all aircraft types that have flown over by airline icao
5422
-	*
5423
-	* @return Array the aircraft list
5424
-	*
5425
-	*/
5421
+	 * Gets all aircraft types that have flown over by airline icao
5422
+	 *
5423
+	 * @return Array the aircraft list
5424
+	 *
5425
+	 */
5426 5426
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5427 5427
 	{
5428 5428
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5451,11 +5451,11 @@  discard block
 block discarded – undo
5451 5451
 
5452 5452
 
5453 5453
 	/**
5454
-	* Gets all aircraft registration that have flown over by airport icao
5455
-	*
5456
-	* @return Array the aircraft list
5457
-	*
5458
-	*/
5454
+	 * Gets all aircraft registration that have flown over by airport icao
5455
+	 *
5456
+	 * @return Array the aircraft list
5457
+	 *
5458
+	 */
5459 5459
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5460 5460
 	{
5461 5461
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5492,11 +5492,11 @@  discard block
 block discarded – undo
5492 5492
 	
5493 5493
 	
5494 5494
 	/**
5495
-	* Gets all aircraft manufacturer that have flown over by airport icao
5496
-	*
5497
-	* @return Array the aircraft list
5498
-	*
5499
-	*/
5495
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5496
+	 *
5497
+	 * @return Array the aircraft list
5498
+	 *
5499
+	 */
5500 5500
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5501 5501
 	{
5502 5502
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5522,11 +5522,11 @@  discard block
 block discarded – undo
5522 5522
 	}
5523 5523
 
5524 5524
 	/**
5525
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5526
-	*
5527
-	* @return Array the aircraft list
5528
-	*
5529
-	*/
5525
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5526
+	 *
5527
+	 * @return Array the aircraft list
5528
+	 *
5529
+	 */
5530 5530
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5531 5531
 	{
5532 5532
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5553,11 +5553,11 @@  discard block
 block discarded – undo
5553 5553
 
5554 5554
 
5555 5555
 	/**
5556
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5557
-	*
5558
-	* @return Array the aircraft list
5559
-	*
5560
-	*/
5556
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5557
+	 *
5558
+	 * @return Array the aircraft list
5559
+	 *
5560
+	 */
5561 5561
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5562 5562
 	{
5563 5563
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5593,11 +5593,11 @@  discard block
 block discarded – undo
5593 5593
 	}
5594 5594
 
5595 5595
 	/**
5596
-	* Gets all aircraft types that have flown over by date
5597
-	*
5598
-	* @return Array the aircraft list
5599
-	*
5600
-	*/
5596
+	 * Gets all aircraft types that have flown over by date
5597
+	 *
5598
+	 * @return Array the aircraft list
5599
+	 *
5600
+	 */
5601 5601
 	public function countAllAircraftTypesByDate($date,$filters = array())
5602 5602
 	{
5603 5603
 		global $globalTimezone, $globalDBdriver;
@@ -5639,11 +5639,11 @@  discard block
 block discarded – undo
5639 5639
 
5640 5640
 
5641 5641
 	/**
5642
-	* Gets all aircraft registration that have flown over by date
5643
-	*
5644
-	* @return Array the aircraft list
5645
-	*
5646
-	*/
5642
+	 * Gets all aircraft registration that have flown over by date
5643
+	 *
5644
+	 * @return Array the aircraft list
5645
+	 *
5646
+	 */
5647 5647
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5648 5648
 	{
5649 5649
 		global $globalTimezone, $globalDBdriver;
@@ -5694,11 +5694,11 @@  discard block
 block discarded – undo
5694 5694
 
5695 5695
 
5696 5696
 	/**
5697
-	* Gets all aircraft manufacturer that have flown over by date
5698
-	*
5699
-	* @return Array the aircraft manufacturer list
5700
-	*
5701
-	*/
5697
+	 * Gets all aircraft manufacturer that have flown over by date
5698
+	 *
5699
+	 * @return Array the aircraft manufacturer list
5700
+	 *
5701
+	 */
5702 5702
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5703 5703
 	{
5704 5704
 		global $globalTimezone, $globalDBdriver;
@@ -5740,11 +5740,11 @@  discard block
 block discarded – undo
5740 5740
 
5741 5741
 
5742 5742
 	/**
5743
-	* Gets all aircraft types that have flown over by ident/callsign
5744
-	*
5745
-	* @return Array the aircraft list
5746
-	*
5747
-	*/
5743
+	 * Gets all aircraft types that have flown over by ident/callsign
5744
+	 *
5745
+	 * @return Array the aircraft list
5746
+	 *
5747
+	 */
5748 5748
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5749 5749
 	{
5750 5750
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5772,11 +5772,11 @@  discard block
 block discarded – undo
5772 5772
 	}
5773 5773
 
5774 5774
 	/**
5775
-	* Gets all aircraft types that have flown over by pilot
5776
-	*
5777
-	* @return Array the aircraft list
5778
-	*
5779
-	*/
5775
+	 * Gets all aircraft types that have flown over by pilot
5776
+	 *
5777
+	 * @return Array the aircraft list
5778
+	 *
5779
+	 */
5780 5780
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5781 5781
 	{
5782 5782
 		global $globalDBdriver;
@@ -5822,11 +5822,11 @@  discard block
 block discarded – undo
5822 5822
 	}
5823 5823
 
5824 5824
 	/**
5825
-	* Gets all aircraft types that have flown over by owner
5826
-	*
5827
-	* @return Array the aircraft list
5828
-	*
5829
-	*/
5825
+	 * Gets all aircraft types that have flown over by owner
5826
+	 *
5827
+	 * @return Array the aircraft list
5828
+	 *
5829
+	 */
5830 5830
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5831 5831
 	{
5832 5832
 		global $globalDBdriver;
@@ -5871,11 +5871,11 @@  discard block
 block discarded – undo
5871 5871
 	}
5872 5872
 
5873 5873
 	/**
5874
-	* Gets all aircraft registration that have flown over by ident/callsign
5875
-	*
5876
-	* @return Array the aircraft list
5877
-	*
5878
-	*/
5874
+	 * Gets all aircraft registration that have flown over by ident/callsign
5875
+	 *
5876
+	 * @return Array the aircraft list
5877
+	 *
5878
+	 */
5879 5879
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5880 5880
 	{
5881 5881
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5914,11 +5914,11 @@  discard block
 block discarded – undo
5914 5914
 	}
5915 5915
 
5916 5916
 	/**
5917
-	* Gets all aircraft registration that have flown over by owner
5918
-	*
5919
-	* @return Array the aircraft list
5920
-	*
5921
-	*/
5917
+	 * Gets all aircraft registration that have flown over by owner
5918
+	 *
5919
+	 * @return Array the aircraft list
5920
+	 *
5921
+	 */
5922 5922
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5923 5923
 	{
5924 5924
 		global $globalDBdriver;
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	}
5990 5990
 
5991 5991
 	/**
5992
-	* Gets all aircraft registration that have flown over by pilot
5993
-	*
5994
-	* @return Array the aircraft list
5995
-	*
5996
-	*/
5992
+	 * Gets all aircraft registration that have flown over by pilot
5993
+	 *
5994
+	 * @return Array the aircraft list
5995
+	 *
5996
+	 */
5997 5997
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5998 5998
 	{
5999 5999
 		global $globalDBdriver;
@@ -6065,11 +6065,11 @@  discard block
 block discarded – undo
6065 6065
 
6066 6066
 
6067 6067
 	/**
6068
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6069
-	*
6070
-	* @return Array the aircraft manufacturer list
6071
-	*
6072
-	*/
6068
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6069
+	 *
6070
+	 * @return Array the aircraft manufacturer list
6071
+	 *
6072
+	 */
6073 6073
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6074 6074
 	{
6075 6075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6094,11 +6094,11 @@  discard block
 block discarded – undo
6094 6094
 	}
6095 6095
 
6096 6096
 	/**
6097
-	* Gets all aircraft manufacturer that have flown over by owner
6098
-	*
6099
-	* @return Array the aircraft manufacturer list
6100
-	*
6101
-	*/
6097
+	 * Gets all aircraft manufacturer that have flown over by owner
6098
+	 *
6099
+	 * @return Array the aircraft manufacturer list
6100
+	 *
6101
+	 */
6102 6102
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6103 6103
 	{
6104 6104
 		global $globalDBdriver;
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	}
6147 6147
 
6148 6148
 	/**
6149
-	* Gets all aircraft manufacturer that have flown over by pilot
6150
-	*
6151
-	* @return Array the aircraft manufacturer list
6152
-	*
6153
-	*/
6149
+	 * Gets all aircraft manufacturer that have flown over by pilot
6150
+	 *
6151
+	 * @return Array the aircraft manufacturer list
6152
+	 *
6153
+	 */
6154 6154
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6155 6155
 	{
6156 6156
 		global $globalDBdriver;
@@ -6199,11 +6199,11 @@  discard block
 block discarded – undo
6199 6199
 
6200 6200
 
6201 6201
 	/**
6202
-	* Gets all aircraft types that have flown over by route
6203
-	*
6204
-	* @return Array the aircraft list
6205
-	*
6206
-	*/
6202
+	 * Gets all aircraft types that have flown over by route
6203
+	 *
6204
+	 * @return Array the aircraft list
6205
+	 *
6206
+	 */
6207 6207
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6208 6208
 	{
6209 6209
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6232,11 +6232,11 @@  discard block
 block discarded – undo
6232 6232
 	}
6233 6233
 
6234 6234
 	/**
6235
-	* Gets all aircraft registration that have flown over by route
6236
-	*
6237
-	* @return Array the aircraft list
6238
-	*
6239
-	*/
6235
+	 * Gets all aircraft registration that have flown over by route
6236
+	 *
6237
+	 * @return Array the aircraft list
6238
+	 *
6239
+	 */
6240 6240
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6241 6241
 	{
6242 6242
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6278,11 +6278,11 @@  discard block
 block discarded – undo
6278 6278
 	
6279 6279
 	
6280 6280
 	/**
6281
-	* Gets all aircraft manufacturer that have flown over by route
6282
-	*
6283
-	* @return Array the aircraft manufacturer list
6284
-	*
6285
-	*/
6281
+	 * Gets all aircraft manufacturer that have flown over by route
6282
+	 *
6283
+	 * @return Array the aircraft manufacturer list
6284
+	 *
6285
+	 */
6286 6286
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6287 6287
 	{
6288 6288
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6316,11 +6316,11 @@  discard block
 block discarded – undo
6316 6316
 	
6317 6317
 	
6318 6318
 	/**
6319
-	* Gets all aircraft types that have flown over by country
6320
-	*
6321
-	* @return Array the aircraft list
6322
-	*
6323
-	*/
6319
+	 * Gets all aircraft types that have flown over by country
6320
+	 *
6321
+	 * @return Array the aircraft list
6322
+	 *
6323
+	 */
6324 6324
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6325 6325
 	{
6326 6326
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6351,11 +6351,11 @@  discard block
 block discarded – undo
6351 6351
 
6352 6352
 
6353 6353
 	/**
6354
-	* Gets all aircraft registration that have flown over by country
6355
-	*
6356
-	* @return Array the aircraft list
6357
-	*
6358
-	*/
6354
+	 * Gets all aircraft registration that have flown over by country
6355
+	 *
6356
+	 * @return Array the aircraft list
6357
+	 *
6358
+	 */
6359 6359
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6360 6360
 	{
6361 6361
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6395,11 +6395,11 @@  discard block
 block discarded – undo
6395 6395
 	
6396 6396
 	
6397 6397
 	/**
6398
-	* Gets all aircraft manufacturer that have flown over by country
6399
-	*
6400
-	* @return Array the aircraft manufacturer list
6401
-	*
6402
-	*/
6398
+	 * Gets all aircraft manufacturer that have flown over by country
6399
+	 *
6400
+	 * @return Array the aircraft manufacturer list
6401
+	 *
6402
+	 */
6403 6403
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6404 6404
 	{
6405 6405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6430,18 +6430,18 @@  discard block
 block discarded – undo
6430 6430
 	
6431 6431
 	
6432 6432
 	/**
6433
-	* Gets all aircraft manufacturers that have flown over
6434
-	*
6435
-	* @return Array the aircraft list
6436
-	*
6437
-	*/
6433
+	 * Gets all aircraft manufacturers that have flown over
6434
+	 *
6435
+	 * @return Array the aircraft list
6436
+	 *
6437
+	 */
6438 6438
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6439 6439
 	{
6440 6440
 		global $globalDBdriver;
6441 6441
 		$filter_query = $this->getFilter($filters,true,true);
6442 6442
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6443 6443
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6444
-                $query_values = array();
6444
+				$query_values = array();
6445 6445
 		if ($year != '') {
6446 6446
 			if ($globalDBdriver == 'mysql') {
6447 6447
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6494,11 +6494,11 @@  discard block
 block discarded – undo
6494 6494
 	
6495 6495
 	
6496 6496
 	/**
6497
-	* Gets all aircraft registrations that have flown over
6498
-	*
6499
-	* @return Array the aircraft list
6500
-	*
6501
-	*/
6497
+	 * Gets all aircraft registrations that have flown over
6498
+	 *
6499
+	 * @return Array the aircraft list
6500
+	 *
6501
+	 */
6502 6502
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6503 6503
 	{
6504 6504
 		global $globalDBdriver;
@@ -6506,15 +6506,15 @@  discard block
 block discarded – undo
6506 6506
 		$filter_query = $this->getFilter($filters,true,true);
6507 6507
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6508 6508
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6509
-                if ($olderthanmonths > 0) {
6510
-            		if ($globalDBdriver == 'mysql') {
6509
+				if ($olderthanmonths > 0) {
6510
+					if ($globalDBdriver == 'mysql') {
6511 6511
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6512 6512
 			} else {
6513 6513
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6514 6514
 			}
6515 6515
 		}
6516
-                if ($sincedate != '') {
6517
-            		if ($globalDBdriver == 'mysql') {
6516
+				if ($sincedate != '') {
6517
+					if ($globalDBdriver == 'mysql') {
6518 6518
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6519 6519
 			} else {
6520 6520
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6579,11 +6579,11 @@  discard block
 block discarded – undo
6579 6579
 
6580 6580
 
6581 6581
 	/**
6582
-	* Gets all aircraft registrations that have flown over
6583
-	*
6584
-	* @return Array the aircraft list
6585
-	*
6586
-	*/
6582
+	 * Gets all aircraft registrations that have flown over
6583
+	 *
6584
+	 * @return Array the aircraft list
6585
+	 *
6586
+	 */
6587 6587
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6588 6588
 	{
6589 6589
 		global $globalDBdriver;
@@ -6591,15 +6591,15 @@  discard block
 block discarded – undo
6591 6591
 		$Image = new Image($this->db);
6592 6592
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6593 6593
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6594
-                if ($olderthanmonths > 0) {
6595
-            		if ($globalDBdriver == 'mysql') {
6594
+				if ($olderthanmonths > 0) {
6595
+					if ($globalDBdriver == 'mysql') {
6596 6596
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6597 6597
 			} else {
6598 6598
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6599 6599
 			}
6600 6600
 		}
6601
-                if ($sincedate != '') {
6602
-            		if ($globalDBdriver == 'mysql') {
6601
+				if ($sincedate != '') {
6602
+					if ($globalDBdriver == 'mysql') {
6603 6603
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6604 6604
 			} else {
6605 6605
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6608,7 +6608,7 @@  discard block
 block discarded – undo
6608 6608
 
6609 6609
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6610 6610
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6611
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6611
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6612 6612
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6613 6613
 		
6614 6614
 		$sth = $this->db->prepare($query);
@@ -6640,26 +6640,26 @@  discard block
 block discarded – undo
6640 6640
 	
6641 6641
 	
6642 6642
 	/**
6643
-	* Gets all departure airports of the airplanes that have flown over
6644
-	*
6645
-	* @return Array the airport list
6646
-	*
6647
-	*/
6643
+	 * Gets all departure airports of the airplanes that have flown over
6644
+	 *
6645
+	 * @return Array the airport list
6646
+	 *
6647
+	 */
6648 6648
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6649 6649
 	{
6650 6650
 		global $globalDBdriver;
6651 6651
 		$filter_query = $this->getFilter($filters,true,true);
6652 6652
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6653 6653
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6654
-                if ($olderthanmonths > 0) {
6655
-            		if ($globalDBdriver == 'mysql') {
6654
+				if ($olderthanmonths > 0) {
6655
+					if ($globalDBdriver == 'mysql') {
6656 6656
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6657 6657
 			} else {
6658 6658
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6659 6659
 			}
6660
-                }
6661
-                if ($sincedate != '') {
6662
-            		if ($globalDBdriver == 'mysql') {
6660
+				}
6661
+				if ($sincedate != '') {
6662
+					if ($globalDBdriver == 'mysql') {
6663 6663
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6664 6664
 			} else {
6665 6665
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6693,7 +6693,7 @@  discard block
 block discarded – undo
6693 6693
 				$query_values = array_merge($query_values,array(':day' => $day));
6694 6694
 			}
6695 6695
 		}
6696
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6696
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6697 6697
 				ORDER BY airport_departure_icao_count DESC";
6698 6698
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6699 6699
 
@@ -6716,35 +6716,35 @@  discard block
 block discarded – undo
6716 6716
 	}
6717 6717
 
6718 6718
 	/**
6719
-	* Gets all departure airports of the airplanes that have flown over
6720
-	*
6721
-	* @return Array the airport list
6722
-	*
6723
-	*/
6719
+	 * Gets all departure airports of the airplanes that have flown over
6720
+	 *
6721
+	 * @return Array the airport list
6722
+	 *
6723
+	 */
6724 6724
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6725 6725
 	{
6726 6726
 		global $globalDBdriver;
6727 6727
 		$filter_query = $this->getFilter($filters,true,true);
6728 6728
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6729 6729
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6730
-                if ($olderthanmonths > 0) {
6731
-            		if ($globalDBdriver == 'mysql') {
6730
+				if ($olderthanmonths > 0) {
6731
+					if ($globalDBdriver == 'mysql') {
6732 6732
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6733 6733
 			} else {
6734 6734
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6735 6735
 			}
6736
-                }
6737
-                if ($sincedate != '') {
6738
-            		if ($globalDBdriver == 'mysql') {
6736
+				}
6737
+				if ($sincedate != '') {
6738
+					if ($globalDBdriver == 'mysql') {
6739 6739
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6740 6740
 			} else {
6741 6741
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6742 6742
 			}
6743 6743
 		}
6744 6744
 
6745
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6746
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6745
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6746
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6748 6748
 				ORDER BY airport_departure_icao_count DESC";
6749 6749
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6750 6750
       
@@ -6769,26 +6769,26 @@  discard block
 block discarded – undo
6769 6769
 	}
6770 6770
 
6771 6771
 	/**
6772
-	* Gets all detected departure airports of the airplanes that have flown over
6773
-	*
6774
-	* @return Array the airport list
6775
-	*
6776
-	*/
6772
+	 * Gets all detected departure airports of the airplanes that have flown over
6773
+	 *
6774
+	 * @return Array the airport list
6775
+	 *
6776
+	 */
6777 6777
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6778 6778
 	{
6779 6779
 		global $globalDBdriver;
6780 6780
 		$filter_query = $this->getFilter($filters,true,true);
6781 6781
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6782 6782
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
6783
-                if ($olderthanmonths > 0) {
6784
-            		if ($globalDBdriver == 'mysql') {
6783
+				if ($olderthanmonths > 0) {
6784
+					if ($globalDBdriver == 'mysql') {
6785 6785
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6786 6786
 			} else {
6787 6787
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6788 6788
 			}
6789
-                }
6790
-                if ($sincedate != '') {
6791
-            		if ($globalDBdriver == 'mysql') {
6789
+				}
6790
+				if ($sincedate != '') {
6791
+					if ($globalDBdriver == 'mysql') {
6792 6792
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6793 6793
 			} else {
6794 6794
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6822,10 +6822,10 @@  discard block
 block discarded – undo
6822 6822
 				$query_values = array_merge($query_values,array(':day' => $day));
6823 6823
 			}
6824 6824
 		}
6825
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6825
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6826 6826
 				ORDER BY airport_departure_icao_count DESC";
6827 6827
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6828
-    		//echo $query;
6828
+			//echo $query;
6829 6829
 		$sth = $this->db->prepare($query);
6830 6830
 		$sth->execute($query_values);
6831 6831
       
@@ -6846,35 +6846,35 @@  discard block
 block discarded – undo
6846 6846
 	}
6847 6847
 	
6848 6848
 	/**
6849
-	* Gets all detected departure airports of the airplanes that have flown over
6850
-	*
6851
-	* @return Array the airport list
6852
-	*
6853
-	*/
6849
+	 * Gets all detected departure airports of the airplanes that have flown over
6850
+	 *
6851
+	 * @return Array the airport list
6852
+	 *
6853
+	 */
6854 6854
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6855 6855
 	{
6856 6856
 		global $globalDBdriver;
6857 6857
 		$filter_query = $this->getFilter($filters,true,true);
6858 6858
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6859 6859
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
6860
-                if ($olderthanmonths > 0) {
6861
-            		if ($globalDBdriver == 'mysql') {
6860
+				if ($olderthanmonths > 0) {
6861
+					if ($globalDBdriver == 'mysql') {
6862 6862
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6863 6863
 			} else {
6864 6864
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6865 6865
 			}
6866
-                }
6867
-                if ($sincedate != '') {
6868
-            		if ($globalDBdriver == 'mysql') {
6866
+				}
6867
+				if ($sincedate != '') {
6868
+					if ($globalDBdriver == 'mysql') {
6869 6869
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6870 6870
 			} else {
6871 6871
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6872 6872
 			}
6873 6873
 		}
6874 6874
 
6875
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6876
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6875
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6876
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6878 6878
 				ORDER BY airport_departure_icao_count DESC";
6879 6879
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6880 6880
       
@@ -6899,11 +6899,11 @@  discard block
 block discarded – undo
6899 6899
 	}	
6900 6900
 	
6901 6901
 	/**
6902
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6903
-	*
6904
-	* @return Array the airport list
6905
-	*
6906
-	*/
6902
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6903
+	 *
6904
+	 * @return Array the airport list
6905
+	 *
6906
+	 */
6907 6907
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6908 6908
 	{
6909 6909
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6937,11 +6937,11 @@  discard block
 block discarded – undo
6937 6937
 	
6938 6938
 	
6939 6939
 	/**
6940
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6941
-	*
6942
-	* @return Array the airport list
6943
-	*
6944
-	*/
6940
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6941
+	 *
6942
+	 * @return Array the airport list
6943
+	 *
6944
+	 */
6945 6945
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6946 6946
 	{
6947 6947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	
6973 6973
 	
6974 6974
 	/**
6975
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6976
-	*
6977
-	* @return Array the airport list
6978
-	*
6979
-	*/
6975
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6976
+	 *
6977
+	 * @return Array the airport list
6978
+	 *
6979
+	 */
6980 6980
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6981 6981
 	{
6982 6982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7009,11 +7009,11 @@  discard block
 block discarded – undo
7009 7009
 	
7010 7010
 	
7011 7011
 	/**
7012
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7013
-	*
7014
-	* @return Array the airport list
7015
-	*
7016
-	*/
7012
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7013
+	 *
7014
+	 * @return Array the airport list
7015
+	 *
7016
+	 */
7017 7017
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7018 7018
 	{
7019 7019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7043,11 +7043,11 @@  discard block
 block discarded – undo
7043 7043
 	
7044 7044
 	
7045 7045
 	/**
7046
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7047
-	*
7048
-	* @return Array the airport list
7049
-	*
7050
-	*/
7046
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7047
+	 *
7048
+	 * @return Array the airport list
7049
+	 *
7050
+	 */
7051 7051
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7052 7052
 	{
7053 7053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7080,11 +7080,11 @@  discard block
 block discarded – undo
7080 7080
 	
7081 7081
 	
7082 7082
 	/**
7083
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7084
-	*
7085
-	* @return Array the airport list
7086
-	*
7087
-	*/
7083
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7084
+	 *
7085
+	 * @return Array the airport list
7086
+	 *
7087
+	 */
7088 7088
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7089 7089
 	{
7090 7090
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7114,11 +7114,11 @@  discard block
 block discarded – undo
7114 7114
 	
7115 7115
 	
7116 7116
 	/**
7117
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7118
-	*
7119
-	* @return Array the airport list
7120
-	*
7121
-	*/
7117
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7118
+	 *
7119
+	 * @return Array the airport list
7120
+	 *
7121
+	 */
7122 7122
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7123 7123
 	{
7124 7124
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7151,11 +7151,11 @@  discard block
 block discarded – undo
7151 7151
 	
7152 7152
 	
7153 7153
 	/**
7154
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7155
-	*
7156
-	* @return Array the airport list
7157
-	*
7158
-	*/
7154
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7155
+	 *
7156
+	 * @return Array the airport list
7157
+	 *
7158
+	 */
7159 7159
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7160 7160
 	{
7161 7161
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7186,11 +7186,11 @@  discard block
 block discarded – undo
7186 7186
 	
7187 7187
 	
7188 7188
 	/**
7189
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7190
-	*
7191
-	* @return Array the airport list
7192
-	*
7193
-	*/
7189
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7190
+	 *
7191
+	 * @return Array the airport list
7192
+	 *
7193
+	 */
7194 7194
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7195 7195
 	{
7196 7196
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7223,11 +7223,11 @@  discard block
 block discarded – undo
7223 7223
 	
7224 7224
 	
7225 7225
 	/**
7226
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7227
-	*
7228
-	* @return Array the airport list
7229
-	*
7230
-	*/
7226
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7227
+	 *
7228
+	 * @return Array the airport list
7229
+	 *
7230
+	 */
7231 7231
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7232 7232
 	{
7233 7233
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7257,11 +7257,11 @@  discard block
 block discarded – undo
7257 7257
 	
7258 7258
 	
7259 7259
 	/**
7260
-	* Gets all departure airports of the airplanes that have flown over based on a date
7261
-	*
7262
-	* @return Array the airport list
7263
-	*
7264
-	*/
7260
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7261
+	 *
7262
+	 * @return Array the airport list
7263
+	 *
7264
+	 */
7265 7265
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7266 7266
 	{
7267 7267
 		global $globalTimezone, $globalDBdriver;
@@ -7307,11 +7307,11 @@  discard block
 block discarded – undo
7307 7307
 	
7308 7308
 	
7309 7309
 	/**
7310
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7311
-	*
7312
-	* @return Array the airport list
7313
-	*
7314
-	*/
7310
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7311
+	 *
7312
+	 * @return Array the airport list
7313
+	 *
7314
+	 */
7315 7315
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7316 7316
 	{
7317 7317
 		global $globalTimezone, $globalDBdriver;
@@ -7354,11 +7354,11 @@  discard block
 block discarded – undo
7354 7354
 	
7355 7355
 	
7356 7356
 	/**
7357
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7358
-	*
7359
-	* @return Array the airport list
7360
-	*
7361
-	*/
7357
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7358
+	 *
7359
+	 * @return Array the airport list
7360
+	 *
7361
+	 */
7362 7362
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7363 7363
 	{
7364 7364
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	}
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7394
-	*
7395
-	* @return Array the airport list
7396
-	*
7397
-	*/
7393
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7394
+	 *
7395
+	 * @return Array the airport list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7426,11 +7426,11 @@  discard block
 block discarded – undo
7426 7426
 	}
7427 7427
 	
7428 7428
 	/**
7429
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7430
-	*
7431
-	* @return Array the airport list
7432
-	*
7433
-	*/
7429
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7430
+	 *
7431
+	 * @return Array the airport list
7432
+	 *
7433
+	 */
7434 7434
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7435 7435
 	{
7436 7436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7463,11 +7463,11 @@  discard block
 block discarded – undo
7463 7463
 	
7464 7464
 	
7465 7465
 	/**
7466
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7467
-	*
7468
-	* @return Array the airport list
7469
-	*
7470
-	*/
7466
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7467
+	 *
7468
+	 * @return Array the airport list
7469
+	 *
7470
+	 */
7471 7471
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7472 7472
 	{
7473 7473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7496,11 +7496,11 @@  discard block
 block discarded – undo
7496 7496
 	}
7497 7497
 	
7498 7498
 	/**
7499
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7500
-	*
7501
-	* @return Array the airport list
7502
-	*
7503
-	*/
7499
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7500
+	 *
7501
+	 * @return Array the airport list
7502
+	 *
7503
+	 */
7504 7504
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7505 7505
 	{
7506 7506
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7516,11 +7516,11 @@  discard block
 block discarded – undo
7516 7516
 	}
7517 7517
 	
7518 7518
 	/**
7519
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7520
-	*
7521
-	* @return Array the airport list
7522
-	*
7523
-	*/
7519
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7520
+	 *
7521
+	 * @return Array the airport list
7522
+	 *
7523
+	 */
7524 7524
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7525 7525
 	{
7526 7526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7538,11 +7538,11 @@  discard block
 block discarded – undo
7538 7538
 	
7539 7539
 	
7540 7540
 	/**
7541
-	* Gets all departure airports of the airplanes that have flown over based on a country
7542
-	*
7543
-	* @return Array the airport list
7544
-	*
7545
-	*/
7541
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7542
+	 *
7543
+	 * @return Array the airport list
7544
+	 *
7545
+	 */
7546 7546
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7547 7547
 	{
7548 7548
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7576,11 +7576,11 @@  discard block
 block discarded – undo
7576 7576
 
7577 7577
 
7578 7578
 	/**
7579
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7580
-	*
7581
-	* @return Array the airport list
7582
-	*
7583
-	*/
7579
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7580
+	 *
7581
+	 * @return Array the airport list
7582
+	 *
7583
+	 */
7584 7584
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7585 7585
 	{
7586 7586
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7610,31 +7610,31 @@  discard block
 block discarded – undo
7610 7610
 	
7611 7611
 
7612 7612
 	/**
7613
-	* Gets all arrival airports of the airplanes that have flown over
7614
-	*
7615
-	* @param Boolean $limit Limit result to 10 or not
7616
-	* @param Integer $olderthanmonths Only show result older than x months
7617
-	* @param String $sincedate Only show result since x date
7618
-	* @param Boolean $icaoaskey Show result by ICAO
7619
-	* @param Array $filters Filter used here
7620
-	* @return Array the airport list
7621
-	*
7622
-	*/
7613
+	 * Gets all arrival airports of the airplanes that have flown over
7614
+	 *
7615
+	 * @param Boolean $limit Limit result to 10 or not
7616
+	 * @param Integer $olderthanmonths Only show result older than x months
7617
+	 * @param String $sincedate Only show result since x date
7618
+	 * @param Boolean $icaoaskey Show result by ICAO
7619
+	 * @param Array $filters Filter used here
7620
+	 * @return Array the airport list
7621
+	 *
7622
+	 */
7623 7623
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7624 7624
 	{
7625 7625
 		global $globalDBdriver;
7626 7626
 		$filter_query = $this->getFilter($filters,true,true);
7627 7627
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7628 7628
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7629
-                if ($olderthanmonths > 0) {
7630
-            		if ($globalDBdriver == 'mysql') {
7629
+				if ($olderthanmonths > 0) {
7630
+					if ($globalDBdriver == 'mysql') {
7631 7631
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7632 7632
 			} else {
7633 7633
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7634 7634
 			}
7635 7635
 		}
7636
-                if ($sincedate != '') {
7637
-            		if ($globalDBdriver == 'mysql') {
7636
+				if ($sincedate != '') {
7637
+					if ($globalDBdriver == 'mysql') {
7638 7638
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7639 7639
 			} else {
7640 7640
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7668,7 +7668,7 @@  discard block
 block discarded – undo
7668 7668
 				$query_values = array_merge($query_values,array(':day' => $day));
7669 7669
 			}
7670 7670
 		}
7671
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7671
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7672 7672
 					ORDER BY airport_arrival_icao_count DESC";
7673 7673
 		if ($limit) $query .= " LIMIT 10";
7674 7674
       
@@ -7697,35 +7697,35 @@  discard block
 block discarded – undo
7697 7697
 	}
7698 7698
 
7699 7699
 	/**
7700
-	* Gets all arrival airports of the airplanes that have flown over
7701
-	*
7702
-	* @return Array the airport list
7703
-	*
7704
-	*/
7700
+	 * Gets all arrival airports of the airplanes that have flown over
7701
+	 *
7702
+	 * @return Array the airport list
7703
+	 *
7704
+	 */
7705 7705
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7706 7706
 	{
7707 7707
 		global $globalDBdriver;
7708 7708
 		$filter_query = $this->getFilter($filters,true,true);
7709 7709
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7710 7710
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7711
-                if ($olderthanmonths > 0) {
7712
-            		if ($globalDBdriver == 'mysql') {
7711
+				if ($olderthanmonths > 0) {
7712
+					if ($globalDBdriver == 'mysql') {
7713 7713
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7714 7714
 			} else {
7715 7715
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7716 7716
 			}
7717 7717
 		}
7718
-                if ($sincedate != '') {
7719
-            		if ($globalDBdriver == 'mysql') {
7718
+				if ($sincedate != '') {
7719
+					if ($globalDBdriver == 'mysql') {
7720 7720
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7721 7721
 			} else {
7722 7722
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7723 7723
 			}
7724 7724
 		}
7725 7725
 
7726
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7727
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7726
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7727
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7729 7729
 					ORDER BY airport_arrival_icao_count DESC";
7730 7730
 		if ($limit) $query .= " LIMIT 10";
7731 7731
       
@@ -7756,26 +7756,26 @@  discard block
 block discarded – undo
7756 7756
 
7757 7757
 
7758 7758
 	/**
7759
-	* Gets all detected arrival airports of the airplanes that have flown over
7760
-	*
7761
-	* @return Array the airport list
7762
-	*
7763
-	*/
7759
+	 * Gets all detected arrival airports of the airplanes that have flown over
7760
+	 *
7761
+	 * @return Array the airport list
7762
+	 *
7763
+	 */
7764 7764
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7765 7765
 	{
7766 7766
 		global $globalDBdriver;
7767 7767
 		$filter_query = $this->getFilter($filters,true,true);
7768 7768
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7769 7769
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7770
-                if ($olderthanmonths > 0) {
7771
-            		if ($globalDBdriver == 'mysql') {
7770
+				if ($olderthanmonths > 0) {
7771
+					if ($globalDBdriver == 'mysql') {
7772 7772
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7773 7773
 			} else {
7774 7774
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7775 7775
 			}
7776 7776
 		}
7777
-                if ($sincedate != '') {
7778
-            		if ($globalDBdriver == 'mysql') {
7777
+				if ($sincedate != '') {
7778
+					if ($globalDBdriver == 'mysql') {
7779 7779
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7780 7780
 			} else {
7781 7781
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7809,7 +7809,7 @@  discard block
 block discarded – undo
7809 7809
 				$query_values = array_merge($query_values,array(':day' => $day));
7810 7810
 			}
7811 7811
 		}
7812
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7812
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7813 7813
 					ORDER BY airport_arrival_icao_count DESC";
7814 7814
 		if ($limit) $query .= " LIMIT 10";
7815 7815
       
@@ -7837,35 +7837,35 @@  discard block
 block discarded – undo
7837 7837
 	}
7838 7838
 	
7839 7839
 	/**
7840
-	* Gets all detected arrival airports of the airplanes that have flown over
7841
-	*
7842
-	* @return Array the airport list
7843
-	*
7844
-	*/
7840
+	 * Gets all detected arrival airports of the airplanes that have flown over
7841
+	 *
7842
+	 * @return Array the airport list
7843
+	 *
7844
+	 */
7845 7845
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7846 7846
 	{
7847 7847
 		global $globalDBdriver;
7848 7848
 		$filter_query = $this->getFilter($filters,true,true);
7849 7849
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7850 7850
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7851
-                if ($olderthanmonths > 0) {
7852
-            		if ($globalDBdriver == 'mysql') {
7851
+				if ($olderthanmonths > 0) {
7852
+					if ($globalDBdriver == 'mysql') {
7853 7853
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7854 7854
 			} else {
7855 7855
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7856 7856
 			}
7857 7857
 		}
7858
-                if ($sincedate != '') {
7859
-            		if ($globalDBdriver == 'mysql') {
7858
+				if ($sincedate != '') {
7859
+					if ($globalDBdriver == 'mysql') {
7860 7860
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7861 7861
 			} else {
7862 7862
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7863 7863
 			}
7864 7864
 		}
7865 7865
 
7866
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7867
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7866
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7867
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7869 7869
 					ORDER BY airport_arrival_icao_count DESC";
7870 7870
 		if ($limit) $query .= " LIMIT 10";
7871 7871
       
@@ -7895,11 +7895,11 @@  discard block
 block discarded – undo
7895 7895
 	}	
7896 7896
 	
7897 7897
 	/**
7898
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7899
-	*
7900
-	* @return Array the airport list
7901
-	*
7902
-	*/
7898
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7899
+	 *
7900
+	 * @return Array the airport list
7901
+	 *
7902
+	 */
7903 7903
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7904 7904
 	{
7905 7905
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7931,11 +7931,11 @@  discard block
 block discarded – undo
7931 7931
 	
7932 7932
 	
7933 7933
 	/**
7934
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7935
-	*
7936
-	* @return Array the airport list
7937
-	*
7938
-	*/
7934
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7935
+	 *
7936
+	 * @return Array the airport list
7937
+	 *
7938
+	 */
7939 7939
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7940 7940
 	{
7941 7941
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7966,11 +7966,11 @@  discard block
 block discarded – undo
7966 7966
 	
7967 7967
 	
7968 7968
 	/**
7969
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7970
-	*
7971
-	* @return Array the airport list
7972
-	*
7973
-	*/
7969
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7970
+	 *
7971
+	 * @return Array the airport list
7972
+	 *
7973
+	 */
7974 7974
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7975 7975
 	{
7976 7976
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8004,11 +8004,11 @@  discard block
 block discarded – undo
8004 8004
 	
8005 8005
 	
8006 8006
 	/**
8007
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8008
-	*
8009
-	* @return Array the airport list
8010
-	*
8011
-	*/
8007
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8008
+	 *
8009
+	 * @return Array the airport list
8010
+	 *
8011
+	 */
8012 8012
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8013 8013
 	{
8014 8014
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8038,11 +8038,11 @@  discard block
 block discarded – undo
8038 8038
 	
8039 8039
 	
8040 8040
 	/**
8041
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8042
-	*
8043
-	* @return Array the airport list
8044
-	*
8045
-	*/
8041
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8042
+	 *
8043
+	 * @return Array the airport list
8044
+	 *
8045
+	 */
8046 8046
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8047 8047
 	{
8048 8048
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8076,11 +8076,11 @@  discard block
 block discarded – undo
8076 8076
 	
8077 8077
 	
8078 8078
 	/**
8079
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8080
-	*
8081
-	* @return Array the airport list
8082
-	*
8083
-	*/
8079
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8080
+	 *
8081
+	 * @return Array the airport list
8082
+	 *
8083
+	 */
8084 8084
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8085 8085
 	{
8086 8086
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8111,11 +8111,11 @@  discard block
 block discarded – undo
8111 8111
 	
8112 8112
 	
8113 8113
 	/**
8114
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8115
-	*
8116
-	* @return Array the airport list
8117
-	*
8118
-	*/
8114
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8115
+	 *
8116
+	 * @return Array the airport list
8117
+	 *
8118
+	 */
8119 8119
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8120 8120
 	{
8121 8121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8148,11 +8148,11 @@  discard block
 block discarded – undo
8148 8148
 	
8149 8149
 	
8150 8150
 	/**
8151
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8152
-	*
8153
-	* @return Array the airport list
8154
-	*
8155
-	*/
8151
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8152
+	 *
8153
+	 * @return Array the airport list
8154
+	 *
8155
+	 */
8156 8156
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8157 8157
 	{
8158 8158
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8182,11 +8182,11 @@  discard block
 block discarded – undo
8182 8182
 	
8183 8183
 	
8184 8184
 	/**
8185
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8186
-	*
8187
-	* @return Array the airport list
8188
-	*
8189
-	*/
8185
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8186
+	 *
8187
+	 * @return Array the airport list
8188
+	 *
8189
+	 */
8190 8190
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8191 8191
 	{
8192 8192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8220,11 +8220,11 @@  discard block
 block discarded – undo
8220 8220
 	
8221 8221
 	
8222 8222
 	/**
8223
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8224
-	*
8225
-	* @return Array the airport list
8226
-	*
8227
-	*/
8223
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8224
+	 *
8225
+	 * @return Array the airport list
8226
+	 *
8227
+	 */
8228 8228
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8229 8229
 	{
8230 8230
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8255,11 +8255,11 @@  discard block
 block discarded – undo
8255 8255
 	
8256 8256
 	
8257 8257
 	/**
8258
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8259
-	*
8260
-	* @return Array the airport list
8261
-	*
8262
-	*/
8258
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8259
+	 *
8260
+	 * @return Array the airport list
8261
+	 *
8262
+	 */
8263 8263
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8264 8264
 	{
8265 8265
 		global $globalTimezone, $globalDBdriver;
@@ -8305,11 +8305,11 @@  discard block
 block discarded – undo
8305 8305
 	
8306 8306
 	
8307 8307
 	/**
8308
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8309
-	*
8310
-	* @return Array the airport list
8311
-	*
8312
-	*/
8308
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8309
+	 *
8310
+	 * @return Array the airport list
8311
+	 *
8312
+	 */
8313 8313
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8314 8314
 	{
8315 8315
 		global $globalTimezone, $globalDBdriver;
@@ -8352,11 +8352,11 @@  discard block
 block discarded – undo
8352 8352
 	
8353 8353
 	
8354 8354
 	/**
8355
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8356
-	*
8357
-	* @return Array the airport list
8358
-	*
8359
-	*/
8355
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8356
+	 *
8357
+	 * @return Array the airport list
8358
+	 *
8359
+	 */
8360 8360
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8361 8361
 	{
8362 8362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8388,11 +8388,11 @@  discard block
 block discarded – undo
8388 8388
 	}
8389 8389
 	
8390 8390
 	/**
8391
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8392
-	*
8393
-	* @return Array the airport list
8394
-	*
8395
-	*/
8391
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8392
+	 *
8393
+	 * @return Array the airport list
8394
+	 *
8395
+	 */
8396 8396
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8397 8397
 	{
8398 8398
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8423,11 +8423,11 @@  discard block
 block discarded – undo
8423 8423
 	}
8424 8424
 
8425 8425
 	/**
8426
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8427
-	*
8428
-	* @return Array the airport list
8429
-	*
8430
-	*/
8426
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8427
+	 *
8428
+	 * @return Array the airport list
8429
+	 *
8430
+	 */
8431 8431
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8432 8432
 	{
8433 8433
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8458,11 +8458,11 @@  discard block
 block discarded – undo
8458 8458
 	}
8459 8459
 	
8460 8460
 	/**
8461
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8462
-	*
8463
-	* @return Array the airport list
8464
-	*
8465
-	*/
8461
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8462
+	 *
8463
+	 * @return Array the airport list
8464
+	 *
8465
+	 */
8466 8466
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8467 8467
 	{
8468 8468
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8491,11 +8491,11 @@  discard block
 block discarded – undo
8491 8491
 	}
8492 8492
 	
8493 8493
 	/**
8494
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8495
-	*
8496
-	* @return Array the airport list
8497
-	*
8498
-	*/
8494
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8495
+	 *
8496
+	 * @return Array the airport list
8497
+	 *
8498
+	 */
8499 8499
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8500 8500
 	{
8501 8501
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8511,11 +8511,11 @@  discard block
 block discarded – undo
8511 8511
 	}
8512 8512
 	
8513 8513
 	/**
8514
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8515
-	*
8516
-	* @return Array the airport list
8517
-	*
8518
-	*/
8514
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8515
+	 *
8516
+	 * @return Array the airport list
8517
+	 *
8518
+	 */
8519 8519
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8520 8520
 	{
8521 8521
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8533,11 +8533,11 @@  discard block
 block discarded – undo
8533 8533
 	
8534 8534
 	
8535 8535
 	/**
8536
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8537
-	*
8538
-	* @return Array the airport list
8539
-	*
8540
-	*/
8536
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8537
+	 *
8538
+	 * @return Array the airport list
8539
+	 *
8540
+	 */
8541 8541
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8542 8542
 	{
8543 8543
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8570,11 +8570,11 @@  discard block
 block discarded – undo
8570 8570
 	
8571 8571
 	
8572 8572
 	/**
8573
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8574
-	*
8575
-	* @return Array the airport list
8576
-	*
8577
-	*/
8573
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8574
+	 *
8575
+	 * @return Array the airport list
8576
+	 *
8577
+	 */
8578 8578
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8579 8579
 	{
8580 8580
 		global $globalDBdriver;
@@ -8606,11 +8606,11 @@  discard block
 block discarded – undo
8606 8606
 
8607 8607
 
8608 8608
 	/**
8609
-	* Counts all airport departure countries
8610
-	*
8611
-	* @return Array the airport departure list
8612
-	*
8613
-	*/
8609
+	 * Counts all airport departure countries
8610
+	 *
8611
+	 * @return Array the airport departure list
8612
+	 *
8613
+	 */
8614 8614
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8615 8615
 	{
8616 8616
 		global $globalDBdriver;
@@ -8669,11 +8669,11 @@  discard block
 block discarded – undo
8669 8669
 	
8670 8670
 	
8671 8671
 	/**
8672
-	* Counts all airport arrival countries
8673
-	*
8674
-	* @return Array the airport arrival list
8675
-	*
8676
-	*/
8672
+	 * Counts all airport arrival countries
8673
+	 *
8674
+	 * @return Array the airport arrival list
8675
+	 *
8676
+	 */
8677 8677
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8678 8678
 	{
8679 8679
 		global $globalDBdriver;
@@ -8735,11 +8735,11 @@  discard block
 block discarded – undo
8735 8735
 
8736 8736
 
8737 8737
 	/**
8738
-	* Gets all route combinations
8739
-	*
8740
-	* @return Array the route list
8741
-	*
8742
-	*/
8738
+	 * Gets all route combinations
8739
+	 *
8740
+	 * @return Array the route list
8741
+	 *
8742
+	 */
8743 8743
 	public function countAllRoutes($filters = array())
8744 8744
 	{
8745 8745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8778,11 +8778,11 @@  discard block
 block discarded – undo
8778 8778
 	
8779 8779
 	
8780 8780
 	/**
8781
-	* Gets all route combinations based on an aircraft
8782
-	*
8783
-	* @return Array the route list
8784
-	*
8785
-	*/
8781
+	 * Gets all route combinations based on an aircraft
8782
+	 *
8783
+	 * @return Array the route list
8784
+	 *
8785
+	 */
8786 8786
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8787 8787
 	{
8788 8788
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8818,11 +8818,11 @@  discard block
 block discarded – undo
8818 8818
 	
8819 8819
 	
8820 8820
 	/**
8821
-	* Gets all route combinations based on an aircraft registration
8822
-	*
8823
-	* @return Array the route list
8824
-	*
8825
-	*/
8821
+	 * Gets all route combinations based on an aircraft registration
8822
+	 *
8823
+	 * @return Array the route list
8824
+	 *
8825
+	 */
8826 8826
 	public function countAllRoutesByRegistration($registration, $filters = array())
8827 8827
 	{
8828 8828
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8860,11 +8860,11 @@  discard block
 block discarded – undo
8860 8860
 	
8861 8861
 	
8862 8862
 	/**
8863
-	* Gets all route combinations based on an airline
8864
-	*
8865
-	* @return Array the route list
8866
-	*
8867
-	*/
8863
+	 * Gets all route combinations based on an airline
8864
+	 *
8865
+	 * @return Array the route list
8866
+	 *
8867
+	 */
8868 8868
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8869 8869
 	{
8870 8870
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8902,11 +8902,11 @@  discard block
 block discarded – undo
8902 8902
 	
8903 8903
 	
8904 8904
 	/**
8905
-	* Gets all route combinations based on an airport
8906
-	*
8907
-	* @return Array the route list
8908
-	*
8909
-	*/
8905
+	 * Gets all route combinations based on an airport
8906
+	 *
8907
+	 * @return Array the route list
8908
+	 *
8909
+	 */
8910 8910
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8911 8911
 	{
8912 8912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8943,11 +8943,11 @@  discard block
 block discarded – undo
8943 8943
 	
8944 8944
 	
8945 8945
 	/**
8946
-	* Gets all route combinations based on an country
8947
-	*
8948
-	* @return Array the route list
8949
-	*
8950
-	*/
8946
+	 * Gets all route combinations based on an country
8947
+	 *
8948
+	 * @return Array the route list
8949
+	 *
8950
+	 */
8951 8951
 	public function countAllRoutesByCountry($country, $filters = array())
8952 8952
 	{
8953 8953
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8983,11 +8983,11 @@  discard block
 block discarded – undo
8983 8983
 
8984 8984
 
8985 8985
 	/**
8986
-	* Gets all route combinations based on an date
8987
-	*
8988
-	* @return Array the route list
8989
-	*
8990
-	*/
8986
+	 * Gets all route combinations based on an date
8987
+	 *
8988
+	 * @return Array the route list
8989
+	 *
8990
+	 */
8991 8991
 	public function countAllRoutesByDate($date, $filters = array())
8992 8992
 	{
8993 8993
 		global $globalTimezone, $globalDBdriver;
@@ -9037,11 +9037,11 @@  discard block
 block discarded – undo
9037 9037
 	
9038 9038
 	
9039 9039
 	/**
9040
-	* Gets all route combinations based on an ident/callsign
9041
-	*
9042
-	* @return Array the route list
9043
-	*
9044
-	*/
9040
+	 * Gets all route combinations based on an ident/callsign
9041
+	 *
9042
+	 * @return Array the route list
9043
+	 *
9044
+	 */
9045 9045
 	public function countAllRoutesByIdent($ident, $filters = array())
9046 9046
 	{
9047 9047
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9077,11 +9077,11 @@  discard block
 block discarded – undo
9077 9077
 	}
9078 9078
 	
9079 9079
 	/**
9080
-	* Gets all route combinations based on an owner
9081
-	*
9082
-	* @return Array the route list
9083
-	*
9084
-	*/
9080
+	 * Gets all route combinations based on an owner
9081
+	 *
9082
+	 * @return Array the route list
9083
+	 *
9084
+	 */
9085 9085
 	public function countAllRoutesByOwner($owner,$filters = array())
9086 9086
 	{
9087 9087
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9117,11 +9117,11 @@  discard block
 block discarded – undo
9117 9117
 	}
9118 9118
 	
9119 9119
 	/**
9120
-	* Gets all route combinations based on a pilot
9121
-	*
9122
-	* @return Array the route list
9123
-	*
9124
-	*/
9120
+	 * Gets all route combinations based on a pilot
9121
+	 *
9122
+	 * @return Array the route list
9123
+	 *
9124
+	 */
9125 9125
 	public function countAllRoutesByPilot($pilot,$filters = array())
9126 9126
 	{
9127 9127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9158,11 +9158,11 @@  discard block
 block discarded – undo
9158 9158
 	
9159 9159
 	
9160 9160
 	/**
9161
-	* Gets all route combinations based on an manufacturer
9162
-	*
9163
-	* @return Array the route list
9164
-	*
9165
-	*/
9161
+	 * Gets all route combinations based on an manufacturer
9162
+	 *
9163
+	 * @return Array the route list
9164
+	 *
9165
+	 */
9166 9166
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9167 9167
 	{
9168 9168
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9200,11 +9200,11 @@  discard block
 block discarded – undo
9200 9200
 	
9201 9201
 	
9202 9202
 	/**
9203
-	* Gets all route combinations with waypoints
9204
-	*
9205
-	* @return Array the route list
9206
-	*
9207
-	*/
9203
+	 * Gets all route combinations with waypoints
9204
+	 *
9205
+	 * @return Array the route list
9206
+	 *
9207
+	 */
9208 9208
 	public function countAllRoutesWithWaypoints($filters = array())
9209 9209
 	{
9210 9210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9241,11 +9241,11 @@  discard block
 block discarded – undo
9241 9241
 	}
9242 9242
 	
9243 9243
 	/**
9244
-	* Gets all callsigns that have flown over
9245
-	*
9246
-	* @return Array the callsign list
9247
-	*
9248
-	*/
9244
+	 * Gets all callsigns that have flown over
9245
+	 *
9246
+	 * @return Array the callsign list
9247
+	 *
9248
+	 */
9249 9249
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9250 9250
 	{
9251 9251
 		global $globalDBdriver;
@@ -9311,11 +9311,11 @@  discard block
 block discarded – undo
9311 9311
 	}
9312 9312
 
9313 9313
 	/**
9314
-	* Gets all callsigns that have flown over
9315
-	*
9316
-	* @return Array the callsign list
9317
-	*
9318
-	*/
9314
+	 * Gets all callsigns that have flown over
9315
+	 *
9316
+	 * @return Array the callsign list
9317
+	 *
9318
+	 */
9319 9319
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9320 9320
 	{
9321 9321
 		global $globalDBdriver;
@@ -9356,11 +9356,11 @@  discard block
 block discarded – undo
9356 9356
 
9357 9357
 
9358 9358
 	/**
9359
-	* Counts all dates
9360
-	*
9361
-	* @return Array the date list
9362
-	*
9363
-	*/
9359
+	 * Counts all dates
9360
+	 *
9361
+	 * @return Array the date list
9362
+	 *
9363
+	 */
9364 9364
 	public function countAllDates($filters = array())
9365 9365
 	{
9366 9366
 		global $globalTimezone, $globalDBdriver;
@@ -9405,11 +9405,11 @@  discard block
 block discarded – undo
9405 9405
 	}
9406 9406
 	
9407 9407
 	/**
9408
-	* Counts all dates
9409
-	*
9410
-	* @return Array the date list
9411
-	*
9412
-	*/
9408
+	 * Counts all dates
9409
+	 *
9410
+	 * @return Array the date list
9411
+	 *
9412
+	 */
9413 9413
 	public function countAllDatesByAirlines($filters = array())
9414 9414
 	{
9415 9415
 		global $globalTimezone, $globalDBdriver;
@@ -9454,11 +9454,11 @@  discard block
 block discarded – undo
9454 9454
 	}	
9455 9455
 	
9456 9456
 	/**
9457
-	* Counts all dates during the last 7 days
9458
-	*
9459
-	* @return Array the date list
9460
-	*
9461
-	*/
9457
+	 * Counts all dates during the last 7 days
9458
+	 *
9459
+	 * @return Array the date list
9460
+	 *
9461
+	 */
9462 9462
 	public function countAllDatesLast7Days($filters = array())
9463 9463
 	{
9464 9464
 		global $globalTimezone, $globalDBdriver;
@@ -9480,7 +9480,7 @@  discard block
 block discarded – undo
9480 9480
 			$query .= " GROUP BY date_name 
9481 9481
 								ORDER BY date_name ASC";
9482 9482
 			$query_data = array(':offset' => $offset);
9483
-    		}
9483
+			}
9484 9484
 		
9485 9485
 		$sth = $this->db->prepare($query);
9486 9486
 		$sth->execute($query_data);
@@ -9500,11 +9500,11 @@  discard block
 block discarded – undo
9500 9500
 	}
9501 9501
 
9502 9502
 	/**
9503
-	* Counts all dates during the last month
9504
-	*
9505
-	* @return Array the date list
9506
-	*
9507
-	*/
9503
+	 * Counts all dates during the last month
9504
+	 *
9505
+	 * @return Array the date list
9506
+	 *
9507
+	 */
9508 9508
 	public function countAllDatesLastMonth($filters = array())
9509 9509
 	{
9510 9510
 		global $globalTimezone, $globalDBdriver;
@@ -9526,7 +9526,7 @@  discard block
 block discarded – undo
9526 9526
 			$query .= " GROUP BY date_name 
9527 9527
 								ORDER BY date_name ASC";
9528 9528
 			$query_data = array(':offset' => $offset);
9529
-    		}
9529
+			}
9530 9530
 		
9531 9531
 		$sth = $this->db->prepare($query);
9532 9532
 		$sth->execute($query_data);
@@ -9547,11 +9547,11 @@  discard block
 block discarded – undo
9547 9547
 
9548 9548
 
9549 9549
 	/**
9550
-	* Counts all dates during the last month
9551
-	*
9552
-	* @return Array the date list
9553
-	*
9554
-	*/
9550
+	 * Counts all dates during the last month
9551
+	 *
9552
+	 * @return Array the date list
9553
+	 *
9554
+	 */
9555 9555
 	public function countAllDatesLastMonthByAirlines($filters = array())
9556 9556
 	{
9557 9557
 		global $globalTimezone, $globalDBdriver;
@@ -9574,7 +9574,7 @@  discard block
 block discarded – undo
9574 9574
 								GROUP BY spotter_output.airline_icao, date_name 
9575 9575
 								ORDER BY date_name ASC";
9576 9576
 			$query_data = array(':offset' => $offset);
9577
-    		}
9577
+			}
9578 9578
 		
9579 9579
 		$sth = $this->db->prepare($query);
9580 9580
 		$sth->execute($query_data);
@@ -9596,11 +9596,11 @@  discard block
 block discarded – undo
9596 9596
 	
9597 9597
 
9598 9598
 	/**
9599
-	* Counts all month
9600
-	*
9601
-	* @return Array the month list
9602
-	*
9603
-	*/
9599
+	 * Counts all month
9600
+	 *
9601
+	 * @return Array the month list
9602
+	 *
9603
+	 */
9604 9604
 	public function countAllMonths($filters = array())
9605 9605
 	{
9606 9606
 		global $globalTimezone, $globalDBdriver;
@@ -9642,11 +9642,11 @@  discard block
 block discarded – undo
9642 9642
 	}
9643 9643
 
9644 9644
 	/**
9645
-	* Counts all month
9646
-	*
9647
-	* @return Array the month list
9648
-	*
9649
-	*/
9645
+	 * Counts all month
9646
+	 *
9647
+	 * @return Array the month list
9648
+	 *
9649
+	 */
9650 9650
 	public function countAllMonthsByAirlines($filters = array())
9651 9651
 	{
9652 9652
 		global $globalTimezone, $globalDBdriver;
@@ -9691,11 +9691,11 @@  discard block
 block discarded – undo
9691 9691
 	}
9692 9692
 
9693 9693
 	/**
9694
-	* Counts all military month
9695
-	*
9696
-	* @return Array the month list
9697
-	*
9698
-	*/
9694
+	 * Counts all military month
9695
+	 *
9696
+	 * @return Array the month list
9697
+	 *
9698
+	 */
9699 9699
 	public function countAllMilitaryMonths($filters = array())
9700 9700
 	{
9701 9701
 		global $globalTimezone, $globalDBdriver;
@@ -9736,11 +9736,11 @@  discard block
 block discarded – undo
9736 9736
 	}
9737 9737
 	
9738 9738
 	/**
9739
-	* Counts all month owners
9740
-	*
9741
-	* @return Array the month list
9742
-	*
9743
-	*/
9739
+	 * Counts all month owners
9740
+	 *
9741
+	 * @return Array the month list
9742
+	 *
9743
+	 */
9744 9744
 	public function countAllMonthsOwners($filters = array())
9745 9745
 	{
9746 9746
 		global $globalTimezone, $globalDBdriver;
@@ -9782,11 +9782,11 @@  discard block
 block discarded – undo
9782 9782
 	}
9783 9783
 	
9784 9784
 	/**
9785
-	* Counts all month owners
9786
-	*
9787
-	* @return Array the month list
9788
-	*
9789
-	*/
9785
+	 * Counts all month owners
9786
+	 *
9787
+	 * @return Array the month list
9788
+	 *
9789
+	 */
9790 9790
 	public function countAllMonthsOwnersByAirlines($filters = array())
9791 9791
 	{
9792 9792
 		global $globalTimezone, $globalDBdriver;
@@ -9829,11 +9829,11 @@  discard block
 block discarded – undo
9829 9829
 	}
9830 9830
 
9831 9831
 	/**
9832
-	* Counts all month pilot
9833
-	*
9834
-	* @return Array the month list
9835
-	*
9836
-	*/
9832
+	 * Counts all month pilot
9833
+	 *
9834
+	 * @return Array the month list
9835
+	 *
9836
+	 */
9837 9837
 	public function countAllMonthsPilots($filters = array())
9838 9838
 	{
9839 9839
 		global $globalTimezone, $globalDBdriver;
@@ -9875,11 +9875,11 @@  discard block
 block discarded – undo
9875 9875
 	}
9876 9876
 	
9877 9877
 	/**
9878
-	* Counts all month pilot
9879
-	*
9880
-	* @return Array the month list
9881
-	*
9882
-	*/
9878
+	 * Counts all month pilot
9879
+	 *
9880
+	 * @return Array the month list
9881
+	 *
9882
+	 */
9883 9883
 	public function countAllMonthsPilotsByAirlines($filters = array())
9884 9884
 	{
9885 9885
 		global $globalTimezone, $globalDBdriver;
@@ -9922,11 +9922,11 @@  discard block
 block discarded – undo
9922 9922
 	}
9923 9923
 
9924 9924
 	/**
9925
-	* Counts all month airline
9926
-	*
9927
-	* @return Array the month list
9928
-	*
9929
-	*/
9925
+	 * Counts all month airline
9926
+	 *
9927
+	 * @return Array the month list
9928
+	 *
9929
+	 */
9930 9930
 	public function countAllMonthsAirlines($filters = array())
9931 9931
 	{
9932 9932
 		global $globalTimezone, $globalDBdriver;
@@ -9968,11 +9968,11 @@  discard block
 block discarded – undo
9968 9968
 	}
9969 9969
 	
9970 9970
 	/**
9971
-	* Counts all month aircraft
9972
-	*
9973
-	* @return Array the month list
9974
-	*
9975
-	*/
9971
+	 * Counts all month aircraft
9972
+	 *
9973
+	 * @return Array the month list
9974
+	 *
9975
+	 */
9976 9976
 	public function countAllMonthsAircrafts($filters = array())
9977 9977
 	{
9978 9978
 		global $globalTimezone, $globalDBdriver;
@@ -10015,11 +10015,11 @@  discard block
 block discarded – undo
10015 10015
 	
10016 10016
 
10017 10017
 	/**
10018
-	* Counts all month aircraft
10019
-	*
10020
-	* @return Array the month list
10021
-	*
10022
-	*/
10018
+	 * Counts all month aircraft
10019
+	 *
10020
+	 * @return Array the month list
10021
+	 *
10022
+	 */
10023 10023
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10024 10024
 	{
10025 10025
 		global $globalTimezone, $globalDBdriver;
@@ -10062,11 +10062,11 @@  discard block
 block discarded – undo
10062 10062
 	}
10063 10063
 
10064 10064
 	/**
10065
-	* Counts all month real arrival
10066
-	*
10067
-	* @return Array the month list
10068
-	*
10069
-	*/
10065
+	 * Counts all month real arrival
10066
+	 *
10067
+	 * @return Array the month list
10068
+	 *
10069
+	 */
10070 10070
 	public function countAllMonthsRealArrivals($filters = array())
10071 10071
 	{
10072 10072
 		global $globalTimezone, $globalDBdriver;
@@ -10109,11 +10109,11 @@  discard block
 block discarded – undo
10109 10109
 	
10110 10110
 
10111 10111
 	/**
10112
-	* Counts all month real arrival
10113
-	*
10114
-	* @return Array the month list
10115
-	*
10116
-	*/
10112
+	 * Counts all month real arrival
10113
+	 *
10114
+	 * @return Array the month list
10115
+	 *
10116
+	 */
10117 10117
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10118 10118
 	{
10119 10119
 		global $globalTimezone, $globalDBdriver;
@@ -10157,11 +10157,11 @@  discard block
 block discarded – undo
10157 10157
 	
10158 10158
 
10159 10159
 	/**
10160
-	* Counts all dates during the last year
10161
-	*
10162
-	* @return Array the date list
10163
-	*
10164
-	*/
10160
+	 * Counts all dates during the last year
10161
+	 *
10162
+	 * @return Array the date list
10163
+	 *
10164
+	 */
10165 10165
 	public function countAllMonthsLastYear($filters)
10166 10166
 	{
10167 10167
 		global $globalTimezone, $globalDBdriver;
@@ -10183,7 +10183,7 @@  discard block
 block discarded – undo
10183 10183
 			$query .= " GROUP BY year_name, month_name
10184 10184
 								ORDER BY year_name, month_name ASC";
10185 10185
 			$query_data = array(':offset' => $offset);
10186
-    		}
10186
+			}
10187 10187
 		
10188 10188
 		$sth = $this->db->prepare($query);
10189 10189
 		$sth->execute($query_data);
@@ -10206,11 +10206,11 @@  discard block
 block discarded – undo
10206 10206
 	
10207 10207
 	
10208 10208
 	/**
10209
-	* Counts all hours
10210
-	*
10211
-	* @return Array the hour list
10212
-	*
10213
-	*/
10209
+	 * Counts all hours
10210
+	 *
10211
+	 * @return Array the hour list
10212
+	 *
10213
+	 */
10214 10214
 	public function countAllHours($orderby,$filters = array())
10215 10215
 	{
10216 10216
 		global $globalTimezone, $globalDBdriver;
@@ -10271,11 +10271,11 @@  discard block
 block discarded – undo
10271 10271
 	}
10272 10272
 	
10273 10273
 	/**
10274
-	* Counts all hours
10275
-	*
10276
-	* @return Array the hour list
10277
-	*
10278
-	*/
10274
+	 * Counts all hours
10275
+	 *
10276
+	 * @return Array the hour list
10277
+	 *
10278
+	 */
10279 10279
 	public function countAllHoursByAirlines($orderby, $filters = array())
10280 10280
 	{
10281 10281
 		global $globalTimezone, $globalDBdriver;
@@ -10338,11 +10338,11 @@  discard block
 block discarded – undo
10338 10338
 
10339 10339
 
10340 10340
 	/**
10341
-	* Counts all hours by airline
10342
-	*
10343
-	* @return Array the hour list
10344
-	*
10345
-	*/
10341
+	 * Counts all hours by airline
10342
+	 *
10343
+	 * @return Array the hour list
10344
+	 *
10345
+	 */
10346 10346
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10347 10347
 	{
10348 10348
 		global $globalTimezone, $globalDBdriver;
@@ -10388,11 +10388,11 @@  discard block
 block discarded – undo
10388 10388
 	
10389 10389
 	
10390 10390
 	/**
10391
-	* Counts all hours by aircraft
10392
-	*
10393
-	* @return Array the hour list
10394
-	*
10395
-	*/
10391
+	 * Counts all hours by aircraft
10392
+	 *
10393
+	 * @return Array the hour list
10394
+	 *
10395
+	 */
10396 10396
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10397 10397
 	{
10398 10398
 		global $globalTimezone, $globalDBdriver;
@@ -10435,11 +10435,11 @@  discard block
 block discarded – undo
10435 10435
 	
10436 10436
 	
10437 10437
 	/**
10438
-	* Counts all hours by aircraft registration
10439
-	*
10440
-	* @return Array the hour list
10441
-	*
10442
-	*/
10438
+	 * Counts all hours by aircraft registration
10439
+	 *
10440
+	 * @return Array the hour list
10441
+	 *
10442
+	 */
10443 10443
 	public function countAllHoursByRegistration($registration, $filters = array())
10444 10444
 	{
10445 10445
 		global $globalTimezone, $globalDBdriver;
@@ -10482,11 +10482,11 @@  discard block
 block discarded – undo
10482 10482
 	
10483 10483
 	
10484 10484
 	/**
10485
-	* Counts all hours by airport
10486
-	*
10487
-	* @return Array the hour list
10488
-	*
10489
-	*/
10485
+	 * Counts all hours by airport
10486
+	 *
10487
+	 * @return Array the hour list
10488
+	 *
10489
+	 */
10490 10490
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10491 10491
 	{
10492 10492
 		global $globalTimezone, $globalDBdriver;
@@ -10530,11 +10530,11 @@  discard block
 block discarded – undo
10530 10530
 	
10531 10531
 	
10532 10532
 	/**
10533
-	* Counts all hours by manufacturer
10534
-	*
10535
-	* @return Array the hour list
10536
-	*
10537
-	*/
10533
+	 * Counts all hours by manufacturer
10534
+	 *
10535
+	 * @return Array the hour list
10536
+	 *
10537
+	 */
10538 10538
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10539 10539
 	{
10540 10540
 		global $globalTimezone, $globalDBdriver;
@@ -10578,11 +10578,11 @@  discard block
 block discarded – undo
10578 10578
 	
10579 10579
 	
10580 10580
 	/**
10581
-	* Counts all hours by date
10582
-	*
10583
-	* @return Array the hour list
10584
-	*
10585
-	*/
10581
+	 * Counts all hours by date
10582
+	 *
10583
+	 * @return Array the hour list
10584
+	 *
10585
+	 */
10586 10586
 	public function countAllHoursByDate($date, $filters = array())
10587 10587
 	{
10588 10588
 		global $globalTimezone, $globalDBdriver;
@@ -10626,11 +10626,11 @@  discard block
 block discarded – undo
10626 10626
 	
10627 10627
 	
10628 10628
 	/**
10629
-	* Counts all hours by a ident/callsign
10630
-	*
10631
-	* @return Array the hour list
10632
-	*
10633
-	*/
10629
+	 * Counts all hours by a ident/callsign
10630
+	 *
10631
+	 * @return Array the hour list
10632
+	 *
10633
+	 */
10634 10634
 	public function countAllHoursByIdent($ident, $filters = array())
10635 10635
 	{
10636 10636
 		global $globalTimezone, $globalDBdriver;
@@ -10673,11 +10673,11 @@  discard block
 block discarded – undo
10673 10673
 	}
10674 10674
 	
10675 10675
 	/**
10676
-	* Counts all hours by a owner
10677
-	*
10678
-	* @return Array the hour list
10679
-	*
10680
-	*/
10676
+	 * Counts all hours by a owner
10677
+	 *
10678
+	 * @return Array the hour list
10679
+	 *
10680
+	 */
10681 10681
 	public function countAllHoursByOwner($owner, $filters = array())
10682 10682
 	{
10683 10683
 		global $globalTimezone, $globalDBdriver;
@@ -10720,11 +10720,11 @@  discard block
 block discarded – undo
10720 10720
 	}
10721 10721
 	
10722 10722
 	/**
10723
-	* Counts all hours by a pilot
10724
-	*
10725
-	* @return Array the hour list
10726
-	*
10727
-	*/
10723
+	 * Counts all hours by a pilot
10724
+	 *
10725
+	 * @return Array the hour list
10726
+	 *
10727
+	 */
10728 10728
 	public function countAllHoursByPilot($pilot, $filters = array())
10729 10729
 	{
10730 10730
 		global $globalTimezone, $globalDBdriver;
@@ -10769,11 +10769,11 @@  discard block
 block discarded – undo
10769 10769
 	
10770 10770
 	
10771 10771
 	/**
10772
-	* Counts all hours by route
10773
-	*
10774
-	* @return Array the hour list
10775
-	*
10776
-	*/
10772
+	 * Counts all hours by route
10773
+	 *
10774
+	 * @return Array the hour list
10775
+	 *
10776
+	 */
10777 10777
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10778 10778
 	{
10779 10779
 		global $globalTimezone, $globalDBdriver;
@@ -10817,11 +10817,11 @@  discard block
 block discarded – undo
10817 10817
 	
10818 10818
 	
10819 10819
 	/**
10820
-	* Counts all hours by country
10821
-	*
10822
-	* @return Array the hour list
10823
-	*
10824
-	*/
10820
+	 * Counts all hours by country
10821
+	 *
10822
+	 * @return Array the hour list
10823
+	 *
10824
+	 */
10825 10825
 	public function countAllHoursByCountry($country, $filters = array())
10826 10826
 	{
10827 10827
 		global $globalTimezone, $globalDBdriver;
@@ -10866,11 +10866,11 @@  discard block
 block discarded – undo
10866 10866
 
10867 10867
 
10868 10868
 	/**
10869
-	* Counts all aircraft that have flown over
10870
-	*
10871
-	* @return Integer the number of aircrafts
10872
-	*
10873
-	*/
10869
+	 * Counts all aircraft that have flown over
10870
+	 *
10871
+	 * @return Integer the number of aircrafts
10872
+	 *
10873
+	 */
10874 10874
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10875 10875
 	{
10876 10876
 		global $globalDBdriver;
@@ -10903,11 +10903,11 @@  discard block
 block discarded – undo
10903 10903
 	}
10904 10904
 
10905 10905
 	/**
10906
-	* Counts all flight that really arrival
10907
-	*
10908
-	* @return Integer the number of aircrafts
10909
-	*
10910
-	*/
10906
+	 * Counts all flight that really arrival
10907
+	 *
10908
+	 * @return Integer the number of aircrafts
10909
+	 *
10910
+	 */
10911 10911
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10912 10912
 	{
10913 10913
 		global $globalDBdriver;
@@ -10940,11 +10940,11 @@  discard block
 block discarded – undo
10940 10940
 	}
10941 10941
 
10942 10942
 	/**
10943
-	* Counts all pilots that have flown over
10944
-	*
10945
-	* @return Integer the number of pilots
10946
-	*
10947
-	*/
10943
+	 * Counts all pilots that have flown over
10944
+	 *
10945
+	 * @return Integer the number of pilots
10946
+	 *
10947
+	 */
10948 10948
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10949 10949
 	{
10950 10950
 		global $globalDBdriver;
@@ -10976,11 +10976,11 @@  discard block
 block discarded – undo
10976 10976
 	}
10977 10977
 
10978 10978
 	/**
10979
-	* Counts all owners that have flown over
10980
-	*
10981
-	* @return Integer the number of owners
10982
-	*
10983
-	*/
10979
+	 * Counts all owners that have flown over
10980
+	 *
10981
+	 * @return Integer the number of owners
10982
+	 *
10983
+	 */
10984 10984
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10985 10985
 	{
10986 10986
 		global $globalDBdriver;
@@ -11013,11 +11013,11 @@  discard block
 block discarded – undo
11013 11013
 	
11014 11014
 	
11015 11015
 	/**
11016
-	* Counts all flights that have flown over
11017
-	*
11018
-	* @return Integer the number of flights
11019
-	*
11020
-	*/
11016
+	 * Counts all flights that have flown over
11017
+	 *
11018
+	 * @return Integer the number of flights
11019
+	 *
11020
+	 */
11021 11021
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11022 11022
 	{
11023 11023
 		global $globalDBdriver;
@@ -11051,11 +11051,11 @@  discard block
 block discarded – undo
11051 11051
 	}
11052 11052
 	
11053 11053
 	/**
11054
-	* Counts all military flights that have flown over
11055
-	*
11056
-	* @return Integer the number of flights
11057
-	*
11058
-	*/
11054
+	 * Counts all military flights that have flown over
11055
+	 *
11056
+	 * @return Integer the number of flights
11057
+	 *
11058
+	 */
11059 11059
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11060 11060
 	{
11061 11061
 		global $globalDBdriver;
@@ -11090,11 +11090,11 @@  discard block
 block discarded – undo
11090 11090
 	
11091 11091
 	
11092 11092
 	/**
11093
-	* Counts all airlines that have flown over
11094
-	*
11095
-	* @return Integer the number of airlines
11096
-	*
11097
-	*/
11093
+	 * Counts all airlines that have flown over
11094
+	 *
11095
+	 * @return Integer the number of airlines
11096
+	 *
11097
+	 */
11098 11098
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11099 11099
 	{
11100 11100
 		global $globalDBdriver;
@@ -11121,8 +11121,8 @@  discard block
 block discarded – undo
11121 11121
 				$query_values = array_merge($query_values,array(':month' => $month));
11122 11122
 			}
11123 11123
 		}
11124
-                if ($query == '') $queryi .= $this->getFilter($filters);
11125
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11124
+				if ($query == '') $queryi .= $this->getFilter($filters);
11125
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11126 11126
 
11127 11127
 
11128 11128
 		$sth = $this->db->prepare($queryi);
@@ -11132,11 +11132,11 @@  discard block
 block discarded – undo
11132 11132
 
11133 11133
   
11134 11134
 	/**
11135
-	* Counts all hours of today
11136
-	*
11137
-	* @return Array the hour list
11138
-	*
11139
-	*/
11135
+	 * Counts all hours of today
11136
+	 *
11137
+	 * @return Array the hour list
11138
+	 *
11139
+	 */
11140 11140
 	public function countAllHoursFromToday($filters = array())
11141 11141
 	{
11142 11142
 		global $globalTimezone, $globalDBdriver;
@@ -11176,11 +11176,11 @@  discard block
 block discarded – undo
11176 11176
 	}
11177 11177
     
11178 11178
 	/**
11179
-	* Gets all the spotter information based on calculated upcoming flights
11180
-	*
11181
-	* @return Array the spotter information
11182
-	*
11183
-	*/
11179
+	 * Gets all the spotter information based on calculated upcoming flights
11180
+	 *
11181
+	 * @return Array the spotter information
11182
+	 *
11183
+	 */
11184 11184
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11185 11185
 	{
11186 11186
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11255,12 +11255,12 @@  discard block
 block discarded – undo
11255 11255
 	}
11256 11256
     
11257 11257
     
11258
-     /**
11259
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11260
-	*
11261
-	* @return Integer the Barrie Spotter ID
11258
+	 /**
11259
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11260
+	  *
11261
+	  * @return Integer the Barrie Spotter ID
11262 11262
 q	*
11263
-	*/
11263
+	  */
11264 11264
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11265 11265
 	{
11266 11266
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11281,13 +11281,13 @@  discard block
 block discarded – undo
11281 11281
   
11282 11282
  
11283 11283
 	/**
11284
-	* Parses a date string
11285
-	*
11286
-	* @param String $dateString the date string
11287
-	* @param String $timezone the timezone of a user
11288
-	* @return Array the time information
11289
-	*
11290
-	*/
11284
+	 * Parses a date string
11285
+	 *
11286
+	 * @param String $dateString the date string
11287
+	 * @param String $timezone the timezone of a user
11288
+	 * @return Array the time information
11289
+	 *
11290
+	 */
11291 11291
 	public function parseDateString($dateString, $timezone = '')
11292 11292
 	{
11293 11293
 		$time_array = array();
@@ -11323,12 +11323,12 @@  discard block
 block discarded – undo
11323 11323
 	
11324 11324
 	
11325 11325
 	/**
11326
-	* Parses the direction degrees to working
11327
-	*
11328
-	* @param Float $direction the direction in degrees
11329
-	* @return Array the direction information
11330
-	*
11331
-	*/
11326
+	 * Parses the direction degrees to working
11327
+	 *
11328
+	 * @param Float $direction the direction in degrees
11329
+	 * @return Array the direction information
11330
+	 *
11331
+	 */
11332 11332
 	public function parseDirection($direction = 0)
11333 11333
 	{
11334 11334
 		if ($direction == '') $direction = 0;
@@ -11407,12 +11407,12 @@  discard block
 block discarded – undo
11407 11407
 	
11408 11408
 	
11409 11409
 	/**
11410
-	* Gets the aircraft registration
11411
-	*
11412
-	* @param String $flightaware_id the flight aware id
11413
-	* @return String the aircraft registration
11414
-	*
11415
-	*/
11410
+	 * Gets the aircraft registration
11411
+	 *
11412
+	 * @param String $flightaware_id the flight aware id
11413
+	 * @return String the aircraft registration
11414
+	 *
11415
+	 */
11416 11416
 	
11417 11417
 	public function getAircraftRegistration($flightaware_id)
11418 11418
 	{
@@ -11441,12 +11441,12 @@  discard block
 block discarded – undo
11441 11441
 
11442 11442
 
11443 11443
 	/**
11444
-	* Gets the aircraft registration from ModeS
11445
-	*
11446
-	* @param String $aircraft_modes the flight ModeS in hex
11447
-	* @return String the aircraft registration
11448
-	*
11449
-	*/
11444
+	 * Gets the aircraft registration from ModeS
11445
+	 *
11446
+	 * @param String $aircraft_modes the flight ModeS in hex
11447
+	 * @return String the aircraft registration
11448
+	 *
11449
+	 */
11450 11450
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11451 11451
 	{
11452 11452
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11462,8 +11462,8 @@  discard block
 block discarded – undo
11462 11462
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11463 11463
 		$sth->closeCursor();
11464 11464
 		if (count($row) > 0) {
11465
-		    //return $row['Registration'];
11466
-		    return $row['registration'];
11465
+			//return $row['Registration'];
11466
+			return $row['registration'];
11467 11467
 		} elseif ($source_type == 'flarm') {
11468 11468
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11469 11469
 		} else return '';
@@ -11471,12 +11471,12 @@  discard block
 block discarded – undo
11471 11471
 	}
11472 11472
 
11473 11473
 	/**
11474
-	* Gets the aircraft type from ModeS
11475
-	*
11476
-	* @param String $aircraft_modes the flight ModeS in hex
11477
-	* @return String the aircraft type
11478
-	*
11479
-	*/
11474
+	 * Gets the aircraft type from ModeS
11475
+	 *
11476
+	 * @param String $aircraft_modes the flight ModeS in hex
11477
+	 * @return String the aircraft type
11478
+	 *
11479
+	 */
11480 11480
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11481 11481
 	{
11482 11482
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11502,12 +11502,12 @@  discard block
 block discarded – undo
11502 11502
 	}
11503 11503
 
11504 11504
 	/**
11505
-	* Gets Country from latitude/longitude
11506
-	*
11507
-	* @param Float $latitude latitute of the flight
11508
-	* @param Float $longitude longitute of the flight
11509
-	* @return String the countrie
11510
-	*/
11505
+	 * Gets Country from latitude/longitude
11506
+	 *
11507
+	 * @param Float $latitude latitute of the flight
11508
+	 * @param Float $longitude longitute of the flight
11509
+	 * @return String the countrie
11510
+	 */
11511 11511
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11512 11512
 	{
11513 11513
 		global $globalDBdriver, $globalDebug;
@@ -11544,11 +11544,11 @@  discard block
 block discarded – undo
11544 11544
 	}
11545 11545
 
11546 11546
 	/**
11547
-	* Gets Country from iso2
11548
-	*
11549
-	* @param String $iso2 ISO2 country code
11550
-	* @return String the countrie
11551
-	*/
11547
+	 * Gets Country from iso2
11548
+	 *
11549
+	 * @param String $iso2 ISO2 country code
11550
+	 * @return String the countrie
11551
+	 */
11552 11552
 	public function getCountryFromISO2($iso2)
11553 11553
 	{
11554 11554
 		global $globalDBdriver, $globalDebug;
@@ -11576,12 +11576,12 @@  discard block
 block discarded – undo
11576 11576
 	}
11577 11577
 
11578 11578
 	/**
11579
-	* converts the registration code using the country prefix
11580
-	*
11581
-	* @param String $registration the aircraft registration
11582
-	* @return String the aircraft registration
11583
-	*
11584
-	*/
11579
+	 * converts the registration code using the country prefix
11580
+	 *
11581
+	 * @param String $registration the aircraft registration
11582
+	 * @return String the aircraft registration
11583
+	 *
11584
+	 */
11585 11585
 	public function convertAircraftRegistration($registration)
11586 11586
 	{
11587 11587
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11633,12 +11633,12 @@  discard block
 block discarded – undo
11633 11633
 	}
11634 11634
 
11635 11635
 	/**
11636
-	* Country from the registration code
11637
-	*
11638
-	* @param String $registration the aircraft registration
11639
-	* @return String the country
11640
-	*
11641
-	*/
11636
+	 * Country from the registration code
11637
+	 *
11638
+	 * @param String $registration the aircraft registration
11639
+	 * @return String the country
11640
+	 *
11641
+	 */
11642 11642
 	public function countryFromAircraftRegistration($registration)
11643 11643
 	{
11644 11644
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11657,8 +11657,8 @@  discard block
 block discarded – undo
11657 11657
 				$country = $row['country'];
11658 11658
 			}
11659 11659
 		} else {
11660
-    			$registration_1 = substr($registration, 0, 1);
11661
-		        $registration_2 = substr($registration, 0, 2);
11660
+				$registration_1 = substr($registration, 0, 1);
11661
+				$registration_2 = substr($registration, 0, 2);
11662 11662
 
11663 11663
 			$country = '';
11664 11664
 			//first get the prefix based on two characters
@@ -11694,12 +11694,12 @@  discard block
 block discarded – undo
11694 11694
 	}
11695 11695
 
11696 11696
 	/**
11697
-	* Registration prefix from the registration code
11698
-	*
11699
-	* @param String $registration the aircraft registration
11700
-	* @return String the registration prefix
11701
-	*
11702
-	*/
11697
+	 * Registration prefix from the registration code
11698
+	 *
11699
+	 * @param String $registration the aircraft registration
11700
+	 * @return String the registration prefix
11701
+	 *
11702
+	 */
11703 11703
 	public function registrationPrefixFromAircraftRegistration($registration)
11704 11704
 	{
11705 11705
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11718,8 +11718,8 @@  discard block
 block discarded – undo
11718 11718
 				//$country = $row['country'];
11719 11719
 			}
11720 11720
 		} else {
11721
-    			$registration_1 = substr($registration, 0, 1);
11722
-		        $registration_2 = substr($registration, 0, 2);
11721
+				$registration_1 = substr($registration, 0, 1);
11722
+				$registration_2 = substr($registration, 0, 2);
11723 11723
 
11724 11724
 			//first get the prefix based on two characters
11725 11725
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11755,12 +11755,12 @@  discard block
 block discarded – undo
11755 11755
 
11756 11756
 
11757 11757
 	/**
11758
-	* Country from the registration code
11759
-	*
11760
-	* @param String $registration the aircraft registration
11761
-	* @return String the country
11762
-	*
11763
-	*/
11758
+	 * Country from the registration code
11759
+	 *
11760
+	 * @param String $registration the aircraft registration
11761
+	 * @return String the country
11762
+	 *
11763
+	 */
11764 11764
 	public function countryFromAircraftRegistrationCode($registration)
11765 11765
 	{
11766 11766
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11777,11 +11777,11 @@  discard block
 block discarded – undo
11777 11777
 	}
11778 11778
 	
11779 11779
 	/**
11780
-	* Set a new highlight value for a flight
11781
-	*
11782
-	* @param String $flightaware_id flightaware_id from spotter_output table
11783
-	* @param String $highlight New highlight value
11784
-	*/
11780
+	 * Set a new highlight value for a flight
11781
+	 *
11782
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11783
+	 * @param String $highlight New highlight value
11784
+	 */
11785 11785
 	public function setHighlightFlight($flightaware_id,$highlight) {
11786 11786
 		
11787 11787
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11790,12 +11790,12 @@  discard block
 block discarded – undo
11790 11790
 	}
11791 11791
 
11792 11792
 	/**
11793
-	* Set a new highlight value for a flight by Registration
11794
-	*
11795
-	* @param String $registration Registration of the aircraft
11796
-	* @param String $date Date of spotted aircraft
11797
-	* @param String $highlight New highlight value
11798
-	*/
11793
+	 * Set a new highlight value for a flight by Registration
11794
+	 *
11795
+	 * @param String $registration Registration of the aircraft
11796
+	 * @param String $date Date of spotted aircraft
11797
+	 * @param String $highlight New highlight value
11798
+	 */
11799 11799
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11800 11800
 		if ($date == '') {
11801 11801
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11809,12 +11809,12 @@  discard block
 block discarded – undo
11809 11809
 	}
11810 11810
 	
11811 11811
 	/**
11812
-	* Gets the short url from bit.ly
11813
-	*
11814
-	* @param String $url the full url
11815
-	* @return String the bit.ly url
11816
-	*
11817
-	*/
11812
+	 * Gets the short url from bit.ly
11813
+	 *
11814
+	 * @param String $url the full url
11815
+	 * @return String the bit.ly url
11816
+	 *
11817
+	 */
11818 11818
 	public function getBitlyURL($url)
11819 11819
 	{
11820 11820
 		global $globalBitlyAccessToken;
@@ -12103,11 +12103,11 @@  discard block
 block discarded – undo
12103 12103
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12104 12104
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12105 12105
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12106
-                } else {
12106
+				} else {
12107 12107
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
12108 12108
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12109 12109
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12110
-    		}
12110
+			}
12111 12111
 		$sth = $this->db->prepare($query);
12112 12112
 		$sth->execute();
12113 12113
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1353 added lines, -1353 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,62 +59,62 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter[0]['source'])) {
73
-			$filters = array_merge($filters,$filter);
73
+			$filters = array_merge($filters, $filter);
74 74
 		}
75
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
75
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
76 76
 		$filter_query_join = '';
77 77
 		$filter_query_where = '';
78
-		foreach($filters as $flt) {
78
+		foreach ($filters as $flt) {
79 79
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
80 80
 				if ($flt['airlines'][0] != '') {
81 81
 					if (isset($flt['source'])) {
82
-						$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_output.flightaware_id";
82
+						$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_output.flightaware_id";
83 83
 					} else {
84
-						$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_output.flightaware_id";
84
+						$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_output.flightaware_id";
85 85
 					}
86 86
 				}
87 87
 			}
88 88
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
89 89
 				if (isset($flt['source'])) {
90
-					$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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
90
+					$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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
91 91
 				} else {
92
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
92
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
93 93
 				}
94 94
 			}
95 95
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
96 96
 				if (isset($flt['source'])) {
97
-					$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'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
97
+					$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'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
98 98
 				} else {
99
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
99
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
100 100
 				}
101 101
 			}
102 102
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
103 103
 				if (isset($flt['source'])) {
104
-					$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_output.flightaware_id";
104
+					$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_output.flightaware_id";
105 105
 				} else {
106
-					$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_output.flightaware_id";
106
+					$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_output.flightaware_id";
107 107
 				}
108 108
 			}
109 109
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
110 110
 				if (isset($flt['source'])) {
111
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id";
111
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id";
112 112
 				}
113 113
 			}
114 114
 		}
115 115
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
116 116
 			if ($filter['airlines'][0] != '') {
117
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id";
117
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id";
118 118
 			}
119 119
 		}
120 120
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
125 125
 		}
126 126
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
127
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id";
127
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id";
128 128
 			}
129 129
 		if (isset($filter['source']) && !empty($filter['source'])) {
130
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
130
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
131 131
 		}
132 132
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
133 133
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
134 134
 		}
135 135
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
136
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
136
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
137 137
 		}
138 138
 		if (isset($filter['year']) && $filter['year'] != '') {
139 139
 			if ($globalDBdriver == 'mysql') {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
160 160
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
161 161
 		if ($filter_query_where != '') {
162
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
162
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
163 163
 		}
164 164
 		$filter_query = $filter_query_join.$filter_query_where;
165 165
 		return $filter_query;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	* @return Array the spotter information
175 175
 	*
176 176
 	*/
177
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
177
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
180 180
 		$Image = new Image($this->db);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			$sth = $this->db->prepare($query.$limitQuery);
205 205
 			$sth->execute($params);
206 206
 		} catch (PDOException $e) {
207
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
207
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
208 208
 			exit();
209 209
 		}
210 210
 		
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		$spotter_array = array();
215 215
 		
216 216
 
217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
218 218
 		{
219 219
 			$num_rows++;
220 220
 			$temp_array = array();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
259 259
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
260 260
 				$temp_array['route_stop'] = $row['route_stop'];
261
-				$allroute = explode(' ',$row['route_stop']);
261
+				$allroute = explode(' ', $row['route_stop']);
262 262
 				foreach ($allroute as $route) {
263 263
 					$route_airport_array = $this->getAllAirportInfo($route);
264 264
 					if (isset($route_airport_array[0]['name'])) {
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
 				{
312 312
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
313 313
 				} else {
314
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
314
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
315 315
 				}
316 316
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
317
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
318
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
317
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
318
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
319 319
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
320 320
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
321 321
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
322 322
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
323
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
324
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
323
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
324
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
325 325
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
326 326
 					}
327 327
 				}
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
358 358
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
359 359
 					if (is_numeric(substr($row['ident'], 2, 1))) {
360
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
360
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
361 361
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
362
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
362
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
363 363
 					} else {
364 364
 						$airline_array = $this->getAllAirlineInfo('NA');
365 365
 					}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 				}
397 397
 			}
398 398
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
399
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
399
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
400 400
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
401 401
 				if (count($acars_array) > 0) {
402 402
 					$temp_array['acars'] = $acars_array;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
414 414
 			}
415 415
 
416
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
416
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
417 417
 			{
418 418
 				if ($globalIVAO) {
419
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
420
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
419
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
420
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
421 421
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
422 422
 				if (count($image_array) > 0) {
423 423
 					$temp_array['image'] = $image_array[0]['image'];
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
442 442
 			}
443 443
 			
444
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
444
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
445 445
 				if ($schedules === true) {
446 446
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
447 447
 					//print_r($schedule_array);
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
 			if (isset($row['squawk'])) {
524 524
 				$temp_array['squawk'] = $row['squawk'];
525 525
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
526
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
527
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
526
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
527
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
528 528
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
529
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
530
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
531
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
529
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
530
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
531
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
532 532
 			}
533 533
     			
534 534
 			$temp_array['query_number_rows'] = $num_rows;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	* @return Array the spotter information
548 548
 	*
549 549
 	*/
550
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
550
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
551 551
 	{
552 552
 		global $globalTimezone, $globalDBdriver;
553 553
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 		$query_values = array();
559 559
 		$additional_query = '';
560
-		$filter_query = $this->getFilter($filters,true,true);
560
+		$filter_query = $this->getFilter($filters, true, true);
561 561
 		if ($q != "")
562 562
 		{
563 563
 			if (!is_string($q))
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 				return false;
566 566
 			} else {
567 567
 				$q_array = explode(" ", $q);
568
-				foreach ($q_array as $q_item){
569
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
568
+				foreach ($q_array as $q_item) {
569
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
570 570
 					$additional_query .= " AND (";
571 571
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
572 572
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -598,37 +598,37 @@  discard block
 block discarded – undo
598 598
 
599 599
 		if ($registration != "")
600 600
 		{
601
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
601
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
602 602
 			if (!is_string($registration))
603 603
 			{
604 604
 				return false;
605 605
 			} else {
606 606
 				$additional_query .= " AND spotter_output.registration = :registration";
607
-				$query_values = array_merge($query_values,array(':registration' => $registration));
607
+				$query_values = array_merge($query_values, array(':registration' => $registration));
608 608
 			}
609 609
 		}
610 610
 
611 611
 		if ($aircraft_icao != "")
612 612
 		{
613
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
613
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
614 614
 			if (!is_string($aircraft_icao))
615 615
 			{
616 616
 				return false;
617 617
 			} else {
618 618
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
619
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
619
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
620 620
 			}
621 621
 		}
622 622
 
623 623
 		if ($aircraft_manufacturer != "")
624 624
 		{
625
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
625
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
626 626
 			if (!is_string($aircraft_manufacturer))
627 627
 			{
628 628
 				return false;
629 629
 			} else {
630 630
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
631
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
631
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
632 632
 			}
633 633
 		}
634 634
 
@@ -644,25 +644,25 @@  discard block
 block discarded – undo
644 644
 
645 645
 		if ($airline_icao != "")
646 646
 		{
647
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
648 648
 			if (!is_string($airline_icao))
649 649
 			{
650 650
 				return false;
651 651
 			} else {
652 652
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
653
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
653
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
654 654
 			}
655 655
 		}
656 656
 
657 657
 		if ($airline_country != "")
658 658
 		{
659
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
659
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
660 660
 			if (!is_string($airline_country))
661 661
 			{
662 662
 				return false;
663 663
 			} else {
664 664
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
665
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
665
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
666 666
 			}
667 667
 		}
668 668
 
@@ -689,31 +689,31 @@  discard block
 block discarded – undo
689 689
 
690 690
 		if ($airport != "")
691 691
 		{
692
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
692
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
693 693
 			if (!is_string($airport))
694 694
 			{
695 695
 				return false;
696 696
 			} else {
697 697
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
698
-				$query_values = array_merge($query_values,array(':airport' => $airport));
698
+				$query_values = array_merge($query_values, array(':airport' => $airport));
699 699
 			}
700 700
 		}
701 701
 
702 702
 		if ($airport_country != "")
703 703
 		{
704
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
704
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
705 705
 			if (!is_string($airport_country))
706 706
 			{
707 707
 				return false;
708 708
 			} else {
709 709
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
710
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
710
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
711 711
 			}
712 712
 		}
713 713
     
714 714
 		if ($callsign != "")
715 715
 		{
716
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
716
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
717 717
 			if (!is_string($callsign))
718 718
 			{
719 719
 				return false;
@@ -721,79 +721,79 @@  discard block
 block discarded – undo
721 721
 				$translate = $Translation->ident2icao($callsign);
722 722
 				if ($translate != $callsign) {
723 723
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
724
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
724
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
725 725
 				} else {
726 726
 					$additional_query .= " AND spotter_output.ident = :callsign";
727
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
727
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
728 728
 				}
729 729
 			}
730 730
 		}
731 731
 
732 732
 		if ($owner != "")
733 733
 		{
734
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
734
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
735 735
 			if (!is_string($owner))
736 736
 			{
737 737
 				return false;
738 738
 			} else {
739 739
 				$additional_query .= " AND spotter_output.owner_name = :owner";
740
-				$query_values = array_merge($query_values,array(':owner' => $owner));
740
+				$query_values = array_merge($query_values, array(':owner' => $owner));
741 741
 			}
742 742
 		}
743 743
 
744 744
 		if ($pilot_name != "")
745 745
 		{
746
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
746
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
747 747
 			if (!is_string($pilot_name))
748 748
 			{
749 749
 				return false;
750 750
 			} else {
751 751
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
752
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
752
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
753 753
 			}
754 754
 		}
755 755
 
756 756
 		if ($pilot_id != "")
757 757
 		{
758
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
758
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
759 759
 			if (!is_string($pilot_id))
760 760
 			{
761 761
 				return false;
762 762
 			} else {
763 763
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
764
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
764
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
765 765
 			}
766 766
 		}
767 767
 
768 768
 		if ($departure_airport_route != "")
769 769
 		{
770
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
770
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
771 771
 			if (!is_string($departure_airport_route))
772 772
 			{
773 773
 				return false;
774 774
 			} else {
775 775
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
776
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
776
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
777 777
 			}
778 778
 		}
779 779
 
780 780
 		if ($arrival_airport_route != "")
781 781
 		{
782
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
782
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
783 783
 			if (!is_string($arrival_airport_route))
784 784
 			{
785 785
 				return false;
786 786
 			} else {
787 787
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
788
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
788
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
789 789
 			}
790 790
 		}
791 791
 
792 792
 		if ($altitude != "")
793 793
 		{
794 794
 			$altitude_array = explode(",", $altitude);
795
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
796
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
795
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
796
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
797 797
 
798 798
 			if ($altitude_array[1] != "")
799 799
 			{                
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 		if ($date_posted != "")
810 810
 		{
811 811
 			$date_array = explode(",", $date_posted);
812
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
813
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
812
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
813
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
814 814
 
815 815
 			if ($globalTimezone != '') {
816 816
 				date_default_timezone_set($globalTimezone);
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
 		{
842 842
 			$limit_array = explode(",", $limit);
843 843
 			
844
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
845
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
844
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
845
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
846 846
 			
847 847
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
848 848
 			{
@@ -871,23 +871,23 @@  discard block
 block discarded – undo
871 871
 
872 872
 
873 873
 		if ($origLat != "" && $origLon != "" && $dist != "") {
874
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
874
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
875 875
 
876 876
 			if ($globalDBdriver == 'mysql') {
877
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
877
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
878 878
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
879 879
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
880 880
 			} else {
881
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
881
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
882 882
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
883 883
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
884 884
 			}
885 885
 		} else {		
886
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
886
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
887 887
 					".$additional_query."
888 888
 					".$orderby_query;
889 889
 		}
890
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
890
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
891 891
 		return $spotter_array;
892 892
 	}
893 893
 	
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		{
911 911
 			$limit_array = explode(",", $limit);
912 912
 			
913
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
914
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
913
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
914
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
915 915
 			
916 916
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
917 917
 			{
@@ -928,9 +928,9 @@  discard block
 block discarded – undo
928 928
 			$orderby_query = " ORDER BY spotter_output.date DESC";
929 929
 		}
930 930
 
931
-		$query  = $global_query.$filter_query." ".$orderby_query;
931
+		$query = $global_query.$filter_query." ".$orderby_query;
932 932
 
933
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
933
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
934 934
 
935 935
 		return $spotter_array;
936 936
 	}
@@ -976,34 +976,34 @@  discard block
 block discarded – undo
976 976
 			{
977 977
 				return false;
978 978
 			} else {
979
-				if ($interval == "30m"){
979
+				if ($interval == "30m") {
980 980
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
981
-				} else if ($interval == "1h"){
981
+				} else if ($interval == "1h") {
982 982
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
983
-				} else if ($interval == "3h"){
983
+				} else if ($interval == "3h") {
984 984
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
985
-				} else if ($interval == "6h"){
985
+				} else if ($interval == "6h") {
986 986
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
987
-				} else if ($interval == "12h"){
987
+				} else if ($interval == "12h") {
988 988
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
989
-				} else if ($interval == "24h"){
989
+				} else if ($interval == "24h") {
990 990
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
991
-				} else if ($interval == "7d"){
991
+				} else if ($interval == "7d") {
992 992
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
993
-				} else if ($interval == "30d"){
993
+				} else if ($interval == "30d") {
994 994
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
995 995
 				} 
996 996
 			}
997 997
 		}
998 998
 
999
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
999
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
1000 1000
                    WHERE spotter_output.latitude <> '' 
1001 1001
 				   AND spotter_output.longitude <> '' 
1002 1002
                    ".$additional_query."
1003 1003
                    HAVING distance < :radius  
1004 1004
 				   ORDER BY distance";
1005 1005
 
1006
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
1006
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
1007 1007
 
1008 1008
 		return $spotter_array;
1009 1009
 	}
@@ -1015,21 +1015,21 @@  discard block
 block discarded – undo
1015 1015
 	* @return Array the spotter information
1016 1016
 	*
1017 1017
 	*/
1018
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1018
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
1019 1019
 	{
1020 1020
 		global $global_query;
1021 1021
 		
1022 1022
 		date_default_timezone_set('UTC');
1023 1023
 
1024
-		$filter_query = $this->getFilter($filter,true,true);
1024
+		$filter_query = $this->getFilter($filter, true, true);
1025 1025
 
1026 1026
 		$limit_query = '';
1027 1027
 		if ($limit != "")
1028 1028
 		{
1029 1029
 			$limit_array = explode(",", $limit);
1030 1030
 			
1031
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1032
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1031
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1033 1033
 			
1034 1034
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1035 1035
 			{
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1047 1047
 		}
1048 1048
 
1049
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1049
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1050 1050
 
1051 1051
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1052 1052
 
@@ -1065,15 +1065,15 @@  discard block
 block discarded – undo
1065 1065
 		global $global_query;
1066 1066
 		
1067 1067
 		date_default_timezone_set('UTC');
1068
-		$filter_query = $this->getFilter($filter,true,true);
1068
+		$filter_query = $this->getFilter($filter, true, true);
1069 1069
 
1070 1070
 		$limit_query = '';
1071 1071
 		if ($limit != "")
1072 1072
 		{
1073 1073
 			$limit_array = explode(",", $limit);
1074 1074
 			
1075
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1076
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1075
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1076
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1077 1077
 			
1078 1078
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1079 1079
 			{
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1091 1091
 		}
1092 1092
 
1093
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1093
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1094 1094
 
1095 1095
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1096 1096
 
@@ -1104,20 +1104,20 @@  discard block
 block discarded – undo
1104 1104
 	* @return Array the spotter information
1105 1105
 	*
1106 1106
 	*/
1107
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1107
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1108 1108
 	{
1109 1109
 		global $global_query;
1110 1110
 		
1111 1111
 		date_default_timezone_set('UTC');
1112
-		$filter_query = $this->getFilter($filter,true,true);
1112
+		$filter_query = $this->getFilter($filter, true, true);
1113 1113
 		
1114 1114
 		$limit_query = '';
1115 1115
 		if ($limit != "")
1116 1116
 		{
1117 1117
 			$limit_array = explode(",", $limit);
1118 1118
 			
1119
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1120
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1119
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1120
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1121 1121
 			
1122 1122
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1123 1123
 			{
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1135 1135
 		}
1136 1136
 
1137
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1137
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1138 1138
 
1139 1139
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1140 1140
 
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 		
1155 1155
 		date_default_timezone_set('UTC');
1156 1156
 		
1157
-		$filter_query = $this->getFilter($filter,true,true);
1157
+		$filter_query = $this->getFilter($filter, true, true);
1158 1158
 		
1159 1159
 		$limit_query = '';
1160 1160
 		
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 		{
1163 1163
 			$limit_array = explode(",", $limit);
1164 1164
 			
1165
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1166
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1165
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1167 1167
 			
1168 1168
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1169 1169
 			{
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1181 1181
 		}
1182 1182
 
1183
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1183
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1184 1184
 
1185 1185
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1186 1186
 
@@ -1199,14 +1199,14 @@  discard block
 block discarded – undo
1199 1199
 		global $global_query;
1200 1200
 		
1201 1201
 		date_default_timezone_set('UTC');
1202
-		$filter_query = $this->getFilter($filter,true,true);
1202
+		$filter_query = $this->getFilter($filter, true, true);
1203 1203
 		$limit_query = '';
1204 1204
 		if ($limit != "")
1205 1205
 		{
1206 1206
 			$limit_array = explode(",", $limit);
1207 1207
 			
1208
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1209
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1208
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1209
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1210 1210
 			
1211 1211
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1212 1212
 			{
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1224 1224
 		}
1225 1225
 
1226
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1226
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1227 1227
 
1228 1228
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1229 1229
 
@@ -1247,9 +1247,9 @@  discard block
 block discarded – undo
1247 1247
 		$query_values = array(':id' => $id);
1248 1248
 
1249 1249
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1250
-		$query  = $global_query." WHERE ".$additional_query." ";
1250
+		$query = $global_query." WHERE ".$additional_query." ";
1251 1251
 
1252
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1252
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1253 1253
 
1254 1254
 		return $spotter_array;
1255 1255
 	}
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 		$query_values = array();
1273 1273
 		$limit_query = '';
1274 1274
 		$additional_query = '';
1275
-		$filter_query = $this->getFilter($filter,true,true);
1275
+		$filter_query = $this->getFilter($filter, true, true);
1276 1276
 		if ($ident != "")
1277 1277
 		{
1278 1278
 			if (!is_string($ident))
@@ -1288,8 +1288,8 @@  discard block
 block discarded – undo
1288 1288
 		{
1289 1289
 			$limit_array = explode(",", $limit);
1290 1290
 			
1291
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1292
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1291
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1292
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1293 1293
 			
1294 1294
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1295 1295
 			{
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 		$query_values = array();
1329 1329
 		$limit_query = '';
1330 1330
 		$additional_query = '';
1331
-		$filter_query = $this->getFilter($filter,true,true);
1331
+		$filter_query = $this->getFilter($filter, true, true);
1332 1332
 		if ($owner != "")
1333 1333
 		{
1334 1334
 			if (!is_string($owner))
@@ -1344,8 +1344,8 @@  discard block
 block discarded – undo
1344 1344
 		{
1345 1345
 			$limit_array = explode(",", $limit);
1346 1346
 			
1347
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1348
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1347
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1348
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1349 1349
 			
1350 1350
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1351 1351
 			{
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 		$query_values = array();
1386 1386
 		$limit_query = '';
1387 1387
 		$additional_query = '';
1388
-		$filter_query = $this->getFilter($filter,true,true);
1388
+		$filter_query = $this->getFilter($filter, true, true);
1389 1389
 		if ($pilot != "")
1390 1390
 		{
1391 1391
 			$additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
@@ -1396,8 +1396,8 @@  discard block
 block discarded – undo
1396 1396
 		{
1397 1397
 			$limit_array = explode(",", $limit);
1398 1398
 			
1399
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1400
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1399
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1400
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1401 1401
 			
1402 1402
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1403 1403
 			{
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 		$query_values = array();
1439 1439
 		$limit_query = '';
1440 1440
 		$additional_query = '';
1441
-		$filter_query = $this->getFilter($filter,true,true);
1441
+		$filter_query = $this->getFilter($filter, true, true);
1442 1442
 		
1443 1443
 		if ($aircraft_type != "")
1444 1444
 		{
@@ -1455,8 +1455,8 @@  discard block
 block discarded – undo
1455 1455
 		{
1456 1456
 			$limit_array = explode(",", $limit);
1457 1457
 			
1458
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1459
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1458
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1459
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1460 1460
 			
1461 1461
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1462 1462
 			{
@@ -1512,8 +1512,8 @@  discard block
 block discarded – undo
1512 1512
 		{
1513 1513
 			$limit_array = explode(",", $limit);
1514 1514
 			
1515
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1516
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1515
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1516
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1517 1517
 			
1518 1518
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1519 1519
 			{
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 		} else {
1530 1530
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1531 1531
 		}
1532
-		$filter_query = $this->getFilter($filter,true,true);
1532
+		$filter_query = $this->getFilter($filter, true, true);
1533 1533
 
1534 1534
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1535 1535
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 	* @return Array the spotter information
1549 1549
 	*
1550 1550
 	*/
1551
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1551
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
1554 1554
 		
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 		$query_values = array();
1558 1558
 		$limit_query = '';
1559 1559
 		$additional_query = '';
1560
-		$filter_query = $this->getFilter($filters,true,true);
1560
+		$filter_query = $this->getFilter($filters, true, true);
1561 1561
 		
1562 1562
 		if ($airline != "")
1563 1563
 		{
@@ -1574,8 +1574,8 @@  discard block
 block discarded – undo
1574 1574
 		{
1575 1575
 			$limit_array = explode(",", $limit);
1576 1576
 			
1577
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1578
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1577
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1578
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1579 1579
 			
1580 1580
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1581 1581
 			{
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	* @return Array the spotter information
1606 1606
 	*
1607 1607
 	*/
1608
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1608
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1609 1609
 	{
1610 1610
 		global $global_query;
1611 1611
 		
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 		$query_values = array();
1614 1614
 		$limit_query = '';
1615 1615
 		$additional_query = '';
1616
-		$filter_query = $this->getFilter($filters,true,true);
1616
+		$filter_query = $this->getFilter($filters, true, true);
1617 1617
 		
1618 1618
 		if ($airport != "")
1619 1619
 		{
@@ -1630,8 +1630,8 @@  discard block
 block discarded – undo
1630 1630
 		{
1631 1631
 			$limit_array = explode(",", $limit);
1632 1632
 			
1633
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1634
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1633
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1634
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1635 1635
 			
1636 1636
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1637 1637
 			{
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 	* @return Array the spotter information
1664 1664
 	*
1665 1665
 	*/
1666
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1666
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1667 1667
 	{
1668 1668
 		global $global_query, $globalTimezone, $globalDBdriver;
1669 1669
 		
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 		$limit_query = '';
1672 1672
 		$additional_query = '';
1673 1673
 
1674
-		$filter_query = $this->getFilter($filter,true,true);
1674
+		$filter_query = $this->getFilter($filter, true, true);
1675 1675
 		
1676 1676
 		if ($date != "")
1677 1677
 		{
@@ -1700,8 +1700,8 @@  discard block
 block discarded – undo
1700 1700
 		{
1701 1701
 			$limit_array = explode(",", $limit);
1702 1702
 			
1703
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1704
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1703
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1704
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1705 1705
 			
1706 1706
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1707 1707
 			{
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 	* @return Array the spotter information
1732 1732
 	*
1733 1733
 	*/
1734
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1734
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1735 1735
 	{
1736 1736
 		global $global_query;
1737 1737
 		
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 		$query_values = array();
1741 1741
 		$limit_query = '';
1742 1742
 		$additional_query = '';
1743
-		$filter_query = $this->getFilter($filters,true,true);
1743
+		$filter_query = $this->getFilter($filters, true, true);
1744 1744
 		if ($country != "")
1745 1745
 		{
1746 1746
 			if (!is_string($country))
@@ -1757,8 +1757,8 @@  discard block
 block discarded – undo
1757 1757
 		{
1758 1758
 			$limit_array = explode(",", $limit);
1759 1759
 			
1760
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1761
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1760
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1761
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1762 1762
 			
1763 1763
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1764 1764
 			{
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		$query_values = array();
1799 1799
 		$additional_query = '';
1800 1800
 		$limit_query = '';
1801
-		$filter_query = $this->getFilter($filters,true,true);
1801
+		$filter_query = $this->getFilter($filters, true, true);
1802 1802
 		
1803 1803
 		if ($aircraft_manufacturer != "")
1804 1804
 		{
@@ -1815,8 +1815,8 @@  discard block
 block discarded – undo
1815 1815
 		{
1816 1816
 			$limit_array = explode(",", $limit);
1817 1817
 			
1818
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1819
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1818
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1819
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1820 1820
 			
1821 1821
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1822 1822
 			{
@@ -1858,14 +1858,14 @@  discard block
 block discarded – undo
1858 1858
 		$query_values = array();
1859 1859
 		$additional_query = '';
1860 1860
 		$limit_query = '';
1861
-		$filter_query = $this->getFilter($filters,true,true);
1861
+		$filter_query = $this->getFilter($filters, true, true);
1862 1862
 		if ($departure_airport_icao != "")
1863 1863
 		{
1864 1864
 			if (!is_string($departure_airport_icao))
1865 1865
 			{
1866 1866
 				return false;
1867 1867
 			} else {
1868
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1868
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1869 1869
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1870 1870
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1871 1871
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1878,10 +1878,10 @@  discard block
 block discarded – undo
1878 1878
 			{
1879 1879
 				return false;
1880 1880
 			} else {
1881
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1881
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1882 1882
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1883 1883
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1884
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1884
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1885 1885
 			}
1886 1886
 		}
1887 1887
 		
@@ -1889,8 +1889,8 @@  discard block
 block discarded – undo
1889 1889
 		{
1890 1890
 			$limit_array = explode(",", $limit);
1891 1891
 			
1892
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1893
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1892
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1893
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1894 1894
 			
1895 1895
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1896 1896
 			{
@@ -1929,15 +1929,15 @@  discard block
 block discarded – undo
1929 1929
 		global $global_query;
1930 1930
 		
1931 1931
 		date_default_timezone_set('UTC');
1932
-		$filter_query = $this->getFilter($filter,true,true);
1932
+		$filter_query = $this->getFilter($filter, true, true);
1933 1933
 		$limit_query = '';
1934 1934
 		
1935 1935
 		if ($limit != "")
1936 1936
 		{
1937 1937
 			$limit_array = explode(",", $limit);
1938 1938
 			
1939
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1940
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1939
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1940
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1941 1941
 			
1942 1942
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1943 1943
 			{
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1955 1955
 		}
1956 1956
 
1957
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1957
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1958 1958
 
1959 1959
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1960 1960
 
@@ -1967,19 +1967,19 @@  discard block
 block discarded – undo
1967 1967
 	* @return String the highlight text
1968 1968
 	*
1969 1969
 	*/
1970
-	public function getHighlightByRegistration($registration,$filter = array())
1970
+	public function getHighlightByRegistration($registration, $filter = array())
1971 1971
 	{
1972 1972
 		global $global_query;
1973 1973
 		
1974 1974
 		date_default_timezone_set('UTC');
1975
-		$filter_query = $this->getFilter($filter,true,true);
1976
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1975
+		$filter_query = $this->getFilter($filter, true, true);
1976
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1977 1977
 		
1978
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1978
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1979 1979
 		$sth = $this->db->prepare($query);
1980 1980
 		$sth->execute(array(':registration' => $registration));
1981 1981
 
1982
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1982
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1983 1983
 		{
1984 1984
 			$highlight = $row['highlight'];
1985 1985
 		}
@@ -1995,14 +1995,14 @@  discard block
 block discarded – undo
1995 1995
 	* @return String usage
1996 1996
 	*
1997 1997
 	*/
1998
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1998
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1999 1999
 	{
2000 2000
 		
2001
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
2002
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
2001
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
2002
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
2003 2003
 
2004 2004
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
2005
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
2005
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
2006 2006
 		
2007 2007
 		$sth = $this->db->prepare($query);
2008 2008
 		$sth->execute($query_values);
@@ -2024,9 +2024,9 @@  discard block
 block discarded – undo
2024 2024
 	public function getAirportIcao($airport_iata = '')
2025 2025
 	{
2026 2026
 		
2027
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
2027
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
2028 2028
 
2029
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2029
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2030 2030
 		$query_values = array(':airport' => $airport_iata);
2031 2031
 		
2032 2032
 		$sth = $this->db->prepare($query);
@@ -2048,12 +2048,12 @@  discard block
 block discarded – undo
2048 2048
 	* @return Float distance to the airport
2049 2049
 	*
2050 2050
 	*/
2051
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2051
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2052 2052
 	{
2053 2053
 		
2054
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2054
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2055 2055
 
2056
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2056
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2057 2057
 		$query_values = array(':airport' => $airport_icao);
2058 2058
 		$sth = $this->db->prepare($query);
2059 2059
 		$sth->execute($query_values);
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
 			$airport_latitude = $row['latitude'];
2064 2064
 			$airport_longitude = $row['longitude'];
2065 2065
 			$Common = new Common();
2066
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2066
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2067 2067
 		} else return '';
2068 2068
 	}
2069 2069
 	
@@ -2077,11 +2077,11 @@  discard block
 block discarded – undo
2077 2077
 	public function getAllAirportInfo($airport = '')
2078 2078
 	{
2079 2079
 		
2080
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2080
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2081 2081
 
2082 2082
 		$query_values = array();
2083 2083
 		if ($airport == 'NA') {
2084
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
2084
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
2085 2085
 		} elseif ($airport == '') {
2086 2086
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
2087 2087
 		} else {
@@ -2129,14 +2129,14 @@  discard block
 block discarded – undo
2129 2129
 	{
2130 2130
 		$lst_countries = '';
2131 2131
 		foreach ($countries as $country) {
2132
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2132
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2133 2133
 			if ($lst_countries == '') {
2134 2134
 				$lst_countries = "'".$country."'";
2135 2135
 			} else {
2136 2136
 				$lst_countries .= ",'".$country."'";
2137 2137
 			}
2138 2138
 		}
2139
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2139
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2140 2140
 		
2141 2141
 		$sth = $this->db->prepare($query);
2142 2142
 		$sth->execute();
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 		$airport_array = array();
2145 2145
 		$temp_array = array();
2146 2146
 		
2147
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2147
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2148 2148
 		{
2149 2149
 			$temp_array['name'] = $row['name'];
2150 2150
 			$temp_array['city'] = $row['city'];
@@ -2172,10 +2172,10 @@  discard block
 block discarded – undo
2172 2172
 	{
2173 2173
 		global $globalDBdriver;
2174 2174
 		if (is_array($coord)) {
2175
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2176
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2177
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2178
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2175
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2176
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2177
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2178
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2179 2179
 		} else return array();
2180 2180
 		if ($globalDBdriver == 'mysql') {
2181 2181
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2187,7 +2187,7 @@  discard block
 block discarded – undo
2187 2187
     
2188 2188
 		$airport_array = array();
2189 2189
 		
2190
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2190
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2191 2191
 		{
2192 2192
 			$temp_array = $row;
2193 2193
 
@@ -2207,13 +2207,13 @@  discard block
 block discarded – undo
2207 2207
 	public function getAllWaypointsInfobyCoord($coord)
2208 2208
 	{
2209 2209
 		if (is_array($coord)) {
2210
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2211
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2212
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2213
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2210
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2211
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2212
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2213
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2214 2214
 		} else return array();
2215 2215
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2216
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2216
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2217 2217
 		//$query  = "SELECT waypoints.* FROM waypoints";
2218 2218
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2219 2219
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
     
2226 2226
 		$waypoints_array = array();
2227 2227
 		
2228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2229 2229
 		{
2230 2230
 			$temp_array = $row;
2231 2231
 
@@ -2247,10 +2247,10 @@  discard block
 block discarded – undo
2247 2247
 	{
2248 2248
 		global $globalUseRealAirlines;
2249 2249
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2250
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2250
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2251 2251
 		if ($airline_icao == 'NA') {
2252 2252
 			$airline_array = array();
2253
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2253
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2254 2254
 			return $airline_array;
2255 2255
 		} else {
2256 2256
 			if (strlen($airline_icao) == 2) {
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
 			if ($fromsource === NULL) {
2272 2272
 				$sth->execute(array(':airline_icao' => $airline_icao));
2273 2273
 			} else {
2274
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2274
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2275 2275
 			}
2276 2276
                         /*
2277 2277
 			$airline_array = array();
@@ -2316,13 +2316,13 @@  discard block
 block discarded – undo
2316 2316
 	{
2317 2317
 		global $globalUseRealAirlines;
2318 2318
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2319
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2320
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2319
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2320
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2321 2321
 		$sth = $this->db->prepare($query);
2322 2322
 		if ($fromsource === NULL) {
2323 2323
 			$sth->execute(array(':airline_name' => $airline_name));
2324 2324
 		} else {
2325
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2325
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2326 2326
 		}
2327 2327
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2328 2328
 		if (empty($result) && $fromsource !== NULL) {
@@ -2347,12 +2347,12 @@  discard block
 block discarded – undo
2347 2347
 	*/
2348 2348
 	public function getAllAircraftInfo($aircraft_type)
2349 2349
 	{
2350
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2350
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2351 2351
 
2352 2352
 		if ($aircraft_type == 'NA') {
2353
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2353
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2354 2354
 		}
2355
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2355
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2356 2356
 		
2357 2357
 		$sth = $this->db->prepare($query);
2358 2358
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2384,7 +2384,7 @@  discard block
 block discarded – undo
2384 2384
 	*/
2385 2385
 	public function getAircraftIcao($aircraft_type)
2386 2386
 	{
2387
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2387
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2388 2388
 		$all_aircraft = array('737-300' => 'B733',
2389 2389
 				'777-200' => 'B772',
2390 2390
 				'777-200ER' => 'B772',
@@ -2396,10 +2396,10 @@  discard block
 block discarded – undo
2396 2396
 				'A380' => 'A388');
2397 2397
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2398 2398
 
2399
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2399
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2400 2400
 		$aircraft_type = strtoupper($aircraft_type);
2401 2401
 		$sth = $this->db->prepare($query);
2402
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2402
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2403 2403
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2404 2404
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2405 2405
 		else return '';
@@ -2412,10 +2412,10 @@  discard block
 block discarded – undo
2412 2412
 	* @return String aircraft type
2413 2413
 	*
2414 2414
 	*/
2415
-	public function getAllAircraftType($aircraft_modes,$source_type = '')
2415
+	public function getAllAircraftType($aircraft_modes, $source_type = '')
2416 2416
 	{
2417
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2418
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
2417
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2418
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
2419 2419
 
2420 2420
 		if ($source_type == '' || $source_type == 'modes') {
2421 2421
 			$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
@@ -2446,9 +2446,9 @@  discard block
 block discarded – undo
2446 2446
 	*/
2447 2447
 	public function getAllAircraftTypeByRegistration($registration)
2448 2448
 	{
2449
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2449
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2450 2450
 
2451
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2451
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2452 2452
 		
2453 2453
 		$sth = $this->db->prepare($query);
2454 2454
 		$sth->execute(array(':registration' => $registration));
@@ -2469,9 +2469,9 @@  discard block
 block discarded – undo
2469 2469
 	*/
2470 2470
 	public function getAllIDByRegistration($registration)
2471 2471
 	{
2472
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2472
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2473 2473
 
2474
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2474
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2475 2475
 		
2476 2476
 		$sth = $this->db->prepare($query);
2477 2477
 		$sth->execute(array(':registration' => $registration));
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
 		$idarray = array();
2480 2480
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2481 2481
 			$date = $row['date'];
2482
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2482
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2483 2483
 		}
2484 2484
 		return $idarray;
2485 2485
 	}
@@ -2493,8 +2493,8 @@  discard block
 block discarded – undo
2493 2493
 	*/
2494 2494
 	public function getOperator($operator)
2495 2495
 	{
2496
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2497
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2496
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2497
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2498 2498
 		
2499 2499
 		$sth = $this->db->prepare($query);
2500 2500
 		$sth->execute(array(':operator' => $operator));
@@ -2515,9 +2515,9 @@  discard block
 block discarded – undo
2515 2515
 	*/
2516 2516
 	public function getRouteInfo($callsign)
2517 2517
 	{
2518
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2518
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2519 2519
                 if ($callsign == '') return array();
2520
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2520
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2521 2521
 		
2522 2522
 		$sth = $this->db->prepare($query);
2523 2523
 		$sth->execute(array(':callsign' => $callsign));
@@ -2538,9 +2538,9 @@  discard block
 block discarded – undo
2538 2538
 	*/
2539 2539
 	public function getAircraftInfoByRegistration($registration)
2540 2540
 	{
2541
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2541
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2542 2542
 
2543
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2543
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2544 2544
 		
2545 2545
 		$sth = $this->db->prepare($query);
2546 2546
 		$sth->execute(array(':registration' => $registration));
@@ -2548,7 +2548,7 @@  discard block
 block discarded – undo
2548 2548
 		$aircraft_array = array();
2549 2549
 		$temp_array = array();
2550 2550
 		
2551
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2551
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2552 2552
 		{
2553 2553
 			$temp_array['airline_icao'] = $row['airline_icao'];
2554 2554
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 	*/
2571 2571
 	public function getAircraftOwnerByRegistration($registration)
2572 2572
 	{
2573
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2573
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2574 2574
 		$Connection = new Connection($this->db);
2575 2575
 		if ($Connection->tableExists('aircraft_owner')) {
2576 2576
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 	public function getAllFlightsforSitemap()
2593 2593
 	{
2594 2594
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2595
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2595
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2596 2596
 		
2597 2597
 		$sth = $this->db->prepare($query);
2598 2598
 		$sth->execute();
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
 		$manufacturer_array = array();
2640 2640
 		$temp_array = array();
2641 2641
 		
2642
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2642
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2643 2643
 		{
2644 2644
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2645 2645
 
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
 		$aircraft_array = array();
2677 2677
 		$temp_array = array();
2678 2678
 		
2679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2680 2680
 		{
2681 2681
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2682 2682
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2697,8 +2697,8 @@  discard block
 block discarded – undo
2697 2697
 	*/
2698 2698
 	public function getAllAircraftRegistrations($filters = array())
2699 2699
 	{
2700
-		$filter_query = $this->getFilter($filters,true,true);
2701
-		$query  = "SELECT DISTINCT spotter_output.registration 
2700
+		$filter_query = $this->getFilter($filters, true, true);
2701
+		$query = "SELECT DISTINCT spotter_output.registration 
2702 2702
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2703 2703
 				ORDER BY spotter_output.registration ASC";
2704 2704
 
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 		$aircraft_array = array();
2709 2709
 		$temp_array = array();
2710 2710
 		
2711
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2711
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2712 2712
 		{
2713 2713
 			$temp_array['registration'] = $row['registration'];
2714 2714
 
@@ -2725,11 +2725,11 @@  discard block
 block discarded – undo
2725 2725
 	* @return Array list of source name
2726 2726
 	*
2727 2727
 	*/
2728
-	public function getAllSourceName($type = '',$filters = array())
2728
+	public function getAllSourceName($type = '', $filters = array())
2729 2729
 	{
2730
-		$filter_query = $this->getFilter($filters,true,true);
2730
+		$filter_query = $this->getFilter($filters, true, true);
2731 2731
 		$query_values = array();
2732
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2732
+		$query = "SELECT DISTINCT spotter_output.source_name 
2733 2733
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2734 2734
 		if ($type != '') {
2735 2735
 			$query_values = array(':type' => $type);
@@ -2744,7 +2744,7 @@  discard block
 block discarded – undo
2744 2744
 		$source_array = array();
2745 2745
 		$temp_array = array();
2746 2746
 		
2747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2748 2748
 		{
2749 2749
 			$temp_array['source_name'] = $row['source_name'];
2750 2750
 			$source_array[] = $temp_array;
@@ -2760,11 +2760,11 @@  discard block
 block discarded – undo
2760 2760
 	* @return Array list of airline names
2761 2761
 	*
2762 2762
 	*/
2763
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2763
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2764 2764
 	{
2765
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766
-		$filter_query = $this->getFilter($filters,true,true);
2767
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2765
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2766
+		$filter_query = $this->getFilter($filters, true, true);
2767
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2768 2768
 		if ($airline_type == '' || $airline_type == 'all') {
2769 2769
 			/*
2770 2770
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
 				$query_data = array(':forsource' => $forsource);
2784 2784
 			}
2785 2785
 		} else {
2786
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2786
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2787 2787
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2788 2788
 					AND spotter_output.airline_type = :airline_type 
2789 2789
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2796,7 +2796,7 @@  discard block
 block discarded – undo
2796 2796
 		$airline_array = array();
2797 2797
 		$temp_array = array();
2798 2798
 		
2799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2800 2800
 		{
2801 2801
 			$temp_array['airline_icao'] = $row['airline_icao'];
2802 2802
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2813,10 +2813,10 @@  discard block
 block discarded – undo
2813 2813
 	* @return Array list of alliance names
2814 2814
 	*
2815 2815
 	*/
2816
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2816
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2817 2817
 	{
2818
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2819
-		$filter_query = $this->getFilter($filters,true,true);
2818
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2819
+		$filter_query = $this->getFilter($filters, true, true);
2820 2820
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2821 2821
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2822 2822
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2844,8 +2844,8 @@  discard block
 block discarded – undo
2844 2844
 	*/
2845 2845
 	public function getAllAirlineCountries($filters = array())
2846 2846
 	{
2847
-		$filter_query = $this->getFilter($filters,true,true);
2848
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2847
+		$filter_query = $this->getFilter($filters, true, true);
2848
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2849 2849
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2850 2850
 				ORDER BY spotter_output.airline_country ASC";
2851 2851
 		
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
 		$airline_array = array();
2857 2857
 		$temp_array = array();
2858 2858
 		
2859
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2859
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2860 2860
 		{
2861 2861
 			$temp_array['airline_country'] = $row['airline_country'];
2862 2862
 
@@ -2876,9 +2876,9 @@  discard block
 block discarded – undo
2876 2876
 	*/
2877 2877
 	public function getAllAirportNames($filters = array())
2878 2878
 	{
2879
-		$filter_query = $this->getFilter($filters,true,true);
2879
+		$filter_query = $this->getFilter($filters, true, true);
2880 2880
 		$airport_array = array();
2881
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2881
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2882 2882
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2883 2883
 				ORDER BY spotter_output.departure_airport_city ASC";
2884 2884
 		
@@ -2887,7 +2887,7 @@  discard block
 block discarded – undo
2887 2887
 		$sth->execute();
2888 2888
 
2889 2889
 		$temp_array = array();
2890
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2890
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2891 2891
 		{
2892 2892
 			$temp_array['airport_icao'] = $row['airport_icao'];
2893 2893
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2897,14 +2897,14 @@  discard block
 block discarded – undo
2897 2897
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2898 2898
 		}
2899 2899
 
2900
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2900
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2901 2901
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2902 2902
 								ORDER BY spotter_output.arrival_airport_city ASC";
2903 2903
 					
2904 2904
 		$sth = $this->db->prepare($query);
2905 2905
 		$sth->execute();
2906 2906
 
2907
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2907
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2908 2908
 			{
2909 2909
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2910 2910
 		//	{
@@ -2928,8 +2928,8 @@  discard block
 block discarded – undo
2928 2928
 	*/
2929 2929
 	public function getAllOwnerNames($filters = array())
2930 2930
 	{
2931
-		$filter_query = $this->getFilter($filters,true,true);
2932
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2931
+		$filter_query = $this->getFilter($filters, true, true);
2932
+		$query = "SELECT DISTINCT spotter_output.owner_name
2933 2933
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2934 2934
 				ORDER BY spotter_output.owner_name ASC";
2935 2935
 		
@@ -2946,8 +2946,8 @@  discard block
 block discarded – undo
2946 2946
 	*/
2947 2947
 	public function getAllPilotNames($filters = array())
2948 2948
 	{
2949
-		$filter_query = $this->getFilter($filters,true,true);
2950
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2949
+		$filter_query = $this->getFilter($filters, true, true);
2950
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2951 2951
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2952 2952
 				ORDER BY spotter_output.pilot_name ASC";
2953 2953
 		
@@ -2980,21 +2980,21 @@  discard block
 block discarded – undo
2980 2980
    
2981 2981
 		$temp_array = array();
2982 2982
 		
2983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2984 2984
 		{
2985 2985
 			$temp_array['airport_country'] = $row['airport_country'];
2986 2986
 
2987 2987
 			$airport_array[$row['airport_country']] = $temp_array;
2988 2988
 		}
2989
-		$filter_query = $this->getFilter($filters,true,true);
2990
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2989
+		$filter_query = $this->getFilter($filters, true, true);
2990
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2991 2991
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2992 2992
 								ORDER BY spotter_output.arrival_airport_country ASC";
2993 2993
 					
2994 2994
 		$sth = $this->db->prepare($query);
2995 2995
 		$sth->execute();
2996 2996
 		
2997
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2997
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2998 2998
 		{
2999 2999
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
3000 3000
 			{
@@ -3017,9 +3017,9 @@  discard block
 block discarded – undo
3017 3017
 	*/
3018 3018
 	public function getAllCountries($filters = array())
3019 3019
 	{
3020
-		$Connection= new Connection($this->db);
3020
+		$Connection = new Connection($this->db);
3021 3021
 		if ($Connection->tableExists('countries')) {
3022
-			$query  = "SELECT countries.name AS airport_country
3022
+			$query = "SELECT countries.name AS airport_country
3023 3023
 				FROM countries
3024 3024
 				ORDER BY countries.name ASC";
3025 3025
 			$sth = $this->db->prepare($query);
@@ -3028,14 +3028,14 @@  discard block
 block discarded – undo
3028 3028
 			$temp_array = array();
3029 3029
 			$country_array = array();
3030 3030
 		
3031
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3031
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3032 3032
 			{
3033 3033
 				$temp_array['country'] = $row['airport_country'];
3034 3034
 				$country_array[$row['airport_country']] = $temp_array;
3035 3035
 			}
3036 3036
 		} else {
3037
-			$filter_query = $this->getFilter($filters,true,true);
3038
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3037
+			$filter_query = $this->getFilter($filters, true, true);
3038
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3039 3039
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
3040 3040
 								ORDER BY spotter_output.departure_airport_country ASC";
3041 3041
 
@@ -3044,20 +3044,20 @@  discard block
 block discarded – undo
3044 3044
    
3045 3045
 			$temp_array = array();
3046 3046
 			$country_array = array();
3047
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3047
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3048 3048
 			{
3049 3049
 				$temp_array['country'] = $row['airport_country'];
3050 3050
 				$country_array[$row['airport_country']] = $temp_array;
3051 3051
 			}
3052 3052
 
3053
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3053
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3054 3054
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3055 3055
 								ORDER BY spotter_output.arrival_airport_country ASC";
3056 3056
 					
3057 3057
 		$sth = $this->db->prepare($query);
3058 3058
 		$sth->execute();
3059 3059
 		
3060
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3060
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3061 3061
 		{
3062 3062
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3063 3063
 			{
@@ -3067,14 +3067,14 @@  discard block
 block discarded – undo
3067 3067
 			}
3068 3068
 		}
3069 3069
 		
3070
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3070
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3071 3071
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3072 3072
 								ORDER BY spotter_output.airline_country ASC";
3073 3073
 					
3074 3074
 		$sth = $this->db->prepare($query);
3075 3075
 		$sth->execute();
3076 3076
 		
3077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3078 3078
 		{
3079 3079
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3080 3080
 			{
@@ -3098,8 +3098,8 @@  discard block
 block discarded – undo
3098 3098
 	*/
3099 3099
 	public function getAllIdents($filters = array())
3100 3100
 	{
3101
-		$filter_query = $this->getFilter($filters,true,true);
3102
-		$query  = "SELECT DISTINCT spotter_output.ident
3101
+		$filter_query = $this->getFilter($filters, true, true);
3102
+		$query = "SELECT DISTINCT spotter_output.ident
3103 3103
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3104 3104
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3105 3105
 
@@ -3109,7 +3109,7 @@  discard block
 block discarded – undo
3109 3109
 		$ident_array = array();
3110 3110
 		$temp_array = array();
3111 3111
 		
3112
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3112
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3113 3113
 		{
3114 3114
 			$temp_array['ident'] = $row['ident'];
3115 3115
 			$ident_array[] = $temp_array;
@@ -3123,9 +3123,9 @@  discard block
 block discarded – undo
3123 3123
 	* @return Array number, icao, name and city of airports
3124 3124
 	*/
3125 3125
 
3126
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3126
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3127 3127
 		global $globalTimezone, $globalDBdriver;
3128
-		$filter_query = $this->getFilter($filters,true,true);
3128
+		$filter_query = $this->getFilter($filters, true, true);
3129 3129
 		if ($globalTimezone != '') {
3130 3130
 			date_default_timezone_set($globalTimezone);
3131 3131
 			$datetime = new DateTime();
@@ -3190,7 +3190,7 @@  discard block
 block discarded – undo
3190 3190
 
3191 3191
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3192 3192
 		global $globalTimezone, $globalDBdriver;
3193
-		$filter_query = $this->getFilter($filters,true,true);
3193
+		$filter_query = $this->getFilter($filters, true, true);
3194 3194
 		if ($globalTimezone != '') {
3195 3195
 			date_default_timezone_set($globalTimezone);
3196 3196
 			$datetime = new DateTime();
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
 
3275 3275
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3276 3276
 		global $globalTimezone, $globalDBdriver;
3277
-		$filter_query = $this->getFilter($filters,true,true);
3277
+		$filter_query = $this->getFilter($filters, true, true);
3278 3278
 		if ($globalTimezone != '') {
3279 3279
 			date_default_timezone_set($globalTimezone);
3280 3280
 			$datetime = new DateTime();
@@ -3307,9 +3307,9 @@  discard block
 block discarded – undo
3307 3307
 	* @return Array number, icao, name and city of airports
3308 3308
 	*/
3309 3309
 
3310
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3310
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3311 3311
 		global $globalTimezone, $globalDBdriver;
3312
-		$filter_query = $this->getFilter($filters,true,true);
3312
+		$filter_query = $this->getFilter($filters, true, true);
3313 3313
 		if ($globalTimezone != '') {
3314 3314
 			date_default_timezone_set($globalTimezone);
3315 3315
 			$datetime = new DateTime();
@@ -3441,12 +3441,12 @@  discard block
 block discarded – undo
3441 3441
 		} else $offset = '+00:00';
3442 3442
 
3443 3443
 		if ($globalDBdriver == 'mysql') {
3444
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3444
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3445 3445
 								FROM spotter_output
3446 3446
 								WHERE spotter_output.date <> '' 
3447 3447
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3448 3448
 		} else {
3449
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3449
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3450 3450
 								FROM spotter_output
3451 3451
 								WHERE spotter_output.date <> '' 
3452 3452
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3458,7 +3458,7 @@  discard block
 block discarded – undo
3458 3458
 		$date_array = array();
3459 3459
 		$temp_array = array();
3460 3460
 		
3461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3462 3462
 		{
3463 3463
 			$temp_array['date'] = $row['date'];
3464 3464
 
@@ -3478,7 +3478,7 @@  discard block
 block discarded – undo
3478 3478
 	*/
3479 3479
 	public function getAllRoutes()
3480 3480
 	{
3481
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3481
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3482 3482
 				FROM spotter_output
3483 3483
 				WHERE spotter_output.ident <> '' 
3484 3484
 				GROUP BY route
@@ -3489,7 +3489,7 @@  discard block
 block discarded – undo
3489 3489
 
3490 3490
 		$routes_array = array();
3491 3491
 		$temp_array = array();
3492
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3492
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3493 3493
 		{
3494 3494
 			$temp_array['route'] = $row['route'];
3495 3495
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3508,21 +3508,21 @@  discard block
 block discarded – undo
3508 3508
 	* @return String success or false
3509 3509
 	*
3510 3510
 	*/	
3511
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3511
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3512 3512
 	{
3513 3513
 		if (!is_numeric(substr($ident, 0, 3)))
3514 3514
 		{
3515 3515
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3516
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3516
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3517 3517
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3518
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3518
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3519 3519
 			} else {
3520 3520
 				$airline_array = $this->getAllAirlineInfo("NA");
3521 3521
 			}
3522 3522
 			if (count($airline_array) == 0) {
3523 3523
 				$airline_array = $this->getAllAirlineInfo("NA");
3524 3524
 			}
3525
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3525
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3526 3526
 				$airline_array = $this->getAllAirlineInfo("NA");
3527 3527
 			}
3528 3528
 		} else {
@@ -3535,7 +3535,7 @@  discard block
 block discarded – undo
3535 3535
 
3536 3536
 
3537 3537
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3538
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3538
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3539 3539
 
3540 3540
 		try {
3541 3541
 			$sth = $this->db->prepare($query);
@@ -3556,11 +3556,11 @@  discard block
 block discarded – undo
3556 3556
 	* @return String success or false
3557 3557
 	*
3558 3558
 	*/	
3559
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3559
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3560 3560
 	{
3561 3561
 		if ($groundspeed == '') $groundspeed = NULL;
3562 3562
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3563
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3563
+                $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3564 3564
 
3565 3565
 		try {
3566 3566
 			$sth = $this->db->prepare($query);
@@ -3600,7 +3600,7 @@  discard block
 block discarded – undo
3600 3600
 	* @param String $verticalrate vertival rate of flight
3601 3601
 	* @return String success or false
3602 3602
 	*/
3603
-	public function addSpotterData($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 = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '',$source_type = '')
3603
+	public function addSpotterData($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 = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '', $source_type = '')
3604 3604
 	{
3605 3605
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3606 3606
 		
@@ -3623,14 +3623,14 @@  discard block
 block discarded – undo
3623 3623
 			} else {
3624 3624
 				if ($ModeS != '') {
3625 3625
 					$timeelapsed = microtime(true);
3626
-					$registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type);
3627
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3626
+					$registration = $this->getAircraftRegistrationBymodeS($ModeS, $source_type);
3627
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3628 3628
 				} else {
3629
-					$myhex = explode('-',$flightaware_id);
3629
+					$myhex = explode('-', $flightaware_id);
3630 3630
 					if (count($myhex) > 0) {
3631 3631
 						$timeelapsed = microtime(true);
3632
-						$registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type);
3633
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3632
+						$registration = $this->getAircraftRegistrationBymodeS($myhex[0], $source_type);
3633
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3634 3634
 					}
3635 3635
 				}
3636 3636
 			}
@@ -3652,24 +3652,24 @@  discard block
 block discarded – undo
3652 3652
 				{
3653 3653
 					$timeelapsed = microtime(true);
3654 3654
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3655
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3655
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3656 3656
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3657
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3657
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3658 3658
 					} else {
3659 3659
 						$airline_array = $this->getAllAirlineInfo("NA");
3660 3660
 					}
3661 3661
 					if (count($airline_array) == 0) {
3662 3662
 						$airline_array = $this->getAllAirlineInfo("NA");
3663 3663
 					}
3664
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3664
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3665 3665
 						$airline_array = $this->getAllAirlineInfo("NA");
3666 3666
 					}
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3667
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3668 3668
 
3669 3669
 				} else {
3670 3670
 					$timeelapsed = microtime(true);
3671 3671
 					$airline_array = $this->getAllAirlineInfo("NA");
3672
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3672
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3673 3673
 				}
3674 3674
 			}
3675 3675
 		} else $airline_array = array();
@@ -3686,27 +3686,27 @@  discard block
 block discarded – undo
3686 3686
 				{
3687 3687
 					$timeelapsed = microtime(true);
3688 3688
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3689
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3689
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3690 3690
 				} else {
3691 3691
 					$timeelapsed = microtime(true);
3692 3692
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3693
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3693
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3694 3694
 				}
3695 3695
 			}
3696 3696
 		} else {
3697 3697
 			if ($ModeS != '') {
3698 3698
 				$timeelapsed = microtime(true);
3699
-				$aircraft_icao = $this->getAllAircraftType($ModeS,$source_type);
3700
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3699
+				$aircraft_icao = $this->getAllAircraftType($ModeS, $source_type);
3700
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3701 3701
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3702 3702
 				{
3703 3703
 					$timeelapsed = microtime(true);
3704 3704
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3705
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3705
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3706 3706
 				} else {
3707 3707
 					$timeelapsed = microtime(true);
3708 3708
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3709
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3709
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3710 3710
 				}
3711 3711
 			}
3712 3712
 		}
@@ -3722,7 +3722,7 @@  discard block
 block discarded – undo
3722 3722
 			} else {
3723 3723
 				$timeelapsed = microtime(true);
3724 3724
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3725
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3725
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3726 3726
 			}
3727 3727
 		}
3728 3728
 		
@@ -3737,7 +3737,7 @@  discard block
 block discarded – undo
3737 3737
 			} else {
3738 3738
 				$timeelapsed = microtime(true);
3739 3739
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3740
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3740
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3741 3741
 			}
3742 3742
 		}
3743 3743
 
@@ -3790,7 +3790,7 @@  discard block
 block discarded – undo
3790 3790
 		}
3791 3791
 
3792 3792
     
3793
-		if ($date == "" || strtotime($date) < time()-20*60)
3793
+		if ($date == "" || strtotime($date) < time() - 20*60)
3794 3794
 		{
3795 3795
 			$date = date("Y-m-d H:i:s", time());
3796 3796
 		}
@@ -3800,7 +3800,7 @@  discard block
 block discarded – undo
3800 3800
 		{
3801 3801
 			$timeelapsed = microtime(true);
3802 3802
 			$image_array = $Image->getSpotterImage($registration);
3803
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3803
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3804 3804
 			if (!isset($image_array[0]['registration']))
3805 3805
 			{
3806 3806
 				//echo "Add image !!!! \n";
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 			}
3809 3809
 			$timeelapsed = microtime(true);
3810 3810
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3811
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3811
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3812 3812
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3813 3813
 		}
3814 3814
     
@@ -3816,33 +3816,33 @@  discard block
 block discarded – undo
3816 3816
 		{
3817 3817
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818 3818
             		else $airline_icao = '';
3819
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3819
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3820 3820
 			if (!isset($image_array[0]['registration']))
3821 3821
 			{
3822 3822
 				//echo "Add image !!!! \n";
3823
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3823
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3824 3824
 			}
3825 3825
 		}
3826 3826
     
3827
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3828
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3829
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3830
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3831
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3832
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3833
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3834
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3835
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3836
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3837
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3838
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3839
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3840
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3841
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3842
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3843
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3844
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3845
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3827
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3828
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3829
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3830
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3831
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3832
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3833
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3834
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3835
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3836
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3837
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3838
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3839
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3840
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3841
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3842
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3843
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3844
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3845
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3846 3846
 	
3847 3847
 		if (count($airline_array) == 0) 
3848 3848
 		{
@@ -3870,7 +3870,7 @@  discard block
 block discarded – undo
3870 3870
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871 3871
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872 3872
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3873
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3874 3874
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3875 3875
 
3876 3876
                 $airline_name = $airline_array[0]['name'];
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
 		if ($airline_type == '') {
3881 3881
 			$timeelapsed = microtime(true);
3882 3882
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3883
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3884 3884
 		}
3885 3885
 		if ($airline_type == null) $airline_type = '';
3886 3886
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3892,7 +3892,7 @@  discard block
 block discarded – undo
3892 3892
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3893 3893
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3894 3894
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3895
-                $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3895
+                $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3896 3896
 
3897 3897
 		try {
3898 3898
 		        
@@ -3918,13 +3918,13 @@  discard block
 block discarded – undo
3918 3918
 	{
3919 3919
 		global $globalDBdriver, $globalTimezone;
3920 3920
 		if ($globalDBdriver == 'mysql') {
3921
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3921
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3922 3922
 								WHERE spotter_output.ident = :ident 
3923 3923
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3924 3924
 								AND spotter_output.date < UTC_TIMESTAMP()";
3925 3925
 			$query_data = array(':ident' => $ident);
3926 3926
 		} else {
3927
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3927
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3928 3928
 								WHERE spotter_output.ident = :ident 
3929 3929
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3930 3930
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3933,8 +3933,8 @@  discard block
 block discarded – undo
3933 3933
 		
3934 3934
 		$sth = $this->db->prepare($query);
3935 3935
 		$sth->execute($query_data);
3936
-    		$ident_result='';
3937
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3936
+    		$ident_result = '';
3937
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3938 3938
 		{
3939 3939
 			$ident_result = $row['ident'];
3940 3940
 		}
@@ -3960,8 +3960,8 @@  discard block
 block discarded – undo
3960 3960
 				return false;
3961 3961
 			} else {
3962 3962
 				$q_array = explode(" ", $q);
3963
-				foreach ($q_array as $q_item){
3964
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3963
+				foreach ($q_array as $q_item) {
3964
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3965 3965
 					$additional_query .= " AND (";
3966 3966
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3967 3967
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3976,11 +3976,11 @@  discard block
 block discarded – undo
3976 3976
 			}
3977 3977
 		}
3978 3978
 		if ($globalDBdriver == 'mysql') {
3979
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3979
+			$query = "SELECT spotter_output.* FROM spotter_output 
3980 3980
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3981 3981
 				AND spotter_output.date < UTC_TIMESTAMP()";
3982 3982
 		} else {
3983
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3983
+			$query = "SELECT spotter_output.* FROM spotter_output 
3984 3984
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3985 3985
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3986 3986
 		}
@@ -3997,11 +3997,11 @@  discard block
 block discarded – undo
3997 3997
 	* @return Array the airline list
3998 3998
 	*
3999 3999
 	*/
4000
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4000
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4001 4001
 	{
4002 4002
 		global $globalDBdriver;
4003
-		$filter_query = $this->getFilter($filters,true,true);
4004
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4003
+		$filter_query = $this->getFilter($filters, true, true);
4004
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4005 4005
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
4006 4006
 		if ($olderthanmonths > 0) {
4007 4007
 			if ($globalDBdriver == 'mysql') {
@@ -4021,28 +4021,28 @@  discard block
 block discarded – undo
4021 4021
 		if ($year != '') {
4022 4022
 			if ($globalDBdriver == 'mysql') {
4023 4023
 				$query .= " AND YEAR(spotter_output.date) = :year";
4024
-				$query_values = array_merge($query_values,array(':year' => $year));
4024
+				$query_values = array_merge($query_values, array(':year' => $year));
4025 4025
 			} else {
4026 4026
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4027
-				$query_values = array_merge($query_values,array(':year' => $year));
4027
+				$query_values = array_merge($query_values, array(':year' => $year));
4028 4028
 			}
4029 4029
 		}
4030 4030
 		if ($month != '') {
4031 4031
 			if ($globalDBdriver == 'mysql') {
4032 4032
 				$query .= " AND MONTH(spotter_output.date) = :month";
4033
-				$query_values = array_merge($query_values,array(':month' => $month));
4033
+				$query_values = array_merge($query_values, array(':month' => $month));
4034 4034
 			} else {
4035 4035
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4036
-				$query_values = array_merge($query_values,array(':month' => $month));
4036
+				$query_values = array_merge($query_values, array(':month' => $month));
4037 4037
 			}
4038 4038
 		}
4039 4039
 		if ($day != '') {
4040 4040
 			if ($globalDBdriver == 'mysql') {
4041 4041
 				$query .= " AND DAY(spotter_output.date) = :day";
4042
-				$query_values = array_merge($query_values,array(':day' => $day));
4042
+				$query_values = array_merge($query_values, array(':day' => $day));
4043 4043
 			} else {
4044 4044
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4045
-				$query_values = array_merge($query_values,array(':day' => $day));
4045
+				$query_values = array_merge($query_values, array(':day' => $day));
4046 4046
 			}
4047 4047
 		}
4048 4048
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4052,7 +4052,7 @@  discard block
 block discarded – undo
4052 4052
 		$sth->execute($query_values);
4053 4053
 		$airline_array = array();
4054 4054
 		$temp_array = array();
4055
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4055
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4056 4056
 		{
4057 4057
 			$temp_array['airline_name'] = $row['airline_name'];
4058 4058
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4069,11 +4069,11 @@  discard block
 block discarded – undo
4069 4069
 	* @return Array the pilots list
4070 4070
 	*
4071 4071
 	*/
4072
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4072
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4073 4073
 	{
4074 4074
 		global $globalDBdriver;
4075
-		$filter_query = $this->getFilter($filters,true,true);
4076
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4075
+		$filter_query = $this->getFilter($filters, true, true);
4076
+		$query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4077 4077
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4078 4078
                 if ($olderthanmonths > 0) {
4079 4079
             		if ($globalDBdriver == 'mysql') {
@@ -4093,28 +4093,28 @@  discard block
 block discarded – undo
4093 4093
 		if ($year != '') {
4094 4094
 			if ($globalDBdriver == 'mysql') {
4095 4095
 				$query .= " AND YEAR(spotter_output.date) = :year";
4096
-				$query_values = array_merge($query_values,array(':year' => $year));
4096
+				$query_values = array_merge($query_values, array(':year' => $year));
4097 4097
 			} else {
4098 4098
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4099
-				$query_values = array_merge($query_values,array(':year' => $year));
4099
+				$query_values = array_merge($query_values, array(':year' => $year));
4100 4100
 			}
4101 4101
 		}
4102 4102
 		if ($month != '') {
4103 4103
 			if ($globalDBdriver == 'mysql') {
4104 4104
 				$query .= " AND MONTH(spotter_output.date) = :month";
4105
-				$query_values = array_merge($query_values,array(':month' => $month));
4105
+				$query_values = array_merge($query_values, array(':month' => $month));
4106 4106
 			} else {
4107 4107
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4108
-				$query_values = array_merge($query_values,array(':month' => $month));
4108
+				$query_values = array_merge($query_values, array(':month' => $month));
4109 4109
 			}
4110 4110
 		}
4111 4111
 		if ($day != '') {
4112 4112
 			if ($globalDBdriver == 'mysql') {
4113 4113
 				$query .= " AND DAY(spotter_output.date) = :day";
4114
-				$query_values = array_merge($query_values,array(':day' => $day));
4114
+				$query_values = array_merge($query_values, array(':day' => $day));
4115 4115
 			} else {
4116 4116
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4117
-				$query_values = array_merge($query_values,array(':day' => $day));
4117
+				$query_values = array_merge($query_values, array(':day' => $day));
4118 4118
 			}
4119 4119
 		}
4120 4120
 		
@@ -4126,7 +4126,7 @@  discard block
 block discarded – undo
4126 4126
 		$sth->execute($query_values);
4127 4127
 		$airline_array = array();
4128 4128
 		$temp_array = array();
4129
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4129
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4130 4130
 		{
4131 4131
 			$temp_array['pilot_name'] = $row['pilot_name'];
4132 4132
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4146,7 +4146,7 @@  discard block
 block discarded – undo
4146 4146
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4147 4147
 	{
4148 4148
 		global $globalDBdriver;
4149
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4149
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4150 4150
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4151 4151
                 if ($olderthanmonths > 0) {
4152 4152
             		if ($globalDBdriver == 'mysql') {
@@ -4172,7 +4172,7 @@  discard block
 block discarded – undo
4172 4172
 		$airline_array = array();
4173 4173
 		$temp_array = array();
4174 4174
         
4175
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4175
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4176 4176
 		{
4177 4177
 			$temp_array['pilot_name'] = $row['pilot_name'];
4178 4178
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4190,11 +4190,11 @@  discard block
 block discarded – undo
4190 4190
 	* @return Array the pilots list
4191 4191
 	*
4192 4192
 	*/
4193
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4193
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4194 4194
 	{
4195 4195
 		global $globalDBdriver;
4196
-		$filter_query = $this->getFilter($filters,true,true);
4197
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4196
+		$filter_query = $this->getFilter($filters, true, true);
4197
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4198 4198
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4199 4199
                 if ($olderthanmonths > 0) {
4200 4200
             		if ($globalDBdriver == 'mysql') {
@@ -4214,28 +4214,28 @@  discard block
 block discarded – undo
4214 4214
 		if ($year != '') {
4215 4215
 			if ($globalDBdriver == 'mysql') {
4216 4216
 				$query .= " AND YEAR(spotter_output.date) = :year";
4217
-				$query_values = array_merge($query_values,array(':year' => $year));
4217
+				$query_values = array_merge($query_values, array(':year' => $year));
4218 4218
 			} else {
4219 4219
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4220
-				$query_values = array_merge($query_values,array(':year' => $year));
4220
+				$query_values = array_merge($query_values, array(':year' => $year));
4221 4221
 			}
4222 4222
 		}
4223 4223
 		if ($month != '') {
4224 4224
 			if ($globalDBdriver == 'mysql') {
4225 4225
 				$query .= " AND MONTH(spotter_output.date) = :month";
4226
-				$query_values = array_merge($query_values,array(':month' => $month));
4226
+				$query_values = array_merge($query_values, array(':month' => $month));
4227 4227
 			} else {
4228 4228
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4229
-				$query_values = array_merge($query_values,array(':month' => $month));
4229
+				$query_values = array_merge($query_values, array(':month' => $month));
4230 4230
 			}
4231 4231
 		}
4232 4232
 		if ($day != '') {
4233 4233
 			if ($globalDBdriver == 'mysql') {
4234 4234
 				$query .= " AND DAY(spotter_output.date) = :day";
4235
-				$query_values = array_merge($query_values,array(':day' => $day));
4235
+				$query_values = array_merge($query_values, array(':day' => $day));
4236 4236
 			} else {
4237 4237
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4238
-				$query_values = array_merge($query_values,array(':day' => $day));
4238
+				$query_values = array_merge($query_values, array(':day' => $day));
4239 4239
 			}
4240 4240
 		}
4241 4241
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4245,7 +4245,7 @@  discard block
 block discarded – undo
4245 4245
 		$sth->execute($query_values);
4246 4246
 		$airline_array = array();
4247 4247
 		$temp_array = array();
4248
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4248
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4249 4249
 		{
4250 4250
 			$temp_array['owner_name'] = $row['owner_name'];
4251 4251
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4260,11 +4260,11 @@  discard block
 block discarded – undo
4260 4260
 	* @return Array the pilots list
4261 4261
 	*
4262 4262
 	*/
4263
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4263
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4264 4264
 	{
4265 4265
 		global $globalDBdriver;
4266
-		$filter_query = $this->getFilter($filters,true,true);
4267
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4266
+		$filter_query = $this->getFilter($filters, true, true);
4267
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4268 4268
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4269 4269
                 if ($olderthanmonths > 0) {
4270 4270
             		if ($globalDBdriver == 'mysql') {
@@ -4290,7 +4290,7 @@  discard block
 block discarded – undo
4290 4290
 		$airline_array = array();
4291 4291
 		$temp_array = array();
4292 4292
         
4293
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4293
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4294 4294
 		{
4295 4295
 			$temp_array['owner_name'] = $row['owner_name'];
4296 4296
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4306,11 +4306,11 @@  discard block
 block discarded – undo
4306 4306
 	* @return Array the airline list
4307 4307
 	*
4308 4308
 	*/
4309
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4309
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4310 4310
 	{
4311
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4312
-		$filter_query = $this->getFilter($filters,true,true);
4313
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4311
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4312
+		$filter_query = $this->getFilter($filters, true, true);
4313
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4314 4314
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4315 4315
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4316 4316
 			    ORDER BY airline_count DESC";
@@ -4322,7 +4322,7 @@  discard block
 block discarded – undo
4322 4322
 		$airline_array = array();
4323 4323
 		$temp_array = array();
4324 4324
         
4325
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4325
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4326 4326
 		{
4327 4327
 			$temp_array['airline_name'] = $row['airline_name'];
4328 4328
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4342,11 +4342,11 @@  discard block
 block discarded – undo
4342 4342
 	* @return Array the airline country list
4343 4343
 	*
4344 4344
 	*/
4345
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4345
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4346 4346
 	{
4347
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4348
-		$filter_query = $this->getFilter($filters,true,true);
4349
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4347
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4348
+		$filter_query = $this->getFilter($filters, true, true);
4349
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4350 4350
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4351 4351
                     GROUP BY spotter_output.airline_country
4352 4352
 					ORDER BY airline_country_count DESC
@@ -4359,7 +4359,7 @@  discard block
 block discarded – undo
4359 4359
 		$airline_country_array = array();
4360 4360
 		$temp_array = array();
4361 4361
         
4362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4363 4363
 		{
4364 4364
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4365 4365
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4378,11 +4378,11 @@  discard block
 block discarded – undo
4378 4378
 	* @return Array the airline list
4379 4379
 	*
4380 4380
 	*/
4381
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4381
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4382 4382
 	{
4383
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4384
-		$filter_query = $this->getFilter($filters,true,true);
4385
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4383
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4384
+		$filter_query = $this->getFilter($filters, true, true);
4385
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4386 4386
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
4387 4387
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4388 4388
 		    ORDER BY airline_count DESC";
@@ -4394,7 +4394,7 @@  discard block
 block discarded – undo
4394 4394
 		$airline_array = array();
4395 4395
 		$temp_array = array();
4396 4396
         
4397
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4397
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4398 4398
 		{
4399 4399
 			$temp_array['airline_name'] = $row['airline_name'];
4400 4400
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4413,11 +4413,11 @@  discard block
 block discarded – undo
4413 4413
 	* @return Array the airline country list
4414 4414
 	*
4415 4415
 	*/
4416
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4416
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4417 4417
 	{
4418
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4419
-		$filter_query = $this->getFilter($filters,true,true);
4420
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4418
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4419
+		$filter_query = $this->getFilter($filters, true, true);
4420
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4421 4421
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4422 4422
 					GROUP BY spotter_output.airline_country
4423 4423
 					ORDER BY airline_country_count DESC
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
 		$airline_country_array = array();
4431 4431
 		$temp_array = array();
4432 4432
         
4433
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4433
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4434 4434
 		{
4435 4435
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4436 4436
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4447,11 +4447,11 @@  discard block
 block discarded – undo
4447 4447
 	* @return Array the airline list
4448 4448
 	*
4449 4449
 	*/
4450
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4450
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4451 4451
 	{
4452
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4453
-		$filter_query = $this->getFilter($filters,true,true);
4454
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4452
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4453
+		$filter_query = $this->getFilter($filters, true, true);
4454
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4455 4455
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4456 4456
 					GROUP BY spotter_output.airline_name
4457 4457
 					ORDER BY airline_count DESC";
@@ -4462,7 +4462,7 @@  discard block
 block discarded – undo
4462 4462
 		$airline_array = array();
4463 4463
 		$temp_array = array();
4464 4464
         
4465
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4465
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4466 4466
 		{
4467 4467
 			$temp_array['airline_name'] = $row['airline_name'];
4468 4468
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4482,11 +4482,11 @@  discard block
 block discarded – undo
4482 4482
 	* @return Array the airline country list
4483 4483
 	*
4484 4484
 	*/
4485
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4485
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4486 4486
 	{
4487
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4488
-		$filter_query = $this->getFilter($filters,true,true);
4489
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4487
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4488
+		$filter_query = $this->getFilter($filters, true, true);
4489
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4490 4490
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4491 4491
 					GROUP BY spotter_output.airline_country
4492 4492
 					ORDER BY airline_country_count DESC
@@ -4499,7 +4499,7 @@  discard block
 block discarded – undo
4499 4499
 		$airline_country_array = array();
4500 4500
 		$temp_array = array();
4501 4501
         
4502
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4502
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4503 4503
 		{
4504 4504
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4505 4505
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4515,11 +4515,11 @@  discard block
 block discarded – undo
4515 4515
 	* @return Array the airline list
4516 4516
 	*
4517 4517
 	*/
4518
-	public function countAllAirlinesByDate($date,$filters = array())
4518
+	public function countAllAirlinesByDate($date, $filters = array())
4519 4519
 	{
4520 4520
 		global $globalTimezone, $globalDBdriver;
4521
-		$filter_query = $this->getFilter($filters,true,true);
4522
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4521
+		$filter_query = $this->getFilter($filters, true, true);
4522
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4523 4523
 		if ($globalTimezone != '') {
4524 4524
 			date_default_timezone_set($globalTimezone);
4525 4525
 			$datetime = new DateTime($date);
@@ -4527,12 +4527,12 @@  discard block
 block discarded – undo
4527 4527
 		} else $offset = '+00:00';
4528 4528
 
4529 4529
 		if ($globalDBdriver == 'mysql') {
4530
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4530
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4531 4531
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4532 4532
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4533 4533
 					ORDER BY airline_count DESC";
4534 4534
 		} else {
4535
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4535
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4536 4536
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4537 4537
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4538 4538
 					ORDER BY airline_count DESC";
@@ -4543,7 +4543,7 @@  discard block
 block discarded – undo
4543 4543
 
4544 4544
 		$airline_array = array();
4545 4545
 		$temp_array = array();
4546
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4546
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4547 4547
 		{
4548 4548
 			$temp_array['airline_name'] = $row['airline_name'];
4549 4549
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4563,11 +4563,11 @@  discard block
 block discarded – undo
4563 4563
 	* @return Array the airline country list
4564 4564
 	*
4565 4565
 	*/
4566
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4566
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4567 4567
 	{
4568 4568
 		global $globalTimezone, $globalDBdriver;
4569
-		$filter_query = $this->getFilter($filters,true,true);
4570
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4569
+		$filter_query = $this->getFilter($filters, true, true);
4570
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4571 4571
 		if ($globalTimezone != '') {
4572 4572
 			date_default_timezone_set($globalTimezone);
4573 4573
 			$datetime = new DateTime($date);
@@ -4575,13 +4575,13 @@  discard block
 block discarded – undo
4575 4575
 		} else $offset = '+00:00';
4576 4576
 		
4577 4577
 		if ($globalDBdriver == 'mysql') {
4578
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4578
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4579 4579
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4580 4580
 					GROUP BY spotter_output.airline_country
4581 4581
 					ORDER BY airline_country_count DESC
4582 4582
 					LIMIT 10 OFFSET 0";
4583 4583
 		} else {
4584
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4584
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4585 4585
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4586 4586
 					GROUP BY spotter_output.airline_country
4587 4587
 					ORDER BY airline_country_count DESC
@@ -4593,7 +4593,7 @@  discard block
 block discarded – undo
4593 4593
  
4594 4594
 		$airline_country_array = array();
4595 4595
 		$temp_array = array();
4596
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4596
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4597 4597
 		{
4598 4598
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4599 4599
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4610,11 +4610,11 @@  discard block
 block discarded – undo
4610 4610
 	* @return Array the airline list
4611 4611
 	*
4612 4612
 	*/
4613
-	public function countAllAirlinesByIdent($ident,$filters = array())
4613
+	public function countAllAirlinesByIdent($ident, $filters = array())
4614 4614
 	{
4615
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4616
-		$filter_query = $this->getFilter($filters,true,true);
4617
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4615
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4616
+		$filter_query = $this->getFilter($filters, true, true);
4617
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4618 4618
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4619 4619
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4620 4620
 				ORDER BY airline_count DESC";
@@ -4631,11 +4631,11 @@  discard block
 block discarded – undo
4631 4631
 	* @return Array the airline list
4632 4632
 	*
4633 4633
 	*/
4634
-	public function countAllAirlinesByOwner($owner,$filters = array())
4634
+	public function countAllAirlinesByOwner($owner, $filters = array())
4635 4635
 	{
4636
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4637
-		$filter_query = $this->getFilter($filters,true,true);
4638
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4636
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4637
+		$filter_query = $this->getFilter($filters, true, true);
4638
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4639 4639
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4640 4640
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4641 4641
 				ORDER BY airline_count DESC";
@@ -4652,47 +4652,47 @@  discard block
 block discarded – undo
4652 4652
 	* @return String Duration of all flights
4653 4653
 	*
4654 4654
 	*/
4655
-	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4655
+	public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
4656 4656
 	{
4657 4657
 		global $globalDBdriver;
4658
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4659
-		$filter_query = $this->getFilter($filters,true,true);
4660
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4658
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4659
+		$filter_query = $this->getFilter($filters, true, true);
4660
+		$query = "SELECT SUM(last_seen - date) AS duration 
4661 4661
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
4662 4662
 				AND last_seen > date";
4663 4663
 		$query_values = array();
4664 4664
 		if ($year != '') {
4665 4665
 			if ($globalDBdriver == 'mysql') {
4666 4666
 				$query .= " AND YEAR(spotter_output.date) = :year";
4667
-				$query_values = array_merge($query_values,array(':year' => $year));
4667
+				$query_values = array_merge($query_values, array(':year' => $year));
4668 4668
 			} else {
4669 4669
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4670
-				$query_values = array_merge($query_values,array(':year' => $year));
4670
+				$query_values = array_merge($query_values, array(':year' => $year));
4671 4671
 			}
4672 4672
 		}
4673 4673
 		if ($month != '') {
4674 4674
 			if ($globalDBdriver == 'mysql') {
4675 4675
 				$query .= " AND MONTH(spotter_output.date) = :month";
4676
-				$query_values = array_merge($query_values,array(':month' => $month));
4676
+				$query_values = array_merge($query_values, array(':month' => $month));
4677 4677
 			} else {
4678 4678
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4679
-				$query_values = array_merge($query_values,array(':month' => $month));
4679
+				$query_values = array_merge($query_values, array(':month' => $month));
4680 4680
 			}
4681 4681
 		}
4682 4682
 		if ($day != '') {
4683 4683
 			if ($globalDBdriver == 'mysql') {
4684 4684
 				$query .= " AND DAY(spotter_output.date) = :day";
4685
-				$query_values = array_merge($query_values,array(':day' => $day));
4685
+				$query_values = array_merge($query_values, array(':day' => $day));
4686 4686
 			} else {
4687 4687
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4688
-				$query_values = array_merge($query_values,array(':day' => $day));
4688
+				$query_values = array_merge($query_values, array(':day' => $day));
4689 4689
 			}
4690 4690
 		}
4691
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4691
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4692 4692
 		$sth = $this->db->prepare($query);
4693 4693
 		$sth->execute($query_values);
4694 4694
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4695
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4695
+		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4696 4696
 		elseif ($result[0]['duration'] == '') return 0;
4697 4697
 		else return $result[0]['duration'];
4698 4698
 	}
@@ -4703,14 +4703,14 @@  discard block
 block discarded – undo
4703 4703
 	* @return String Duration of all flights
4704 4704
 	*
4705 4705
 	*/
4706
-	public function countFlightsByOwner($owner,$filters = array())
4706
+	public function countFlightsByOwner($owner, $filters = array())
4707 4707
 	{
4708
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4709
-		$filter_query = $this->getFilter($filters,true,true);
4710
-		$query  = "SELECT COUNT(*) AS nb 
4708
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4709
+		$filter_query = $this->getFilter($filters, true, true);
4710
+		$query = "SELECT COUNT(*) AS nb 
4711 4711
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4712 4712
 		$query_values = array();
4713
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4713
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4714 4714
 		$sth = $this->db->prepare($query);
4715 4715
 		$sth->execute($query_values);
4716 4716
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4723,14 +4723,14 @@  discard block
 block discarded – undo
4723 4723
 	* @return String Duration of all flights
4724 4724
 	*
4725 4725
 	*/
4726
-	public function countFlightsByPilot($pilot,$filters = array())
4726
+	public function countFlightsByPilot($pilot, $filters = array())
4727 4727
 	{
4728
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4729
-		$filter_query = $this->getFilter($filters,true,true);
4730
-		$query  = "SELECT COUNT(*) AS nb 
4728
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4729
+		$filter_query = $this->getFilter($filters, true, true);
4730
+		$query = "SELECT COUNT(*) AS nb 
4731 4731
 				FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)";
4732 4732
 		$query_values = array();
4733
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4733
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4734 4734
 		$sth = $this->db->prepare($query);
4735 4735
 		$sth->execute($query_values);
4736 4736
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4743,47 +4743,47 @@  discard block
 block discarded – undo
4743 4743
 	* @return String Duration of all flights
4744 4744
 	*
4745 4745
 	*/
4746
-	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4746
+	public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
4747 4747
 	{
4748 4748
 		global $globalDBdriver;
4749
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4750
-		$filter_query = $this->getFilter($filters,true,true);
4751
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4749
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4750
+		$filter_query = $this->getFilter($filters, true, true);
4751
+		$query = "SELECT SUM(last_seen - date) AS duration 
4752 4752
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4753 4753
 		 		AND last_seen > date";
4754 4754
 		$query_values = array();
4755 4755
 		if ($year != '') {
4756 4756
 			if ($globalDBdriver == 'mysql') {
4757 4757
 				$query .= " AND YEAR(spotter_output.date) = :year";
4758
-				$query_values = array_merge($query_values,array(':year' => $year));
4758
+				$query_values = array_merge($query_values, array(':year' => $year));
4759 4759
 			} else {
4760 4760
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4761
-				$query_values = array_merge($query_values,array(':year' => $year));
4761
+				$query_values = array_merge($query_values, array(':year' => $year));
4762 4762
 			}
4763 4763
 		}
4764 4764
 		if ($month != '') {
4765 4765
 			if ($globalDBdriver == 'mysql') {
4766 4766
 				$query .= " AND MONTH(spotter_output.date) = :month";
4767
-				$query_values = array_merge($query_values,array(':month' => $month));
4767
+				$query_values = array_merge($query_values, array(':month' => $month));
4768 4768
 			} else {
4769 4769
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4770
-				$query_values = array_merge($query_values,array(':month' => $month));
4770
+				$query_values = array_merge($query_values, array(':month' => $month));
4771 4771
 			}
4772 4772
 		}
4773 4773
 		if ($day != '') {
4774 4774
 			if ($globalDBdriver == 'mysql') {
4775 4775
 				$query .= " AND DAY(spotter_output.date) = :day";
4776
-				$query_values = array_merge($query_values,array(':day' => $day));
4776
+				$query_values = array_merge($query_values, array(':day' => $day));
4777 4777
 			} else {
4778 4778
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4779
-				$query_values = array_merge($query_values,array(':day' => $day));
4779
+				$query_values = array_merge($query_values, array(':day' => $day));
4780 4780
 			}
4781 4781
 		}
4782
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4782
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4783 4783
 		$sth = $this->db->prepare($query);
4784 4784
 		$sth->execute($query_values);
4785 4785
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4786
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4786
+		if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4787 4787
 		else return $result[0]['duration'];
4788 4788
 	}
4789 4789
 
@@ -4793,11 +4793,11 @@  discard block
 block discarded – undo
4793 4793
 	* @return Array the airline list
4794 4794
 	*
4795 4795
 	*/
4796
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4796
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4797 4797
 	{
4798
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4799
-		$filter_query = $this->getFilter($filters,true,true);
4800
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4798
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4799
+		$filter_query = $this->getFilter($filters, true, true);
4800
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4801 4801
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4802 4802
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4803 4803
 				ORDER BY airline_count DESC";
@@ -4814,25 +4814,25 @@  discard block
 block discarded – undo
4814 4814
 	* @return Array the airline list
4815 4815
 	*
4816 4816
 	*/
4817
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4817
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4818 4818
 	{
4819
-		$filter_query = $this->getFilter($filters,true,true);
4820
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4821
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4819
+		$filter_query = $this->getFilter($filters, true, true);
4820
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4821
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4822 4822
 
4823
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4823
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4824 4824
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4825 4825
 					GROUP BY spotter_output.airline_name
4826 4826
 					ORDER BY airline_count DESC";
4827 4827
       
4828 4828
 		
4829 4829
 		$sth = $this->db->prepare($query);
4830
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4830
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4831 4831
       
4832 4832
 		$airline_array = array();
4833 4833
 		$temp_array = array();
4834 4834
         
4835
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4835
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4836 4836
 		{
4837 4837
 			$temp_array['airline_name'] = $row['airline_name'];
4838 4838
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4850,13 +4850,13 @@  discard block
 block discarded – undo
4850 4850
 	* @return Array the airline country list
4851 4851
 	*
4852 4852
 	*/
4853
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4853
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4854 4854
 	{
4855
-		$filter_query = $this->getFilter($filters,true,true);
4856
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4857
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4855
+		$filter_query = $this->getFilter($filters, true, true);
4856
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4857
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4858 4858
       
4859
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4859
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4860 4860
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4861 4861
 				GROUP BY spotter_output.airline_country
4862 4862
 				ORDER BY airline_country_count DESC
@@ -4864,11 +4864,11 @@  discard block
 block discarded – undo
4864 4864
       
4865 4865
 		
4866 4866
 		$sth = $this->db->prepare($query);
4867
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4867
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4868 4868
       
4869 4869
 		$airline_country_array = array();
4870 4870
 		$temp_array = array();
4871
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4871
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4872 4872
 		{
4873 4873
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4874 4874
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4886,11 +4886,11 @@  discard block
 block discarded – undo
4886 4886
 	* @return Array the airline list
4887 4887
 	*
4888 4888
 	*/
4889
-	public function countAllAirlinesByCountry($country,$filters = array())
4889
+	public function countAllAirlinesByCountry($country, $filters = array())
4890 4890
 	{
4891
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4892
-		$filter_query = $this->getFilter($filters,true,true);
4893
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4891
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4892
+		$filter_query = $this->getFilter($filters, true, true);
4893
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4894 4894
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4895 4895
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4896 4896
 			    ORDER BY airline_count DESC";
@@ -4901,7 +4901,7 @@  discard block
 block discarded – undo
4901 4901
 
4902 4902
 		$airline_array = array();
4903 4903
 		$temp_array = array();
4904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4905 4905
 		{
4906 4906
 			$temp_array['airline_name'] = $row['airline_name'];
4907 4907
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4920,11 +4920,11 @@  discard block
 block discarded – undo
4920 4920
 	* @return Array the airline country list
4921 4921
 	*
4922 4922
 	*/
4923
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4923
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4924 4924
 	{
4925
-		$filter_query = $this->getFilter($filters,true,true);
4926
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4927
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4925
+		$filter_query = $this->getFilter($filters, true, true);
4926
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4927
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4928 4928
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4929 4929
 				GROUP BY spotter_output.airline_country
4930 4930
 				ORDER BY airline_country_count DESC
@@ -4936,7 +4936,7 @@  discard block
 block discarded – undo
4936 4936
 
4937 4937
 		$airline_country_array = array();
4938 4938
 		$temp_array = array();
4939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4940 4940
 		{
4941 4941
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4942 4942
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4956,35 +4956,35 @@  discard block
 block discarded – undo
4956 4956
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4957 4957
 	{
4958 4958
 		global $globalDBdriver;
4959
-		$filter_query = $this->getFilter($filters,true,true);
4960
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4959
+		$filter_query = $this->getFilter($filters, true, true);
4960
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4961 4961
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4962 4962
 		$query_values = array();
4963 4963
 		if ($year != '') {
4964 4964
 			if ($globalDBdriver == 'mysql') {
4965 4965
 				$query .= " AND YEAR(spotter_output.date) = :year";
4966
-				$query_values = array_merge($query_values,array(':year' => $year));
4966
+				$query_values = array_merge($query_values, array(':year' => $year));
4967 4967
 			} else {
4968 4968
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4969
-				$query_values = array_merge($query_values,array(':year' => $year));
4969
+				$query_values = array_merge($query_values, array(':year' => $year));
4970 4970
 			}
4971 4971
 		}
4972 4972
 		if ($month != '') {
4973 4973
 			if ($globalDBdriver == 'mysql') {
4974 4974
 				$query .= " AND MONTH(spotter_output.date) = :month";
4975
-				$query_values = array_merge($query_values,array(':month' => $month));
4975
+				$query_values = array_merge($query_values, array(':month' => $month));
4976 4976
 			} else {
4977 4977
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4978
-				$query_values = array_merge($query_values,array(':month' => $month));
4978
+				$query_values = array_merge($query_values, array(':month' => $month));
4979 4979
 			}
4980 4980
 		}
4981 4981
 		if ($day != '') {
4982 4982
 			if ($globalDBdriver == 'mysql') {
4983 4983
 				$query .= " AND DAY(spotter_output.date) = :day";
4984
-				$query_values = array_merge($query_values,array(':day' => $day));
4984
+				$query_values = array_merge($query_values, array(':day' => $day));
4985 4985
 			} else {
4986 4986
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4987
-				$query_values = array_merge($query_values,array(':day' => $day));
4987
+				$query_values = array_merge($query_values, array(':day' => $day));
4988 4988
 			}
4989 4989
 		}
4990 4990
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4996,7 +4996,7 @@  discard block
 block discarded – undo
4996 4996
 
4997 4997
 		$airline_array = array();
4998 4998
 		$temp_array = array();
4999
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4999
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5000 5000
 		{
5001 5001
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
5002 5002
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -5012,11 +5012,11 @@  discard block
 block discarded – undo
5012 5012
 	* @return Array the airline country list
5013 5013
 	*
5014 5014
 	*/
5015
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5015
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5016 5016
 	{
5017 5017
 		global $globalDBdriver;
5018 5018
 		//$filter_query = $this->getFilter($filters,true,true);
5019
-		$Connection= new Connection($this->db);
5019
+		$Connection = new Connection($this->db);
5020 5020
 		if (!$Connection->tableExists('countries')) return array();
5021 5021
 		/*
5022 5022
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -5031,7 +5031,7 @@  discard block
 block discarded – undo
5031 5031
 */
5032 5032
 		require_once('class.SpotterLive.php');
5033 5033
 		$SpotterLive = new SpotterLive();
5034
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
5034
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
5035 5035
 		$filter_query .= ' over_country IS NOT NULL';
5036 5036
                 if ($olderthanmonths > 0) {
5037 5037
 			if ($globalDBdriver == 'mysql') {
@@ -5058,7 +5058,7 @@  discard block
 block discarded – undo
5058 5058
 		$flight_array = array();
5059 5059
 		$temp_array = array();
5060 5060
         
5061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5062 5062
 		{
5063 5063
 			$temp_array['flight_count'] = $row['nb'];
5064 5064
 			$temp_array['flight_country'] = $row['name'];
@@ -5076,11 +5076,11 @@  discard block
 block discarded – undo
5076 5076
 	* @return Array the aircraft list
5077 5077
 	*
5078 5078
 	*/
5079
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5079
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5080 5080
 	{
5081 5081
 		global $globalDBdriver;
5082
-		$filter_query = $this->getFilter($filters,true,true);
5083
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5082
+		$filter_query = $this->getFilter($filters, true, true);
5083
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5084 5084
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
5085 5085
 		if ($olderthanmonths > 0) {
5086 5086
 			if ($globalDBdriver == 'mysql') {
@@ -5100,28 +5100,28 @@  discard block
 block discarded – undo
5100 5100
 		if ($year != '') {
5101 5101
 			if ($globalDBdriver == 'mysql') {
5102 5102
 				$query .= " AND YEAR(spotter_output.date) = :year";
5103
-				$query_values = array_merge($query_values,array(':year' => $year));
5103
+				$query_values = array_merge($query_values, array(':year' => $year));
5104 5104
 			} else {
5105 5105
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5106
-				$query_values = array_merge($query_values,array(':year' => $year));
5106
+				$query_values = array_merge($query_values, array(':year' => $year));
5107 5107
 			}
5108 5108
 		}
5109 5109
 		if ($month != '') {
5110 5110
 			if ($globalDBdriver == 'mysql') {
5111 5111
 				$query .= " AND MONTH(spotter_output.date) = :month";
5112
-				$query_values = array_merge($query_values,array(':month' => $month));
5112
+				$query_values = array_merge($query_values, array(':month' => $month));
5113 5113
 			} else {
5114 5114
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5115
-				$query_values = array_merge($query_values,array(':month' => $month));
5115
+				$query_values = array_merge($query_values, array(':month' => $month));
5116 5116
 			}
5117 5117
 		}
5118 5118
 		if ($day != '') {
5119 5119
 			if ($globalDBdriver == 'mysql') {
5120 5120
 				$query .= " AND DAY(spotter_output.date) = :day";
5121
-				$query_values = array_merge($query_values,array(':day' => $day));
5121
+				$query_values = array_merge($query_values, array(':day' => $day));
5122 5122
 			} else {
5123 5123
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5124
-				$query_values = array_merge($query_values,array(':day' => $day));
5124
+				$query_values = array_merge($query_values, array(':day' => $day));
5125 5125
 			}
5126 5126
 		}
5127 5127
 
@@ -5133,7 +5133,7 @@  discard block
 block discarded – undo
5133 5133
 
5134 5134
 		$aircraft_array = array();
5135 5135
 		$temp_array = array();
5136
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5136
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5137 5137
 		{
5138 5138
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5139 5139
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5150,11 +5150,11 @@  discard block
 block discarded – undo
5150 5150
 	* @return Array the aircraft list
5151 5151
 	*
5152 5152
 	*/
5153
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5153
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5154 5154
 	{
5155 5155
 		global $globalDBdriver;
5156
-		$filter_query = $this->getFilter($filters,true,true);
5157
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5156
+		$filter_query = $this->getFilter($filters, true, true);
5157
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5158 5158
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA'";
5159 5159
 		if ($olderthanmonths > 0) {
5160 5160
 			if ($globalDBdriver == 'mysql') {
@@ -5174,28 +5174,28 @@  discard block
 block discarded – undo
5174 5174
 		if ($year != '') {
5175 5175
 			if ($globalDBdriver == 'mysql') {
5176 5176
 				$query .= " AND YEAR(spotter_output.date) = :year";
5177
-				$query_values = array_merge($query_values,array(':year' => $year));
5177
+				$query_values = array_merge($query_values, array(':year' => $year));
5178 5178
 			} else {
5179 5179
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5180
-				$query_values = array_merge($query_values,array(':year' => $year));
5180
+				$query_values = array_merge($query_values, array(':year' => $year));
5181 5181
 			}
5182 5182
 		}
5183 5183
 		if ($month != '') {
5184 5184
 			if ($globalDBdriver == 'mysql') {
5185 5185
 				$query .= " AND MONTH(spotter_output.date) = :month";
5186
-				$query_values = array_merge($query_values,array(':month' => $month));
5186
+				$query_values = array_merge($query_values, array(':month' => $month));
5187 5187
 			} else {
5188 5188
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5189
-				$query_values = array_merge($query_values,array(':month' => $month));
5189
+				$query_values = array_merge($query_values, array(':month' => $month));
5190 5190
 			}
5191 5191
 		}
5192 5192
 		if ($day != '') {
5193 5193
 			if ($globalDBdriver == 'mysql') {
5194 5194
 				$query .= " AND DAY(spotter_output.date) = :day";
5195
-				$query_values = array_merge($query_values,array(':day' => $day));
5195
+				$query_values = array_merge($query_values, array(':day' => $day));
5196 5196
 			} else {
5197 5197
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5198
-				$query_values = array_merge($query_values,array(':day' => $day));
5198
+				$query_values = array_merge($query_values, array(':day' => $day));
5199 5199
 			}
5200 5200
 		}
5201 5201
 
@@ -5207,7 +5207,7 @@  discard block
 block discarded – undo
5207 5207
 
5208 5208
 		$aircraft_array = array();
5209 5209
 		$temp_array = array();
5210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5211 5211
 		{
5212 5212
 			$temp_array['airline_icao'] = $row['airline_icao'];
5213 5213
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5225,11 +5225,11 @@  discard block
 block discarded – undo
5225 5225
 	* @return Array the aircraft list
5226 5226
 	*
5227 5227
 	*/
5228
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5228
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5229 5229
 	{
5230 5230
 		global $globalDBdriver;
5231
-		$filter_query = $this->getFilter($filters,true,true);
5232
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5231
+		$filter_query = $this->getFilter($filters, true, true);
5232
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5233 5233
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
5234 5234
 		if ($olderthanmonths > 0) {
5235 5235
 			if ($globalDBdriver == 'mysql') {
@@ -5254,7 +5254,7 @@  discard block
 block discarded – undo
5254 5254
 
5255 5255
 		$aircraft_array = array();
5256 5256
 		$temp_array = array();
5257
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5257
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5258 5258
 		{
5259 5259
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5260 5260
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5273,13 +5273,13 @@  discard block
 block discarded – undo
5273 5273
 	* @return Array the aircraft list
5274 5274
 	*
5275 5275
 	*/
5276
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5276
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5277 5277
 	{
5278 5278
 		$Image = new Image($this->db);
5279
-		$filter_query = $this->getFilter($filters,true,true);
5280
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5279
+		$filter_query = $this->getFilter($filters, true, true);
5280
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5281 5281
 
5282
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5282
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5283 5283
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5284 5284
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5285 5285
 				ORDER BY registration_count DESC";
@@ -5290,14 +5290,14 @@  discard block
 block discarded – undo
5290 5290
 		$aircraft_array = array();
5291 5291
 		$temp_array = array();
5292 5292
         
5293
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5293
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5294 5294
 		{
5295 5295
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5296 5296
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5297 5297
 			$temp_array['registration'] = $row['registration'];
5298 5298
 			$temp_array['airline_name'] = $row['airline_name'];
5299 5299
 			$temp_array['image_thumbnail'] = "";
5300
-			if($row['registration'] != "")
5300
+			if ($row['registration'] != "")
5301 5301
 			{
5302 5302
 				$image_array = $Image->getSpotterImage($row['registration']);
5303 5303
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5316,11 +5316,11 @@  discard block
 block discarded – undo
5316 5316
 	* @return Array the aircraft list
5317 5317
 	*
5318 5318
 	*/
5319
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5319
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5320 5320
 	{
5321
-		$filter_query = $this->getFilter($filters,true,true);
5322
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5323
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5321
+		$filter_query = $this->getFilter($filters, true, true);
5322
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5323
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5324 5324
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5325 5325
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5326 5326
 			    ORDER BY aircraft_icao_count DESC";
@@ -5331,7 +5331,7 @@  discard block
 block discarded – undo
5331 5331
 		$aircraft_array = array();
5332 5332
 		$temp_array = array();
5333 5333
 
5334
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5334
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5335 5335
 		{
5336 5336
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5337 5337
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5349,13 +5349,13 @@  discard block
 block discarded – undo
5349 5349
 	* @return Array the aircraft list
5350 5350
 	*
5351 5351
 	*/
5352
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5352
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5353 5353
 	{
5354
-		$filter_query = $this->getFilter($filters,true,true);
5354
+		$filter_query = $this->getFilter($filters, true, true);
5355 5355
 		$Image = new Image($this->db);
5356
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5356
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5357 5357
 
5358
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5358
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5359 5359
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5360 5360
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5361 5361
 			    ORDER BY registration_count DESC";
@@ -5365,14 +5365,14 @@  discard block
 block discarded – undo
5365 5365
 
5366 5366
 		$aircraft_array = array();
5367 5367
 		$temp_array = array();
5368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5369 5369
 		{
5370 5370
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5371 5371
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5372 5372
 			$temp_array['registration'] = $row['registration'];
5373 5373
 			$temp_array['airline_name'] = $row['airline_name'];
5374 5374
 			$temp_array['image_thumbnail'] = "";
5375
-			if($row['registration'] != "")
5375
+			if ($row['registration'] != "")
5376 5376
 			{
5377 5377
 				$image_array = $Image->getSpotterImage($row['registration']);
5378 5378
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5391,11 +5391,11 @@  discard block
 block discarded – undo
5391 5391
 	* @return Array the aircraft list
5392 5392
 	*
5393 5393
 	*/
5394
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5394
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5395 5395
 	{
5396
-		$filter_query = $this->getFilter($filters,true,true);
5397
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5398
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5396
+		$filter_query = $this->getFilter($filters, true, true);
5397
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5398
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5399 5399
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5400 5400
 				GROUP BY spotter_output.aircraft_manufacturer 
5401 5401
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5406,7 +5406,7 @@  discard block
 block discarded – undo
5406 5406
 		$aircraft_array = array();
5407 5407
 		$temp_array = array();
5408 5408
 
5409
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5409
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5410 5410
 		{
5411 5411
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5412 5412
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5423,12 +5423,12 @@  discard block
 block discarded – undo
5423 5423
 	* @return Array the aircraft list
5424 5424
 	*
5425 5425
 	*/
5426
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5426
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5427 5427
 	{
5428
-		$filter_query = $this->getFilter($filters,true,true);
5429
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5428
+		$filter_query = $this->getFilter($filters, true, true);
5429
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5430 5430
 
5431
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5431
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5432 5432
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
5433 5433
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5434 5434
 				ORDER BY aircraft_icao_count DESC";
@@ -5438,7 +5438,7 @@  discard block
 block discarded – undo
5438 5438
 
5439 5439
 		$aircraft_array = array();
5440 5440
 		$temp_array = array();
5441
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5441
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5442 5442
 		{
5443 5443
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5444 5444
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5456,13 +5456,13 @@  discard block
 block discarded – undo
5456 5456
 	* @return Array the aircraft list
5457 5457
 	*
5458 5458
 	*/
5459
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5459
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5460 5460
 	{
5461
-		$filter_query = $this->getFilter($filters,true,true);
5461
+		$filter_query = $this->getFilter($filters, true, true);
5462 5462
 		$Image = new Image($this->db);
5463
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5463
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5464 5464
 
5465
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5465
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5466 5466
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5467 5467
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5468 5468
 		    ORDER BY registration_count DESC";
@@ -5472,14 +5472,14 @@  discard block
 block discarded – undo
5472 5472
 
5473 5473
 		$aircraft_array = array();
5474 5474
 		$temp_array = array();
5475
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5475
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5476 5476
 		{
5477 5477
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5478 5478
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5479 5479
 			$temp_array['registration'] = $row['registration'];
5480 5480
 			$temp_array['airline_name'] = $row['airline_name'];
5481 5481
 			$temp_array['image_thumbnail'] = "";
5482
-			if($row['registration'] != "")
5482
+			if ($row['registration'] != "")
5483 5483
 			{
5484 5484
 				$image_array = $Image->getSpotterImage($row['registration']);
5485 5485
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5497,11 +5497,11 @@  discard block
 block discarded – undo
5497 5497
 	* @return Array the aircraft list
5498 5498
 	*
5499 5499
 	*/
5500
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5500
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5501 5501
 	{
5502
-		$filter_query = $this->getFilter($filters,true,true);
5503
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5504
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5502
+		$filter_query = $this->getFilter($filters, true, true);
5503
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5504
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5505 5505
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
5506 5506
                     GROUP BY spotter_output.aircraft_manufacturer 
5507 5507
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5512,7 +5512,7 @@  discard block
 block discarded – undo
5512 5512
 
5513 5513
 		$aircraft_array = array();
5514 5514
 		$temp_array = array();
5515
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5515
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5516 5516
 		{
5517 5517
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5518 5518
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5527,12 +5527,12 @@  discard block
 block discarded – undo
5527 5527
 	* @return Array the aircraft list
5528 5528
 	*
5529 5529
 	*/
5530
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5530
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5531 5531
 	{
5532
-		$filter_query = $this->getFilter($filters,true,true);
5533
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5532
+		$filter_query = $this->getFilter($filters, true, true);
5533
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5534 5534
 
5535
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5535
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5536 5536
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5537 5537
                     GROUP BY spotter_output.aircraft_name 
5538 5538
 					ORDER BY aircraft_icao_count DESC";
@@ -5541,7 +5541,7 @@  discard block
 block discarded – undo
5541 5541
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5542 5542
 		$aircraft_array = array();
5543 5543
 		$temp_array = array();
5544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5545 5545
 		{
5546 5546
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5547 5547
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5560,11 +5560,11 @@  discard block
 block discarded – undo
5560 5560
 	*/
5561 5561
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5562 5562
 	{
5563
-		$filter_query = $this->getFilter($filters,true,true);
5563
+		$filter_query = $this->getFilter($filters, true, true);
5564 5564
 		$Image = new Image($this->db);
5565
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5565
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5566 5566
 
5567
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5567
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5568 5568
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5569 5569
                     GROUP BY spotter_output.registration 
5570 5570
 					ORDER BY registration_count DESC";
@@ -5574,14 +5574,14 @@  discard block
 block discarded – undo
5574 5574
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5575 5575
 		$aircraft_array = array();
5576 5576
 		$temp_array = array();
5577
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5577
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5578 5578
 		{
5579 5579
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5580 5580
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5581 5581
 			$temp_array['registration'] = $row['registration'];
5582 5582
 			$temp_array['airline_name'] = $row['airline_name'];
5583 5583
 			$temp_array['image_thumbnail'] = "";
5584
-			if($row['registration'] != "")
5584
+			if ($row['registration'] != "")
5585 5585
 			{
5586 5586
 				$image_array = $Image->getSpotterImage($row['registration']);
5587 5587
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5598,11 +5598,11 @@  discard block
 block discarded – undo
5598 5598
 	* @return Array the aircraft list
5599 5599
 	*
5600 5600
 	*/
5601
-	public function countAllAircraftTypesByDate($date,$filters = array())
5601
+	public function countAllAircraftTypesByDate($date, $filters = array())
5602 5602
 	{
5603 5603
 		global $globalTimezone, $globalDBdriver;
5604
-		$filter_query = $this->getFilter($filters,true,true);
5605
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5604
+		$filter_query = $this->getFilter($filters, true, true);
5605
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5606 5606
 		if ($globalTimezone != '') {
5607 5607
 			date_default_timezone_set($globalTimezone);
5608 5608
 			$datetime = new DateTime($date);
@@ -5610,12 +5610,12 @@  discard block
 block discarded – undo
5610 5610
 		} else $offset = '+00:00';
5611 5611
 
5612 5612
 		if ($globalDBdriver == 'mysql') {
5613
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5613
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5614 5614
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5615 5615
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5616 5616
 					ORDER BY aircraft_icao_count DESC";
5617 5617
 		} else {
5618
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5618
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5619 5619
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5620 5620
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5621 5621
 					ORDER BY aircraft_icao_count DESC";
@@ -5626,7 +5626,7 @@  discard block
 block discarded – undo
5626 5626
 
5627 5627
 		$aircraft_array = array();
5628 5628
 		$temp_array = array();
5629
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5629
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5630 5630
 		{
5631 5631
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5632 5632
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5644,12 +5644,12 @@  discard block
 block discarded – undo
5644 5644
 	* @return Array the aircraft list
5645 5645
 	*
5646 5646
 	*/
5647
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5647
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5648 5648
 	{
5649 5649
 		global $globalTimezone, $globalDBdriver;
5650
-		$filter_query = $this->getFilter($filters,true,true);
5650
+		$filter_query = $this->getFilter($filters, true, true);
5651 5651
 		$Image = new Image($this->db);
5652
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5652
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5653 5653
 		if ($globalTimezone != '') {
5654 5654
 			date_default_timezone_set($globalTimezone);
5655 5655
 			$datetime = new DateTime($date);
@@ -5657,12 +5657,12 @@  discard block
 block discarded – undo
5657 5657
 		} else $offset = '+00:00';
5658 5658
 
5659 5659
 		if ($globalDBdriver == 'mysql') {
5660
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5660
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5661 5661
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5662 5662
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5663 5663
 					ORDER BY registration_count DESC";
5664 5664
 		} else {
5665
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5665
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5666 5666
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5667 5667
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5668 5668
 					ORDER BY registration_count DESC";
@@ -5673,14 +5673,14 @@  discard block
 block discarded – undo
5673 5673
 
5674 5674
 		$aircraft_array = array();
5675 5675
 		$temp_array = array();
5676
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5676
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5677 5677
 		{
5678 5678
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5679 5679
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5680 5680
 			$temp_array['registration'] = $row['registration'];
5681 5681
 			$temp_array['airline_name'] = $row['airline_name'];
5682 5682
 			$temp_array['image_thumbnail'] = "";
5683
-			if($row['registration'] != "")
5683
+			if ($row['registration'] != "")
5684 5684
 			{
5685 5685
 				$image_array = $Image->getSpotterImage($row['registration']);
5686 5686
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5699,11 +5699,11 @@  discard block
 block discarded – undo
5699 5699
 	* @return Array the aircraft manufacturer list
5700 5700
 	*
5701 5701
 	*/
5702
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5702
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5703 5703
 	{
5704 5704
 		global $globalTimezone, $globalDBdriver;
5705
-		$filter_query = $this->getFilter($filters,true,true);
5706
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5705
+		$filter_query = $this->getFilter($filters, true, true);
5706
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5707 5707
 		if ($globalTimezone != '') {
5708 5708
 			date_default_timezone_set($globalTimezone);
5709 5709
 			$datetime = new DateTime($date);
@@ -5711,12 +5711,12 @@  discard block
 block discarded – undo
5711 5711
 		} else $offset = '+00:00';
5712 5712
 
5713 5713
 		if ($globalDBdriver == 'mysql') {
5714
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5714
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5715 5715
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5716 5716
 				GROUP BY spotter_output.aircraft_manufacturer 
5717 5717
 				ORDER BY aircraft_manufacturer_count DESC";
5718 5718
 		} else {
5719
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5719
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5720 5720
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5721 5721
 				GROUP BY spotter_output.aircraft_manufacturer 
5722 5722
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5728,7 +5728,7 @@  discard block
 block discarded – undo
5728 5728
 		$aircraft_array = array();
5729 5729
 		$temp_array = array();
5730 5730
 
5731
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5731
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5732 5732
 		{
5733 5733
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5734 5734
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5745,11 +5745,11 @@  discard block
 block discarded – undo
5745 5745
 	* @return Array the aircraft list
5746 5746
 	*
5747 5747
 	*/
5748
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5748
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5749 5749
 	{
5750
-		$filter_query = $this->getFilter($filters,true,true);
5751
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5752
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5750
+		$filter_query = $this->getFilter($filters, true, true);
5751
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5752
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5753 5753
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5754 5754
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5755 5755
 				ORDER BY aircraft_icao_count DESC";
@@ -5760,7 +5760,7 @@  discard block
 block discarded – undo
5760 5760
 		$aircraft_array = array();
5761 5761
 		$temp_array = array();
5762 5762
 
5763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5764 5764
 		{
5765 5765
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5766 5766
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5777,45 +5777,45 @@  discard block
 block discarded – undo
5777 5777
 	* @return Array the aircraft list
5778 5778
 	*
5779 5779
 	*/
5780
-	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5780
+	public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5781 5781
 	{
5782 5782
 		global $globalDBdriver;
5783
-		$filter_query = $this->getFilter($filters,true,true);
5784
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5785
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5783
+		$filter_query = $this->getFilter($filters, true, true);
5784
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5785
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5786 5786
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)";
5787 5787
 		$query_values = array();
5788 5788
 		if ($year != '') {
5789 5789
 			if ($globalDBdriver == 'mysql') {
5790 5790
 				$query .= " AND YEAR(spotter_output.date) = :year";
5791
-				$query_values = array_merge($query_values,array(':year' => $year));
5791
+				$query_values = array_merge($query_values, array(':year' => $year));
5792 5792
 			} else {
5793 5793
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5794
-				$query_values = array_merge($query_values,array(':year' => $year));
5794
+				$query_values = array_merge($query_values, array(':year' => $year));
5795 5795
 			}
5796 5796
 		}
5797 5797
 		if ($month != '') {
5798 5798
 			if ($globalDBdriver == 'mysql') {
5799 5799
 				$query .= " AND MONTH(spotter_output.date) = :month";
5800
-				$query_values = array_merge($query_values,array(':month' => $month));
5800
+				$query_values = array_merge($query_values, array(':month' => $month));
5801 5801
 			} else {
5802 5802
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5803
-				$query_values = array_merge($query_values,array(':month' => $month));
5803
+				$query_values = array_merge($query_values, array(':month' => $month));
5804 5804
 			}
5805 5805
 		}
5806 5806
 		if ($day != '') {
5807 5807
 			if ($globalDBdriver == 'mysql') {
5808 5808
 				$query .= " AND DAY(spotter_output.date) = :day";
5809
-				$query_values = array_merge($query_values,array(':day' => $day));
5809
+				$query_values = array_merge($query_values, array(':day' => $day));
5810 5810
 			} else {
5811 5811
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5812
-				$query_values = array_merge($query_values,array(':day' => $day));
5812
+				$query_values = array_merge($query_values, array(':day' => $day));
5813 5813
 			}
5814 5814
 		}
5815 5815
 
5816 5816
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5817 5817
 				ORDER BY aircraft_icao_count DESC";
5818
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5818
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
5819 5819
 		$sth = $this->db->prepare($query);
5820 5820
 		$sth->execute($query_values);
5821 5821
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5827,44 +5827,44 @@  discard block
 block discarded – undo
5827 5827
 	* @return Array the aircraft list
5828 5828
 	*
5829 5829
 	*/
5830
-	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5830
+	public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5831 5831
 	{
5832 5832
 		global $globalDBdriver;
5833
-		$filter_query = $this->getFilter($filters,true,true);
5834
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5835
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5833
+		$filter_query = $this->getFilter($filters, true, true);
5834
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5835
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5836 5836
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
5837 5837
 		$query_values = array();
5838 5838
 		if ($year != '') {
5839 5839
 			if ($globalDBdriver == 'mysql') {
5840 5840
 				$query .= " AND YEAR(spotter_output.date) = :year";
5841
-				$query_values = array_merge($query_values,array(':year' => $year));
5841
+				$query_values = array_merge($query_values, array(':year' => $year));
5842 5842
 			} else {
5843 5843
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5844
-				$query_values = array_merge($query_values,array(':year' => $year));
5844
+				$query_values = array_merge($query_values, array(':year' => $year));
5845 5845
 			}
5846 5846
 		}
5847 5847
 		if ($month != '') {
5848 5848
 			if ($globalDBdriver == 'mysql') {
5849 5849
 				$query .= " AND MONTH(spotter_output.date) = :month";
5850
-				$query_values = array_merge($query_values,array(':month' => $month));
5850
+				$query_values = array_merge($query_values, array(':month' => $month));
5851 5851
 			} else {
5852 5852
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5853
-				$query_values = array_merge($query_values,array(':month' => $month));
5853
+				$query_values = array_merge($query_values, array(':month' => $month));
5854 5854
 			}
5855 5855
 		}
5856 5856
 		if ($day != '') {
5857 5857
 			if ($globalDBdriver == 'mysql') {
5858 5858
 				$query .= " AND DAY(spotter_output.date) = :day";
5859
-				$query_values = array_merge($query_values,array(':day' => $day));
5859
+				$query_values = array_merge($query_values, array(':day' => $day));
5860 5860
 			} else {
5861 5861
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5862
-				$query_values = array_merge($query_values,array(':day' => $day));
5862
+				$query_values = array_merge($query_values, array(':day' => $day));
5863 5863
 			}
5864 5864
 		}
5865 5865
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5866 5866
 				ORDER BY aircraft_icao_count DESC";
5867
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5867
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5868 5868
 		$sth = $this->db->prepare($query);
5869 5869
 		$sth->execute($query_values);
5870 5870
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5876,13 +5876,13 @@  discard block
 block discarded – undo
5876 5876
 	* @return Array the aircraft list
5877 5877
 	*
5878 5878
 	*/
5879
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5879
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5880 5880
 	{
5881
-		$filter_query = $this->getFilter($filters,true,true);
5881
+		$filter_query = $this->getFilter($filters, true, true);
5882 5882
 		$Image = new Image($this->db);
5883
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5883
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5884 5884
 
5885
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5885
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5886 5886
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5887 5887
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5888 5888
 		    ORDER BY registration_count DESC";
@@ -5894,14 +5894,14 @@  discard block
 block discarded – undo
5894 5894
 		$aircraft_array = array();
5895 5895
 		$temp_array = array();
5896 5896
         
5897
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5897
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5898 5898
 		{
5899 5899
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5900 5900
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5901 5901
 			$temp_array['registration'] = $row['registration'];
5902 5902
 			$temp_array['airline_name'] = $row['airline_name'];
5903 5903
 			$temp_array['image_thumbnail'] = "";
5904
-			if($row['registration'] != "")
5904
+			if ($row['registration'] != "")
5905 5905
 			{
5906 5906
 				$image_array = $Image->getSpotterImage($row['registration']);
5907 5907
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5919,44 +5919,44 @@  discard block
 block discarded – undo
5919 5919
 	* @return Array the aircraft list
5920 5920
 	*
5921 5921
 	*/
5922
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5922
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5923 5923
 	{
5924 5924
 		global $globalDBdriver;
5925
-		$filter_query = $this->getFilter($filters,true,true);
5925
+		$filter_query = $this->getFilter($filters, true, true);
5926 5926
 		$Image = new Image($this->db);
5927
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5927
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5928 5928
 
5929
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5929
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5930 5930
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner";
5931 5931
 		$query_values = array();
5932 5932
 		if ($year != '') {
5933 5933
 			if ($globalDBdriver == 'mysql') {
5934 5934
 				$query .= " AND YEAR(spotter_output.date) = :year";
5935
-				$query_values = array_merge($query_values,array(':year' => $year));
5935
+				$query_values = array_merge($query_values, array(':year' => $year));
5936 5936
 			} else {
5937 5937
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5938
-				$query_values = array_merge($query_values,array(':year' => $year));
5938
+				$query_values = array_merge($query_values, array(':year' => $year));
5939 5939
 			}
5940 5940
 		}
5941 5941
 		if ($month != '') {
5942 5942
 			if ($globalDBdriver == 'mysql') {
5943 5943
 				$query .= " AND MONTH(spotter_output.date) = :month";
5944
-				$query_values = array_merge($query_values,array(':month' => $month));
5944
+				$query_values = array_merge($query_values, array(':month' => $month));
5945 5945
 			} else {
5946 5946
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5947
-				$query_values = array_merge($query_values,array(':month' => $month));
5947
+				$query_values = array_merge($query_values, array(':month' => $month));
5948 5948
 			}
5949 5949
 		}
5950 5950
 		if ($day != '') {
5951 5951
 			if ($globalDBdriver == 'mysql') {
5952 5952
 				$query .= " AND DAY(spotter_output.date) = :day";
5953
-				$query_values = array_merge($query_values,array(':day' => $day));
5953
+				$query_values = array_merge($query_values, array(':day' => $day));
5954 5954
 			} else {
5955 5955
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5956
-				$query_values = array_merge($query_values,array(':day' => $day));
5956
+				$query_values = array_merge($query_values, array(':day' => $day));
5957 5957
 			}
5958 5958
 		}
5959
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5959
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5960 5960
 
5961 5961
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5962 5962
 		    ORDER BY registration_count DESC";
@@ -5968,7 +5968,7 @@  discard block
 block discarded – undo
5968 5968
 		$aircraft_array = array();
5969 5969
 		$temp_array = array();
5970 5970
         
5971
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5971
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5972 5972
 		{
5973 5973
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5974 5974
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5976,7 +5976,7 @@  discard block
 block discarded – undo
5976 5976
 			$temp_array['registration'] = $row['registration'];
5977 5977
 			$temp_array['airline_name'] = $row['airline_name'];
5978 5978
 			$temp_array['image_thumbnail'] = "";
5979
-			if($row['registration'] != "")
5979
+			if ($row['registration'] != "")
5980 5980
 			{
5981 5981
 				$image_array = $Image->getSpotterImage($row['registration']);
5982 5982
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5994,44 +5994,44 @@  discard block
 block discarded – undo
5994 5994
 	* @return Array the aircraft list
5995 5995
 	*
5996 5996
 	*/
5997
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5997
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5998 5998
 	{
5999 5999
 		global $globalDBdriver;
6000
-		$filter_query = $this->getFilter($filters,true,true);
6000
+		$filter_query = $this->getFilter($filters, true, true);
6001 6001
 		$Image = new Image($this->db);
6002
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6002
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6003 6003
 
6004
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
6004
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
6005 6005
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6006 6006
 		$query_values = array();
6007 6007
 		if ($year != '') {
6008 6008
 			if ($globalDBdriver == 'mysql') {
6009 6009
 				$query .= " AND YEAR(spotter_output.date) = :year";
6010
-				$query_values = array_merge($query_values,array(':year' => $year));
6010
+				$query_values = array_merge($query_values, array(':year' => $year));
6011 6011
 			} else {
6012 6012
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6013
-				$query_values = array_merge($query_values,array(':year' => $year));
6013
+				$query_values = array_merge($query_values, array(':year' => $year));
6014 6014
 			}
6015 6015
 		}
6016 6016
 		if ($month != '') {
6017 6017
 			if ($globalDBdriver == 'mysql') {
6018 6018
 				$query .= " AND MONTH(spotter_output.date) = :month";
6019
-				$query_values = array_merge($query_values,array(':month' => $month));
6019
+				$query_values = array_merge($query_values, array(':month' => $month));
6020 6020
 			} else {
6021 6021
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6022
-				$query_values = array_merge($query_values,array(':month' => $month));
6022
+				$query_values = array_merge($query_values, array(':month' => $month));
6023 6023
 			}
6024 6024
 		}
6025 6025
 		if ($day != '') {
6026 6026
 			if ($globalDBdriver == 'mysql') {
6027 6027
 				$query .= " AND DAY(spotter_output.date) = :day";
6028
-				$query_values = array_merge($query_values,array(':day' => $day));
6028
+				$query_values = array_merge($query_values, array(':day' => $day));
6029 6029
 			} else {
6030 6030
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6031
-				$query_values = array_merge($query_values,array(':day' => $day));
6031
+				$query_values = array_merge($query_values, array(':day' => $day));
6032 6032
 			}
6033 6033
 		}
6034
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6034
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6035 6035
 
6036 6036
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
6037 6037
 		    ORDER BY registration_count DESC";
@@ -6043,7 +6043,7 @@  discard block
 block discarded – undo
6043 6043
 		$aircraft_array = array();
6044 6044
 		$temp_array = array();
6045 6045
         
6046
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6046
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6047 6047
 		{
6048 6048
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6049 6049
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6051,7 +6051,7 @@  discard block
 block discarded – undo
6051 6051
 			$temp_array['registration'] = $row['registration'];
6052 6052
 			$temp_array['airline_name'] = $row['airline_name'];
6053 6053
 			$temp_array['image_thumbnail'] = "";
6054
-			if($row['registration'] != "")
6054
+			if ($row['registration'] != "")
6055 6055
 			{
6056 6056
 				$image_array = $Image->getSpotterImage($row['registration']);
6057 6057
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6070,11 +6070,11 @@  discard block
 block discarded – undo
6070 6070
 	* @return Array the aircraft manufacturer list
6071 6071
 	*
6072 6072
 	*/
6073
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6073
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
6074 6074
 	{
6075
-		$filter_query = $this->getFilter($filters,true,true);
6076
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6077
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6075
+		$filter_query = $this->getFilter($filters, true, true);
6076
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6077
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6078 6078
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
6079 6079
                     GROUP BY spotter_output.aircraft_manufacturer 
6080 6080
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6084,7 +6084,7 @@  discard block
 block discarded – undo
6084 6084
 		$sth->execute(array(':ident' => $ident));
6085 6085
 		$aircraft_array = array();
6086 6086
 		$temp_array = array();
6087
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6087
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6088 6088
 		{
6089 6089
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6090 6090
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6099,42 +6099,42 @@  discard block
 block discarded – undo
6099 6099
 	* @return Array the aircraft manufacturer list
6100 6100
 	*
6101 6101
 	*/
6102
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6102
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
6103 6103
 	{
6104 6104
 		global $globalDBdriver;
6105
-		$filter_query = $this->getFilter($filters,true,true);
6106
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6107
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6105
+		$filter_query = $this->getFilter($filters, true, true);
6106
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6107
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6108 6108
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner";
6109 6109
 		$query_values = array();
6110 6110
 		if ($year != '') {
6111 6111
 			if ($globalDBdriver == 'mysql') {
6112 6112
 				$query .= " AND YEAR(spotter_output.date) = :year";
6113
-				$query_values = array_merge($query_values,array(':year' => $year));
6113
+				$query_values = array_merge($query_values, array(':year' => $year));
6114 6114
 			} else {
6115 6115
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6116
-				$query_values = array_merge($query_values,array(':year' => $year));
6116
+				$query_values = array_merge($query_values, array(':year' => $year));
6117 6117
 			}
6118 6118
 		}
6119 6119
 		if ($month != '') {
6120 6120
 			if ($globalDBdriver == 'mysql') {
6121 6121
 				$query .= " AND MONTH(spotter_output.date) = :month";
6122
-				$query_values = array_merge($query_values,array(':month' => $month));
6122
+				$query_values = array_merge($query_values, array(':month' => $month));
6123 6123
 			} else {
6124 6124
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6125
-				$query_values = array_merge($query_values,array(':month' => $month));
6125
+				$query_values = array_merge($query_values, array(':month' => $month));
6126 6126
 			}
6127 6127
 		}
6128 6128
 		if ($day != '') {
6129 6129
 			if ($globalDBdriver == 'mysql') {
6130 6130
 				$query .= " AND DAY(spotter_output.date) = :day";
6131
-				$query_values = array_merge($query_values,array(':day' => $day));
6131
+				$query_values = array_merge($query_values, array(':day' => $day));
6132 6132
 			} else {
6133 6133
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6134
-				$query_values = array_merge($query_values,array(':day' => $day));
6134
+				$query_values = array_merge($query_values, array(':day' => $day));
6135 6135
 			}
6136 6136
 		}
6137
-		$query_values = array_merge($query_values,array(':owner' => $owner));
6137
+		$query_values = array_merge($query_values, array(':owner' => $owner));
6138 6138
 
6139 6139
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6140 6140
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6151,42 +6151,42 @@  discard block
 block discarded – undo
6151 6151
 	* @return Array the aircraft manufacturer list
6152 6152
 	*
6153 6153
 	*/
6154
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6154
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6155 6155
 	{
6156 6156
 		global $globalDBdriver;
6157
-		$filter_query = $this->getFilter($filters,true,true);
6158
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6159
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6157
+		$filter_query = $this->getFilter($filters, true, true);
6158
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6159
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6160 6160
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6161 6161
 		$query_values = array();
6162 6162
 		if ($year != '') {
6163 6163
 			if ($globalDBdriver == 'mysql') {
6164 6164
 				$query .= " AND YEAR(spotter_output.date) = :year";
6165
-				$query_values = array_merge($query_values,array(':year' => $year));
6165
+				$query_values = array_merge($query_values, array(':year' => $year));
6166 6166
 			} else {
6167 6167
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6168
-				$query_values = array_merge($query_values,array(':year' => $year));
6168
+				$query_values = array_merge($query_values, array(':year' => $year));
6169 6169
 			}
6170 6170
 		}
6171 6171
 		if ($month != '') {
6172 6172
 			if ($globalDBdriver == 'mysql') {
6173 6173
 				$query .= " AND MONTH(spotter_output.date) = :month";
6174
-				$query_values = array_merge($query_values,array(':month' => $month));
6174
+				$query_values = array_merge($query_values, array(':month' => $month));
6175 6175
 			} else {
6176 6176
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6177
-				$query_values = array_merge($query_values,array(':month' => $month));
6177
+				$query_values = array_merge($query_values, array(':month' => $month));
6178 6178
 			}
6179 6179
 		}
6180 6180
 		if ($day != '') {
6181 6181
 			if ($globalDBdriver == 'mysql') {
6182 6182
 				$query .= " AND DAY(spotter_output.date) = :day";
6183
-				$query_values = array_merge($query_values,array(':day' => $day));
6183
+				$query_values = array_merge($query_values, array(':day' => $day));
6184 6184
 			} else {
6185 6185
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6186
-				$query_values = array_merge($query_values,array(':day' => $day));
6186
+				$query_values = array_merge($query_values, array(':day' => $day));
6187 6187
 			}
6188 6188
 		}
6189
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6189
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6190 6190
 
6191 6191
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6192 6192
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6204,24 +6204,24 @@  discard block
 block discarded – undo
6204 6204
 	* @return Array the aircraft list
6205 6205
 	*
6206 6206
 	*/
6207
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6207
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6208 6208
 	{
6209
-		$filter_query = $this->getFilter($filters,true,true);
6210
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6211
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6209
+		$filter_query = $this->getFilter($filters, true, true);
6210
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6211
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6212 6212
 		
6213 6213
 
6214
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6214
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6215 6215
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
6216 6216
                     GROUP BY spotter_output.aircraft_name 
6217 6217
 					ORDER BY aircraft_icao_count DESC";
6218 6218
  
6219 6219
 		
6220 6220
 		$sth = $this->db->prepare($query);
6221
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6221
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6222 6222
 		$aircraft_array = array();
6223 6223
 		$temp_array = array();
6224
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6224
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6225 6225
 		{
6226 6226
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6227 6227
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6237,33 +6237,33 @@  discard block
 block discarded – undo
6237 6237
 	* @return Array the aircraft list
6238 6238
 	*
6239 6239
 	*/
6240
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6240
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6241 6241
 	{
6242
-		$filter_query = $this->getFilter($filters,true,true);
6242
+		$filter_query = $this->getFilter($filters, true, true);
6243 6243
 		$Image = new Image($this->db);
6244
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6245
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6244
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6245
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6246 6246
 
6247
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
6247
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
6248 6248
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
6249 6249
                     GROUP BY spotter_output.registration 
6250 6250
 					ORDER BY registration_count DESC";
6251 6251
 
6252 6252
 		
6253 6253
 		$sth = $this->db->prepare($query);
6254
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6254
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6255 6255
       
6256 6256
 		$aircraft_array = array();
6257 6257
 		$temp_array = array();
6258 6258
         
6259
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6259
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6260 6260
 		{
6261 6261
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6262 6262
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6263 6263
 			$temp_array['registration'] = $row['registration'];
6264 6264
 			$temp_array['airline_name'] = $row['airline_name'];
6265 6265
 			$temp_array['image_thumbnail'] = "";
6266
-			if($row['registration'] != "")
6266
+			if ($row['registration'] != "")
6267 6267
 			{
6268 6268
 				$image_array = $Image->getSpotterImage($row['registration']);
6269 6269
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6283,25 +6283,25 @@  discard block
 block discarded – undo
6283 6283
 	* @return Array the aircraft manufacturer list
6284 6284
 	*
6285 6285
 	*/
6286
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6286
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6287 6287
 	{
6288
-		$filter_query = $this->getFilter($filters,true,true);
6289
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6290
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6288
+		$filter_query = $this->getFilter($filters, true, true);
6289
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6290
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6291 6291
 
6292
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6292
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6293 6293
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
6294 6294
                     GROUP BY spotter_output.aircraft_manufacturer 
6295 6295
 					ORDER BY aircraft_manufacturer_count DESC";
6296 6296
 
6297 6297
 		
6298 6298
 		$sth = $this->db->prepare($query);
6299
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6299
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6300 6300
       
6301 6301
 		$aircraft_array = array();
6302 6302
 		$temp_array = array();
6303 6303
         
6304
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6304
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6305 6305
 		{
6306 6306
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6307 6307
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6321,11 +6321,11 @@  discard block
 block discarded – undo
6321 6321
 	* @return Array the aircraft list
6322 6322
 	*
6323 6323
 	*/
6324
-	public function countAllAircraftTypesByCountry($country,$filters = array())
6324
+	public function countAllAircraftTypesByCountry($country, $filters = array())
6325 6325
 	{
6326
-		$filter_query = $this->getFilter($filters,true,true);
6327
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6328
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6326
+		$filter_query = $this->getFilter($filters, true, true);
6327
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6328
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6329 6329
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6330 6330
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
6331 6331
 			    ORDER BY aircraft_icao_count DESC";
@@ -6337,7 +6337,7 @@  discard block
 block discarded – undo
6337 6337
 		$aircraft_array = array();
6338 6338
 		$temp_array = array();
6339 6339
         
6340
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6340
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6341 6341
 		{
6342 6342
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6343 6343
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6356,12 +6356,12 @@  discard block
 block discarded – undo
6356 6356
 	* @return Array the aircraft list
6357 6357
 	*
6358 6358
 	*/
6359
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6359
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
6360 6360
 	{
6361
-		$filter_query = $this->getFilter($filters,true,true);
6361
+		$filter_query = $this->getFilter($filters, true, true);
6362 6362
 		$Image = new Image($this->db);
6363
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6364
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
6363
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6364
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
6365 6365
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
6366 6366
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
6367 6367
 			    ORDER BY registration_count DESC";
@@ -6373,14 +6373,14 @@  discard block
 block discarded – undo
6373 6373
 		$aircraft_array = array();
6374 6374
 		$temp_array = array();
6375 6375
         
6376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6377 6377
 		{
6378 6378
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6379 6379
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6380 6380
 			$temp_array['registration'] = $row['registration'];
6381 6381
 			$temp_array['airline_name'] = $row['airline_name'];
6382 6382
 			$temp_array['image_thumbnail'] = "";
6383
-			if($row['registration'] != "")
6383
+			if ($row['registration'] != "")
6384 6384
 			{
6385 6385
 				$image_array = $Image->getSpotterImage($row['registration']);
6386 6386
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6400,11 +6400,11 @@  discard block
 block discarded – undo
6400 6400
 	* @return Array the aircraft manufacturer list
6401 6401
 	*
6402 6402
 	*/
6403
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6403
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6404 6404
 	{
6405
-		$filter_query = $this->getFilter($filters,true,true);
6406
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6407
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6405
+		$filter_query = $this->getFilter($filters, true, true);
6406
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6407
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6408 6408
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
6409 6409
                     GROUP BY spotter_output.aircraft_manufacturer 
6410 6410
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6416,7 +6416,7 @@  discard block
 block discarded – undo
6416 6416
 		$aircraft_array = array();
6417 6417
 		$temp_array = array();
6418 6418
         
6419
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6419
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6420 6420
 		{
6421 6421
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6422 6422
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6435,38 +6435,38 @@  discard block
 block discarded – undo
6435 6435
 	* @return Array the aircraft list
6436 6436
 	*
6437 6437
 	*/
6438
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6438
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6439 6439
 	{
6440 6440
 		global $globalDBdriver;
6441
-		$filter_query = $this->getFilter($filters,true,true);
6442
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6441
+		$filter_query = $this->getFilter($filters, true, true);
6442
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6443 6443
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6444 6444
                 $query_values = array();
6445 6445
 		if ($year != '') {
6446 6446
 			if ($globalDBdriver == 'mysql') {
6447 6447
 				$query .= " AND YEAR(spotter_output.date) = :year";
6448
-				$query_values = array_merge($query_values,array(':year' => $year));
6448
+				$query_values = array_merge($query_values, array(':year' => $year));
6449 6449
 			} else {
6450 6450
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6451
-				$query_values = array_merge($query_values,array(':year' => $year));
6451
+				$query_values = array_merge($query_values, array(':year' => $year));
6452 6452
 			}
6453 6453
 		}
6454 6454
 		if ($month != '') {
6455 6455
 			if ($globalDBdriver == 'mysql') {
6456 6456
 				$query .= " AND MONTH(spotter_output.date) = :month";
6457
-				$query_values = array_merge($query_values,array(':month' => $month));
6457
+				$query_values = array_merge($query_values, array(':month' => $month));
6458 6458
 			} else {
6459 6459
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6460
-				$query_values = array_merge($query_values,array(':month' => $month));
6460
+				$query_values = array_merge($query_values, array(':month' => $month));
6461 6461
 			}
6462 6462
 		}
6463 6463
 		if ($day != '') {
6464 6464
 			if ($globalDBdriver == 'mysql') {
6465 6465
 				$query .= " AND DAY(spotter_output.date) = :day";
6466
-				$query_values = array_merge($query_values,array(':day' => $day));
6466
+				$query_values = array_merge($query_values, array(':day' => $day));
6467 6467
 			} else {
6468 6468
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6469
-				$query_values = array_merge($query_values,array(':day' => $day));
6469
+				$query_values = array_merge($query_values, array(':day' => $day));
6470 6470
 			}
6471 6471
 		}
6472 6472
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6480,7 +6480,7 @@  discard block
 block discarded – undo
6480 6480
 		$manufacturer_array = array();
6481 6481
 		$temp_array = array();
6482 6482
         
6483
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6483
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6484 6484
 		{
6485 6485
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6486 6486
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6499,12 +6499,12 @@  discard block
 block discarded – undo
6499 6499
 	* @return Array the aircraft list
6500 6500
 	*
6501 6501
 	*/
6502
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6502
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6503 6503
 	{
6504 6504
 		global $globalDBdriver;
6505 6505
 		$Image = new Image($this->db);
6506
-		$filter_query = $this->getFilter($filters,true,true);
6507
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6506
+		$filter_query = $this->getFilter($filters, true, true);
6507
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6508 6508
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6509 6509
                 if ($olderthanmonths > 0) {
6510 6510
             		if ($globalDBdriver == 'mysql') {
@@ -6524,28 +6524,28 @@  discard block
 block discarded – undo
6524 6524
 		if ($year != '') {
6525 6525
 			if ($globalDBdriver == 'mysql') {
6526 6526
 				$query .= " AND YEAR(spotter_output.date) = :year";
6527
-				$query_values = array_merge($query_values,array(':year' => $year));
6527
+				$query_values = array_merge($query_values, array(':year' => $year));
6528 6528
 			} else {
6529 6529
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6530
-				$query_values = array_merge($query_values,array(':year' => $year));
6530
+				$query_values = array_merge($query_values, array(':year' => $year));
6531 6531
 			}
6532 6532
 		}
6533 6533
 		if ($month != '') {
6534 6534
 			if ($globalDBdriver == 'mysql') {
6535 6535
 				$query .= " AND MONTH(spotter_output.date) = :month";
6536
-				$query_values = array_merge($query_values,array(':month' => $month));
6536
+				$query_values = array_merge($query_values, array(':month' => $month));
6537 6537
 			} else {
6538 6538
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6539
-				$query_values = array_merge($query_values,array(':month' => $month));
6539
+				$query_values = array_merge($query_values, array(':month' => $month));
6540 6540
 			}
6541 6541
 		}
6542 6542
 		if ($day != '') {
6543 6543
 			if ($globalDBdriver == 'mysql') {
6544 6544
 				$query .= " AND DAY(spotter_output.date) = :day";
6545
-				$query_values = array_merge($query_values,array(':day' => $day));
6545
+				$query_values = array_merge($query_values, array(':day' => $day));
6546 6546
 			} else {
6547 6547
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6548
-				$query_values = array_merge($query_values,array(':day' => $day));
6548
+				$query_values = array_merge($query_values, array(':day' => $day));
6549 6549
 			}
6550 6550
 		}
6551 6551
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6557,7 +6557,7 @@  discard block
 block discarded – undo
6557 6557
 		$aircraft_array = array();
6558 6558
 		$temp_array = array();
6559 6559
         
6560
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6560
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6561 6561
 		{
6562 6562
 			$temp_array['registration'] = $row['registration'];
6563 6563
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6565,7 +6565,7 @@  discard block
 block discarded – undo
6565 6565
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6566 6566
 			$temp_array['airline_name'] = $row['airline_name'];
6567 6567
 			$temp_array['image_thumbnail'] = "";
6568
-			if($row['registration'] != "")
6568
+			if ($row['registration'] != "")
6569 6569
 			{
6570 6570
 				$image_array = $Image->getSpotterImage($row['registration']);
6571 6571
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6584,12 +6584,12 @@  discard block
 block discarded – undo
6584 6584
 	* @return Array the aircraft list
6585 6585
 	*
6586 6586
 	*/
6587
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6587
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6588 6588
 	{
6589 6589
 		global $globalDBdriver;
6590
-		$filter_query = $this->getFilter($filters,true,true);
6590
+		$filter_query = $this->getFilter($filters, true, true);
6591 6591
 		$Image = new Image($this->db);
6592
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6592
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6593 6593
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6594 6594
                 if ($olderthanmonths > 0) {
6595 6595
             		if ($globalDBdriver == 'mysql') {
@@ -6617,7 +6617,7 @@  discard block
 block discarded – undo
6617 6617
 		$aircraft_array = array();
6618 6618
 		$temp_array = array();
6619 6619
         
6620
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6620
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6621 6621
 		{
6622 6622
 			$temp_array['registration'] = $row['registration'];
6623 6623
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6626,7 +6626,7 @@  discard block
 block discarded – undo
6626 6626
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6627 6627
 			$temp_array['airline_name'] = $row['airline_name'];
6628 6628
 			$temp_array['image_thumbnail'] = "";
6629
-			if($row['registration'] != "")
6629
+			if ($row['registration'] != "")
6630 6630
 			{
6631 6631
 				$image_array = $Image->getSpotterImage($row['registration']);
6632 6632
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6645,11 +6645,11 @@  discard block
 block discarded – undo
6645 6645
 	* @return Array the airport list
6646 6646
 	*
6647 6647
 	*/
6648
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6648
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6649 6649
 	{
6650 6650
 		global $globalDBdriver;
6651
-		$filter_query = $this->getFilter($filters,true,true);
6652
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6651
+		$filter_query = $this->getFilter($filters, true, true);
6652
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6653 6653
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6654 6654
                 if ($olderthanmonths > 0) {
6655 6655
             		if ($globalDBdriver == 'mysql') {
@@ -6669,28 +6669,28 @@  discard block
 block discarded – undo
6669 6669
 		if ($year != '') {
6670 6670
 			if ($globalDBdriver == 'mysql') {
6671 6671
 				$query .= " AND YEAR(spotter_output.date) = :year";
6672
-				$query_values = array_merge($query_values,array(':year' => $year));
6672
+				$query_values = array_merge($query_values, array(':year' => $year));
6673 6673
 			} else {
6674 6674
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6675
-				$query_values = array_merge($query_values,array(':year' => $year));
6675
+				$query_values = array_merge($query_values, array(':year' => $year));
6676 6676
 			}
6677 6677
 		}
6678 6678
 		if ($month != '') {
6679 6679
 			if ($globalDBdriver == 'mysql') {
6680 6680
 				$query .= " AND MONTH(spotter_output.date) = :month";
6681
-				$query_values = array_merge($query_values,array(':month' => $month));
6681
+				$query_values = array_merge($query_values, array(':month' => $month));
6682 6682
 			} else {
6683 6683
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6684
-				$query_values = array_merge($query_values,array(':month' => $month));
6684
+				$query_values = array_merge($query_values, array(':month' => $month));
6685 6685
 			}
6686 6686
 		}
6687 6687
 		if ($day != '') {
6688 6688
 			if ($globalDBdriver == 'mysql') {
6689 6689
 				$query .= " AND DAY(spotter_output.date) = :day";
6690
-				$query_values = array_merge($query_values,array(':day' => $day));
6690
+				$query_values = array_merge($query_values, array(':day' => $day));
6691 6691
 			} else {
6692 6692
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6693
-				$query_values = array_merge($query_values,array(':day' => $day));
6693
+				$query_values = array_merge($query_values, array(':day' => $day));
6694 6694
 			}
6695 6695
 		}
6696 6696
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6702,7 +6702,7 @@  discard block
 block discarded – undo
6702 6702
 
6703 6703
 		$airport_array = array();
6704 6704
 		$temp_array = array();
6705
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6705
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6706 6706
 		{
6707 6707
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6708 6708
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6721,11 +6721,11 @@  discard block
 block discarded – undo
6721 6721
 	* @return Array the airport list
6722 6722
 	*
6723 6723
 	*/
6724
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6724
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6725 6725
 	{
6726 6726
 		global $globalDBdriver;
6727
-		$filter_query = $this->getFilter($filters,true,true);
6728
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6727
+		$filter_query = $this->getFilter($filters, true, true);
6728
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6729 6729
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6730 6730
                 if ($olderthanmonths > 0) {
6731 6731
             		if ($globalDBdriver == 'mysql') {
@@ -6754,7 +6754,7 @@  discard block
 block discarded – undo
6754 6754
 		$airport_array = array();
6755 6755
 		$temp_array = array();
6756 6756
         
6757
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6757
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6758 6758
 		{
6759 6759
 			$temp_array['airline_icao'] = $row['airline_icao'];
6760 6760
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6774,11 +6774,11 @@  discard block
 block discarded – undo
6774 6774
 	* @return Array the airport list
6775 6775
 	*
6776 6776
 	*/
6777
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6777
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6778 6778
 	{
6779 6779
 		global $globalDBdriver;
6780
-		$filter_query = $this->getFilter($filters,true,true);
6781
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6780
+		$filter_query = $this->getFilter($filters, true, true);
6781
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6782 6782
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
6783 6783
                 if ($olderthanmonths > 0) {
6784 6784
             		if ($globalDBdriver == 'mysql') {
@@ -6798,28 +6798,28 @@  discard block
 block discarded – undo
6798 6798
 		if ($year != '') {
6799 6799
 			if ($globalDBdriver == 'mysql') {
6800 6800
 				$query .= " AND YEAR(spotter_output.date) = :year";
6801
-				$query_values = array_merge($query_values,array(':year' => $year));
6801
+				$query_values = array_merge($query_values, array(':year' => $year));
6802 6802
 			} else {
6803 6803
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6804
-				$query_values = array_merge($query_values,array(':year' => $year));
6804
+				$query_values = array_merge($query_values, array(':year' => $year));
6805 6805
 			}
6806 6806
 		}
6807 6807
 		if ($month != '') {
6808 6808
 			if ($globalDBdriver == 'mysql') {
6809 6809
 				$query .= " AND MONTH(spotter_output.date) = :month";
6810
-				$query_values = array_merge($query_values,array(':month' => $month));
6810
+				$query_values = array_merge($query_values, array(':month' => $month));
6811 6811
 			} else {
6812 6812
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6813
-				$query_values = array_merge($query_values,array(':month' => $month));
6813
+				$query_values = array_merge($query_values, array(':month' => $month));
6814 6814
 			}
6815 6815
 		}
6816 6816
 		if ($day != '') {
6817 6817
 			if ($globalDBdriver == 'mysql') {
6818 6818
 				$query .= " AND DAY(spotter_output.date) = :day";
6819
-				$query_values = array_merge($query_values,array(':day' => $day));
6819
+				$query_values = array_merge($query_values, array(':day' => $day));
6820 6820
 			} else {
6821 6821
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6822
-				$query_values = array_merge($query_values,array(':day' => $day));
6822
+				$query_values = array_merge($query_values, array(':day' => $day));
6823 6823
 			}
6824 6824
 		}
6825 6825
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6832,7 +6832,7 @@  discard block
 block discarded – undo
6832 6832
 		$airport_array = array();
6833 6833
 		$temp_array = array();
6834 6834
         
6835
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6835
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6836 6836
 		{
6837 6837
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6838 6838
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6851,11 +6851,11 @@  discard block
 block discarded – undo
6851 6851
 	* @return Array the airport list
6852 6852
 	*
6853 6853
 	*/
6854
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6854
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6855 6855
 	{
6856 6856
 		global $globalDBdriver;
6857
-		$filter_query = $this->getFilter($filters,true,true);
6858
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6857
+		$filter_query = $this->getFilter($filters, true, true);
6858
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6859 6859
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
6860 6860
                 if ($olderthanmonths > 0) {
6861 6861
             		if ($globalDBdriver == 'mysql') {
@@ -6884,7 +6884,7 @@  discard block
 block discarded – undo
6884 6884
 		$airport_array = array();
6885 6885
 		$temp_array = array();
6886 6886
         
6887
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6887
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6888 6888
 		{
6889 6889
 			$temp_array['airline_icao'] = $row['airline_icao'];
6890 6890
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6904,11 +6904,11 @@  discard block
 block discarded – undo
6904 6904
 	* @return Array the airport list
6905 6905
 	*
6906 6906
 	*/
6907
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6907
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6908 6908
 	{
6909
-		$filter_query = $this->getFilter($filters,true,true);
6910
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6911
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6909
+		$filter_query = $this->getFilter($filters, true, true);
6910
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6911
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6912 6912
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
6913 6913
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6914 6914
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6920,7 +6920,7 @@  discard block
 block discarded – undo
6920 6920
 		$airport_array = array();
6921 6921
 		$temp_array = array();
6922 6922
         
6923
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6923
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6924 6924
 		{
6925 6925
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6926 6926
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6942,11 +6942,11 @@  discard block
 block discarded – undo
6942 6942
 	* @return Array the airport list
6943 6943
 	*
6944 6944
 	*/
6945
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6945
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6946 6946
 	{
6947
-		$filter_query = $this->getFilter($filters,true,true);
6948
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6949
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6947
+		$filter_query = $this->getFilter($filters, true, true);
6948
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6949
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6950 6950
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6951 6951
                     GROUP BY spotter_output.departure_airport_country
6952 6952
 					ORDER BY airport_departure_country_count DESC";
@@ -6958,7 +6958,7 @@  discard block
 block discarded – undo
6958 6958
 		$airport_array = array();
6959 6959
 		$temp_array = array();
6960 6960
         
6961
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6961
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6962 6962
 		{
6963 6963
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6964 6964
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6977,11 +6977,11 @@  discard block
 block discarded – undo
6977 6977
 	* @return Array the airport list
6978 6978
 	*
6979 6979
 	*/
6980
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6980
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6981 6981
 	{
6982
-		$filter_query = $this->getFilter($filters,true,true);
6983
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6984
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6982
+		$filter_query = $this->getFilter($filters, true, true);
6983
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6984
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6985 6985
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6986 6986
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6987 6987
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6993,7 +6993,7 @@  discard block
 block discarded – undo
6993 6993
 		$airport_array = array();
6994 6994
 		$temp_array = array();
6995 6995
         
6996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6997 6997
 		{
6998 6998
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6999 6999
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	* @return Array the airport list
7015 7015
 	*
7016 7016
 	*/
7017
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7017
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
7018 7018
 	{
7019
-		$filter_query = $this->getFilter($filters,true,true);
7020
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7021
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7019
+		$filter_query = $this->getFilter($filters, true, true);
7020
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7021
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7022 7022
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7023 7023
                     GROUP BY spotter_output.departure_airport_country
7024 7024
 					ORDER BY airport_departure_country_count DESC";
@@ -7030,7 +7030,7 @@  discard block
 block discarded – undo
7030 7030
 		$airport_array = array();
7031 7031
 		$temp_array = array();
7032 7032
         
7033
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7033
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7034 7034
 		{
7035 7035
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7036 7036
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7048,11 +7048,11 @@  discard block
 block discarded – undo
7048 7048
 	* @return Array the airport list
7049 7049
 	*
7050 7050
 	*/
7051
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7051
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
7052 7052
 	{
7053
-		$filter_query = $this->getFilter($filters,true,true);
7054
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7055
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7053
+		$filter_query = $this->getFilter($filters, true, true);
7054
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7055
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7056 7056
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
7057 7057
                     GROUP BY spotter_output.departure_airport_icao
7058 7058
 					ORDER BY airport_departure_icao_count DESC";
@@ -7064,7 +7064,7 @@  discard block
 block discarded – undo
7064 7064
 		$airport_array = array();
7065 7065
 		$temp_array = array();
7066 7066
         
7067
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7067
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7068 7068
 		{
7069 7069
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7070 7070
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7085,11 +7085,11 @@  discard block
 block discarded – undo
7085 7085
 	* @return Array the airport list
7086 7086
 	*
7087 7087
 	*/
7088
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7088
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
7089 7089
 	{
7090
-		$filter_query = $this->getFilter($filters,true,true);
7091
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7092
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7090
+		$filter_query = $this->getFilter($filters, true, true);
7091
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7092
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7093 7093
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
7094 7094
                     GROUP BY spotter_output.departure_airport_country
7095 7095
 					ORDER BY airport_departure_country_count DESC";
@@ -7101,7 +7101,7 @@  discard block
 block discarded – undo
7101 7101
 		$airport_array = array();
7102 7102
 		$temp_array = array();
7103 7103
         
7104
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7104
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7105 7105
 		{
7106 7106
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7107 7107
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7119,11 +7119,11 @@  discard block
 block discarded – undo
7119 7119
 	* @return Array the airport list
7120 7120
 	*
7121 7121
 	*/
7122
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7122
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
7123 7123
 	{
7124
-		$filter_query = $this->getFilter($filters,true,true);
7125
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7126
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7124
+		$filter_query = $this->getFilter($filters, true, true);
7125
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7126
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7127 7127
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
7128 7128
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7129 7129
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7135,7 +7135,7 @@  discard block
 block discarded – undo
7135 7135
 		$airport_array = array();
7136 7136
 		$temp_array = array();
7137 7137
         
7138
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7138
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7139 7139
 		{
7140 7140
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7141 7141
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7156,11 +7156,11 @@  discard block
 block discarded – undo
7156 7156
 	* @return Array the airport list
7157 7157
 	*
7158 7158
 	*/
7159
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7159
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
7160 7160
 	{
7161
-		$filter_query = $this->getFilter($filters,true,true);
7162
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7163
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7161
+		$filter_query = $this->getFilter($filters, true, true);
7162
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7163
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7164 7164
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
7165 7165
                     GROUP BY spotter_output.departure_airport_country
7166 7166
 					ORDER BY airport_departure_country_count DESC";
@@ -7172,7 +7172,7 @@  discard block
 block discarded – undo
7172 7172
 		$airport_array = array();
7173 7173
 		$temp_array = array();
7174 7174
         
7175
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7175
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7176 7176
 		{
7177 7177
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7178 7178
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7191,11 +7191,11 @@  discard block
 block discarded – undo
7191 7191
 	* @return Array the airport list
7192 7192
 	*
7193 7193
 	*/
7194
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7194
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7195 7195
 	{
7196
-		$filter_query = $this->getFilter($filters,true,true);
7197
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7198
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7196
+		$filter_query = $this->getFilter($filters, true, true);
7197
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7198
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7199 7199
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
7200 7200
                     GROUP BY spotter_output.departure_airport_icao
7201 7201
 					ORDER BY airport_departure_icao_count DESC";
@@ -7207,7 +7207,7 @@  discard block
 block discarded – undo
7207 7207
 		$airport_array = array();
7208 7208
 		$temp_array = array();
7209 7209
         
7210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7211 7211
 		{
7212 7212
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7213 7213
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7228,11 +7228,11 @@  discard block
 block discarded – undo
7228 7228
 	* @return Array the airport list
7229 7229
 	*
7230 7230
 	*/
7231
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7231
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7232 7232
 	{
7233
-		$filter_query = $this->getFilter($filters,true,true);
7234
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7235
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7233
+		$filter_query = $this->getFilter($filters, true, true);
7234
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7235
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7236 7236
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7237 7237
                     GROUP BY spotter_output.departure_airport_country
7238 7238
 					ORDER BY airport_departure_country_count DESC";
@@ -7244,7 +7244,7 @@  discard block
 block discarded – undo
7244 7244
 		$airport_array = array();
7245 7245
 		$temp_array = array();
7246 7246
         
7247
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7247
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7248 7248
 		{
7249 7249
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7250 7250
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7262,11 +7262,11 @@  discard block
 block discarded – undo
7262 7262
 	* @return Array the airport list
7263 7263
 	*
7264 7264
 	*/
7265
-	public function countAllDepartureAirportsByDate($date,$filters = array())
7265
+	public function countAllDepartureAirportsByDate($date, $filters = array())
7266 7266
 	{
7267 7267
 		global $globalTimezone, $globalDBdriver;
7268
-		$filter_query = $this->getFilter($filters,true,true);
7269
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7268
+		$filter_query = $this->getFilter($filters, true, true);
7269
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7270 7270
 		if ($globalTimezone != '') {
7271 7271
 			date_default_timezone_set($globalTimezone);
7272 7272
 			$datetime = new DateTime($date);
@@ -7274,12 +7274,12 @@  discard block
 block discarded – undo
7274 7274
 		} else $offset = '+00:00';
7275 7275
 
7276 7276
 		if ($globalDBdriver == 'mysql') {
7277
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7277
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7278 7278
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
7279 7279
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7280 7280
 					ORDER BY airport_departure_icao_count DESC";
7281 7281
 		} else {
7282
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7282
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7283 7283
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
7284 7284
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7285 7285
 					ORDER BY airport_departure_icao_count DESC";
@@ -7291,7 +7291,7 @@  discard block
 block discarded – undo
7291 7291
 		$airport_array = array();
7292 7292
 		$temp_array = array();
7293 7293
         
7294
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7294
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7295 7295
 		{
7296 7296
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7297 7297
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7312,11 +7312,11 @@  discard block
 block discarded – undo
7312 7312
 	* @return Array the airport list
7313 7313
 	*
7314 7314
 	*/
7315
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7315
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
7316 7316
 	{
7317 7317
 		global $globalTimezone, $globalDBdriver;
7318
-		$filter_query = $this->getFilter($filters,true,true);
7319
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7318
+		$filter_query = $this->getFilter($filters, true, true);
7319
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7320 7320
 		if ($globalTimezone != '') {
7321 7321
 			date_default_timezone_set($globalTimezone);
7322 7322
 			$datetime = new DateTime($date);
@@ -7324,12 +7324,12 @@  discard block
 block discarded – undo
7324 7324
 		} else $offset = '+00:00';
7325 7325
 
7326 7326
 		if ($globalDBdriver == 'mysql') {
7327
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7327
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7328 7328
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7329 7329
 					GROUP BY spotter_output.departure_airport_country
7330 7330
 					ORDER BY airport_departure_country_count DESC";
7331 7331
 		} else {
7332
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7332
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7333 7333
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7334 7334
 					GROUP BY spotter_output.departure_airport_country
7335 7335
 					ORDER BY airport_departure_country_count DESC";
@@ -7341,7 +7341,7 @@  discard block
 block discarded – undo
7341 7341
 		$airport_array = array();
7342 7342
 		$temp_array = array();
7343 7343
         
7344
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7344
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7345 7345
 		{
7346 7346
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7347 7347
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7359,11 +7359,11 @@  discard block
 block discarded – undo
7359 7359
 	* @return Array the airport list
7360 7360
 	*
7361 7361
 	*/
7362
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7362
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
7363 7363
 	{
7364
-		$filter_query = $this->getFilter($filters,true,true);
7365
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7366
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7364
+		$filter_query = $this->getFilter($filters, true, true);
7365
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7366
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7367 7367
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
7368 7368
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7369 7369
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7375,7 +7375,7 @@  discard block
 block discarded – undo
7375 7375
 		$airport_array = array();
7376 7376
 		$temp_array = array();
7377 7377
         
7378
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7378
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7379 7379
 		{
7380 7380
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7381 7381
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7395,11 +7395,11 @@  discard block
 block discarded – undo
7395 7395
 	* @return Array the airport list
7396 7396
 	*
7397 7397
 	*/
7398
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7398
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7399 7399
 	{
7400
-		$filter_query = $this->getFilter($filters,true,true);
7401
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7402
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7400
+		$filter_query = $this->getFilter($filters, true, true);
7401
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7402
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7403 7403
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
7404 7404
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7405 7405
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7411,7 +7411,7 @@  discard block
 block discarded – undo
7411 7411
 		$airport_array = array();
7412 7412
 		$temp_array = array();
7413 7413
         
7414
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7414
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7415 7415
 		{
7416 7416
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7417 7417
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7431,11 +7431,11 @@  discard block
 block discarded – undo
7431 7431
 	* @return Array the airport list
7432 7432
 	*
7433 7433
 	*/
7434
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7434
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7435 7435
 	{
7436
-		$filter_query = $this->getFilter($filters,true,true);
7437
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7438
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7436
+		$filter_query = $this->getFilter($filters, true, true);
7437
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7438
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7439 7439
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7440 7440
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7441 7441
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7446,7 +7446,7 @@  discard block
 block discarded – undo
7446 7446
 		$airport_array = array();
7447 7447
 		$temp_array = array();
7448 7448
         
7449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7450 7450
 		{
7451 7451
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7452 7452
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7468,11 +7468,11 @@  discard block
 block discarded – undo
7468 7468
 	* @return Array the airport list
7469 7469
 	*
7470 7470
 	*/
7471
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7471
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7472 7472
 	{
7473
-		$filter_query = $this->getFilter($filters,true,true);
7474
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7475
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7473
+		$filter_query = $this->getFilter($filters, true, true);
7474
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7475
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7476 7476
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7477 7477
                     GROUP BY spotter_output.departure_airport_country
7478 7478
 					ORDER BY airport_departure_country_count DESC";
@@ -7484,7 +7484,7 @@  discard block
 block discarded – undo
7484 7484
 		$airport_array = array();
7485 7485
 		$temp_array = array();
7486 7486
         
7487
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7487
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7488 7488
 		{
7489 7489
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7490 7490
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7501,11 +7501,11 @@  discard block
 block discarded – undo
7501 7501
 	* @return Array the airport list
7502 7502
 	*
7503 7503
 	*/
7504
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7504
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7505 7505
 	{
7506
-		$filter_query = $this->getFilter($filters,true,true);
7507
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7508
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7506
+		$filter_query = $this->getFilter($filters, true, true);
7507
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7508
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7509 7509
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7510 7510
 			GROUP BY spotter_output.departure_airport_country
7511 7511
 			ORDER BY airport_departure_country_count DESC";
@@ -7521,11 +7521,11 @@  discard block
 block discarded – undo
7521 7521
 	* @return Array the airport list
7522 7522
 	*
7523 7523
 	*/
7524
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7524
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7525 7525
 	{
7526
-		$filter_query = $this->getFilter($filters,true,true);
7527
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7528
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7526
+		$filter_query = $this->getFilter($filters, true, true);
7527
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7528
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7529 7529
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7530 7530
 			GROUP BY spotter_output.departure_airport_country
7531 7531
 			ORDER BY airport_departure_country_count DESC";
@@ -7543,12 +7543,12 @@  discard block
 block discarded – undo
7543 7543
 	* @return Array the airport list
7544 7544
 	*
7545 7545
 	*/
7546
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7546
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7547 7547
 	{
7548
-		$filter_query = $this->getFilter($filters,true,true);
7549
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7548
+		$filter_query = $this->getFilter($filters, true, true);
7549
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7550 7550
 
7551
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7551
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7552 7552
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7553 7553
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7554 7554
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7560,7 +7560,7 @@  discard block
 block discarded – undo
7560 7560
 		$airport_array = array();
7561 7561
 		$temp_array = array();
7562 7562
         
7563
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7563
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7564 7564
 		{
7565 7565
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7566 7566
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7581,11 +7581,11 @@  discard block
 block discarded – undo
7581 7581
 	* @return Array the airport list
7582 7582
 	*
7583 7583
 	*/
7584
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7584
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7585 7585
 	{
7586
-		$filter_query = $this->getFilter($filters,true,true);
7587
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7588
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7586
+		$filter_query = $this->getFilter($filters, true, true);
7587
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7588
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7589 7589
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7590 7590
                     GROUP BY spotter_output.departure_airport_country
7591 7591
 					ORDER BY airport_departure_country_count DESC";
@@ -7597,7 +7597,7 @@  discard block
 block discarded – undo
7597 7597
 		$airport_array = array();
7598 7598
 		$temp_array = array();
7599 7599
         
7600
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7600
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7601 7601
 		{
7602 7602
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7603 7603
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7620,11 +7620,11 @@  discard block
 block discarded – undo
7620 7620
 	* @return Array the airport list
7621 7621
 	*
7622 7622
 	*/
7623
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7623
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7624 7624
 	{
7625 7625
 		global $globalDBdriver;
7626
-		$filter_query = $this->getFilter($filters,true,true);
7627
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7626
+		$filter_query = $this->getFilter($filters, true, true);
7627
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7628 7628
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7629 7629
                 if ($olderthanmonths > 0) {
7630 7630
             		if ($globalDBdriver == 'mysql') {
@@ -7644,28 +7644,28 @@  discard block
 block discarded – undo
7644 7644
 		if ($year != '') {
7645 7645
 			if ($globalDBdriver == 'mysql') {
7646 7646
 				$query .= " AND YEAR(spotter_output.date) = :year";
7647
-				$query_values = array_merge($query_values,array(':year' => $year));
7647
+				$query_values = array_merge($query_values, array(':year' => $year));
7648 7648
 			} else {
7649 7649
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7650
-				$query_values = array_merge($query_values,array(':year' => $year));
7650
+				$query_values = array_merge($query_values, array(':year' => $year));
7651 7651
 			}
7652 7652
 		}
7653 7653
 		if ($month != '') {
7654 7654
 			if ($globalDBdriver == 'mysql') {
7655 7655
 				$query .= " AND MONTH(spotter_output.date) = :month";
7656
-				$query_values = array_merge($query_values,array(':month' => $month));
7656
+				$query_values = array_merge($query_values, array(':month' => $month));
7657 7657
 			} else {
7658 7658
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7659
-				$query_values = array_merge($query_values,array(':month' => $month));
7659
+				$query_values = array_merge($query_values, array(':month' => $month));
7660 7660
 			}
7661 7661
 		}
7662 7662
 		if ($day != '') {
7663 7663
 			if ($globalDBdriver == 'mysql') {
7664 7664
 				$query .= " AND DAY(spotter_output.date) = :day";
7665
-				$query_values = array_merge($query_values,array(':day' => $day));
7665
+				$query_values = array_merge($query_values, array(':day' => $day));
7666 7666
 			} else {
7667 7667
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7668
-				$query_values = array_merge($query_values,array(':day' => $day));
7668
+				$query_values = array_merge($query_values, array(':day' => $day));
7669 7669
 			}
7670 7670
 		}
7671 7671
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7679,7 +7679,7 @@  discard block
 block discarded – undo
7679 7679
 		$airport_array = array();
7680 7680
 		$temp_array = array();
7681 7681
         
7682
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7682
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7683 7683
 		{
7684 7684
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7685 7685
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7702,11 +7702,11 @@  discard block
 block discarded – undo
7702 7702
 	* @return Array the airport list
7703 7703
 	*
7704 7704
 	*/
7705
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7705
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7706 7706
 	{
7707 7707
 		global $globalDBdriver;
7708
-		$filter_query = $this->getFilter($filters,true,true);
7709
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7708
+		$filter_query = $this->getFilter($filters, true, true);
7709
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7710 7710
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7711 7711
                 if ($olderthanmonths > 0) {
7712 7712
             		if ($globalDBdriver == 'mysql') {
@@ -7736,7 +7736,7 @@  discard block
 block discarded – undo
7736 7736
 		$airport_array = array();
7737 7737
 		$temp_array = array();
7738 7738
         
7739
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7739
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7740 7740
 		{
7741 7741
 			$temp_array['airline_icao'] = $row['airline_icao'];
7742 7742
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7761,11 +7761,11 @@  discard block
 block discarded – undo
7761 7761
 	* @return Array the airport list
7762 7762
 	*
7763 7763
 	*/
7764
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7764
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7765 7765
 	{
7766 7766
 		global $globalDBdriver;
7767
-		$filter_query = $this->getFilter($filters,true,true);
7768
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7767
+		$filter_query = $this->getFilter($filters, true, true);
7768
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7769 7769
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7770 7770
                 if ($olderthanmonths > 0) {
7771 7771
             		if ($globalDBdriver == 'mysql') {
@@ -7785,28 +7785,28 @@  discard block
 block discarded – undo
7785 7785
 		if ($year != '') {
7786 7786
 			if ($globalDBdriver == 'mysql') {
7787 7787
 				$query .= " AND YEAR(spotter_output.date) = :year";
7788
-				$query_values = array_merge($query_values,array(':year' => $year));
7788
+				$query_values = array_merge($query_values, array(':year' => $year));
7789 7789
 			} else {
7790 7790
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7791
-				$query_values = array_merge($query_values,array(':year' => $year));
7791
+				$query_values = array_merge($query_values, array(':year' => $year));
7792 7792
 			}
7793 7793
 		}
7794 7794
 		if ($month != '') {
7795 7795
 			if ($globalDBdriver == 'mysql') {
7796 7796
 				$query .= " AND MONTH(spotter_output.date) = :month";
7797
-				$query_values = array_merge($query_values,array(':month' => $month));
7797
+				$query_values = array_merge($query_values, array(':month' => $month));
7798 7798
 			} else {
7799 7799
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7800
-				$query_values = array_merge($query_values,array(':month' => $month));
7800
+				$query_values = array_merge($query_values, array(':month' => $month));
7801 7801
 			}
7802 7802
 		}
7803 7803
 		if ($day != '') {
7804 7804
 			if ($globalDBdriver == 'mysql') {
7805 7805
 				$query .= " AND DAY(spotter_output.date) = :day";
7806
-				$query_values = array_merge($query_values,array(':day' => $day));
7806
+				$query_values = array_merge($query_values, array(':day' => $day));
7807 7807
 			} else {
7808 7808
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7809
-				$query_values = array_merge($query_values,array(':day' => $day));
7809
+				$query_values = array_merge($query_values, array(':day' => $day));
7810 7810
 			}
7811 7811
 		}
7812 7812
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7819,7 +7819,7 @@  discard block
 block discarded – undo
7819 7819
       
7820 7820
 		$airport_array = array();
7821 7821
 		$temp_array = array();
7822
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7822
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7823 7823
 		{
7824 7824
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7825 7825
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7842,11 +7842,11 @@  discard block
 block discarded – undo
7842 7842
 	* @return Array the airport list
7843 7843
 	*
7844 7844
 	*/
7845
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7845
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7846 7846
 	{
7847 7847
 		global $globalDBdriver;
7848
-		$filter_query = $this->getFilter($filters,true,true);
7849
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7848
+		$filter_query = $this->getFilter($filters, true, true);
7849
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7850 7850
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7851 7851
                 if ($olderthanmonths > 0) {
7852 7852
             		if ($globalDBdriver == 'mysql') {
@@ -7876,7 +7876,7 @@  discard block
 block discarded – undo
7876 7876
 		$airport_array = array();
7877 7877
 		$temp_array = array();
7878 7878
         
7879
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7879
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7880 7880
 		{
7881 7881
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7882 7882
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7902,9 +7902,9 @@  discard block
 block discarded – undo
7902 7902
 	*/
7903 7903
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7904 7904
 	{
7905
-		$filter_query = $this->getFilter($filters,true,true);
7906
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7907
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7905
+		$filter_query = $this->getFilter($filters, true, true);
7906
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7907
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7908 7908
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
7909 7909
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7910 7910
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7915,7 +7915,7 @@  discard block
 block discarded – undo
7915 7915
 		$airport_array = array();
7916 7916
 		$temp_array = array();
7917 7917
         
7918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7919 7919
 		{
7920 7920
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7921 7921
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7936,12 +7936,12 @@  discard block
 block discarded – undo
7936 7936
 	* @return Array the airport list
7937 7937
 	*
7938 7938
 	*/
7939
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7939
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7940 7940
 	{
7941
-		$filter_query = $this->getFilter($filters,true,true);
7942
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7941
+		$filter_query = $this->getFilter($filters, true, true);
7942
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7943 7943
 					
7944
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7944
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7945 7945
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7946 7946
                     GROUP BY spotter_output.arrival_airport_country
7947 7947
 					ORDER BY airport_arrival_country_count DESC";
@@ -7953,7 +7953,7 @@  discard block
 block discarded – undo
7953 7953
 		$airport_array = array();
7954 7954
 		$temp_array = array();
7955 7955
         
7956
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7956
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7957 7957
 		{
7958 7958
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7959 7959
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7971,11 +7971,11 @@  discard block
 block discarded – undo
7971 7971
 	* @return Array the airport list
7972 7972
 	*
7973 7973
 	*/
7974
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7974
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7975 7975
 	{
7976
-		$filter_query = $this->getFilter($filters,true,true);
7977
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7978
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7976
+		$filter_query = $this->getFilter($filters, true, true);
7977
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7978
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7979 7979
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7980 7980
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7981 7981
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7987,7 +7987,7 @@  discard block
 block discarded – undo
7987 7987
 		$airport_array = array();
7988 7988
 		$temp_array = array();
7989 7989
         
7990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7991 7991
 		{
7992 7992
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7993 7993
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8009,11 +8009,11 @@  discard block
 block discarded – undo
8009 8009
 	* @return Array the airport list
8010 8010
 	*
8011 8011
 	*/
8012
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8012
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
8013 8013
 	{
8014
-		$filter_query = $this->getFilter($filters,true,true);
8015
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8016
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8014
+		$filter_query = $this->getFilter($filters, true, true);
8015
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8016
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8017 8017
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
8018 8018
                     GROUP BY spotter_output.arrival_airport_country
8019 8019
 					ORDER BY airport_arrival_country_count DESC";
@@ -8025,7 +8025,7 @@  discard block
 block discarded – undo
8025 8025
 		$airport_array = array();
8026 8026
 		$temp_array = array();
8027 8027
         
8028
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8028
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8029 8029
 		{
8030 8030
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8031 8031
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8043,12 +8043,12 @@  discard block
 block discarded – undo
8043 8043
 	* @return Array the airport list
8044 8044
 	*
8045 8045
 	*/
8046
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8046
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
8047 8047
 	{
8048
-		$filter_query = $this->getFilter($filters,true,true);
8049
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8048
+		$filter_query = $this->getFilter($filters, true, true);
8049
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8050 8050
 
8051
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8051
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8052 8052
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
8053 8053
                     GROUP BY spotter_output.arrival_airport_icao
8054 8054
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8060,7 +8060,7 @@  discard block
 block discarded – undo
8060 8060
 		$airport_array = array();
8061 8061
 		$temp_array = array();
8062 8062
         
8063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8064 8064
 		{
8065 8065
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8066 8066
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8081,11 +8081,11 @@  discard block
 block discarded – undo
8081 8081
 	* @return Array the airport list
8082 8082
 	*
8083 8083
 	*/
8084
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8084
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
8085 8085
 	{
8086
-		$filter_query = $this->getFilter($filters,true,true);
8087
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8088
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8086
+		$filter_query = $this->getFilter($filters, true, true);
8087
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8088
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8089 8089
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
8090 8090
                     GROUP BY spotter_output.arrival_airport_country
8091 8091
 					ORDER BY airport_arrival_country_count DESC";
@@ -8097,7 +8097,7 @@  discard block
 block discarded – undo
8097 8097
 		$airport_array = array();
8098 8098
 		$temp_array = array();
8099 8099
         
8100
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8100
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8101 8101
 		{
8102 8102
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8103 8103
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8116,11 +8116,11 @@  discard block
 block discarded – undo
8116 8116
 	* @return Array the airport list
8117 8117
 	*
8118 8118
 	*/
8119
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8119
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
8120 8120
 	{
8121
-		$filter_query = $this->getFilter($filters,true,true);
8122
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8123
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8121
+		$filter_query = $this->getFilter($filters, true, true);
8122
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8123
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8124 8124
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8125 8125
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8126 8126
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8132,7 +8132,7 @@  discard block
 block discarded – undo
8132 8132
 		$airport_array = array();
8133 8133
 		$temp_array = array();
8134 8134
         
8135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8136 8136
 		{
8137 8137
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8138 8138
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8153,11 +8153,11 @@  discard block
 block discarded – undo
8153 8153
 	* @return Array the airport list
8154 8154
 	*
8155 8155
 	*/
8156
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8156
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
8157 8157
 	{
8158
-		$filter_query = $this->getFilter($filters,true,true);
8159
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8160
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8158
+		$filter_query = $this->getFilter($filters, true, true);
8159
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8160
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8161 8161
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8162 8162
                     GROUP BY spotter_output.arrival_airport_country
8163 8163
 					ORDER BY airport_arrival_country_count DESC";
@@ -8169,7 +8169,7 @@  discard block
 block discarded – undo
8169 8169
 		$airport_array = array();
8170 8170
 		$temp_array = array();
8171 8171
         
8172
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8172
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8173 8173
 		{
8174 8174
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8175 8175
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8187,11 +8187,11 @@  discard block
 block discarded – undo
8187 8187
 	* @return Array the airport list
8188 8188
 	*
8189 8189
 	*/
8190
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8190
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
8191 8191
 	{
8192
-		$filter_query = $this->getFilter($filters,true,true);
8193
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8194
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8192
+		$filter_query = $this->getFilter($filters, true, true);
8193
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8194
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8195 8195
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8196 8196
                     GROUP BY spotter_output.arrival_airport_icao
8197 8197
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8203,7 +8203,7 @@  discard block
 block discarded – undo
8203 8203
 		$airport_array = array();
8204 8204
 		$temp_array = array();
8205 8205
         
8206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8207 8207
 		{
8208 8208
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8209 8209
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8225,11 +8225,11 @@  discard block
 block discarded – undo
8225 8225
 	* @return Array the airport list
8226 8226
 	*
8227 8227
 	*/
8228
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8228
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
8229 8229
 	{
8230
-		$filter_query = $this->getFilter($filters,true,true);
8231
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8232
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8230
+		$filter_query = $this->getFilter($filters, true, true);
8231
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8232
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8233 8233
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8234 8234
                     GROUP BY spotter_output.arrival_airport_country
8235 8235
 					ORDER BY airport_arrival_country_count DESC";
@@ -8241,7 +8241,7 @@  discard block
 block discarded – undo
8241 8241
 		$airport_array = array();
8242 8242
 		$temp_array = array();
8243 8243
         
8244
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8244
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8245 8245
 		{
8246 8246
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8247 8247
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8260,11 +8260,11 @@  discard block
 block discarded – undo
8260 8260
 	* @return Array the airport list
8261 8261
 	*
8262 8262
 	*/
8263
-	public function countAllArrivalAirportsByDate($date,$filters = array())
8263
+	public function countAllArrivalAirportsByDate($date, $filters = array())
8264 8264
 	{
8265 8265
 		global $globalTimezone, $globalDBdriver;
8266
-		$filter_query = $this->getFilter($filters,true,true);
8267
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8266
+		$filter_query = $this->getFilter($filters, true, true);
8267
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8268 8268
 		if ($globalTimezone != '') {
8269 8269
 			date_default_timezone_set($globalTimezone);
8270 8270
 			$datetime = new DateTime($date);
@@ -8272,12 +8272,12 @@  discard block
 block discarded – undo
8272 8272
 		} else $offset = '+00:00';
8273 8273
 
8274 8274
 		if ($globalDBdriver == 'mysql') {
8275
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8275
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8276 8276
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8277 8277
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8278 8278
 					ORDER BY airport_arrival_icao_count DESC";
8279 8279
 		} else {
8280
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8280
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8281 8281
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8282 8282
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8283 8283
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8289,7 +8289,7 @@  discard block
 block discarded – undo
8289 8289
 		$airport_array = array();
8290 8290
 		$temp_array = array();
8291 8291
         
8292
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8292
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8293 8293
 		{
8294 8294
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8295 8295
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8313,8 +8313,8 @@  discard block
 block discarded – undo
8313 8313
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8314 8314
 	{
8315 8315
 		global $globalTimezone, $globalDBdriver;
8316
-		$filter_query = $this->getFilter($filters,true,true);
8317
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8316
+		$filter_query = $this->getFilter($filters, true, true);
8317
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8318 8318
 		if ($globalTimezone != '') {
8319 8319
 			date_default_timezone_set($globalTimezone);
8320 8320
 			$datetime = new DateTime($date);
@@ -8322,12 +8322,12 @@  discard block
 block discarded – undo
8322 8322
 		} else $offset = '+00:00';
8323 8323
 
8324 8324
 		if ($globalDBdriver == 'mysql') {
8325
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8325
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8326 8326
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
8327 8327
 					GROUP BY spotter_output.arrival_airport_country
8328 8328
 					ORDER BY airport_arrival_country_count DESC";
8329 8329
 		} else {
8330
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8330
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8331 8331
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
8332 8332
 					GROUP BY spotter_output.arrival_airport_country
8333 8333
 					ORDER BY airport_arrival_country_count DESC";
@@ -8339,7 +8339,7 @@  discard block
 block discarded – undo
8339 8339
 		$airport_array = array();
8340 8340
 		$temp_array = array();
8341 8341
         
8342
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8342
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8343 8343
 		{
8344 8344
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8345 8345
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8357,11 +8357,11 @@  discard block
 block discarded – undo
8357 8357
 	* @return Array the airport list
8358 8358
 	*
8359 8359
 	*/
8360
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8360
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
8361 8361
 	{
8362
-		$filter_query = $this->getFilter($filters,true,true);
8363
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8364
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8362
+		$filter_query = $this->getFilter($filters, true, true);
8363
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8364
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8365 8365
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
8366 8366
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8367 8367
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8373,7 +8373,7 @@  discard block
 block discarded – undo
8373 8373
 		$airport_array = array();
8374 8374
 		$temp_array = array();
8375 8375
         
8376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8377 8377
 		{
8378 8378
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8379 8379
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8393,11 +8393,11 @@  discard block
 block discarded – undo
8393 8393
 	* @return Array the airport list
8394 8394
 	*
8395 8395
 	*/
8396
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8396
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8397 8397
 	{
8398
-		$filter_query = $this->getFilter($filters,true,true);
8399
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8400
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8398
+		$filter_query = $this->getFilter($filters, true, true);
8399
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8400
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8401 8401
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
8402 8402
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8403 8403
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8408,7 +8408,7 @@  discard block
 block discarded – undo
8408 8408
 		$airport_array = array();
8409 8409
 		$temp_array = array();
8410 8410
         
8411
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8411
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8412 8412
 		{
8413 8413
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8414 8414
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8428,11 +8428,11 @@  discard block
 block discarded – undo
8428 8428
 	* @return Array the airport list
8429 8429
 	*
8430 8430
 	*/
8431
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8431
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8432 8432
 	{
8433
-		$filter_query = $this->getFilter($filters,true,true);
8434
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8435
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8433
+		$filter_query = $this->getFilter($filters, true, true);
8434
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8435
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8436 8436
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8437 8437
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8438 8438
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8443,7 +8443,7 @@  discard block
 block discarded – undo
8443 8443
 		$airport_array = array();
8444 8444
 		$temp_array = array();
8445 8445
         
8446
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8446
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8447 8447
 		{
8448 8448
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8449 8449
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8465,9 +8465,9 @@  discard block
 block discarded – undo
8465 8465
 	*/
8466 8466
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8467 8467
 	{
8468
-		$filter_query = $this->getFilter($filters,true,true);
8469
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8470
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8468
+		$filter_query = $this->getFilter($filters, true, true);
8469
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8470
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8471 8471
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8472 8472
                     GROUP BY spotter_output.arrival_airport_country
8473 8473
 					ORDER BY airport_arrival_country_count DESC";
@@ -8479,7 +8479,7 @@  discard block
 block discarded – undo
8479 8479
 		$airport_array = array();
8480 8480
 		$temp_array = array();
8481 8481
         
8482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8483 8483
 		{
8484 8484
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8485 8485
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8498,9 +8498,9 @@  discard block
 block discarded – undo
8498 8498
 	*/
8499 8499
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8500 8500
 	{
8501
-		$filter_query = $this->getFilter($filters,true,true);
8502
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8503
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8501
+		$filter_query = $this->getFilter($filters, true, true);
8502
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8503
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8504 8504
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8505 8505
                     GROUP BY spotter_output.arrival_airport_country
8506 8506
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8518,9 +8518,9 @@  discard block
 block discarded – undo
8518 8518
 	*/
8519 8519
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8520 8520
 	{
8521
-		$filter_query = $this->getFilter($filters,true,true);
8522
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8523
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8521
+		$filter_query = $this->getFilter($filters, true, true);
8522
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8523
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8524 8524
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8525 8525
                     GROUP BY spotter_output.arrival_airport_country
8526 8526
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8538,11 +8538,11 @@  discard block
 block discarded – undo
8538 8538
 	* @return Array the airport list
8539 8539
 	*
8540 8540
 	*/
8541
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8541
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8542 8542
 	{
8543
-		$filter_query = $this->getFilter($filters,true,true);
8544
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8545
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8543
+		$filter_query = $this->getFilter($filters, true, true);
8544
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8545
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8546 8546
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8547 8547
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8548 8548
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8554,7 +8554,7 @@  discard block
 block discarded – undo
8554 8554
 		$airport_array = array();
8555 8555
 		$temp_array = array();
8556 8556
         
8557
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8557
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8558 8558
 		{
8559 8559
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8560 8560
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8575,12 +8575,12 @@  discard block
 block discarded – undo
8575 8575
 	* @return Array the airport list
8576 8576
 	*
8577 8577
 	*/
8578
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8578
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8579 8579
 	{
8580 8580
 		global $globalDBdriver;
8581
-		$filter_query = $this->getFilter($filters,true,true);
8582
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8583
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8581
+		$filter_query = $this->getFilter($filters, true, true);
8582
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8583
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8584 8584
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8585 8585
                     GROUP BY spotter_output.arrival_airport_country
8586 8586
 					ORDER BY airport_arrival_country_count DESC";
@@ -8592,7 +8592,7 @@  discard block
 block discarded – undo
8592 8592
 		$airport_array = array();
8593 8593
 		$temp_array = array();
8594 8594
         
8595
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8595
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8596 8596
 		{
8597 8597
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8598 8598
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8611,38 +8611,38 @@  discard block
 block discarded – undo
8611 8611
 	* @return Array the airport departure list
8612 8612
 	*
8613 8613
 	*/
8614
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8614
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8615 8615
 	{
8616 8616
 		global $globalDBdriver;
8617
-		$filter_query = $this->getFilter($filters,true,true);
8618
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8617
+		$filter_query = $this->getFilter($filters, true, true);
8618
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8619 8619
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8620 8620
 		$query_values = array();
8621 8621
 		if ($year != '') {
8622 8622
 			if ($globalDBdriver == 'mysql') {
8623 8623
 				$query .= " AND YEAR(spotter_output.date) = :year";
8624
-				$query_values = array_merge($query_values,array(':year' => $year));
8624
+				$query_values = array_merge($query_values, array(':year' => $year));
8625 8625
 			} else {
8626 8626
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8627
-				$query_values = array_merge($query_values,array(':year' => $year));
8627
+				$query_values = array_merge($query_values, array(':year' => $year));
8628 8628
 			}
8629 8629
 		}
8630 8630
 		if ($month != '') {
8631 8631
 			if ($globalDBdriver == 'mysql') {
8632 8632
 				$query .= " AND MONTH(spotter_output.date) = :month";
8633
-				$query_values = array_merge($query_values,array(':month' => $month));
8633
+				$query_values = array_merge($query_values, array(':month' => $month));
8634 8634
 			} else {
8635 8635
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8636
-				$query_values = array_merge($query_values,array(':month' => $month));
8636
+				$query_values = array_merge($query_values, array(':month' => $month));
8637 8637
 			}
8638 8638
 		}
8639 8639
 		if ($day != '') {
8640 8640
 			if ($globalDBdriver == 'mysql') {
8641 8641
 				$query .= " AND DAY(spotter_output.date) = :day";
8642
-				$query_values = array_merge($query_values,array(':day' => $day));
8642
+				$query_values = array_merge($query_values, array(':day' => $day));
8643 8643
 			} else {
8644 8644
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8645
-				$query_values = array_merge($query_values,array(':day' => $day));
8645
+				$query_values = array_merge($query_values, array(':day' => $day));
8646 8646
 			}
8647 8647
 		}
8648 8648
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8656,7 +8656,7 @@  discard block
 block discarded – undo
8656 8656
 		$airport_array = array();
8657 8657
 		$temp_array = array();
8658 8658
         
8659
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8659
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8660 8660
 		{
8661 8661
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8662 8662
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8674,38 +8674,38 @@  discard block
 block discarded – undo
8674 8674
 	* @return Array the airport arrival list
8675 8675
 	*
8676 8676
 	*/
8677
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8677
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8678 8678
 	{
8679 8679
 		global $globalDBdriver;
8680
-		$filter_query = $this->getFilter($filters,true,true);
8681
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8680
+		$filter_query = $this->getFilter($filters, true, true);
8681
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8682 8682
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8683 8683
 		$query_values = array();
8684 8684
 		if ($year != '') {
8685 8685
 			if ($globalDBdriver == 'mysql') {
8686 8686
 				$query .= " AND YEAR(spotter_output.date) = :year";
8687
-				$query_values = array_merge($query_values,array(':year' => $year));
8687
+				$query_values = array_merge($query_values, array(':year' => $year));
8688 8688
 			} else {
8689 8689
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8690
-				$query_values = array_merge($query_values,array(':year' => $year));
8690
+				$query_values = array_merge($query_values, array(':year' => $year));
8691 8691
 			}
8692 8692
 		}
8693 8693
 		if ($month != '') {
8694 8694
 			if ($globalDBdriver == 'mysql') {
8695 8695
 				$query .= " AND MONTH(spotter_output.date) = :month";
8696
-				$query_values = array_merge($query_values,array(':month' => $month));
8696
+				$query_values = array_merge($query_values, array(':month' => $month));
8697 8697
 			} else {
8698 8698
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8699
-				$query_values = array_merge($query_values,array(':month' => $month));
8699
+				$query_values = array_merge($query_values, array(':month' => $month));
8700 8700
 			}
8701 8701
 		}
8702 8702
 		if ($day != '') {
8703 8703
 			if ($globalDBdriver == 'mysql') {
8704 8704
 				$query .= " AND DAY(spotter_output.date) = :day";
8705
-				$query_values = array_merge($query_values,array(':day' => $day));
8705
+				$query_values = array_merge($query_values, array(':day' => $day));
8706 8706
 			} else {
8707 8707
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8708
-				$query_values = array_merge($query_values,array(':day' => $day));
8708
+				$query_values = array_merge($query_values, array(':day' => $day));
8709 8709
 			}
8710 8710
 		}
8711 8711
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8719,7 +8719,7 @@  discard block
 block discarded – undo
8719 8719
 		$airport_array = array();
8720 8720
 		$temp_array = array();
8721 8721
         
8722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8723 8723
 		{
8724 8724
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8725 8725
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8742,8 +8742,8 @@  discard block
 block discarded – undo
8742 8742
 	*/
8743 8743
 	public function countAllRoutes($filters = array())
8744 8744
 	{
8745
-		$filter_query = $this->getFilter($filters,true,true);
8746
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8745
+		$filter_query = $this->getFilter($filters, true, true);
8746
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8747 8747
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
8748 8748
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
8749 8749
                     ORDER BY route_count DESC
@@ -8756,7 +8756,7 @@  discard block
 block discarded – undo
8756 8756
 		$routes_array = array();
8757 8757
 		$temp_array = array();
8758 8758
         
8759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8760 8760
 		{
8761 8761
 			$temp_array['route_count'] = $row['route_count'];
8762 8762
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8783,11 +8783,11 @@  discard block
 block discarded – undo
8783 8783
 	* @return Array the route list
8784 8784
 	*
8785 8785
 	*/
8786
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8786
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8787 8787
 	{
8788
-		$filter_query = $this->getFilter($filters,true,true);
8789
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8790
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8788
+		$filter_query = $this->getFilter($filters, true, true);
8789
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8790
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8791 8791
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8792 8792
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8793 8793
 			    ORDER BY route_count DESC";
@@ -8798,7 +8798,7 @@  discard block
 block discarded – undo
8798 8798
 		$routes_array = array();
8799 8799
 		$temp_array = array();
8800 8800
         
8801
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8801
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8802 8802
 		{
8803 8803
 			$temp_array['route_count'] = $row['route_count'];
8804 8804
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8825,9 +8825,9 @@  discard block
 block discarded – undo
8825 8825
 	*/
8826 8826
 	public function countAllRoutesByRegistration($registration, $filters = array())
8827 8827
 	{
8828
-		$filter_query = $this->getFilter($filters,true,true);
8828
+		$filter_query = $this->getFilter($filters, true, true);
8829 8829
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8830
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8830
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8831 8831
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8832 8832
                     GROUP BY route
8833 8833
                     ORDER BY route_count DESC";
@@ -8839,7 +8839,7 @@  discard block
 block discarded – undo
8839 8839
 		$routes_array = array();
8840 8840
 		$temp_array = array();
8841 8841
         
8842
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8842
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8843 8843
 		{
8844 8844
 			$temp_array['route_count'] = $row['route_count'];
8845 8845
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8867,9 +8867,9 @@  discard block
 block discarded – undo
8867 8867
 	*/
8868 8868
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8869 8869
 	{
8870
-		$filter_query = $this->getFilter($filters,true,true);
8871
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8872
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8870
+		$filter_query = $this->getFilter($filters, true, true);
8871
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8872
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8873 8873
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8874 8874
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8875 8875
 			    ORDER BY route_count DESC";
@@ -8881,7 +8881,7 @@  discard block
 block discarded – undo
8881 8881
 		$routes_array = array();
8882 8882
 		$temp_array = array();
8883 8883
         
8884
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8884
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8885 8885
 		{
8886 8886
 			$temp_array['route_count'] = $row['route_count'];
8887 8887
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8909,9 +8909,9 @@  discard block
 block discarded – undo
8909 8909
 	*/
8910 8910
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8911 8911
 	{
8912
-		$filter_query = $this->getFilter($filters,true,true);
8913
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8914
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8912
+		$filter_query = $this->getFilter($filters, true, true);
8913
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8914
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8915 8915
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8916 8916
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8917 8917
 			    ORDER BY route_count DESC";
@@ -8922,7 +8922,7 @@  discard block
 block discarded – undo
8922 8922
 		$routes_array = array();
8923 8923
 		$temp_array = array();
8924 8924
         
8925
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8925
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8926 8926
 		{
8927 8927
 			$temp_array['route_count'] = $row['route_count'];
8928 8928
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8950,9 +8950,9 @@  discard block
 block discarded – undo
8950 8950
 	*/
8951 8951
 	public function countAllRoutesByCountry($country, $filters = array())
8952 8952
 	{
8953
-		$filter_query = $this->getFilter($filters,true,true);
8954
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8955
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8953
+		$filter_query = $this->getFilter($filters, true, true);
8954
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8955
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8956 8956
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8957 8957
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8958 8958
 			    ORDER BY route_count DESC";
@@ -8963,7 +8963,7 @@  discard block
 block discarded – undo
8963 8963
 		$routes_array = array();
8964 8964
 		$temp_array = array();
8965 8965
         
8966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8967 8967
 		{
8968 8968
 			$temp_array['route_count'] = $row['route_count'];
8969 8969
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8991,8 +8991,8 @@  discard block
 block discarded – undo
8991 8991
 	public function countAllRoutesByDate($date, $filters = array())
8992 8992
 	{
8993 8993
 		global $globalTimezone, $globalDBdriver;
8994
-		$filter_query = $this->getFilter($filters,true,true);
8995
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8994
+		$filter_query = $this->getFilter($filters, true, true);
8995
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8996 8996
 		if ($globalTimezone != '') {
8997 8997
 			date_default_timezone_set($globalTimezone);
8998 8998
 			$datetime = new DateTime($date);
@@ -9000,12 +9000,12 @@  discard block
 block discarded – undo
9000 9000
 		} else $offset = '+00:00';
9001 9001
 		
9002 9002
 		if ($globalDBdriver == 'mysql') {
9003
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9003
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9004 9004
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
9005 9005
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9006 9006
 				    ORDER BY route_count DESC";
9007 9007
 		} else {
9008
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9008
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9009 9009
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
9010 9010
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9011 9011
 				    ORDER BY route_count DESC";
@@ -9017,7 +9017,7 @@  discard block
 block discarded – undo
9017 9017
 		$routes_array = array();
9018 9018
 		$temp_array = array();
9019 9019
         
9020
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9020
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9021 9021
 		{
9022 9022
 			$temp_array['route_count'] = $row['route_count'];
9023 9023
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9044,9 +9044,9 @@  discard block
 block discarded – undo
9044 9044
 	*/
9045 9045
 	public function countAllRoutesByIdent($ident, $filters = array())
9046 9046
 	{
9047
-		$filter_query = $this->getFilter($filters,true,true);
9048
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9049
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9047
+		$filter_query = $this->getFilter($filters, true, true);
9048
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9049
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9050 9050
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
9051 9051
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9052 9052
                     ORDER BY route_count DESC";
@@ -9058,7 +9058,7 @@  discard block
 block discarded – undo
9058 9058
 		$routes_array = array();
9059 9059
 		$temp_array = array();
9060 9060
         
9061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9062 9062
 		{
9063 9063
 			$temp_array['route_count'] = $row['route_count'];
9064 9064
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9082,11 +9082,11 @@  discard block
 block discarded – undo
9082 9082
 	* @return Array the route list
9083 9083
 	*
9084 9084
 	*/
9085
-	public function countAllRoutesByOwner($owner,$filters = array())
9085
+	public function countAllRoutesByOwner($owner, $filters = array())
9086 9086
 	{
9087
-		$filter_query = $this->getFilter($filters,true,true);
9088
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
9089
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9087
+		$filter_query = $this->getFilter($filters, true, true);
9088
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
9089
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9090 9090
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
9091 9091
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9092 9092
                     ORDER BY route_count DESC";
@@ -9098,7 +9098,7 @@  discard block
 block discarded – undo
9098 9098
 		$routes_array = array();
9099 9099
 		$temp_array = array();
9100 9100
         
9101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9102 9102
 		{
9103 9103
 			$temp_array['route_count'] = $row['route_count'];
9104 9104
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9122,11 +9122,11 @@  discard block
 block discarded – undo
9122 9122
 	* @return Array the route list
9123 9123
 	*
9124 9124
 	*/
9125
-	public function countAllRoutesByPilot($pilot,$filters = array())
9125
+	public function countAllRoutesByPilot($pilot, $filters = array())
9126 9126
 	{
9127
-		$filter_query = $this->getFilter($filters,true,true);
9128
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
9129
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9127
+		$filter_query = $this->getFilter($filters, true, true);
9128
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
9129
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9130 9130
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
9131 9131
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9132 9132
                     ORDER BY route_count DESC";
@@ -9138,7 +9138,7 @@  discard block
 block discarded – undo
9138 9138
 		$routes_array = array();
9139 9139
 		$temp_array = array();
9140 9140
         
9141
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9141
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9142 9142
 		{
9143 9143
 			$temp_array['route_count'] = $row['route_count'];
9144 9144
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9165,9 +9165,9 @@  discard block
 block discarded – undo
9165 9165
 	*/
9166 9166
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9167 9167
 	{
9168
-		$filter_query = $this->getFilter($filters,true,true);
9169
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9170
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9168
+		$filter_query = $this->getFilter($filters, true, true);
9169
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9170
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9171 9171
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
9172 9172
                     GROUP BY route
9173 9173
                     ORDER BY route_count DESC";
@@ -9179,7 +9179,7 @@  discard block
 block discarded – undo
9179 9179
 		$routes_array = array();
9180 9180
 		$temp_array = array();
9181 9181
         
9182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9183 9183
 		{
9184 9184
 			$temp_array['route_count'] = $row['route_count'];
9185 9185
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9207,8 +9207,8 @@  discard block
 block discarded – undo
9207 9207
 	*/
9208 9208
 	public function countAllRoutesWithWaypoints($filters = array())
9209 9209
 	{
9210
-		$filter_query = $this->getFilter($filters,true,true);
9211
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9210
+		$filter_query = $this->getFilter($filters, true, true);
9211
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
9212 9212
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
9213 9213
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9214 9214
                     ORDER BY route_count DESC
@@ -9221,7 +9221,7 @@  discard block
 block discarded – undo
9221 9221
 		$routes_array = array();
9222 9222
 		$temp_array = array();
9223 9223
         
9224
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9224
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9225 9225
 		{
9226 9226
 			$temp_array['spotter_id'] = $row['spotter_id'];
9227 9227
 			$temp_array['route_count'] = $row['route_count'];
@@ -9246,11 +9246,11 @@  discard block
 block discarded – undo
9246 9246
 	* @return Array the callsign list
9247 9247
 	*
9248 9248
 	*/
9249
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9249
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
9250 9250
 	{
9251 9251
 		global $globalDBdriver;
9252
-		$filter_query = $this->getFilter($filters,true,true);
9253
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9252
+		$filter_query = $this->getFilter($filters, true, true);
9253
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9254 9254
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9255 9255
 		 if ($olderthanmonths > 0) {
9256 9256
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -9264,28 +9264,28 @@  discard block
 block discarded – undo
9264 9264
 		if ($year != '') {
9265 9265
 			if ($globalDBdriver == 'mysql') {
9266 9266
 				$query .= " AND YEAR(spotter_output.date) = :year";
9267
-				$query_values = array_merge($query_values,array(':year' => $year));
9267
+				$query_values = array_merge($query_values, array(':year' => $year));
9268 9268
 			} else {
9269 9269
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9270
-				$query_values = array_merge($query_values,array(':year' => $year));
9270
+				$query_values = array_merge($query_values, array(':year' => $year));
9271 9271
 			}
9272 9272
 		}
9273 9273
 		if ($month != '') {
9274 9274
 			if ($globalDBdriver == 'mysql') {
9275 9275
 				$query .= " AND MONTH(spotter_output.date) = :month";
9276
-				$query_values = array_merge($query_values,array(':month' => $month));
9276
+				$query_values = array_merge($query_values, array(':month' => $month));
9277 9277
 			} else {
9278 9278
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9279
-				$query_values = array_merge($query_values,array(':month' => $month));
9279
+				$query_values = array_merge($query_values, array(':month' => $month));
9280 9280
 			}
9281 9281
 		}
9282 9282
 		if ($day != '') {
9283 9283
 			if ($globalDBdriver == 'mysql') {
9284 9284
 				$query .= " AND DAY(spotter_output.date) = :day";
9285
-				$query_values = array_merge($query_values,array(':day' => $day));
9285
+				$query_values = array_merge($query_values, array(':day' => $day));
9286 9286
 			} else {
9287 9287
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
9288
-				$query_values = array_merge($query_values,array(':day' => $day));
9288
+				$query_values = array_merge($query_values, array(':day' => $day));
9289 9289
 			}
9290 9290
 		}
9291 9291
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -9297,7 +9297,7 @@  discard block
 block discarded – undo
9297 9297
 		$callsign_array = array();
9298 9298
 		$temp_array = array();
9299 9299
         
9300
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9300
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9301 9301
 		{
9302 9302
 			$temp_array['callsign_icao'] = $row['ident'];
9303 9303
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9319,8 +9319,8 @@  discard block
 block discarded – undo
9319 9319
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9320 9320
 	{
9321 9321
 		global $globalDBdriver;
9322
-		$filter_query = $this->getFilter($filters,true,true);
9323
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9322
+		$filter_query = $this->getFilter($filters, true, true);
9323
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9324 9324
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9325 9325
 		 if ($olderthanmonths > 0) {
9326 9326
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -9339,7 +9339,7 @@  discard block
 block discarded – undo
9339 9339
 		$callsign_array = array();
9340 9340
 		$temp_array = array();
9341 9341
         
9342
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9342
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9343 9343
 		{
9344 9344
 			$temp_array['callsign_icao'] = $row['ident'];
9345 9345
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9393,7 +9393,7 @@  discard block
 block discarded – undo
9393 9393
 		$date_array = array();
9394 9394
 		$temp_array = array();
9395 9395
         
9396
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9396
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9397 9397
 		{
9398 9398
 			$temp_array['date_name'] = $row['date_name'];
9399 9399
 			$temp_array['date_count'] = $row['date_count'];
@@ -9418,15 +9418,15 @@  discard block
 block discarded – undo
9418 9418
 			$datetime = new DateTime();
9419 9419
 			$offset = $datetime->format('P');
9420 9420
 		} else $offset = '+00:00';
9421
-		$filter_query = $this->getFilter($filters,true,true);
9421
+		$filter_query = $this->getFilter($filters, true, true);
9422 9422
 		if ($globalDBdriver == 'mysql') {
9423
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9423
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9424 9424
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9425 9425
 								GROUP BY spotter_output.airline_icao, date_name 
9426 9426
 								ORDER BY date_count DESC
9427 9427
 								LIMIT 10 OFFSET 0";
9428 9428
 		} else {
9429
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9429
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9430 9430
 								FROM spotter_output 
9431 9431
 								WHERE spotter_output.airline_icao <> '' 
9432 9432
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9441,7 +9441,7 @@  discard block
 block discarded – undo
9441 9441
 		$date_array = array();
9442 9442
 		$temp_array = array();
9443 9443
         
9444
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9444
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9445 9445
 		{
9446 9446
 			$temp_array['date_name'] = $row['date_name'];
9447 9447
 			$temp_array['date_count'] = $row['date_count'];
@@ -9467,7 +9467,7 @@  discard block
 block discarded – undo
9467 9467
 			$datetime = new DateTime();
9468 9468
 			$offset = $datetime->format('P');
9469 9469
 		} else $offset = '+00:00';
9470
-		$filter_query = $this->getFilter($filters,true,true);
9470
+		$filter_query = $this->getFilter($filters, true, true);
9471 9471
 		if ($globalDBdriver == 'mysql') {
9472 9472
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9473 9473
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9488,7 +9488,7 @@  discard block
 block discarded – undo
9488 9488
 		$date_array = array();
9489 9489
 		$temp_array = array();
9490 9490
         
9491
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9491
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9492 9492
 		{
9493 9493
 			$temp_array['date_name'] = $row['date_name'];
9494 9494
 			$temp_array['date_count'] = $row['date_count'];
@@ -9513,7 +9513,7 @@  discard block
 block discarded – undo
9513 9513
 			$datetime = new DateTime();
9514 9514
 			$offset = $datetime->format('P');
9515 9515
 		} else $offset = '+00:00';
9516
-		$filter_query = $this->getFilter($filters,true,true);
9516
+		$filter_query = $this->getFilter($filters, true, true);
9517 9517
 		if ($globalDBdriver == 'mysql') {
9518 9518
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9519 9519
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9534,7 +9534,7 @@  discard block
 block discarded – undo
9534 9534
 		$date_array = array();
9535 9535
 		$temp_array = array();
9536 9536
         
9537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9538 9538
 		{
9539 9539
 			$temp_array['date_name'] = $row['date_name'];
9540 9540
 			$temp_array['date_count'] = $row['date_count'];
@@ -9555,7 +9555,7 @@  discard block
 block discarded – undo
9555 9555
 	public function countAllDatesLastMonthByAirlines($filters = array())
9556 9556
 	{
9557 9557
 		global $globalTimezone, $globalDBdriver;
9558
-		$filter_query = $this->getFilter($filters,true,true);
9558
+		$filter_query = $this->getFilter($filters, true, true);
9559 9559
 		if ($globalTimezone != '') {
9560 9560
 			date_default_timezone_set($globalTimezone);
9561 9561
 			$datetime = new DateTime();
@@ -9563,13 +9563,13 @@  discard block
 block discarded – undo
9563 9563
 		} else $offset = '+00:00';
9564 9564
 		
9565 9565
 		if ($globalDBdriver == 'mysql') {
9566
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9566
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9567 9567
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9568 9568
 								GROUP BY spotter_output.airline_icao, date_name 
9569 9569
 								ORDER BY spotter_output.date ASC";
9570 9570
 			$query_data = array(':offset' => $offset);
9571 9571
 		} else {
9572
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9572
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9573 9573
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9574 9574
 								GROUP BY spotter_output.airline_icao, date_name 
9575 9575
 								ORDER BY date_name ASC";
@@ -9582,7 +9582,7 @@  discard block
 block discarded – undo
9582 9582
 		$date_array = array();
9583 9583
 		$temp_array = array();
9584 9584
         
9585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9586 9586
 		{
9587 9587
 			$temp_array['date_name'] = $row['date_name'];
9588 9588
 			$temp_array['date_count'] = $row['date_count'];
@@ -9629,7 +9629,7 @@  discard block
 block discarded – undo
9629 9629
 		$date_array = array();
9630 9630
 		$temp_array = array();
9631 9631
         
9632
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9632
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9633 9633
 		{
9634 9634
 			$temp_array['month_name'] = $row['month_name'];
9635 9635
 			$temp_array['year_name'] = $row['year_name'];
@@ -9650,7 +9650,7 @@  discard block
 block discarded – undo
9650 9650
 	public function countAllMonthsByAirlines($filters = array())
9651 9651
 	{
9652 9652
 		global $globalTimezone, $globalDBdriver;
9653
-		$filter_query = $this->getFilter($filters,true,true);
9653
+		$filter_query = $this->getFilter($filters, true, true);
9654 9654
 		if ($globalTimezone != '') {
9655 9655
 			date_default_timezone_set($globalTimezone);
9656 9656
 			$datetime = new DateTime();
@@ -9658,12 +9658,12 @@  discard block
 block discarded – undo
9658 9658
 		} else $offset = '+00:00';
9659 9659
 
9660 9660
 		if ($globalDBdriver == 'mysql') {
9661
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9661
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9662 9662
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9663 9663
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9664 9664
 								ORDER BY date_count DESC";
9665 9665
 		} else {
9666
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9666
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9667 9667
 								FROM spotter_output 
9668 9668
 								WHERE spotter_output.airline_icao <> '' 
9669 9669
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9677,7 +9677,7 @@  discard block
 block discarded – undo
9677 9677
 		$date_array = array();
9678 9678
 		$temp_array = array();
9679 9679
         
9680
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9680
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9681 9681
 		{
9682 9682
 			$temp_array['month_name'] = $row['month_name'];
9683 9683
 			$temp_array['year_name'] = $row['year_name'];
@@ -9704,14 +9704,14 @@  discard block
 block discarded – undo
9704 9704
 			$datetime = new DateTime();
9705 9705
 			$offset = $datetime->format('P');
9706 9706
 		} else $offset = '+00:00';
9707
-		$filter_query = $this->getFilter($filters,true,true);
9707
+		$filter_query = $this->getFilter($filters, true, true);
9708 9708
 		if ($globalDBdriver == 'mysql') {
9709
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9709
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9710 9710
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9711 9711
 								GROUP BY year_name, month_name 
9712 9712
 								ORDER BY date_count DESC";
9713 9713
 		} else {
9714
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9714
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9715 9715
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9716 9716
 								GROUP BY year_name, month_name 
9717 9717
 								ORDER BY date_count DESC";
@@ -9723,7 +9723,7 @@  discard block
 block discarded – undo
9723 9723
 		$date_array = array();
9724 9724
 		$temp_array = array();
9725 9725
         
9726
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9726
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9727 9727
 		{
9728 9728
 			$temp_array['month_name'] = $row['month_name'];
9729 9729
 			$temp_array['year_name'] = $row['year_name'];
@@ -9749,15 +9749,15 @@  discard block
 block discarded – undo
9749 9749
 			$datetime = new DateTime();
9750 9750
 			$offset = $datetime->format('P');
9751 9751
 		} else $offset = '+00:00';
9752
-		$filter_query = $this->getFilter($filters,true,true);
9752
+		$filter_query = $this->getFilter($filters, true, true);
9753 9753
 
9754 9754
 		if ($globalDBdriver == 'mysql') {
9755
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9755
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9756 9756
 								FROM spotter_output".$filter_query." owner_name <> ''
9757 9757
 								GROUP BY year_name, month_name
9758 9758
 								ORDER BY date_count DESC";
9759 9759
 		} else {
9760
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9760
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9761 9761
 								FROM spotter_output".$filter_query." owner_name <> ''
9762 9762
 								GROUP BY year_name, month_name
9763 9763
 								ORDER BY date_count DESC";
@@ -9769,7 +9769,7 @@  discard block
 block discarded – undo
9769 9769
 		$date_array = array();
9770 9770
 		$temp_array = array();
9771 9771
         
9772
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9772
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9773 9773
 		{
9774 9774
 			$temp_array['month_name'] = $row['month_name'];
9775 9775
 			$temp_array['year_name'] = $row['year_name'];
@@ -9790,7 +9790,7 @@  discard block
 block discarded – undo
9790 9790
 	public function countAllMonthsOwnersByAirlines($filters = array())
9791 9791
 	{
9792 9792
 		global $globalTimezone, $globalDBdriver;
9793
-		$filter_query = $this->getFilter($filters,true,true);
9793
+		$filter_query = $this->getFilter($filters, true, true);
9794 9794
 		if ($globalTimezone != '') {
9795 9795
 			date_default_timezone_set($globalTimezone);
9796 9796
 			$datetime = new DateTime();
@@ -9798,12 +9798,12 @@  discard block
 block discarded – undo
9798 9798
 		} else $offset = '+00:00';
9799 9799
 
9800 9800
 		if ($globalDBdriver == 'mysql') {
9801
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9801
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9802 9802
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9803 9803
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9804 9804
 								ORDER BY date_count DESC";
9805 9805
 		} else {
9806
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9806
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9807 9807
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9808 9808
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9809 9809
 								ORDER BY date_count DESC";
@@ -9815,7 +9815,7 @@  discard block
 block discarded – undo
9815 9815
 		$date_array = array();
9816 9816
 		$temp_array = array();
9817 9817
         
9818
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9818
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9819 9819
 		{
9820 9820
 			$temp_array['month_name'] = $row['month_name'];
9821 9821
 			$temp_array['year_name'] = $row['year_name'];
@@ -9842,15 +9842,15 @@  discard block
 block discarded – undo
9842 9842
 			$datetime = new DateTime();
9843 9843
 			$offset = $datetime->format('P');
9844 9844
 		} else $offset = '+00:00';
9845
-		$filter_query = $this->getFilter($filters,true,true);
9845
+		$filter_query = $this->getFilter($filters, true, true);
9846 9846
 
9847 9847
 		if ($globalDBdriver == 'mysql') {
9848
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9848
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9849 9849
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9850 9850
 								GROUP BY year_name, month_name
9851 9851
 								ORDER BY date_count DESC";
9852 9852
 		} else {
9853
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9853
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9854 9854
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9855 9855
 								GROUP BY year_name, month_name
9856 9856
 								ORDER BY date_count DESC";
@@ -9862,7 +9862,7 @@  discard block
 block discarded – undo
9862 9862
 		$date_array = array();
9863 9863
 		$temp_array = array();
9864 9864
         
9865
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9865
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9866 9866
 		{
9867 9867
 			$temp_array['month_name'] = $row['month_name'];
9868 9868
 			$temp_array['year_name'] = $row['year_name'];
@@ -9883,7 +9883,7 @@  discard block
 block discarded – undo
9883 9883
 	public function countAllMonthsPilotsByAirlines($filters = array())
9884 9884
 	{
9885 9885
 		global $globalTimezone, $globalDBdriver;
9886
-		$filter_query = $this->getFilter($filters,true,true);
9886
+		$filter_query = $this->getFilter($filters, true, true);
9887 9887
 		if ($globalTimezone != '') {
9888 9888
 			date_default_timezone_set($globalTimezone);
9889 9889
 			$datetime = new DateTime();
@@ -9891,12 +9891,12 @@  discard block
 block discarded – undo
9891 9891
 		} else $offset = '+00:00';
9892 9892
 
9893 9893
 		if ($globalDBdriver == 'mysql') {
9894
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9894
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9895 9895
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9896 9896
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9897 9897
 								ORDER BY date_count DESC";
9898 9898
 		} else {
9899
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9899
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9900 9900
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9901 9901
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9902 9902
 								ORDER BY date_count DESC";
@@ -9908,7 +9908,7 @@  discard block
 block discarded – undo
9908 9908
 		$date_array = array();
9909 9909
 		$temp_array = array();
9910 9910
         
9911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9912 9912
 		{
9913 9913
 			$temp_array['month_name'] = $row['month_name'];
9914 9914
 			$temp_array['year_name'] = $row['year_name'];
@@ -9930,7 +9930,7 @@  discard block
 block discarded – undo
9930 9930
 	public function countAllMonthsAirlines($filters = array())
9931 9931
 	{
9932 9932
 		global $globalTimezone, $globalDBdriver;
9933
-		$filter_query = $this->getFilter($filters,true,true);
9933
+		$filter_query = $this->getFilter($filters, true, true);
9934 9934
 		if ($globalTimezone != '') {
9935 9935
 			date_default_timezone_set($globalTimezone);
9936 9936
 			$datetime = new DateTime();
@@ -9938,12 +9938,12 @@  discard block
 block discarded – undo
9938 9938
 		} else $offset = '+00:00';
9939 9939
 
9940 9940
 		if ($globalDBdriver == 'mysql') {
9941
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
9941
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
9942 9942
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9943 9943
 								GROUP BY year_name, month_name
9944 9944
 								ORDER BY date_count DESC";
9945 9945
 		} else {
9946
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9946
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9947 9947
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9948 9948
 								GROUP BY year_name, month_name
9949 9949
 								ORDER BY date_count DESC";
@@ -9955,7 +9955,7 @@  discard block
 block discarded – undo
9955 9955
 		$date_array = array();
9956 9956
 		$temp_array = array();
9957 9957
         
9958
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9958
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9959 9959
 		{
9960 9960
 			$temp_array['month_name'] = $row['month_name'];
9961 9961
 			$temp_array['year_name'] = $row['year_name'];
@@ -9981,15 +9981,15 @@  discard block
 block discarded – undo
9981 9981
 			$datetime = new DateTime();
9982 9982
 			$offset = $datetime->format('P');
9983 9983
 		} else $offset = '+00:00';
9984
-		$filter_query = $this->getFilter($filters,true,true);
9984
+		$filter_query = $this->getFilter($filters, true, true);
9985 9985
 
9986 9986
 		if ($globalDBdriver == 'mysql') {
9987
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9987
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9988 9988
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9989 9989
 								GROUP BY year_name, month_name
9990 9990
 								ORDER BY date_count DESC";
9991 9991
 		} else {
9992
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9992
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9993 9993
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9994 9994
 								GROUP BY year_name, month_name
9995 9995
 								ORDER BY date_count DESC";
@@ -10001,7 +10001,7 @@  discard block
 block discarded – undo
10001 10001
 		$date_array = array();
10002 10002
 		$temp_array = array();
10003 10003
         
10004
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10004
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10005 10005
 		{
10006 10006
 			$temp_array['month_name'] = $row['month_name'];
10007 10007
 			$temp_array['year_name'] = $row['year_name'];
@@ -10023,7 +10023,7 @@  discard block
 block discarded – undo
10023 10023
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10024 10024
 	{
10025 10025
 		global $globalTimezone, $globalDBdriver;
10026
-		$filter_query = $this->getFilter($filters,true,true);
10026
+		$filter_query = $this->getFilter($filters, true, true);
10027 10027
 		if ($globalTimezone != '') {
10028 10028
 			date_default_timezone_set($globalTimezone);
10029 10029
 			$datetime = new DateTime();
@@ -10031,12 +10031,12 @@  discard block
 block discarded – undo
10031 10031
 		} else $offset = '+00:00';
10032 10032
 
10033 10033
 		if ($globalDBdriver == 'mysql') {
10034
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
10034
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
10035 10035
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
10036 10036
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10037 10037
 								ORDER BY date_count DESC";
10038 10038
 		} else {
10039
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
10039
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
10040 10040
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
10041 10041
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10042 10042
 								ORDER BY date_count DESC";
@@ -10048,7 +10048,7 @@  discard block
 block discarded – undo
10048 10048
 		$date_array = array();
10049 10049
 		$temp_array = array();
10050 10050
         
10051
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10051
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10052 10052
 		{
10053 10053
 			$temp_array['month_name'] = $row['month_name'];
10054 10054
 			$temp_array['year_name'] = $row['year_name'];
@@ -10075,15 +10075,15 @@  discard block
 block discarded – undo
10075 10075
 			$datetime = new DateTime();
10076 10076
 			$offset = $datetime->format('P');
10077 10077
 		} else $offset = '+00:00';
10078
-		$filter_query = $this->getFilter($filters,true,true);
10078
+		$filter_query = $this->getFilter($filters, true, true);
10079 10079
 
10080 10080
 		if ($globalDBdriver == 'mysql') {
10081
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
10081
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
10082 10082
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10083 10083
 								GROUP BY year_name, month_name
10084 10084
 								ORDER BY date_count DESC";
10085 10085
 		} else {
10086
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10086
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10087 10087
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10088 10088
 								GROUP BY year_name, month_name
10089 10089
 								ORDER BY date_count DESC";
@@ -10095,7 +10095,7 @@  discard block
 block discarded – undo
10095 10095
 		$date_array = array();
10096 10096
 		$temp_array = array();
10097 10097
         
10098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10099 10099
 		{
10100 10100
 			$temp_array['month_name'] = $row['month_name'];
10101 10101
 			$temp_array['year_name'] = $row['year_name'];
@@ -10117,7 +10117,7 @@  discard block
 block discarded – undo
10117 10117
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10118 10118
 	{
10119 10119
 		global $globalTimezone, $globalDBdriver;
10120
-		$filter_query = $this->getFilter($filters,true,true);
10120
+		$filter_query = $this->getFilter($filters, true, true);
10121 10121
 		if ($globalTimezone != '') {
10122 10122
 			date_default_timezone_set($globalTimezone);
10123 10123
 			$datetime = new DateTime();
@@ -10125,12 +10125,12 @@  discard block
 block discarded – undo
10125 10125
 		} else $offset = '+00:00';
10126 10126
 
10127 10127
 		if ($globalDBdriver == 'mysql') {
10128
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
10128
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
10129 10129
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10130 10130
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10131 10131
 								ORDER BY date_count DESC";
10132 10132
 		} else {
10133
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10133
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10134 10134
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10135 10135
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10136 10136
 								ORDER BY date_count DESC";
@@ -10142,7 +10142,7 @@  discard block
 block discarded – undo
10142 10142
 		$date_array = array();
10143 10143
 		$temp_array = array();
10144 10144
         
10145
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10145
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10146 10146
 		{
10147 10147
 			$temp_array['month_name'] = $row['month_name'];
10148 10148
 			$temp_array['year_name'] = $row['year_name'];
@@ -10170,7 +10170,7 @@  discard block
 block discarded – undo
10170 10170
 			$datetime = new DateTime();
10171 10171
 			$offset = $datetime->format('P');
10172 10172
 		} else $offset = '+00:00';
10173
-		$filter_query = $this->getFilter($filters,true,true);
10173
+		$filter_query = $this->getFilter($filters, true, true);
10174 10174
 		if ($globalDBdriver == 'mysql') {
10175 10175
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
10176 10176
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -10191,7 +10191,7 @@  discard block
 block discarded – undo
10191 10191
 		$date_array = array();
10192 10192
 		$temp_array = array();
10193 10193
         
10194
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10194
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10195 10195
 		{
10196 10196
 			$temp_array['year_name'] = $row['year_name'];
10197 10197
 			$temp_array['month_name'] = $row['month_name'];
@@ -10211,7 +10211,7 @@  discard block
 block discarded – undo
10211 10211
 	* @return Array the hour list
10212 10212
 	*
10213 10213
 	*/
10214
-	public function countAllHours($orderby,$filters = array())
10214
+	public function countAllHours($orderby, $filters = array())
10215 10215
 	{
10216 10216
 		global $globalTimezone, $globalDBdriver;
10217 10217
 		if ($globalTimezone != '') {
@@ -10259,7 +10259,7 @@  discard block
 block discarded – undo
10259 10259
 		$hour_array = array();
10260 10260
 		$temp_array = array();
10261 10261
         
10262
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10262
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10263 10263
 		{
10264 10264
 			$temp_array['hour_name'] = $row['hour_name'];
10265 10265
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10279,7 +10279,7 @@  discard block
 block discarded – undo
10279 10279
 	public function countAllHoursByAirlines($orderby, $filters = array())
10280 10280
 	{
10281 10281
 		global $globalTimezone, $globalDBdriver;
10282
-		$filter_query = $this->getFilter($filters,true,true);
10282
+		$filter_query = $this->getFilter($filters, true, true);
10283 10283
 		if ($globalTimezone != '') {
10284 10284
 			date_default_timezone_set($globalTimezone);
10285 10285
 			$datetime = new DateTime();
@@ -10297,7 +10297,7 @@  discard block
 block discarded – undo
10297 10297
 		}
10298 10298
 		
10299 10299
 		if ($globalDBdriver == 'mysql') {
10300
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10300
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10301 10301
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10302 10302
 								GROUP BY spotter_output.airline_icao, hour_name 
10303 10303
 								".$orderby_sql;
@@ -10310,7 +10310,7 @@  discard block
 block discarded – undo
10310 10310
   */    
10311 10311
 		$query_data = array(':offset' => $offset);
10312 10312
 		} else {
10313
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10313
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10314 10314
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10315 10315
 								GROUP BY spotter_output.airline_icao, hour_name 
10316 10316
 								".$orderby_sql;
@@ -10323,7 +10323,7 @@  discard block
 block discarded – undo
10323 10323
 		$hour_array = array();
10324 10324
 		$temp_array = array();
10325 10325
         
10326
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10326
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10327 10327
 		{
10328 10328
 			$temp_array['hour_name'] = $row['hour_name'];
10329 10329
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10346,34 +10346,34 @@  discard block
 block discarded – undo
10346 10346
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10347 10347
 	{
10348 10348
 		global $globalTimezone, $globalDBdriver;
10349
-		$filter_query = $this->getFilter($filters,true,true);
10349
+		$filter_query = $this->getFilter($filters, true, true);
10350 10350
 		if ($globalTimezone != '') {
10351 10351
 			date_default_timezone_set($globalTimezone);
10352 10352
 			$datetime = new DateTime();
10353 10353
 			$offset = $datetime->format('P');
10354 10354
 		} else $offset = '+00:00';
10355 10355
 
10356
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10356
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
10357 10357
 
10358 10358
 		if ($globalDBdriver == 'mysql') {
10359
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10359
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10360 10360
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10361 10361
 								GROUP BY hour_name 
10362 10362
 								ORDER BY hour_name ASC";
10363 10363
 		} else {
10364
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10364
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10365 10365
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10366 10366
 								GROUP BY hour_name 
10367 10367
 								ORDER BY hour_name ASC";
10368 10368
 		}
10369 10369
 		
10370 10370
 		$sth = $this->db->prepare($query);
10371
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
10371
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
10372 10372
       
10373 10373
 		$hour_array = array();
10374 10374
 		$temp_array = array();
10375 10375
         
10376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10377 10377
 		{
10378 10378
 			$temp_array['hour_name'] = $row['hour_name'];
10379 10379
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10396,8 +10396,8 @@  discard block
 block discarded – undo
10396 10396
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10397 10397
 	{
10398 10398
 		global $globalTimezone, $globalDBdriver;
10399
-		$filter_query = $this->getFilter($filters,true,true);
10400
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10399
+		$filter_query = $this->getFilter($filters, true, true);
10400
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10401 10401
 		if ($globalTimezone != '') {
10402 10402
 			date_default_timezone_set($globalTimezone);
10403 10403
 			$datetime = new DateTime();
@@ -10405,24 +10405,24 @@  discard block
 block discarded – undo
10405 10405
 		} else $offset = '+00:00';
10406 10406
 
10407 10407
 		if ($globalDBdriver == 'mysql') {
10408
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10408
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10409 10409
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10410 10410
 								GROUP BY hour_name 
10411 10411
 								ORDER BY hour_name ASC";
10412 10412
 		} else {
10413
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10413
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10414 10414
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10415 10415
 								GROUP BY hour_name 
10416 10416
 								ORDER BY hour_name ASC";
10417 10417
 		}
10418 10418
 		
10419 10419
 		$sth = $this->db->prepare($query);
10420
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10420
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10421 10421
       
10422 10422
 		$hour_array = array();
10423 10423
 		$temp_array = array();
10424 10424
         
10425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10426 10426
 		{
10427 10427
 			$temp_array['hour_name'] = $row['hour_name'];
10428 10428
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10443,8 +10443,8 @@  discard block
 block discarded – undo
10443 10443
 	public function countAllHoursByRegistration($registration, $filters = array())
10444 10444
 	{
10445 10445
 		global $globalTimezone, $globalDBdriver;
10446
-		$filter_query = $this->getFilter($filters,true,true);
10447
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10446
+		$filter_query = $this->getFilter($filters, true, true);
10447
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10448 10448
 		if ($globalTimezone != '') {
10449 10449
 			date_default_timezone_set($globalTimezone);
10450 10450
 			$datetime = new DateTime();
@@ -10452,24 +10452,24 @@  discard block
 block discarded – undo
10452 10452
 		} else $offset = '+00:00';
10453 10453
 
10454 10454
 		if ($globalDBdriver == 'mysql') {
10455
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10455
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10456 10456
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10457 10457
 								GROUP BY hour_name 
10458 10458
 								ORDER BY hour_name ASC";
10459 10459
 		} else {
10460
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10460
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10461 10461
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10462 10462
 								GROUP BY hour_name 
10463 10463
 								ORDER BY hour_name ASC";
10464 10464
 		}
10465 10465
 		
10466 10466
 		$sth = $this->db->prepare($query);
10467
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10467
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10468 10468
       
10469 10469
 		$hour_array = array();
10470 10470
 		$temp_array = array();
10471 10471
         
10472
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10472
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10473 10473
 		{
10474 10474
 			$temp_array['hour_name'] = $row['hour_name'];
10475 10475
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10490,8 +10490,8 @@  discard block
 block discarded – undo
10490 10490
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10491 10491
 	{
10492 10492
 		global $globalTimezone, $globalDBdriver;
10493
-		$filter_query = $this->getFilter($filters,true,true);
10494
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10493
+		$filter_query = $this->getFilter($filters, true, true);
10494
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10495 10495
 		if ($globalTimezone != '') {
10496 10496
 			date_default_timezone_set($globalTimezone);
10497 10497
 			$datetime = new DateTime();
@@ -10499,24 +10499,24 @@  discard block
 block discarded – undo
10499 10499
 		} else $offset = '+00:00';
10500 10500
 
10501 10501
 		if ($globalDBdriver == 'mysql') {
10502
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10502
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10503 10503
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10504 10504
 								GROUP BY hour_name 
10505 10505
 								ORDER BY hour_name ASC";
10506 10506
 		} else {
10507
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10507
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10508 10508
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10509 10509
 								GROUP BY hour_name 
10510 10510
 								ORDER BY hour_name ASC";
10511 10511
 		}
10512 10512
 		
10513 10513
 		$sth = $this->db->prepare($query);
10514
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10514
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10515 10515
       
10516 10516
 		$hour_array = array();
10517 10517
 		$temp_array = array();
10518 10518
         
10519
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10519
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10520 10520
 		{
10521 10521
 			$temp_array['hour_name'] = $row['hour_name'];
10522 10522
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10535,11 +10535,11 @@  discard block
 block discarded – undo
10535 10535
 	* @return Array the hour list
10536 10536
 	*
10537 10537
 	*/
10538
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10538
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10539 10539
 	{
10540 10540
 		global $globalTimezone, $globalDBdriver;
10541
-		$filter_query = $this->getFilter($filters,true,true);
10542
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10541
+		$filter_query = $this->getFilter($filters, true, true);
10542
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10543 10543
 		if ($globalTimezone != '') {
10544 10544
 			date_default_timezone_set($globalTimezone);
10545 10545
 			$datetime = new DateTime();
@@ -10547,24 +10547,24 @@  discard block
 block discarded – undo
10547 10547
 		} else $offset = '+00:00';
10548 10548
 
10549 10549
 		if ($globalDBdriver == 'mysql') {
10550
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10550
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10551 10551
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10552 10552
 								GROUP BY hour_name 
10553 10553
 								ORDER BY hour_name ASC";
10554 10554
 		} else {
10555
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10555
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10556 10556
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10557 10557
 								GROUP BY hour_name 
10558 10558
 								ORDER BY hour_name ASC";
10559 10559
 		}
10560 10560
 		
10561 10561
 		$sth = $this->db->prepare($query);
10562
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10562
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10563 10563
       
10564 10564
 		$hour_array = array();
10565 10565
 		$temp_array = array();
10566 10566
         
10567
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10567
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10568 10568
 		{
10569 10569
 			$temp_array['hour_name'] = $row['hour_name'];
10570 10570
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10586,8 +10586,8 @@  discard block
 block discarded – undo
10586 10586
 	public function countAllHoursByDate($date, $filters = array())
10587 10587
 	{
10588 10588
 		global $globalTimezone, $globalDBdriver;
10589
-		$filter_query = $this->getFilter($filters,true,true);
10590
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10589
+		$filter_query = $this->getFilter($filters, true, true);
10590
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10591 10591
 		if ($globalTimezone != '') {
10592 10592
 			date_default_timezone_set($globalTimezone);
10593 10593
 			$datetime = new DateTime($date);
@@ -10595,12 +10595,12 @@  discard block
 block discarded – undo
10595 10595
 		} else $offset = '+00:00';
10596 10596
 
10597 10597
 		if ($globalDBdriver == 'mysql') {
10598
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10598
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10599 10599
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10600 10600
 								GROUP BY hour_name 
10601 10601
 								ORDER BY hour_name ASC";
10602 10602
 		} else {
10603
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10603
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10604 10604
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10605 10605
 								GROUP BY hour_name 
10606 10606
 								ORDER BY hour_name ASC";
@@ -10612,7 +10612,7 @@  discard block
 block discarded – undo
10612 10612
 		$hour_array = array();
10613 10613
 		$temp_array = array();
10614 10614
         
10615
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10615
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10616 10616
 		{
10617 10617
 			$temp_array['hour_name'] = $row['hour_name'];
10618 10618
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10634,8 +10634,8 @@  discard block
 block discarded – undo
10634 10634
 	public function countAllHoursByIdent($ident, $filters = array())
10635 10635
 	{
10636 10636
 		global $globalTimezone, $globalDBdriver;
10637
-		$filter_query = $this->getFilter($filters,true,true);
10638
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10637
+		$filter_query = $this->getFilter($filters, true, true);
10638
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10639 10639
 		if ($globalTimezone != '') {
10640 10640
 			date_default_timezone_set($globalTimezone);
10641 10641
 			$datetime = new DateTime();
@@ -10643,12 +10643,12 @@  discard block
 block discarded – undo
10643 10643
 		} else $offset = '+00:00';
10644 10644
 
10645 10645
 		if ($globalDBdriver == 'mysql') {
10646
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10646
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10647 10647
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10648 10648
 								GROUP BY hour_name 
10649 10649
 								ORDER BY hour_name ASC";
10650 10650
 		} else {
10651
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10651
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10652 10652
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10653 10653
 								GROUP BY hour_name 
10654 10654
 								ORDER BY hour_name ASC";
@@ -10656,12 +10656,12 @@  discard block
 block discarded – undo
10656 10656
       
10657 10657
 		
10658 10658
 		$sth = $this->db->prepare($query);
10659
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10659
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10660 10660
       
10661 10661
 		$hour_array = array();
10662 10662
 		$temp_array = array();
10663 10663
         
10664
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10664
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10665 10665
 		{
10666 10666
 			$temp_array['hour_name'] = $row['hour_name'];
10667 10667
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10681,8 +10681,8 @@  discard block
 block discarded – undo
10681 10681
 	public function countAllHoursByOwner($owner, $filters = array())
10682 10682
 	{
10683 10683
 		global $globalTimezone, $globalDBdriver;
10684
-		$filter_query = $this->getFilter($filters,true,true);
10685
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10684
+		$filter_query = $this->getFilter($filters, true, true);
10685
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10686 10686
 		if ($globalTimezone != '') {
10687 10687
 			date_default_timezone_set($globalTimezone);
10688 10688
 			$datetime = new DateTime();
@@ -10690,12 +10690,12 @@  discard block
 block discarded – undo
10690 10690
 		} else $offset = '+00:00';
10691 10691
 
10692 10692
 		if ($globalDBdriver == 'mysql') {
10693
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10693
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10694 10694
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10695 10695
 								GROUP BY hour_name 
10696 10696
 								ORDER BY hour_name ASC";
10697 10697
 		} else {
10698
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10698
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10699 10699
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10700 10700
 								GROUP BY hour_name 
10701 10701
 								ORDER BY hour_name ASC";
@@ -10703,12 +10703,12 @@  discard block
 block discarded – undo
10703 10703
       
10704 10704
 		
10705 10705
 		$sth = $this->db->prepare($query);
10706
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10706
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10707 10707
       
10708 10708
 		$hour_array = array();
10709 10709
 		$temp_array = array();
10710 10710
         
10711
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10711
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10712 10712
 		{
10713 10713
 			$temp_array['hour_name'] = $row['hour_name'];
10714 10714
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10728,8 +10728,8 @@  discard block
 block discarded – undo
10728 10728
 	public function countAllHoursByPilot($pilot, $filters = array())
10729 10729
 	{
10730 10730
 		global $globalTimezone, $globalDBdriver;
10731
-		$filter_query = $this->getFilter($filters,true,true);
10732
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10731
+		$filter_query = $this->getFilter($filters, true, true);
10732
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10733 10733
 		if ($globalTimezone != '') {
10734 10734
 			date_default_timezone_set($globalTimezone);
10735 10735
 			$datetime = new DateTime();
@@ -10737,12 +10737,12 @@  discard block
 block discarded – undo
10737 10737
 		} else $offset = '+00:00';
10738 10738
 
10739 10739
 		if ($globalDBdriver == 'mysql') {
10740
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10740
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10741 10741
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10742 10742
 								GROUP BY hour_name 
10743 10743
 								ORDER BY hour_name ASC";
10744 10744
 		} else {
10745
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10745
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10746 10746
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10747 10747
 								GROUP BY hour_name 
10748 10748
 								ORDER BY hour_name ASC";
@@ -10750,12 +10750,12 @@  discard block
 block discarded – undo
10750 10750
       
10751 10751
 		
10752 10752
 		$sth = $this->db->prepare($query);
10753
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10753
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10754 10754
       
10755 10755
 		$hour_array = array();
10756 10756
 		$temp_array = array();
10757 10757
         
10758
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10758
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10759 10759
 		{
10760 10760
 			$temp_array['hour_name'] = $row['hour_name'];
10761 10761
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10774,12 +10774,12 @@  discard block
 block discarded – undo
10774 10774
 	* @return Array the hour list
10775 10775
 	*
10776 10776
 	*/
10777
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10777
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10778 10778
 	{
10779 10779
 		global $globalTimezone, $globalDBdriver;
10780
-		$filter_query = $this->getFilter($filters,true,true);
10781
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10782
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10780
+		$filter_query = $this->getFilter($filters, true, true);
10781
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10782
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10783 10783
 		if ($globalTimezone != '') {
10784 10784
 			date_default_timezone_set($globalTimezone);
10785 10785
 			$datetime = new DateTime();
@@ -10787,24 +10787,24 @@  discard block
 block discarded – undo
10787 10787
 		} else $offset = '+00:00';
10788 10788
 
10789 10789
 		if ($globalDBdriver == 'mysql') {
10790
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10790
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10791 10791
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10792 10792
 								GROUP BY hour_name 
10793 10793
 								ORDER BY hour_name ASC";
10794 10794
 		} else {
10795
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10795
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10796 10796
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10797 10797
 								GROUP BY hour_name 
10798 10798
 								ORDER BY hour_name ASC";
10799 10799
 		}
10800 10800
 		
10801 10801
 		$sth = $this->db->prepare($query);
10802
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10802
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10803 10803
       
10804 10804
 		$hour_array = array();
10805 10805
 		$temp_array = array();
10806 10806
         
10807
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10807
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10808 10808
 		{
10809 10809
 			$temp_array['hour_name'] = $row['hour_name'];
10810 10810
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10825,8 +10825,8 @@  discard block
 block discarded – undo
10825 10825
 	public function countAllHoursByCountry($country, $filters = array())
10826 10826
 	{
10827 10827
 		global $globalTimezone, $globalDBdriver;
10828
-		$filter_query = $this->getFilter($filters,true,true);
10829
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10828
+		$filter_query = $this->getFilter($filters, true, true);
10829
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10830 10830
 		if ($globalTimezone != '') {
10831 10831
 			date_default_timezone_set($globalTimezone);
10832 10832
 			$datetime = new DateTime();
@@ -10834,24 +10834,24 @@  discard block
 block discarded – undo
10834 10834
 		} else $offset = '+00:00';
10835 10835
 
10836 10836
 		if ($globalDBdriver == 'mysql') {
10837
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10837
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10838 10838
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10839 10839
 								GROUP BY hour_name 
10840 10840
 								ORDER BY hour_name ASC";
10841 10841
 		} else {
10842
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10842
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10843 10843
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10844 10844
 								GROUP BY hour_name 
10845 10845
 								ORDER BY hour_name ASC";
10846 10846
 		}
10847 10847
 		
10848 10848
 		$sth = $this->db->prepare($query);
10849
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10849
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10850 10850
       
10851 10851
 		$hour_array = array();
10852 10852
 		$temp_array = array();
10853 10853
         
10854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10855 10855
 		{
10856 10856
 			$temp_array['hour_name'] = $row['hour_name'];
10857 10857
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10871,29 +10871,29 @@  discard block
 block discarded – undo
10871 10871
 	* @return Integer the number of aircrafts
10872 10872
 	*
10873 10873
 	*/
10874
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10874
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10875 10875
 	{
10876 10876
 		global $globalDBdriver;
10877
-		$filter_query = $this->getFilter($filters,true,true);
10878
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10877
+		$filter_query = $this->getFilter($filters, true, true);
10878
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10879 10879
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10880 10880
 		$query_values = array();
10881 10881
 		if ($year != '') {
10882 10882
 			if ($globalDBdriver == 'mysql') {
10883 10883
 				$query .= " AND YEAR(spotter_output.date) = :year";
10884
-				$query_values = array_merge($query_values,array(':year' => $year));
10884
+				$query_values = array_merge($query_values, array(':year' => $year));
10885 10885
 			} else {
10886 10886
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10887
-				$query_values = array_merge($query_values,array(':year' => $year));
10887
+				$query_values = array_merge($query_values, array(':year' => $year));
10888 10888
 			}
10889 10889
 		}
10890 10890
 		if ($month != '') {
10891 10891
 			if ($globalDBdriver == 'mysql') {
10892 10892
 				$query .= " AND MONTH(spotter_output.date) = :month";
10893
-				$query_values = array_merge($query_values,array(':month' => $month));
10893
+				$query_values = array_merge($query_values, array(':month' => $month));
10894 10894
 			} else {
10895 10895
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10896
-				$query_values = array_merge($query_values,array(':month' => $month));
10896
+				$query_values = array_merge($query_values, array(':month' => $month));
10897 10897
 			}
10898 10898
 		}
10899 10899
 
@@ -10908,29 +10908,29 @@  discard block
 block discarded – undo
10908 10908
 	* @return Integer the number of aircrafts
10909 10909
 	*
10910 10910
 	*/
10911
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10911
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10912 10912
 	{
10913 10913
 		global $globalDBdriver;
10914
-		$filter_query = $this->getFilter($filters,true,true);
10915
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10914
+		$filter_query = $this->getFilter($filters, true, true);
10915
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10916 10916
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10917 10917
 		$query_values = array();
10918 10918
 		if ($year != '') {
10919 10919
 			if ($globalDBdriver == 'mysql') {
10920 10920
 				$query .= " AND YEAR(spotter_output.date) = :year";
10921
-				$query_values = array_merge($query_values,array(':year' => $year));
10921
+				$query_values = array_merge($query_values, array(':year' => $year));
10922 10922
 			} else {
10923 10923
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10924
-				$query_values = array_merge($query_values,array(':year' => $year));
10924
+				$query_values = array_merge($query_values, array(':year' => $year));
10925 10925
 			}
10926 10926
 		}
10927 10927
 		if ($month != '') {
10928 10928
 			if ($globalDBdriver == 'mysql') {
10929 10929
 				$query .= " AND MONTH(spotter_output.date) = :month";
10930
-				$query_values = array_merge($query_values,array(':month' => $month));
10930
+				$query_values = array_merge($query_values, array(':month' => $month));
10931 10931
 			} else {
10932 10932
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10933
-				$query_values = array_merge($query_values,array(':month' => $month));
10933
+				$query_values = array_merge($query_values, array(':month' => $month));
10934 10934
 			}
10935 10935
 		}
10936 10936
 		
@@ -10945,29 +10945,29 @@  discard block
 block discarded – undo
10945 10945
 	* @return Integer the number of pilots
10946 10946
 	*
10947 10947
 	*/
10948
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10948
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10949 10949
 	{
10950 10950
 		global $globalDBdriver;
10951
-		$filter_query = $this->getFilter($filters,true,true);
10952
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10951
+		$filter_query = $this->getFilter($filters, true, true);
10952
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10953 10953
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10954 10954
 		$query_values = array();
10955 10955
 		if ($year != '') {
10956 10956
 			if ($globalDBdriver == 'mysql') {
10957 10957
 				$query .= " AND YEAR(spotter_output.date) = :year";
10958
-				$query_values = array_merge($query_values,array(':year' => $year));
10958
+				$query_values = array_merge($query_values, array(':year' => $year));
10959 10959
 			} else {
10960 10960
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10961
-				$query_values = array_merge($query_values,array(':year' => $year));
10961
+				$query_values = array_merge($query_values, array(':year' => $year));
10962 10962
 			}
10963 10963
 		}
10964 10964
 		if ($month != '') {
10965 10965
 			if ($globalDBdriver == 'mysql') {
10966 10966
 				$query .= " AND MONTH(spotter_output.date) = :month";
10967
-				$query_values = array_merge($query_values,array(':month' => $month));
10967
+				$query_values = array_merge($query_values, array(':month' => $month));
10968 10968
 			} else {
10969 10969
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10970
-				$query_values = array_merge($query_values,array(':month' => $month));
10970
+				$query_values = array_merge($query_values, array(':month' => $month));
10971 10971
 			}
10972 10972
 		}
10973 10973
 		$sth = $this->db->prepare($query);
@@ -10981,29 +10981,29 @@  discard block
 block discarded – undo
10981 10981
 	* @return Integer the number of owners
10982 10982
 	*
10983 10983
 	*/
10984
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10984
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10985 10985
 	{
10986 10986
 		global $globalDBdriver;
10987
-		$filter_query = $this->getFilter($filters,true,true);
10988
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10987
+		$filter_query = $this->getFilter($filters, true, true);
10988
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10989 10989
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10990 10990
 		$query_values = array();
10991 10991
 		if ($year != '') {
10992 10992
 			if ($globalDBdriver == 'mysql') {
10993 10993
 				$query .= " AND YEAR(spotter_output.date) = :year";
10994
-				$query_values = array_merge($query_values,array(':year' => $year));
10994
+				$query_values = array_merge($query_values, array(':year' => $year));
10995 10995
 			} else {
10996 10996
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10997
-				$query_values = array_merge($query_values,array(':year' => $year));
10997
+				$query_values = array_merge($query_values, array(':year' => $year));
10998 10998
 			}
10999 10999
 		}
11000 11000
 		if ($month != '') {
11001 11001
 			if ($globalDBdriver == 'mysql') {
11002 11002
 				$query .= " AND MONTH(spotter_output.date) = :month";
11003
-				$query_values = array_merge($query_values,array(':month' => $month));
11003
+				$query_values = array_merge($query_values, array(':month' => $month));
11004 11004
 			} else {
11005 11005
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11006
-				$query_values = array_merge($query_values,array(':month' => $month));
11006
+				$query_values = array_merge($query_values, array(':month' => $month));
11007 11007
 			}
11008 11008
 		}
11009 11009
 		$sth = $this->db->prepare($query);
@@ -11018,32 +11018,32 @@  discard block
 block discarded – undo
11018 11018
 	* @return Integer the number of flights
11019 11019
 	*
11020 11020
 	*/
11021
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
11021
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
11022 11022
 	{
11023 11023
 		global $globalDBdriver;
11024
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11024
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11025 11025
 		$query_values = array();
11026 11026
 		$query = '';
11027 11027
 		if ($year != '') {
11028 11028
 			if ($globalDBdriver == 'mysql') {
11029 11029
 				$query .= " AND YEAR(spotter_output.date) = :year";
11030
-				$query_values = array_merge($query_values,array(':year' => $year));
11030
+				$query_values = array_merge($query_values, array(':year' => $year));
11031 11031
 			} else {
11032 11032
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11033
-				$query_values = array_merge($query_values,array(':year' => $year));
11033
+				$query_values = array_merge($query_values, array(':year' => $year));
11034 11034
 			}
11035 11035
 		}
11036 11036
 		if ($month != '') {
11037 11037
 			if ($globalDBdriver == 'mysql') {
11038 11038
 				$query .= " AND MONTH(spotter_output.date) = :month";
11039
-				$query_values = array_merge($query_values,array(':month' => $month));
11039
+				$query_values = array_merge($query_values, array(':month' => $month));
11040 11040
 			} else {
11041 11041
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11042
-				$query_values = array_merge($query_values,array(':month' => $month));
11042
+				$query_values = array_merge($query_values, array(':month' => $month));
11043 11043
 			}
11044 11044
 		}
11045 11045
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11046
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11046
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11047 11047
 		
11048 11048
 		$sth = $this->db->prepare($queryi);
11049 11049
 		$sth->execute($query_values);
@@ -11056,29 +11056,29 @@  discard block
 block discarded – undo
11056 11056
 	* @return Integer the number of flights
11057 11057
 	*
11058 11058
 	*/
11059
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11059
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
11060 11060
 	{
11061 11061
 		global $globalDBdriver;
11062
-		$filter_query = $this->getFilter($filters,true,true);
11063
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11062
+		$filter_query = $this->getFilter($filters, true, true);
11063
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11064 11064
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
11065 11065
 		$query_values = array();
11066 11066
 		if ($year != '') {
11067 11067
 			if ($globalDBdriver == 'mysql') {
11068 11068
 				$query .= " AND YEAR(spotter_output.date) = :year";
11069
-				$query_values = array_merge($query_values,array(':year' => $year));
11069
+				$query_values = array_merge($query_values, array(':year' => $year));
11070 11070
 			} else {
11071 11071
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11072
-				$query_values = array_merge($query_values,array(':year' => $year));
11072
+				$query_values = array_merge($query_values, array(':year' => $year));
11073 11073
 			}
11074 11074
 		}
11075 11075
 		if ($month != '') {
11076 11076
 			if ($globalDBdriver == 'mysql') {
11077 11077
 				$query .= " AND MONTH(spotter_output.date) = :month";
11078
-				$query_values = array_merge($query_values,array(':month' => $month));
11078
+				$query_values = array_merge($query_values, array(':month' => $month));
11079 11079
 			} else {
11080 11080
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11081
-				$query_values = array_merge($query_values,array(':month' => $month));
11081
+				$query_values = array_merge($query_values, array(':month' => $month));
11082 11082
 			}
11083 11083
 		}
11084 11084
       
@@ -11095,10 +11095,10 @@  discard block
 block discarded – undo
11095 11095
 	* @return Integer the number of airlines
11096 11096
 	*
11097 11097
 	*/
11098
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11098
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
11099 11099
 	{
11100 11100
 		global $globalDBdriver;
11101
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11101
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11102 11102
 							FROM spotter_output";
11103 11103
       
11104 11104
 		$query_values = array();
@@ -11106,23 +11106,23 @@  discard block
 block discarded – undo
11106 11106
 		if ($year != '') {
11107 11107
 			if ($globalDBdriver == 'mysql') {
11108 11108
 				$query .= " AND YEAR(spotter_output.date) = :year";
11109
-				$query_values = array_merge($query_values,array(':year' => $year));
11109
+				$query_values = array_merge($query_values, array(':year' => $year));
11110 11110
 			} else {
11111 11111
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11112
-				$query_values = array_merge($query_values,array(':year' => $year));
11112
+				$query_values = array_merge($query_values, array(':year' => $year));
11113 11113
 			}
11114 11114
 		}
11115 11115
 		if ($month != '') {
11116 11116
 			if ($globalDBdriver == 'mysql') {
11117 11117
 				$query .= " AND MONTH(spotter_output.date) = :month";
11118
-				$query_values = array_merge($query_values,array(':month' => $month));
11118
+				$query_values = array_merge($query_values, array(':month' => $month));
11119 11119
 			} else {
11120 11120
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11121
-				$query_values = array_merge($query_values,array(':month' => $month));
11121
+				$query_values = array_merge($query_values, array(':month' => $month));
11122 11122
 			}
11123 11123
 		}
11124 11124
                 if ($query == '') $queryi .= $this->getFilter($filters);
11125
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11125
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11126 11126
 
11127 11127
 
11128 11128
 		$sth = $this->db->prepare($queryi);
@@ -11140,7 +11140,7 @@  discard block
 block discarded – undo
11140 11140
 	public function countAllHoursFromToday($filters = array())
11141 11141
 	{
11142 11142
 		global $globalTimezone, $globalDBdriver;
11143
-		$filter_query = $this->getFilter($filters,true,true);
11143
+		$filter_query = $this->getFilter($filters, true, true);
11144 11144
 		if ($globalTimezone != '') {
11145 11145
 			date_default_timezone_set($globalTimezone);
11146 11146
 			$datetime = new DateTime();
@@ -11148,12 +11148,12 @@  discard block
 block discarded – undo
11148 11148
 		} else $offset = '+00:00';
11149 11149
 
11150 11150
 		if ($globalDBdriver == 'mysql') {
11151
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11151
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11152 11152
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
11153 11153
 								GROUP BY hour_name 
11154 11154
 								ORDER BY hour_name ASC";
11155 11155
 		} else {
11156
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11156
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11157 11157
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
11158 11158
 								GROUP BY hour_name 
11159 11159
 								ORDER BY hour_name ASC";
@@ -11165,7 +11165,7 @@  discard block
 block discarded – undo
11165 11165
 		$hour_array = array();
11166 11166
 		$temp_array = array();
11167 11167
         
11168
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11168
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11169 11169
 		{
11170 11170
 			$temp_array['hour_name'] = $row['hour_name'];
11171 11171
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -11184,14 +11184,14 @@  discard block
 block discarded – undo
11184 11184
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11185 11185
 	{
11186 11186
 		global $global_query, $globalDBdriver, $globalTimezone;
11187
-		$filter_query = $this->getFilter($filters,true,true);
11187
+		$filter_query = $this->getFilter($filters, true, true);
11188 11188
 		date_default_timezone_set('UTC');
11189 11189
 		$limit_query = '';
11190 11190
 		if ($limit != "")
11191 11191
 		{
11192 11192
 			$limit_array = explode(",", $limit);
11193
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
11194
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
11193
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
11194
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
11195 11195
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
11196 11196
 			{
11197 11197
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -11244,7 +11244,7 @@  discard block
 block discarded – undo
11244 11244
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
11245 11245
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
11246 11246
 			//echo $query;
11247
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
11247
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
11248 11248
 			/*
11249 11249
 			$sth = $this->db->prepare($query);
11250 11250
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -11263,9 +11263,9 @@  discard block
 block discarded – undo
11263 11263
 	*/
11264 11264
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11265 11265
 	{
11266
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
11266
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
11267 11267
 
11268
-		$query  = "SELECT spotter_output.spotter_id
11268
+		$query = "SELECT spotter_output.spotter_id
11269 11269
 								FROM spotter_output 
11270 11270
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
11271 11271
         
@@ -11273,7 +11273,7 @@  discard block
 block discarded – undo
11273 11273
 		$sth = $this->db->prepare($query);
11274 11274
 		$sth->execute();
11275 11275
 
11276
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11276
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11277 11277
 		{
11278 11278
 			return $row['spotter_id'];
11279 11279
 		}
@@ -11298,23 +11298,23 @@  discard block
 block discarded – undo
11298 11298
 		}
11299 11299
 		
11300 11300
 		$current_date = date("Y-m-d H:i:s");
11301
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
11301
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
11302 11302
 		
11303 11303
 		$diff = abs(strtotime($current_date) - strtotime($date));
11304 11304
 
11305
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
11305
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
11306 11306
 		$years = $time_array['years'];
11307 11307
 		
11308
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
11308
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
11309 11309
 		$months = $time_array['months'];
11310 11310
 		
11311
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
11311
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
11312 11312
 		$days = $time_array['days'];
11313
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
11313
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
11314 11314
 		$hours = $time_array['hours'];
11315
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
11315
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
11316 11316
 		$minutes = $time_array['minutes'];
11317
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11317
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11318 11318
 		
11319 11319
 		return $time_array;	
11320 11320
 	}	
@@ -11340,63 +11340,63 @@  discard block
 block discarded – undo
11340 11340
 			$temp_array['direction_degree'] = $direction;
11341 11341
 			$temp_array['direction_shortname'] = "N";
11342 11342
 			$temp_array['direction_fullname'] = "North";
11343
-		} elseif ($direction >= 22.5 && $direction < 45){
11343
+		} elseif ($direction >= 22.5 && $direction < 45) {
11344 11344
 			$temp_array['direction_degree'] = $direction;
11345 11345
 			$temp_array['direction_shortname'] = "NNE";
11346 11346
 			$temp_array['direction_fullname'] = "North-Northeast";
11347
-		} elseif ($direction >= 45 && $direction < 67.5){
11347
+		} elseif ($direction >= 45 && $direction < 67.5) {
11348 11348
 			$temp_array['direction_degree'] = $direction;
11349 11349
 			$temp_array['direction_shortname'] = "NE";
11350 11350
 			$temp_array['direction_fullname'] = "Northeast";
11351
-		} elseif ($direction >= 67.5 && $direction < 90){
11351
+		} elseif ($direction >= 67.5 && $direction < 90) {
11352 11352
 			$temp_array['direction_degree'] = $direction;
11353 11353
 			$temp_array['direction_shortname'] = "ENE";
11354 11354
 			$temp_array['direction_fullname'] = "East-Northeast";
11355
-		} elseif ($direction >= 90 && $direction < 112.5){
11355
+		} elseif ($direction >= 90 && $direction < 112.5) {
11356 11356
 			$temp_array['direction_degree'] = $direction;
11357 11357
 			$temp_array['direction_shortname'] = "E";
11358 11358
 			$temp_array['direction_fullname'] = "East";
11359
-		} elseif ($direction >= 112.5 && $direction < 135){
11359
+		} elseif ($direction >= 112.5 && $direction < 135) {
11360 11360
 			$temp_array['direction_degree'] = $direction;
11361 11361
 			$temp_array['direction_shortname'] = "ESE";
11362 11362
 			$temp_array['direction_fullname'] = "East-Southeast";
11363
-		} elseif ($direction >= 135 && $direction < 157.5){
11363
+		} elseif ($direction >= 135 && $direction < 157.5) {
11364 11364
 			$temp_array['direction_degree'] = $direction;
11365 11365
 			$temp_array['direction_shortname'] = "SE";
11366 11366
 			$temp_array['direction_fullname'] = "Southeast";
11367
-		} elseif ($direction >= 157.5 && $direction < 180){
11367
+		} elseif ($direction >= 157.5 && $direction < 180) {
11368 11368
 			$temp_array['direction_degree'] = $direction;
11369 11369
 			$temp_array['direction_shortname'] = "SSE";
11370 11370
 			$temp_array['direction_fullname'] = "South-Southeast";
11371
-		} elseif ($direction >= 180 && $direction < 202.5){
11371
+		} elseif ($direction >= 180 && $direction < 202.5) {
11372 11372
 			$temp_array['direction_degree'] = $direction;
11373 11373
 			$temp_array['direction_shortname'] = "S";
11374 11374
 			$temp_array['direction_fullname'] = "South";
11375
-		} elseif ($direction >= 202.5 && $direction < 225){
11375
+		} elseif ($direction >= 202.5 && $direction < 225) {
11376 11376
 			$temp_array['direction_degree'] = $direction;
11377 11377
 			$temp_array['direction_shortname'] = "SSW";
11378 11378
 			$temp_array['direction_fullname'] = "South-Southwest";
11379
-		} elseif ($direction >= 225 && $direction < 247.5){
11379
+		} elseif ($direction >= 225 && $direction < 247.5) {
11380 11380
 			$temp_array['direction_degree'] = $direction;
11381 11381
 			$temp_array['direction_shortname'] = "SW";
11382 11382
 			$temp_array['direction_fullname'] = "Southwest";
11383
-		} elseif ($direction >= 247.5 && $direction < 270){
11383
+		} elseif ($direction >= 247.5 && $direction < 270) {
11384 11384
 			$temp_array['direction_degree'] = $direction;
11385 11385
 			$temp_array['direction_shortname'] = "WSW";
11386 11386
 			$temp_array['direction_fullname'] = "West-Southwest";
11387
-		} elseif ($direction >= 270 && $direction < 292.5){
11387
+		} elseif ($direction >= 270 && $direction < 292.5) {
11388 11388
 			$temp_array['direction_degree'] = $direction;
11389 11389
 			$temp_array['direction_shortname'] = "W";
11390 11390
 			$temp_array['direction_fullname'] = "West";
11391
-		} elseif ($direction >= 292.5 && $direction < 315){
11391
+		} elseif ($direction >= 292.5 && $direction < 315) {
11392 11392
 			$temp_array['direction_degree'] = $direction;
11393 11393
 			$temp_array['direction_shortname'] = "WNW";
11394 11394
 			$temp_array['direction_fullname'] = "West-Northwest";
11395
-		} elseif ($direction >= 315 && $direction < 337.5){
11395
+		} elseif ($direction >= 315 && $direction < 337.5) {
11396 11396
 			$temp_array['direction_degree'] = $direction;
11397 11397
 			$temp_array['direction_shortname'] = "NW";
11398 11398
 			$temp_array['direction_fullname'] = "Northwest";
11399
-		} elseif ($direction >= 337.5 && $direction < 360){
11399
+		} elseif ($direction >= 337.5 && $direction < 360) {
11400 11400
 			$temp_array['direction_degree'] = $direction;
11401 11401
 			$temp_array['direction_shortname'] = "NNW";
11402 11402
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11449,8 +11449,8 @@  discard block
 block discarded – undo
11449 11449
 	*/
11450 11450
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11451 11451
 	{
11452
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11453
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
11452
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11453
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
11454 11454
 		if ($source_type == '' || $source_type == 'modes') {
11455 11455
 			$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
11456 11456
 		} else {
@@ -11477,10 +11477,10 @@  discard block
 block discarded – undo
11477 11477
 	* @return String the aircraft type
11478 11478
 	*
11479 11479
 	*/
11480
-	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11480
+	public function getAircraftTypeBymodeS($aircraft_modes, $source_type = '')
11481 11481
 	{
11482
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11483
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
11482
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11483
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
11484 11484
 		if ($source_type == '' || $source_type == 'modes') {
11485 11485
 			$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
11486 11486
 		} else {
@@ -11508,11 +11508,11 @@  discard block
 block discarded – undo
11508 11508
 	* @param Float $longitude longitute of the flight
11509 11509
 	* @return String the countrie
11510 11510
 	*/
11511
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11511
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11512 11512
 	{
11513 11513
 		global $globalDBdriver, $globalDebug;
11514
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11515
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11514
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11515
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11516 11516
 	
11517 11517
 		$Connection = new Connection($this->db);
11518 11518
 		if (!$Connection->tableExists('countries')) return '';
@@ -11552,7 +11552,7 @@  discard block
 block discarded – undo
11552 11552
 	public function getCountryFromISO2($iso2)
11553 11553
 	{
11554 11554
 		global $globalDBdriver, $globalDebug;
11555
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11555
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11556 11556
 	
11557 11557
 		$Connection = new Connection($this->db);
11558 11558
 		if (!$Connection->tableExists('countries')) return '';
@@ -11584,19 +11584,19 @@  discard block
 block discarded – undo
11584 11584
 	*/
11585 11585
 	public function convertAircraftRegistration($registration)
11586 11586
 	{
11587
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11587
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11588 11588
 		$registration_prefix = '';
11589 11589
 		$registration_1 = substr($registration, 0, 1);
11590 11590
 		$registration_2 = substr($registration, 0, 2);
11591 11591
 
11592 11592
 		//first get the prefix based on two characters
11593
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11593
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11594 11594
       
11595 11595
 		
11596 11596
 		$sth = $this->db->prepare($query);
11597 11597
 		$sth->execute(array(':registration_2' => $registration_2));
11598 11598
         
11599
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11599
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11600 11600
 		{
11601 11601
 			$registration_prefix = $row['registration_prefix'];
11602 11602
 		}
@@ -11604,11 +11604,11 @@  discard block
 block discarded – undo
11604 11604
 		//if we didn't find a two chracter prefix lets just search the one with one character
11605 11605
 		if ($registration_prefix == '')
11606 11606
 		{
11607
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11607
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11608 11608
 			$sth = $this->db->prepare($query);
11609 11609
 			$sth->execute(array(':registration_1' => $registration_1));
11610 11610
 	        
11611
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11611
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11612 11612
 			{
11613 11613
 				$registration_prefix = $row['registration_prefix'];
11614 11614
 			}
@@ -11622,7 +11622,7 @@  discard block
 block discarded – undo
11622 11622
 			} else {
11623 11623
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11624 11624
 			}
11625
-		} else if(strlen($registration_prefix) == 2){
11625
+		} else if (strlen($registration_prefix) == 2) {
11626 11626
 			if (0 === strpos($registration, 'N')) {
11627 11627
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11628 11628
 			} else {
@@ -11641,17 +11641,17 @@  discard block
 block discarded – undo
11641 11641
 	*/
11642 11642
 	public function countryFromAircraftRegistration($registration)
11643 11643
 	{
11644
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11644
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11645 11645
 		
11646 11646
 		$registration_prefix = '';
11647
-		$registration_test = explode('-',$registration);
11647
+		$registration_test = explode('-', $registration);
11648 11648
 		$country = '';
11649 11649
 		if ($registration_test[0] != $registration) {
11650 11650
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11651 11651
 	      
11652 11652
 			$sth = $this->db->prepare($query);
11653 11653
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11654
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11654
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11655 11655
 			{
11656 11656
 				//$registration_prefix = $row['registration_prefix'];
11657 11657
 				$country = $row['country'];
@@ -11662,13 +11662,13 @@  discard block
 block discarded – undo
11662 11662
 
11663 11663
 			$country = '';
11664 11664
 			//first get the prefix based on two characters
11665
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11665
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11666 11666
       
11667 11667
 			
11668 11668
 			$sth = $this->db->prepare($query);
11669 11669
 			$sth->execute(array(':registration_2' => $registration_2));
11670 11670
         
11671
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11671
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11672 11672
 			{
11673 11673
 				$registration_prefix = $row['registration_prefix'];
11674 11674
 				$country = $row['country'];
@@ -11677,12 +11677,12 @@  discard block
 block discarded – undo
11677 11677
 			//if we didn't find a two chracter prefix lets just search the one with one character
11678 11678
 			if ($registration_prefix == "")
11679 11679
 			{
11680
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11680
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11681 11681
 	      
11682 11682
 				$sth = $this->db->prepare($query);
11683 11683
 				$sth->execute(array(':registration_1' => $registration_1));
11684 11684
 	        
11685
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11685
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11686 11686
 				{
11687 11687
 					//$registration_prefix = $row['registration_prefix'];
11688 11688
 					$country = $row['country'];
@@ -11702,17 +11702,17 @@  discard block
 block discarded – undo
11702 11702
 	*/
11703 11703
 	public function registrationPrefixFromAircraftRegistration($registration)
11704 11704
 	{
11705
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11705
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11706 11706
 		
11707 11707
 		$registration_prefix = '';
11708
-		$registration_test = explode('-',$registration);
11708
+		$registration_test = explode('-', $registration);
11709 11709
 		//$country = '';
11710 11710
 		if ($registration_test[0] != $registration) {
11711
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11711
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11712 11712
 	      
11713 11713
 			$sth = $this->db->prepare($query);
11714 11714
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11715
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11715
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11716 11716
 			{
11717 11717
 				$registration_prefix = $row['registration_prefix'];
11718 11718
 				//$country = $row['country'];
@@ -11722,13 +11722,13 @@  discard block
 block discarded – undo
11722 11722
 		        $registration_2 = substr($registration, 0, 2);
11723 11723
 
11724 11724
 			//first get the prefix based on two characters
11725
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11725
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11726 11726
       
11727 11727
 			
11728 11728
 			$sth = $this->db->prepare($query);
11729 11729
 			$sth->execute(array(':registration_2' => $registration_2));
11730 11730
         
11731
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11731
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11732 11732
 			{
11733 11733
 				$registration_prefix = $row['registration_prefix'];
11734 11734
 				//$country = $row['country'];
@@ -11737,12 +11737,12 @@  discard block
 block discarded – undo
11737 11737
 			//if we didn't find a two chracter prefix lets just search the one with one character
11738 11738
 			if ($registration_prefix == "")
11739 11739
 			{
11740
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11740
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11741 11741
 	      
11742 11742
 				$sth = $this->db->prepare($query);
11743 11743
 				$sth->execute(array(':registration_1' => $registration_1));
11744 11744
 	        
11745
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11745
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11746 11746
 				{
11747 11747
 					$registration_prefix = $row['registration_prefix'];
11748 11748
 					//$country = $row['country'];
@@ -11763,13 +11763,13 @@  discard block
 block discarded – undo
11763 11763
 	*/
11764 11764
 	public function countryFromAircraftRegistrationCode($registration)
11765 11765
 	{
11766
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11766
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11767 11767
 		
11768 11768
 		$country = '';
11769
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11769
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11770 11770
 		$sth = $this->db->prepare($query);
11771 11771
 		$sth->execute(array(':registration' => $registration));
11772
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11772
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11773 11773
 		{
11774 11774
 			$country = $row['country'];
11775 11775
 		}
@@ -11782,9 +11782,9 @@  discard block
 block discarded – undo
11782 11782
 	* @param String $flightaware_id flightaware_id from spotter_output table
11783 11783
 	* @param String $highlight New highlight value
11784 11784
 	*/
11785
-	public function setHighlightFlight($flightaware_id,$highlight) {
11785
+	public function setHighlightFlight($flightaware_id, $highlight) {
11786 11786
 		
11787
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11787
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11788 11788
 		$sth = $this->db->prepare($query);
11789 11789
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11790 11790
 	}
@@ -11796,13 +11796,13 @@  discard block
 block discarded – undo
11796 11796
 	* @param String $date Date of spotted aircraft
11797 11797
 	* @param String $highlight New highlight value
11798 11798
 	*/
11799
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11799
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11800 11800
 		if ($date == '') {
11801 11801
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11802 11802
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11803 11803
 		} else {
11804 11804
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11805
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11805
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11806 11806
 		}
11807 11807
 		$sth = $this->db->prepare($query);
11808 11808
 		$sth->execute($query_values);
@@ -11832,7 +11832,7 @@  discard block
 block discarded – undo
11832 11832
 		
11833 11833
 		$bitly_data = json_decode($bitly_data);
11834 11834
 		$bitly_url = '';
11835
-		if ($bitly_data->status_txt = "OK"){
11835
+		if ($bitly_data->status_txt = "OK") {
11836 11836
 			$bitly_url = $bitly_data->data->url;
11837 11837
 		}
11838 11838
 
@@ -11842,7 +11842,7 @@  discard block
 block discarded – undo
11842 11842
 
11843 11843
 	public function getOrderBy()
11844 11844
 	{
11845
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
11845
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
11846 11846
 		
11847 11847
 		return $orderby;
11848 11848
 		
@@ -11976,14 +11976,14 @@  discard block
 block discarded – undo
11976 11976
 		}
11977 11977
 		$sth = $this->db->prepare($query);
11978 11978
 		$sth->execute();
11979
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11979
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11980 11980
 		{
11981 11981
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11982 11982
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11983 11983
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11984
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
11984
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
11985 11985
 				$sthu = $this->db->prepare($update_query);
11986
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
11986
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
11987 11987
 			}
11988 11988
 		}
11989 11989
 		
@@ -11996,7 +11996,7 @@  discard block
 block discarded – undo
11996 11996
 		}
11997 11997
 		$sth = $this->db->prepare($query);
11998 11998
 		$sth->execute();
11999
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11999
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12000 12000
 		{
12001 12001
 			if (is_numeric(substr($row['ident'], -1, 1)))
12002 12002
 			{
@@ -12005,11 +12005,11 @@  discard block
 block discarded – undo
12005 12005
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
12006 12006
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
12007 12007
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12008
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
12008
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
12009 12009
 				if (isset($airline_array[0]['name'])) {
12010
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
12010
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
12011 12011
 					$sthu = $this->db->prepare($update_query);
12012
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
12012
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
12013 12013
 				}
12014 12014
 			}
12015 12015
 		}
@@ -12029,18 +12029,18 @@  discard block
 block discarded – undo
12029 12029
 		}
12030 12030
 		$sth = $this->db->prepare($query);
12031 12031
 		$sth->execute();
12032
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12032
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12033 12033
 		{
12034 12034
 			if ($row['aircraft_icao'] != '') {
12035 12035
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
12036
-				if ($row['registration'] != ""){
12036
+				if ($row['registration'] != "") {
12037 12037
 					$image_array = $Image->getSpotterImage($row['registration']);
12038 12038
 					if (!isset($image_array[0]['registration'])) {
12039 12039
 						$Image->addSpotterImage($row['registration']);
12040 12040
 					}
12041 12041
 				}
12042 12042
 				if (count($aircraft_name) > 0) {
12043
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
12043
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
12044 12044
 					$sthu = $this->db->prepare($update_query);
12045 12045
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
12046 12046
 				}
@@ -12055,10 +12055,10 @@  discard block
 block discarded – undo
12055 12055
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
12056 12056
 		$sth = $this->db->prepare($query);
12057 12057
 		$sth->execute();
12058
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12058
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12059 12059
 		{
12060 12060
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
12061
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
12061
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
12062 12062
 				$airport_icao = '';
12063 12063
 				 if (isset($closestAirports[0])) {
12064 12064
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -12072,7 +12072,7 @@  discard block
 block discarded – undo
12072 12072
 								break;
12073 12073
 							}
12074 12074
 						}
12075
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12075
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
12076 12076
 						$airport_icao = $closestAirports[0]['icao'];
12077 12077
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12078 12078
 					} else {
@@ -12083,28 +12083,28 @@  discard block
 block discarded – undo
12083 12083
 				}
12084 12084
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12085 12085
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12086
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12086
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12087 12087
 					$sthu = $this->db->prepare($update_query);
12088
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
12088
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
12089 12089
 				}
12090 12090
 			}
12091 12091
 		}
12092 12092
 	}
12093 12093
 	
12094
-	public function closestAirports($origLat,$origLon,$dist = 10) {
12094
+	public function closestAirports($origLat, $origLon, $dist = 10) {
12095 12095
 		global $globalDBdriver;
12096
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
12096
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
12097 12097
 /*
12098 12098
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12099 12099
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12100 12100
                       having distance < $dist ORDER BY distance limit 100;";
12101 12101
 */
12102 12102
 		if ($globalDBdriver == 'mysql') {
12103
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12103
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12104 12104
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12105 12105
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12106 12106
                 } else {
12107
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
12107
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
12108 12108
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12109 12109
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12110 12110
     		}
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.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -111,8 +113,11 @@  discard block
 block discarded – undo
111 113
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
112 114
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
113 115
 		}
114
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
115
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
116
+		if ($filter_query_where == '' && $where) {
117
+			$filter_query_where = ' WHERE';
118
+		} elseif ($filter_query_where != '' && $and) {
119
+			$filter_query_where .= ' AND';
120
+		}
116 121
 		if ($filter_query_where != '') {
117 122
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
118 123
 		}
@@ -154,7 +159,9 @@  discard block
 block discarded – undo
154 159
 			}
155 160
 		}
156 161
 
157
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
162
+		if (!isset($globalLiveInterval)) {
163
+			$globalLiveInterval = '200';
164
+		}
158 165
 		if ($globalDBdriver == 'mysql') {
159 166
 			//$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";
160 167
 			$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;
@@ -179,7 +186,9 @@  discard block
 block discarded – undo
179 186
 
180 187
 		$filter_query = $this->getFilter($filter,true,true);
181 188
 
182
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
189
+		if (!isset($globalLiveInterval)) {
190
+			$globalLiveInterval = '200';
191
+		}
183 192
 		if ($globalDBdriver == 'mysql') {
184 193
 //			$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$orderby_query";
185 194
 //			$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, a.aircraft_shadow 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 INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -236,7 +245,9 @@  discard block
 block discarded – undo
236 245
 
237 246
 		$filter_query = $this->getFilter($filter,true,true);
238 247
 
239
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
248
+		if (!isset($globalLiveInterval)) {
249
+			$globalLiveInterval = '200';
250
+		}
240 251
 		if ($globalDBdriver == 'mysql') {
241 252
 /*
242 253
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, 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 
@@ -280,7 +291,9 @@  discard block
 block discarded – undo
280 291
 		global $globalDBdriver, $globalLiveInterval;
281 292
 		$filter_query = $this->getFilter($filter,true,true);
282 293
 
283
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
294
+		if (!isset($globalLiveInterval)) {
295
+			$globalLiveInterval = '200';
296
+		}
284 297
 		if ($globalDBdriver == 'mysql') {
285 298
 			//$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;
286 299
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -310,7 +323,9 @@  discard block
 block discarded – undo
310 323
 	{
311 324
 		global $globalDBdriver, $globalLiveInterval;
312 325
 		$Spotter = new Spotter($this->db);
313
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
326
+		if (!isset($globalLiveInterval)) {
327
+			$globalLiveInterval = '200';
328
+		}
314 329
 		$filter_query = $this->getFilter($filter);
315 330
 
316 331
 		if (is_array($coord)) {
@@ -318,7 +333,9 @@  discard block
 block discarded – undo
318 333
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319 334
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320 335
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321
-		} else return array();
336
+		} else {
337
+			return array();
338
+		}
322 339
 		if ($globalDBdriver == 'mysql') {
323 340
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id 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.")";
324 341
 			$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;
@@ -509,11 +526,15 @@  discard block
 block discarded – undo
509 526
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
510 527
 		if ($globalDBdriver == 'mysql') {
511 528
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
512
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
529
+			if ($liveinterval) {
530
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
531
+			}
513 532
 			$query .= ' ORDER BY date';
514 533
 		} else {
515 534
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
516
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
535
+			if ($liveinterval) {
536
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
537
+			}
517 538
 			$query .= ' ORDER BY date';
518 539
 		}
519 540
 
@@ -608,7 +629,9 @@  discard block
 block discarded – undo
608 629
 				$i++;
609 630
 				$j++;
610 631
 				if ($j == 30) {
611
-					if ($globalDebug) echo ".";
632
+					if ($globalDebug) {
633
+						echo ".";
634
+					}
612 635
 				    	try {
613 636
 						
614 637
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -915,7 +938,9 @@  discard block
 block discarded – undo
915 938
 			{
916 939
 				return false;
917 940
 			}
918
-		} else return '';
941
+		} else {
942
+			return '';
943
+		}
919 944
 
920 945
 		if ($longitude != '')
921 946
 		{
@@ -923,7 +948,9 @@  discard block
 block discarded – undo
923 948
 			{
924 949
 				return false;
925 950
 			}
926
-		} else return '';
951
+		} else {
952
+			return '';
953
+		}
927 954
 
928 955
 		if ($waypoints != '')
929 956
 		{
@@ -939,7 +966,9 @@  discard block
 block discarded – undo
939 966
 			{
940 967
 				return false;
941 968
 			}
942
-		} else $altitude = 0;
969
+		} else {
970
+			$altitude = 0;
971
+		}
943 972
 
944 973
 		if ($heading != '')
945 974
 		{
@@ -947,7 +976,9 @@  discard block
 block discarded – undo
947 976
 			{
948 977
 				return false;
949 978
 			}
950
-		} else $heading = 0;
979
+		} else {
980
+			$heading = 0;
981
+		}
951 982
 
952 983
 		if ($groundspeed != '')
953 984
 		{
@@ -955,9 +986,13 @@  discard block
 block discarded – undo
955 986
 			{
956 987
 				return false;
957 988
 			}
958
-		} else $groundspeed = 0;
989
+		} else {
990
+			$groundspeed = 0;
991
+		}
959 992
 		date_default_timezone_set('UTC');
960
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
993
+		if ($date == '') {
994
+			$date = date("Y-m-d H:i:s", time());
995
+		}
961 996
 
962 997
         
963 998
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1001,10 +1036,18 @@  discard block
 block discarded – undo
1001 1036
 		$arrival_airport_country = '';
1002 1037
 		
1003 1038
             	
1004
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1005
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1006
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1007
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1039
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1040
+            		$squawk = NULL;
1041
+            	}
1042
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1043
+            		$verticalrate = NULL;
1044
+            	}
1045
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1046
+            		$groundspeed = 0;
1047
+            	}
1048
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1049
+            		$heading = 0;
1050
+            	}
1008 1051
             	
1009 1052
 		$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) 
1010 1053
 		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)';
@@ -1018,10 +1061,14 @@  discard block
 block discarded – undo
1018 1061
                 	return "error : ".$e->getMessage();
1019 1062
                 }
1020 1063
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1021
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1064
+		    if ($globalDebug) {
1065
+		    	echo '(Add to SBS archive : ';
1066
+		    }
1022 1067
 		    $SpotterArchive = new SpotterArchive($this->db);
1023 1068
 		    $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, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1024
-		    if ($globalDebug) echo $result.')';
1069
+		    if ($globalDebug) {
1070
+		    	echo $result.')';
1071
+		    }
1025 1072
 		}
1026 1073
 		return "success";
1027 1074
 
Please login to merge, or discard this patch.
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	/**
131
-	* Gets all the spotter information based on the latest data entry
132
-	*
133
-	* @return Array the spotter information
134
-	*
135
-	*/
131
+	 * Gets all the spotter information based on the latest data entry
132
+	 *
133
+	 * @return Array the spotter information
134
+	 *
135
+	 */
136 136
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
137 137
 	{
138 138
 		global $globalDBdriver, $globalLiveInterval;
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 
176 176
 	/**
177
-	* Gets Minimal Live Spotter data
178
-	*
179
-	* @return Array the spotter information
180
-	*
181
-	*/
177
+	 * Gets Minimal Live Spotter data
178
+	 *
179
+	 * @return Array the spotter information
180
+	 *
181
+	 */
182 182
 	public function getMinLiveSpotterData($filter = array())
183 183
 	{
184 184
 		global $globalDBdriver, $globalLiveInterval;
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
 	}
232 232
 
233 233
 	/**
234
-	* Gets Minimal Live Spotter data since xx seconds
235
-	*
236
-	* @return Array the spotter information
237
-	*
238
-	*/
234
+	 * Gets Minimal Live Spotter data since xx seconds
235
+	 *
236
+	 * @return Array the spotter information
237
+	 *
238
+	 */
239 239
 	public function getMinLastLiveSpotterData($filter = array())
240 240
 	{
241 241
 		global $globalDBdriver, $globalLiveInterval;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 			$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 
254 254
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
255 255
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
256
-                } else {
256
+				} else {
257 257
 /*
258 258
 			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, 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 
259 259
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 //			echo $query;
266 266
 		}
267 267
 
268
-    		try {
268
+			try {
269 269
 			$sth = $this->db->prepare($query);
270 270
 			$sth->execute();
271 271
 		} catch(PDOException $e) {
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	}
278 278
 
279 279
 	/**
280
-	* Gets number of latest data entry
281
-	*
282
-	* @return String number of entry
283
-	*
284
-	*/
280
+	 * Gets number of latest data entry
281
+	 *
282
+	 * @return String number of entry
283
+	 *
284
+	 */
285 285
 	public function getLiveSpotterCount($filter = array())
286 286
 	{
287 287
 		global $globalDBdriver, $globalLiveInterval;
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	}
309 309
 
310 310
 	/**
311
-	* Gets all the spotter information based on the latest data entry and coord
312
-	*
313
-	* @return Array the spotter information
314
-	*
315
-	*/
311
+	 * Gets all the spotter information based on the latest data entry and coord
312
+	 *
313
+	 * @return Array the spotter information
314
+	 *
315
+	 */
316 316
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
317 317
 	{
318 318
 		global $globalDBdriver, $globalLiveInterval;
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	}
338 338
 
339 339
 	/**
340
-	* Gets all the spotter information based on a user's latitude and longitude
341
-	*
342
-	* @return Array the spotter information
343
-	*
344
-	*/
340
+	 * Gets all the spotter information based on a user's latitude and longitude
341
+	 *
342
+	 * @return Array the spotter information
343
+	 *
344
+	 */
345 345
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
346 346
 	{
347 347
 		$Spotter = new Spotter($this->db);
@@ -351,145 +351,145 @@  discard block
 block discarded – undo
351 351
 				return false;
352 352
 			}
353 353
 		}
354
-        if ($lng != '')
355
-                {
356
-                        if (!is_numeric($lng))
357
-                        {
358
-                                return false;
359
-                        }
360
-                }
361
-
362
-                if ($radius != '')
363
-                {
364
-                        if (!is_numeric($radius))
365
-                        {
366
-                                return false;
367
-                        }
368
-                }
354
+		if ($lng != '')
355
+				{
356
+						if (!is_numeric($lng))
357
+						{
358
+								return false;
359
+						}
360
+				}
361
+
362
+				if ($radius != '')
363
+				{
364
+						if (!is_numeric($radius))
365
+						{
366
+								return false;
367
+						}
368
+				}
369 369
 		$additional_query = '';
370
-        if ($interval != '')
371
-                {
372
-                        if (!is_string($interval))
373
-                        {
374
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
375
-			        return false;
376
-                        } else {
377
-                if ($interval == '1m')
378
-                {
379
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
380
-                } else if ($interval == '15m'){
381
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
382
-                } 
383
-            }
384
-                } else {
385
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
386
-        }
387
-
388
-                $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 
370
+		if ($interval != '')
371
+				{
372
+						if (!is_string($interval))
373
+						{
374
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
375
+					return false;
376
+						} else {
377
+				if ($interval == '1m')
378
+				{
379
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
380
+				} else if ($interval == '15m'){
381
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
382
+				} 
383
+			}
384
+				} else {
385
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
386
+		}
387
+
388
+				$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 
389 389
                    WHERE spotter_live.latitude <> '' 
390 390
                                    AND spotter_live.longitude <> '' 
391 391
                    ".$additional_query."
392 392
                    HAVING distance < :radius  
393 393
                                    ORDER BY distance";
394 394
 
395
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
395
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
396 396
 
397
-                return $spotter_array;
398
-        }
397
+				return $spotter_array;
398
+		}
399 399
 
400 400
     
401
-        /**
402
-	* Gets all the spotter information based on a particular callsign
403
-	*
404
-	* @return Array the spotter information
405
-	*
406
-	*/
401
+		/**
402
+		 * Gets all the spotter information based on a particular callsign
403
+		 *
404
+		 * @return Array the spotter information
405
+		 *
406
+		 */
407 407
 	public function getLastLiveSpotterDataByIdent($ident)
408 408
 	{
409 409
 		$Spotter = new Spotter($this->db);
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $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';
413
+				$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';
414 414
 
415 415
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
416 416
 
417 417
 		return $spotter_array;
418 418
 	}
419 419
 
420
-        /**
421
-	* Gets all the spotter information based on a particular callsign
422
-	*
423
-	* @return Array the spotter information
424
-	*
425
-	*/
420
+		/**
421
+		 * Gets all the spotter information based on a particular callsign
422
+		 *
423
+		 * @return Array the spotter information
424
+		 *
425
+		 */
426 426
 	public function getDateLiveSpotterDataByIdent($ident,$date)
427 427
 	{
428 428
 		$Spotter = new Spotter($this->db);
429 429
 		date_default_timezone_set('UTC');
430 430
 
431 431
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
432
-                $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';
432
+				$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';
433 433
 
434
-                $date = date('c',$date);
434
+				$date = date('c',$date);
435 435
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
439 439
 
440
-        /**
441
-	* Gets last spotter information based on a particular callsign
442
-	*
443
-	* @return Array the spotter information
444
-	*
445
-	*/
440
+		/**
441
+		 * Gets last spotter information based on a particular callsign
442
+		 *
443
+		 * @return Array the spotter information
444
+		 *
445
+		 */
446 446
 	public function getLastLiveSpotterDataById($id)
447 447
 	{
448 448
 		$Spotter = new Spotter($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $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';
452
+				$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';
453 453
 
454 454
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
458 458
 
459
-        /**
460
-	* Gets last spotter information based on a particular callsign
461
-	*
462
-	* @return Array the spotter information
463
-	*
464
-	*/
459
+		/**
460
+		 * Gets last spotter information based on a particular callsign
461
+		 *
462
+		 * @return Array the spotter information
463
+		 *
464
+		 */
465 465
 	public function getDateLiveSpotterDataById($id,$date)
466 466
 	{
467 467
 		$Spotter = new Spotter($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
471
-                $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';
472
-                $date = date('c',$date);
471
+				$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';
472
+				$date = date('c',$date);
473 473
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
474 474
 
475 475
 		return $spotter_array;
476 476
 	}
477 477
 
478
-        /**
479
-	* Gets altitude information based on a particular callsign
480
-	*
481
-	* @return Array the spotter information
482
-	*
483
-	*/
478
+		/**
479
+		 * Gets altitude information based on a particular callsign
480
+		 *
481
+		 * @return Array the spotter information
482
+		 *
483
+		 */
484 484
 	public function getAltitudeLiveSpotterDataByIdent($ident)
485 485
 	{
486 486
 
487 487
 		date_default_timezone_set('UTC');
488 488
 
489 489
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
490
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
490
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
491 491
 
492
-    		try {
492
+			try {
493 493
 			
494 494
 			$sth = $this->db->prepare($query);
495 495
 			$sth->execute(array(':ident' => $ident));
@@ -502,12 +502,12 @@  discard block
 block discarded – undo
502 502
 		return $spotter_array;
503 503
 	}
504 504
 
505
-        /**
506
-	* Gets all the spotter information based on a particular id
507
-	*
508
-	* @return Array the spotter information
509
-	*
510
-	*/
505
+		/**
506
+		 * Gets all the spotter information based on a particular id
507
+		 *
508
+		 * @return Array the spotter information
509
+		 *
510
+		 */
511 511
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
512 512
 	{
513 513
 		global $globalDBdriver, $globalLiveInterval;
@@ -535,18 +535,18 @@  discard block
 block discarded – undo
535 535
 		return $spotter_array;
536 536
 	}
537 537
 
538
-        /**
539
-	* Gets all the spotter information based on a particular ident
540
-	*
541
-	* @return Array the spotter information
542
-	*
543
-	*/
538
+		/**
539
+		 * Gets all the spotter information based on a particular ident
540
+		 *
541
+		 * @return Array the spotter information
542
+		 *
543
+		 */
544 544
 	public function getAllLiveSpotterDataByIdent($ident)
545 545
 	{
546 546
 		date_default_timezone_set('UTC');
547 547
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
548 548
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
549
-    		try {
549
+			try {
550 550
 			
551 551
 			$sth = $this->db->prepare($query);
552 552
 			$sth->execute(array(':ident' => $ident));
@@ -560,23 +560,23 @@  discard block
 block discarded – undo
560 560
 
561 561
 
562 562
 	/**
563
-	* Deletes all info in the table
564
-	*
565
-	* @return String success or false
566
-	*
567
-	*/
563
+	 * Deletes all info in the table
564
+	 *
565
+	 * @return String success or false
566
+	 *
567
+	 */
568 568
 	public function deleteLiveSpotterData()
569 569
 	{
570 570
 		global $globalDBdriver;
571 571
 		if ($globalDBdriver == 'mysql') {
572 572
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
573 573
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
574
-            		//$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)";
574
+					//$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)";
575 575
 		} else {
576 576
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
577 577
 		}
578 578
         
579
-    		try {
579
+			try {
580 580
 			
581 581
 			$sth = $this->db->prepare($query);
582 582
 			$sth->execute();
@@ -588,18 +588,18 @@  discard block
 block discarded – undo
588 588
 	}
589 589
 
590 590
 	/**
591
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
592
-	*
593
-	* @return String success or false
594
-	*
595
-	*/
591
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
592
+	 *
593
+	 * @return String success or false
594
+	 *
595
+	 */
596 596
 	public function deleteLiveSpotterDataNotUpdated()
597 597
 	{
598 598
 		global $globalDBdriver, $globalDebug;
599 599
 		if ($globalDBdriver == 'mysql') {
600 600
 			//$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';
601
-    			$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 1200 OFFSET 0";
602
-    			try {
601
+				$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 1200 OFFSET 0";
602
+				try {
603 603
 				
604 604
 				$sth = $this->db->prepare($query);
605 605
 				$sth->execute();
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 				return "error";
608 608
 			}
609 609
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
610
-                        $i = 0;
611
-                        $j =0;
610
+						$i = 0;
611
+						$j =0;
612 612
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
613 613
 			foreach($all as $row)
614 614
 			{
@@ -616,20 +616,20 @@  discard block
 block discarded – undo
616 616
 				$j++;
617 617
 				if ($j == 30) {
618 618
 					if ($globalDebug) echo ".";
619
-				    	try {
619
+						try {
620 620
 						
621 621
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
622 622
 						$sth->execute();
623 623
 					} catch(PDOException $e) {
624 624
 						return "error";
625 625
 					}
626
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
627
-                                	$j = 0;
626
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
627
+									$j = 0;
628 628
 				}
629 629
 				$query_delete .= "'".$row['flightaware_id']."',";
630 630
 			}
631 631
 			if ($i > 0) {
632
-    				try {
632
+					try {
633 633
 					
634 634
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
635 635
 					$sth->execute();
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
 			return "success";
641 641
 		} elseif ($globalDBdriver == 'pgsql') {
642 642
 			//$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";
643
-    			//$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";
644
-    			$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 800 OFFSET 0)";
645
-    			try {
643
+				//$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";
644
+				$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 800 OFFSET 0)";
645
+				try {
646 646
 				
647 647
 				$sth = $this->db->prepare($query);
648 648
 				$sth->execute();
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
 	}
687 687
 
688 688
 	/**
689
-	* Deletes all info in the table for an ident
690
-	*
691
-	* @return String success or false
692
-	*
693
-	*/
689
+	 * Deletes all info in the table for an ident
690
+	 *
691
+	 * @return String success or false
692
+	 *
693
+	 */
694 694
 	public function deleteLiveSpotterDataByIdent($ident)
695 695
 	{
696 696
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
697 697
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
698 698
         
699
-    		try {
699
+			try {
700 700
 			
701 701
 			$sth = $this->db->prepare($query);
702 702
 			$sth->execute(array(':ident' => $ident));
@@ -708,17 +708,17 @@  discard block
 block discarded – undo
708 708
 	}
709 709
 
710 710
 	/**
711
-	* Deletes all info in the table for an id
712
-	*
713
-	* @return String success or false
714
-	*
715
-	*/
711
+	 * Deletes all info in the table for an id
712
+	 *
713
+	 * @return String success or false
714
+	 *
715
+	 */
716 716
 	public function deleteLiveSpotterDataById($id)
717 717
 	{
718 718
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
719 719
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
720 720
         
721
-    		try {
721
+			try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':id' => $id));
@@ -731,11 +731,11 @@  discard block
 block discarded – undo
731 731
 
732 732
 
733 733
 	/**
734
-	* Gets the aircraft ident within the last hour
735
-	*
736
-	* @return String the ident
737
-	*
738
-	*/
734
+	 * Gets the aircraft ident within the last hour
735
+	 *
736
+	 * @return String the ident
737
+	 *
738
+	 */
739 739
 	public function getIdentFromLastHour($ident)
740 740
 	{
741 741
 		global $globalDBdriver, $globalTimezone;
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
 			$ident_result = $row['ident'];
762 762
 		}
763 763
 		return $ident_result;
764
-        }
764
+		}
765 765
 
766 766
 	/**
767
-	* Check recent aircraft
768
-	*
769
-	* @return String the ident
770
-	*
771
-	*/
767
+	 * Check recent aircraft
768
+	 *
769
+	 * @return String the ident
770
+	 *
771
+	 */
772 772
 	public function checkIdentRecent($ident)
773 773
 	{
774 774
 		global $globalDBdriver, $globalTimezone;
@@ -794,14 +794,14 @@  discard block
 block discarded – undo
794 794
 			$ident_result = $row['flightaware_id'];
795 795
 		}
796 796
 		return $ident_result;
797
-        }
797
+		}
798 798
 
799 799
 	/**
800
-	* Check recent aircraft by id
801
-	*
802
-	* @return String the ident
803
-	*
804
-	*/
800
+	 * Check recent aircraft by id
801
+	 *
802
+	 * @return String the ident
803
+	 *
804
+	 */
805 805
 	public function checkIdRecent($id)
806 806
 	{
807 807
 		global $globalDBdriver, $globalTimezone;
@@ -827,14 +827,14 @@  discard block
 block discarded – undo
827 827
 			$ident_result = $row['flightaware_id'];
828 828
 		}
829 829
 		return $ident_result;
830
-        }
830
+		}
831 831
 
832 832
 	/**
833
-	* Check recent aircraft by ModeS
834
-	*
835
-	* @return String the ModeS
836
-	*
837
-	*/
833
+	 * Check recent aircraft by ModeS
834
+	 *
835
+	 * @return String the ModeS
836
+	 *
837
+	 */
838 838
 	public function checkModeSRecent($modes)
839 839
 	{
840 840
 		global $globalDBdriver, $globalTimezone;
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 			$ident_result = $row['flightaware_id'];
862 862
 		}
863 863
 		return $ident_result;
864
-        }
864
+		}
865 865
 
866 866
 	/**
867
-	* Adds a new spotter data
868
-	*
869
-	* @param String $flightaware_id the ID from flightaware
870
-	* @param String $ident the flight ident
871
-	* @param String $aircraft_icao the aircraft type
872
-	* @param String $departure_airport_icao the departure airport
873
-	* @param String $arrival_airport_icao the arrival airport
874
-	* @return String success or false
875
-	*
876
-	*/
867
+	 * Adds a new spotter data
868
+	 *
869
+	 * @param String $flightaware_id the ID from flightaware
870
+	 * @param String $ident the flight ident
871
+	 * @param String $aircraft_icao the aircraft type
872
+	 * @param String $departure_airport_icao the departure airport
873
+	 * @param String $arrival_airport_icao the arrival airport
874
+	 * @return String success or false
875
+	 *
876
+	 */
877 877
 	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 = '')
878 878
 	{
879 879
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1008,10 +1008,10 @@  discard block
 block discarded – undo
1008 1008
 		$arrival_airport_country = '';
1009 1009
 		
1010 1010
             	
1011
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1012
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1013
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1014
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1012
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1013
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1014
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1015 1015
             	
1016 1016
 		$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) 
1017 1017
 		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)';
@@ -1021,14 +1021,14 @@  discard block
 block discarded – undo
1021 1021
 			
1022 1022
 			$sth = $this->db->prepare($query);
1023 1023
 			$sth->execute($query_values);
1024
-                } catch(PDOException $e) {
1025
-                	return "error : ".$e->getMessage();
1026
-                }
1024
+				} catch(PDOException $e) {
1025
+					return "error : ".$e->getMessage();
1026
+				}
1027 1027
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1028
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1029
-		    $SpotterArchive = new SpotterArchive($this->db);
1030
-		    $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, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1031
-		    if ($globalDebug) echo $result.')';
1028
+			if ($globalDebug) echo '(Add to SBS archive : ';
1029
+			$SpotterArchive = new SpotterArchive($this->db);
1030
+			$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, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1031
+			if ($globalDebug) echo $result.')';
1032 1032
 		}
1033 1033
 		return "success";
1034 1034
 
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
37 37
 				if ($flt['airlines'][0] != '') {
38 38
 					if (isset($flt['source'])) {
39
-						$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";
39
+						$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 40
 					} else {
41
-						$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";
41
+						$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 42
 					}
43 43
 				}
44 44
 			}
45 45
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
46 46
 				if (isset($flt['source'])) {
47
-					$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";
47
+					$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 48
 				} else {
49
-					$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";
49
+					$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 50
 				}
51 51
 			}
52 52
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
53 53
 				if (isset($flt['source'])) {
54
-					$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";
54
+					$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 55
 				} else {
56
-					$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";
56
+					$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 57
 				}
58 58
 			}
59 59
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
60 60
 				if (isset($flt['source'])) {
61
-					$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";
61
+					$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 62
 				} else {
63
-					$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";
63
+					$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 64
 				}
65 65
 			}
66 66
 			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']))) {
67 67
 				if (isset($flt['source'])) {
68
-					$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";
68
+					$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 69
 				}
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
73 73
 			if ($filter['airlines'][0] != '') {
74
-				$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";
74
+				$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 75
 			}
76 76
 		}
77 77
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			$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 ";
82 82
 		}
83 83
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
84
-			$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";
84
+			$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 85
 		}
86 86
 		if (isset($filter['source']) && !empty($filter['source'])) {
87
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
87
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
88 88
 		}
89 89
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
90 90
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
114 114
 				}
115 115
 			}
116
-			$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";
116
+			$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";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
122 122
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
123 123
 		if ($filter_query_where != '') {
124
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
124
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
125 125
 		}
126 126
 		$filter_query = $filter_query_join.$filter_query_where;
127 127
 		return $filter_query;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		if ($limit != '')
145 145
 		{
146 146
 			$limit_array = explode(',', $limit);
147
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
148
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
147
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
148
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
149 149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
150 150
 			{
151 151
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		} else {
169 169
 			$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;
170 170
 		}
171
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
171
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
172 172
 
173 173
 		return $spotter_array;
174 174
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		global $globalDBdriver, $globalLiveInterval;
185 185
 		date_default_timezone_set('UTC');
186 186
 
187
-		$filter_query = $this->getFilter($filter,true,true);
187
+		$filter_query = $this->getFilter($filter, true, true);
188 188
 
189 189
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
190 190
 		if ($globalDBdriver == 'mysql') {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			$query  = 'SELECT a.aircraft_shadow, 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 
196 196
 			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 LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
197 197
 */
198
-			$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 
198
+			$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 
199 199
 			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." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
200 200
 
201 201
 //			$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 FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			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 LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
211 211
 */
212 212
 
213
-			$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 
213
+			$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 
214 214
 			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." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
215 215
 
216 216
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		try {
222 222
 			$sth = $this->db->prepare($query);
223 223
 			$sth->execute();
224
-		} catch(PDOException $e) {
224
+		} catch (PDOException $e) {
225 225
 			echo $e->getMessage();
226 226
 			die;
227 227
 		}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		global $globalDBdriver, $globalLiveInterval;
242 242
 		date_default_timezone_set('UTC');
243 243
 
244
-		$filter_query = $this->getFilter($filter,true,true);
244
+		$filter_query = $this->getFilter($filter, true, true);
245 245
 
246 246
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
247 247
 		if ($globalDBdriver == 'mysql') {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
251 251
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
252 252
 */
253
-			$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 
253
+			$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 
254 254
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
255 255
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
256 256
                 } else {
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
260 260
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
261 261
 */
262
-			$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 
262
+			$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 
263 263
 			FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
264 264
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
265 265
 //			echo $query;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     		try {
269 269
 			$sth = $this->db->prepare($query);
270 270
 			$sth->execute();
271
-		} catch(PDOException $e) {
271
+		} catch (PDOException $e) {
272 272
 			echo $e->getMessage();
273 273
 			die;
274 274
 		}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	public function getLiveSpotterCount($filter = array())
286 286
 	{
287 287
 		global $globalDBdriver, $globalLiveInterval;
288
-		$filter_query = $this->getFilter($filter,true,true);
288
+		$filter_query = $this->getFilter($filter, true, true);
289 289
 
290 290
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
291 291
 		if ($globalDBdriver == 'mysql') {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		try {
299 299
 			$sth = $this->db->prepare($query);
300 300
 			$sth->execute();
301
-		} catch(PDOException $e) {
301
+		} catch (PDOException $e) {
302 302
 			echo $e->getMessage();
303 303
 			die;
304 304
 		}
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 		$filter_query = $this->getFilter($filter);
322 322
 
323 323
 		if (is_array($coord)) {
324
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
327
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
325
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
326
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
327
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
328 328
 		} else return array();
329 329
 		if ($globalDBdriver == 'mysql') {
330 330
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id 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.")";
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
                 if ($interval == '1m')
378 378
                 {
379 379
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
380
-                } else if ($interval == '15m'){
380
+                } else if ($interval == '15m') {
381 381
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
382 382
                 } 
383 383
             }
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
386 386
         }
387 387
 
388
-                $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 
388
+                $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 
389 389
                    WHERE spotter_live.latitude <> '' 
390 390
                                    AND spotter_live.longitude <> '' 
391 391
                    ".$additional_query."
392 392
                    HAVING distance < :radius  
393 393
                                    ORDER BY distance";
394 394
 
395
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
395
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
396 396
 
397 397
                 return $spotter_array;
398 398
         }
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $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';
413
+                $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';
414 414
 
415
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
415
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
416 416
 
417 417
 		return $spotter_array;
418 418
 	}
@@ -423,16 +423,16 @@  discard block
 block discarded – undo
423 423
 	* @return Array the spotter information
424 424
 	*
425 425
 	*/
426
-	public function getDateLiveSpotterDataByIdent($ident,$date)
426
+	public function getDateLiveSpotterDataByIdent($ident, $date)
427 427
 	{
428 428
 		$Spotter = new Spotter($this->db);
429 429
 		date_default_timezone_set('UTC');
430 430
 
431 431
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
432
-                $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';
432
+                $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';
433 433
 
434
-                $date = date('c',$date);
435
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
434
+                $date = date('c', $date);
435
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $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';
452
+                $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';
453 453
 
454
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
454
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -462,15 +462,15 @@  discard block
 block discarded – undo
462 462
 	* @return Array the spotter information
463 463
 	*
464 464
 	*/
465
-	public function getDateLiveSpotterDataById($id,$date)
465
+	public function getDateLiveSpotterDataById($id, $date)
466 466
 	{
467 467
 		$Spotter = new Spotter($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
471
-                $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';
472
-                $date = date('c',$date);
473
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
471
+                $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';
472
+                $date = date('c', $date);
473
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
474 474
 
475 475
 		return $spotter_array;
476 476
 	}
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 		date_default_timezone_set('UTC');
488 488
 
489 489
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
490
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
490
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
491 491
 
492 492
     		try {
493 493
 			
494 494
 			$sth = $this->db->prepare($query);
495 495
 			$sth->execute(array(':ident' => $ident));
496
-		} catch(PDOException $e) {
496
+		} catch (PDOException $e) {
497 497
 			echo $e->getMessage();
498 498
 			die;
499 499
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	* @return Array the spotter information
509 509
 	*
510 510
 	*/
511
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
511
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
512 512
 	{
513 513
 		global $globalDBdriver, $globalLiveInterval;
514 514
 		date_default_timezone_set('UTC');
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		try {
528 528
 			$sth = $this->db->prepare($query);
529 529
 			$sth->execute(array(':id' => $id));
530
-		} catch(PDOException $e) {
530
+		} catch (PDOException $e) {
531 531
 			echo $e->getMessage();
532 532
 			die;
533 533
 		}
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	{
546 546
 		date_default_timezone_set('UTC');
547 547
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
548
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
548
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
549 549
     		try {
550 550
 			
551 551
 			$sth = $this->db->prepare($query);
552 552
 			$sth->execute(array(':ident' => $ident));
553
-		} catch(PDOException $e) {
553
+		} catch (PDOException $e) {
554 554
 			echo $e->getMessage();
555 555
 			die;
556 556
 		}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			
581 581
 			$sth = $this->db->prepare($query);
582 582
 			$sth->execute();
583
-		} catch(PDOException $e) {
583
+		} catch (PDOException $e) {
584 584
 			return "error";
585 585
 		}
586 586
 
@@ -603,14 +603,14 @@  discard block
 block discarded – undo
603 603
 				
604 604
 				$sth = $this->db->prepare($query);
605 605
 				$sth->execute();
606
-			} catch(PDOException $e) {
606
+			} catch (PDOException $e) {
607 607
 				return "error";
608 608
 			}
609 609
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
610 610
                         $i = 0;
611
-                        $j =0;
611
+                        $j = 0;
612 612
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
613
-			foreach($all as $row)
613
+			foreach ($all as $row)
614 614
 			{
615 615
 				$i++;
616 616
 				$j++;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 					if ($globalDebug) echo ".";
619 619
 				    	try {
620 620
 						
621
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
621
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
622 622
 						$sth->execute();
623
-					} catch(PDOException $e) {
623
+					} catch (PDOException $e) {
624 624
 						return "error";
625 625
 					}
626 626
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
 			if ($i > 0) {
632 632
     				try {
633 633
 					
634
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
634
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
635 635
 					$sth->execute();
636
-				} catch(PDOException $e) {
636
+				} catch (PDOException $e) {
637 637
 					return "error";
638 638
 				}
639 639
 			}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 				
647 647
 				$sth = $this->db->prepare($query);
648 648
 				$sth->execute();
649
-			} catch(PDOException $e) {
649
+			} catch (PDOException $e) {
650 650
 				return "error";
651 651
 			}
652 652
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 	public function deleteLiveSpotterDataByIdent($ident)
695 695
 	{
696 696
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
697
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
697
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
698 698
         
699 699
     		try {
700 700
 			
701 701
 			$sth = $this->db->prepare($query);
702 702
 			$sth->execute(array(':ident' => $ident));
703
-		} catch(PDOException $e) {
703
+		} catch (PDOException $e) {
704 704
 			return "error";
705 705
 		}
706 706
 
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
 	public function deleteLiveSpotterDataById($id)
717 717
 	{
718 718
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
719
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
719
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
720 720
         
721 721
     		try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':id' => $id));
725
-		} catch(PDOException $e) {
725
+		} catch (PDOException $e) {
726 726
 			return "error";
727 727
 		}
728 728
 
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 	{
741 741
 		global $globalDBdriver, $globalTimezone;
742 742
 		if ($globalDBdriver == 'mysql') {
743
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
743
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
744 744
 				WHERE spotter_live.ident = :ident 
745 745
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
746 746
 				AND spotter_live.date < UTC_TIMESTAMP()';
747 747
 			$query_data = array(':ident' => $ident);
748 748
 		} else {
749
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
749
+			$query = "SELECT spotter_live.ident FROM spotter_live 
750 750
 				WHERE spotter_live.ident = :ident 
751 751
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
752 752
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 		
756 756
 		$sth = $this->db->prepare($query);
757 757
 		$sth->execute($query_data);
758
-		$ident_result='';
759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
758
+		$ident_result = '';
759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
760 760
 		{
761 761
 			$ident_result = $row['ident'];
762 762
 		}
@@ -773,13 +773,13 @@  discard block
 block discarded – undo
773 773
 	{
774 774
 		global $globalDBdriver, $globalTimezone;
775 775
 		if ($globalDBdriver == 'mysql') {
776
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
776
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
777 777
 				WHERE spotter_live.ident = :ident 
778 778
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
779 779
 //				AND spotter_live.date < UTC_TIMESTAMP()";
780 780
 			$query_data = array(':ident' => $ident);
781 781
 		} else {
782
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
782
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
783 783
 				WHERE spotter_live.ident = :ident 
784 784
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
785 785
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 		
789 789
 		$sth = $this->db->prepare($query);
790 790
 		$sth->execute($query_data);
791
-		$ident_result='';
792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
791
+		$ident_result = '';
792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
793 793
 		{
794 794
 			$ident_result = $row['flightaware_id'];
795 795
 		}
@@ -806,13 +806,13 @@  discard block
 block discarded – undo
806 806
 	{
807 807
 		global $globalDBdriver, $globalTimezone;
808 808
 		if ($globalDBdriver == 'mysql') {
809
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
809
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
810 810
 				WHERE spotter_live.flightaware_id = :id 
811 811
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
812 812
 //				AND spotter_live.date < UTC_TIMESTAMP()";
813 813
 			$query_data = array(':id' => $id);
814 814
 		} else {
815
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
815
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
816 816
 				WHERE spotter_live.flightaware_id = :id 
817 817
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
818 818
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 		
822 822
 		$sth = $this->db->prepare($query);
823 823
 		$sth->execute($query_data);
824
-		$ident_result='';
825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
824
+		$ident_result = '';
825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
826 826
 		{
827 827
 			$ident_result = $row['flightaware_id'];
828 828
 		}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 	{
840 840
 		global $globalDBdriver, $globalTimezone;
841 841
 		if ($globalDBdriver == 'mysql') {
842
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
842
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
843 843
 				WHERE spotter_live.ModeS = :modes 
844 844
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
845 845
 //				AND spotter_live.date < UTC_TIMESTAMP()";
846 846
 			$query_data = array(':modes' => $modes);
847 847
 		} else {
848
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
848
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
849 849
 				WHERE spotter_live.ModeS = :modes 
850 850
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
851 851
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 		
855 855
 		$sth = $this->db->prepare($query);
856 856
 		$sth->execute($query_data);
857
-		$ident_result='';
858
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
857
+		$ident_result = '';
858
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
859 859
 		{
860 860
 			//$ident_result = $row['spotter_live_id'];
861 861
 			$ident_result = $row['flightaware_id'];
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	* @return String success or false
875 875
 	*
876 876
 	*/
877
-	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 = '')
877
+	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 = '')
878 878
 	{
879 879
 		global $globalURL, $globalArchive, $globalDebug;
880 880
 		$Common = new Common();
@@ -967,26 +967,26 @@  discard block
 block discarded – undo
967 967
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
968 968
 
969 969
         
970
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
971
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
972
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
973
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
974
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
975
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
976
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
977
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
978
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
979
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
980
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
981
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
982
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
983
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
984
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
985
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
986
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
987
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
988
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
989
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
970
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
971
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
972
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
973
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
974
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
975
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
976
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
977
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
978
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
979
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
980
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
981
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
982
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
983
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
984
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
985
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
986
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
987
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
988
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
989
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
990 990
 
991 991
 		$airline_name = '';
992 992
 		$airline_icao = '';
@@ -1008,26 +1008,26 @@  discard block
 block discarded – undo
1008 1008
 		$arrival_airport_country = '';
1009 1009
 		
1010 1010
             	
1011
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1012
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1013
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1014
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1012
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1013
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1014
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1015 1015
             	
1016
-		$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) 
1016
+		$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) 
1017 1017
 		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)';
1018 1018
 
1019
-		$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);
1019
+		$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);
1020 1020
 		try {
1021 1021
 			
1022 1022
 			$sth = $this->db->prepare($query);
1023 1023
 			$sth->execute($query_values);
1024
-                } catch(PDOException $e) {
1024
+                } catch (PDOException $e) {
1025 1025
                 	return "error : ".$e->getMessage();
1026 1026
                 }
1027 1027
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1028 1028
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1029 1029
 		    $SpotterArchive = new SpotterArchive($this->db);
1030
-		    $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, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1030
+		    $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, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1031 1031
 		    if ($globalDebug) echo $result.')';
1032 1032
 		}
1033 1033
 		return "success";
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 	public function getOrderBy()
1038 1038
 	{
1039
-		$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"));
1039
+		$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"));
1040 1040
 		return $orderby;
1041 1041
 	}
1042 1042
 
Please login to merge, or discard this patch.